diff --git a/example/transaction/customGiftcard.js b/example/transaction/customGiftcard.js new file mode 100644 index 0000000..5110176 --- /dev/null +++ b/example/transaction/customGiftcard.js @@ -0,0 +1,26 @@ +import buckarooClient from '../buckarooClient'; +import { uniqid } from '../../src'; + +const giftcard = buckarooClient.method('giftcard'); + +//Pay +giftcard + .pay({ + amountDebit: 10, + description: 'Custom Giftcard Payment', + name: 'customgiftcard3', + cardNumber: '0000000000000000001', + pin: '1000', + }) + .request(); +//Refund +giftcard + .refund({ + originalTransactionKey: uniqid(), + amountCredit: 10, + invoice: 'Custom Giftcard Refund', + name: 'customgiftcard3', + email: 'test@buckaroo.nl', + lastName: 'Acceptatie', + }) + .request(); diff --git a/example/transaction/customGiftcard.ts b/example/transaction/customGiftcard.ts new file mode 100644 index 0000000..5110176 --- /dev/null +++ b/example/transaction/customGiftcard.ts @@ -0,0 +1,26 @@ +import buckarooClient from '../buckarooClient'; +import { uniqid } from '../../src'; + +const giftcard = buckarooClient.method('giftcard'); + +//Pay +giftcard + .pay({ + amountDebit: 10, + description: 'Custom Giftcard Payment', + name: 'customgiftcard3', + cardNumber: '0000000000000000001', + pin: '1000', + }) + .request(); +//Refund +giftcard + .refund({ + originalTransactionKey: uniqid(), + amountCredit: 10, + invoice: 'Custom Giftcard Refund', + name: 'customgiftcard3', + email: 'test@buckaroo.nl', + lastName: 'Acceptatie', + }) + .request(); diff --git a/package.json b/package.json index db817d8..0c32516 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@buckaroo/buckaroo_sdk", - "version": "1.2.0", + "version": "1.3.0", "description": "Buckaroo payment SDK", "main": "dist/buckaroo.cjs.js", "module": "dist/buckaroo.esm.js", diff --git a/src/PaymentMethods/GiftCard/index.ts b/src/PaymentMethods/GiftCard/index.ts index e28e6d1..5082c57 100644 --- a/src/PaymentMethods/GiftCard/index.ts +++ b/src/PaymentMethods/GiftCard/index.ts @@ -9,10 +9,16 @@ export default class GiftCard extends PayablePaymentMethod { } pay(payload: IPay) { + if (payload.name) { + this.setServiceCode(payload.name); + } return super.pay(payload, new Pay(payload)); } refund(payload: IRefund) { + if (payload.name) { + this.setServiceCode(payload.name); + } return super.refund(payload, new Refund(payload)); } }