Skip to content

Commit

Permalink
Merge pull request #42 from buckaroo-it/examples
Browse files Browse the repository at this point in the history
BA-119 Add more transaction examples
  • Loading branch information
SandervdHulst authored Feb 23, 2024
2 parents d5adcde + d5bd74e commit c6c9f0d
Show file tree
Hide file tree
Showing 68 changed files with 2,300 additions and 5 deletions.
87 changes: 87 additions & 0 deletions example/transaction/afterpay.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
import buckarooClient from '../buckarooClient';
import { getIPAddress, RecipientCategory, uniqid } from '../../src';

const afterpay = buckarooClient.method('afterpay');

//Pay
afterpay
.pay({
invoice: 'Riverty Pay',
clientIP: getIPAddress(),
amountDebit: 100,
billing: {
recipient: {
category: RecipientCategory.PERSON,
firstName: 'Test',
lastName: 'Acceptatie',
birthDate: '01-01-1990',
},
address: {
street: 'Hoofdstraat',
houseNumber: '80',
zipcode: '8441ER',
city: 'Heerenveen',
country: 'NL',
},
email: '[email protected]',
phone: {
mobile: '0612345678',
landline: '0201234567',
},
},
articles: [
{
vatPercentage: 21,
price: 10,
description: 'Test',
quantity: 4,
identifier: 'test',
},
],
})
.request();
//Refund
afterpay
.refund({
originalTransactionKey: 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
amountCredit: 10.1,
invoice: 'Riverty refund',
})
.request();
//Authorize
afterpay
.pay({
invoice: 'Riverty Pay',
clientIP: getIPAddress(),
amountDebit: 100,
billing: {
recipient: {
category: RecipientCategory.PERSON,
firstName: 'Test',
lastName: 'Acceptatie',
birthDate: '01-01-1990',
},
address: {
street: 'Hoofdstraat',
houseNumber: '80',
zipcode: '8441ER',
city: 'Heerenveen',
country: 'NL',
},
email: '[email protected]',
phone: {
mobile: '0612345678',
landline: '0201234567',
},
},
articles: [
{
vatPercentage: 21,
price: 10,
description: 'Test',
quantity: 4,
identifier: 'test',
},
],
})
.request();
87 changes: 87 additions & 0 deletions example/transaction/afterpay.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
import buckarooClient from '../buckarooClient';
import { RecipientCategory, getIPAddress } from '../../src';

const afterpay = buckarooClient.method('afterpay');

//Pay
afterpay
.pay({
invoice: 'Riverty Pay',
clientIP: getIPAddress(),
amountDebit: 100,
billing: {
recipient: {
category: RecipientCategory.PERSON,
firstName: 'Test',
lastName: 'Acceptatie',
birthDate: '01-01-1990',
},
address: {
street: 'Hoofdstraat',
houseNumber: '80',
zipcode: '8441ER',
city: 'Heerenveen',
country: 'NL',
},
email: '[email protected]',
phone: {
mobile: '0612345678',
landline: '0201234567',
},
},
articles: [
{
vatPercentage: 21,
price: 10,
description: 'Test',
quantity: 4,
identifier: 'test',
},
],
})
.request();
//Refund
afterpay
.refund({
originalTransactionKey: 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
amountCredit: 10.1,
invoice: 'Riverty refund',
})
.request();
//Authorize
afterpay
.authorize({
invoice: 'Riverty Pay',
clientIP: getIPAddress(),
amountDebit: 100,
billing: {
recipient: {
category: RecipientCategory.PERSON,
firstName: 'Test',
lastName: 'Acceptatie',
birthDate: '01-01-1990',
},
address: {
street: 'Hoofdstraat',
houseNumber: '80',
zipcode: '8441ER',
city: 'Heerenveen',
country: 'NL',
},
email: '[email protected]',
phone: {
mobile: '0612345678',
landline: '0201234567',
},
},
articles: [
{
vatPercentage: 21,
price: 10,
description: 'Test',
quantity: 4,
identifier: 'test',
},
],
})
.request();
18 changes: 18 additions & 0 deletions example/transaction/aliPay.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import buckarooClient from '../buckarooClient';
const alipay = buckarooClient.method('alipay');
//Pay
alipay
.pay({
amountDebit: 10.1,
description: 'Alipay Payment',
useMobileView: false,
})
.request();
//Refund
alipay
.refund({
originalTransactionKey: 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
amountCredit: 10.1,
invoice: 'Alipay Refund'
})
.request();
20 changes: 20 additions & 0 deletions example/transaction/aliPay.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import buckarooClient from '../buckarooClient';

const alipay = buckarooClient.method('alipay');

//Pay
alipay
.pay({
amountDebit: 10.1,
description: 'Alipay Payment',
useMobileView: false,
})
.request();
//Refund
alipay
.refund({
originalTransactionKey: 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
amountCredit: 10.1,
invoice: 'Alipay Refund',
})
.request();
19 changes: 19 additions & 0 deletions example/transaction/applePay.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import buckarooClient from '../buckarooClient';
const applepay = buckarooClient.method('applepay');
//Pay
applepay
.pay({
amountDebit: 10.1,
description: 'ApplePay Payment'
paymentData: 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
customerCardName: 'XXXXXXX',
})
.request();
//Refund
applepay
.refund({
originalTransactionKey: 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
amountCredit: 10.1,
invoice: 'ApplePay Refund'
})
.request();
21 changes: 21 additions & 0 deletions example/transaction/applePay.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import buckarooClient from '../buckarooClient';

const applepay = buckarooClient.method('applepay');

//Pay
applepay
.pay({
amountDebit: 10.1,
description: 'ApplePay Payment',
paymentData: 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
customerCardName: 'XXXXXXX',
})
.request();
//Refund
applepay
.refund({
originalTransactionKey: 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
amountCredit: 10.1,
invoice: 'ApplePay Refund',
})
.request();
53 changes: 53 additions & 0 deletions example/transaction/bancontact.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import buckarooClient from '../buckarooClient';
const bancontact = buckarooClient.method('bancontactmrcash');
//Pay
bancontact
.pay({
amountDebit: 10.1,
description: 'Bancontact Payment',
})
.request();
//Refund
bancontact
.refund({
originalTransactionKey: 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
amountCredit: 10.1,
invoice: 'Bancontact refund',
})
.request();
//Authenticate
bancontact
.authenticate({
invoice: 'BancontactAuthenticate',
amountDebit: 10.1,
description: 'Bancontact Authenticate',
})
.request();
//PayOneClick
bancontact
.payOneClick({
invoice: 'Bancontact PayOneClick',
originalTransactionKey: 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
amountDebit: 100,
})
.request();
//CompletePayment
bancontact
.completePayment({
originalTransactionKey: 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
encryptedCardData: 'XXXXXXXXXXXXXXXXXXXXXXXX',
})
//PayEncrypted
bancontact
.payEncrypted({
amountDebit: 100,
encryptedCardData: 'XXXXXXXXXXXXXXXXXXXXXXXX',
invoice: 'Bancontact PayEncrypred',
})
//PayRecurring
bancontact
.payRecurring({
amountDebit: 100,
encryptedCardData: 'XXXXXXXXXXXXXXXXXXXXXXXX',
invoice: 'Bancontact PayRecurring',
})
55 changes: 55 additions & 0 deletions example/transaction/bancontact.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import buckarooClient from '../buckarooClient';

const bancontact = buckarooClient.method('bancontactmrcash');

//Pay
bancontact
.pay({
amountDebit: 10.1,
description: 'Bancontact Payment',
})
.request();
//Refund
bancontact
.refund({
originalTransactionKey: 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
amountCredit: 10.1,
invoice: 'Bancontact Refund',
})
.request();
//Authenticate
bancontact
.authenticate({
invoice: 'BancontactAuthenticate',
amountDebit: 10.1,
description: 'Bancontact Authenticate',
})
.request();
//PayOneClick
bancontact
.payOneClick({
invoice: 'Bancontact PayOneClick',
originalTransactionKey: 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
amountDebit: 100,
})
.request();
//CompletePayment
bancontact
.completePayment({
originalTransactionKey: 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
encryptedCardData: 'XXXXXXXXXXXXXXXXXXXXXXXX',
})
//PayEncrypted
bancontact
.payEncrypted({
amountDebit: 100,
encryptedCardData: 'XXXXXXXXXXXXXXXXXXXXXXXX',
invoice: 'Bancontact PayEncrypred',
})
//PayRecurring
bancontact
.payRecurring({
amountDebit: 100,
encryptedCardData: 'XXXXXXXXXXXXXXXXXXXXXXXX',
invoice: 'Bancontact PayRecurring',
})
28 changes: 28 additions & 0 deletions example/transaction/bankTransfer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import buckarooClient from '../buckarooClient';
import { Gender } from '../../src';

const transfer = buckarooClient.method('transfer');

//Pay
transfer
.pay({
amountDebit: 10.1,
description: 'Transfer Payment',
customer: {
firstName: 'Test',
lastName: 'Acceptatie',
gender: Gender.MALE,
},
email: '[email protected]',
sendMail: true,
dateDue: '2024-10-10',
})
.request();
//Refund
transfer
.refund({
originalTransactionKey: 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
amountCredit: 10.1,
invoice: 'Transfer Refund',
})
.request();
Loading

0 comments on commit c6c9f0d

Please sign in to comment.