Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions example/transaction/swish.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import buckarooClient from '../buckarooClient';
import { uniqid } from '../../src';

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

//Pay
swish
.pay({
currency: 'SEK',
amountDebit: 10.0,
invoice: uniqid(),
description: 'Swish Payment',
})
.request();
//Refund
swish
.refund({
originalTransactionKey: 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
currency: 'SEK',
amountCredit: 10.0,
invoice: uniqid(),
description: 'Swish Refund',
})
.request();
22 changes: 22 additions & 0 deletions example/transaction/swish.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import buckarooClient from '../buckarooClient';
import { uniqid } from '../../src/Utils';

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

//Pay
bizum
.pay({
amountDebit: 10.1,
invoice: uniqid(),
description: 'Bizum Payment',
})
.request();
//Refund
bizum
.refund({
originalTransactionKey: 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
amountCredit: 10.1,
invoice: uniqid(),
description: 'Bizum Refund',
})
.request();
8 changes: 8 additions & 0 deletions src/PaymentMethods/Swish/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { PayablePaymentMethod } from '../../Services';
import { ServiceCode } from '../../Utils';

export default class Swish extends PayablePaymentMethod {
public defaultServiceCode(): ServiceCode {
return 'swish';
}
}
1 change: 1 addition & 0 deletions src/PaymentMethods/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ export { default as przelewy24 } from './Przelewy24';
export { default as sepadirectdebit } from './SEPA';
export { default as subscriptions } from './Subscriptions';
export { default as surepay } from './Surepay';
export { default as swish } from './Swish';
export { default as thunes } from './Thunes';
export { default as alipay } from './Alipay';
export { default as trustly } from './Trustly';
Expand Down
32 changes: 32 additions & 0 deletions tests/PaymentMethods/Swish.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { IRefundRequest, PaymentMethodInstance } from '../../src';
import buckarooClientTest from '../BuckarooClient.test';
import { createRefundPayload } from '../Payloads';

let method: PaymentMethodInstance<'swish'>;

beforeEach(() => {
method = buckarooClientTest.method('swish');
});

describe('Swish methods', () => {
test('Pay', async () => {
const response = await method
.pay({
currency: 'SEK',
amountDebit: 10,
})
.request();
expect(response.isPendingProcessing()).toBeTruthy();
});
test.only('Refund', async () => {
const response = await method
.refund(
createRefundPayload<IRefundRequest>({
currency: 'SEK',
originalTransactionKey: '571519D5237B40D884B6D95245ED953B',
})
)
.request();
expect(response.isSuccess()).toBeTruthy();
});
});
Loading