diff --git a/package.json b/package.json index 0c51206..a616f8a 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ "dependencies": { "@types/qs": "6.9.3", "pagarme": "4.13.0", - "pagarme-js-types": "2.5.1", + "pagarme-js-types": "2.6.0", "qs": "6.9.4" }, "devDependencies": { diff --git a/src/payment-method-handler.ts b/src/payment-method-handler.ts index 54af8ee..81eeb78 100644 --- a/src/payment-method-handler.ts +++ b/src/payment-method-handler.ts @@ -8,6 +8,7 @@ import pagarme, { CreateTransactionCreditCartInput, CreateTransactionBoletoInput, CreateTransactionInputBase, + CreateTransactionPixInput, ItemInput } from 'pagarme'; import { Optional } from './types/utils'; @@ -38,6 +39,7 @@ export type PagarmePaymentMethodMetadata = Omit< CreateTransactionBoletoInput, 'boleto_instructions' | 'boleto_fine' | 'boleto_interest' > + | CreateTransactionPixInput ) & { extraInfo?: { metadata?: any; @@ -284,14 +286,18 @@ export const pagarmePaymentMethodHandler = new PaymentMethodHandler({ unit_price: line.unitPrice, quantity: line.quantity })), - boleto_fine: { - days: boletoFineDays, - amount: boletoFineAmount - }, - boleto_interest: { - days: boletoInterestDays, - amount: boletoInterestAmount - }, + ...(metadata.payment_method === 'boleto' + ? { + boleto_fine: { + days: boletoFineDays, + amount: boletoFineAmount + }, + boleto_interest: { + days: boletoInterestDays, + amount: boletoInterestAmount + } + } + : {}), metadata: JSON.stringify({ id: order.id, ...extraInfo?.metadata diff --git a/yarn.lock b/yarn.lock index 4f2df40..3f0d962 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7863,10 +7863,10 @@ pacote@^9.1.0, pacote@^9.5.12, pacote@^9.5.3: unique-filename "^1.1.1" which "^1.3.1" -pagarme-js-types@2.5.1: - version "2.5.1" - resolved "https://registry.yarnpkg.com/pagarme-js-types/-/pagarme-js-types-2.5.1.tgz#7f10c1f891408f3f65878e9e095746a11f23c8d0" - integrity sha512-rLdPyC8DYaAHCcg2smr/7uh4/b1aq8uqi/YEgwnRUL0yCdEwOqlOxbP++/0MpJg7ywzbRJzjGe7uUUXVw/Gg9g== +pagarme-js-types@2.6.0: + version "2.6.0" + resolved "https://registry.yarnpkg.com/pagarme-js-types/-/pagarme-js-types-2.6.0.tgz#3c6ab507f11af336409812fc60ace0d745c1ad8d" + integrity sha512-ff0XFEE83StzyfiMYhOdjjRdtaEiX7dBPMLWpCq9JcshFZxZh8zIU3ph8L5eQH+R9mKNXp9uUzlcqfOhEb9EYw== pagarme@4.13.0: version "4.13.0"