-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
65f0390
commit 3a00788
Showing
6 changed files
with
113 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import buckarooClient from '../buckarooClient'; | ||
|
||
const blik = buckarooClient.method('blik'); | ||
|
||
//Pay | ||
blik | ||
.pay({ | ||
currency: 'PLN', | ||
amountDebit: 10.00, | ||
invoice: 'Blik Test Plugins Example', | ||
description: 'Blik Test Plugins Example', | ||
email: 'test@buckaroo.nl', | ||
}) | ||
.request(); | ||
//Refund | ||
blik | ||
.refund({ | ||
originalTransactionKey: 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', | ||
currency: 'PLN', | ||
amountCredit: 5.00, | ||
invoice: 'Refund Blik Test Plugins Example', | ||
description: 'Refund Blik Test Plugins Example', | ||
}) | ||
.request(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import buckarooClient from '../buckarooClient'; | ||
|
||
const blik = buckarooClient.method('blik'); | ||
|
||
//Pay | ||
blik | ||
.pay({ | ||
currency: 'PLN', | ||
amountDebit: 10.00, | ||
invoice: 'Blik Test Plugins Example', | ||
description: 'Blik Test Plugins Example', | ||
email: 'test@buckaroo.nl', | ||
}) | ||
.request(); | ||
//Refund | ||
blik | ||
.refund({ | ||
originalTransactionKey: 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', | ||
currency: 'PLN', | ||
amountCredit: 5.00, | ||
invoice: 'Refund Blik Test Plugins Example', | ||
description: 'Refund Blik Test Plugins Example', | ||
}) | ||
.request(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { IPaymentRequest, ServiceParameter } from '../../../Models'; | ||
|
||
export interface IPay extends IPaymentRequest { | ||
email?: string; | ||
} | ||
|
||
export class Pay extends ServiceParameter { | ||
set email(value: string) { | ||
this.set('email', value); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { PayablePaymentMethod } from '../../Services'; | ||
import { IRefundRequest } from '../../Models'; | ||
import { IPay, Pay } from './Models/Pay'; | ||
import { ServiceCode } from '../../Utils'; | ||
|
||
export default class Blik extends PayablePaymentMethod { | ||
|
||
public defaultServiceCode(): ServiceCode { | ||
return 'blik'; | ||
} | ||
|
||
pay(payload: IPay) { | ||
return super.pay(payload, new Pay(payload)); | ||
} | ||
|
||
refund(payload: IRefundRequest) { | ||
return super.refund(payload); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import buckarooClientTest from '../BuckarooClient.test'; | ||
|
||
const blik = buckarooClientTest.method('blik'); | ||
|
||
describe('Testing Blik methods', () => { | ||
test('Pay', async () => { | ||
return blik | ||
.pay({ | ||
currency: 'PLN', | ||
amountDebit: 10.00, | ||
invoice: 'Blik Test Plugin Example', | ||
description: 'Blik Test Plugin Example', | ||
email: 'test@buckaroo.nl', | ||
}) | ||
.request() | ||
.then((res) => { | ||
expect(res.isPendingProcessing()).toBeTruthy(); | ||
}); | ||
}); | ||
test('Refund', async () => { | ||
return blik | ||
.refund({ | ||
originalTransactionKey: 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', | ||
currency: 'PLN', | ||
amountCredit: 5.00, | ||
invoice: 'Refund Blik Test Plugin Example', | ||
description: 'Refund Blik Test Plugin Example', | ||
}) | ||
.request() | ||
.then((info) => { | ||
expect(info.httpResponse.status).toEqual(200) | ||
}); | ||
}); | ||
}); |