File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import buckarooClient from '../buckarooClient' ;
2+ import { uniqid } from '../../src' ;
3+
4+ const swish = buckarooClient . method ( 'swish' ) ;
5+
6+ //Pay
7+ swish
8+ . pay ( {
9+ currency : 'SEK' ,
10+ amountDebit : 10.0 ,
11+ invoice : uniqid ( ) ,
12+ description : 'Swish Payment' ,
13+ } )
14+ . request ( ) ;
15+ //Refund
16+ swish
17+ . refund ( {
18+ originalTransactionKey : 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' ,
19+ currency : 'SEK' ,
20+ amountCredit : 10.0 ,
21+ invoice : uniqid ( ) ,
22+ description : 'Swish Refund' ,
23+ } )
24+ . request ( ) ;
Original file line number Diff line number Diff line change 1+ import buckarooClient from '../buckarooClient' ;
2+ import { uniqid } from '../../src/Utils' ;
3+
4+ const bizum = buckarooClient . method ( 'bizum' ) ;
5+
6+ //Pay
7+ bizum
8+ . pay ( {
9+ amountDebit : 10.1 ,
10+ invoice : uniqid ( ) ,
11+ description : 'Bizum Payment' ,
12+ } )
13+ . request ( ) ;
14+ //Refund
15+ bizum
16+ . refund ( {
17+ originalTransactionKey : 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' ,
18+ amountCredit : 10.1 ,
19+ invoice : uniqid ( ) ,
20+ description : 'Bizum Refund' ,
21+ } )
22+ . request ( ) ;
Original file line number Diff line number Diff line change 1+ import { PayablePaymentMethod } from '../../Services' ;
2+ import { ServiceCode } from '../../Utils' ;
3+
4+ export default class Swish extends PayablePaymentMethod {
5+ public defaultServiceCode ( ) : ServiceCode {
6+ return 'swish' ;
7+ }
8+ }
Original file line number Diff line number Diff line change @@ -82,6 +82,7 @@ export { default as przelewy24 } from './Przelewy24';
8282export { default as sepadirectdebit } from './SEPA' ;
8383export { default as subscriptions } from './Subscriptions' ;
8484export { default as surepay } from './Surepay' ;
85+ export { default as swish } from './Swish' ;
8586export { default as thunes } from './Thunes' ;
8687export { default as alipay } from './Alipay' ;
8788export { default as trustly } from './Trustly' ;
Original file line number Diff line number Diff line change 1+ import { IRefundRequest , PaymentMethodInstance } from '../../src' ;
2+ import buckarooClientTest from '../BuckarooClient.test' ;
3+ import { createRefundPayload } from '../Payloads' ;
4+
5+ let method : PaymentMethodInstance < 'swish' > ;
6+
7+ beforeEach ( ( ) => {
8+ method = buckarooClientTest . method ( 'swish' ) ;
9+ } ) ;
10+
11+ describe ( 'Swish methods' , ( ) => {
12+ test ( 'Pay' , async ( ) => {
13+ const response = await method
14+ . pay ( {
15+ currency : 'SEK' ,
16+ amountDebit : 10 ,
17+ } )
18+ . request ( ) ;
19+ expect ( response . isPendingProcessing ( ) ) . toBeTruthy ( ) ;
20+ } ) ;
21+ test . only ( 'Refund' , async ( ) => {
22+ const response = await method
23+ . refund (
24+ createRefundPayload < IRefundRequest > ( {
25+ currency : 'SEK' ,
26+ originalTransactionKey : '571519D5237B40D884B6D95245ED953B' ,
27+ } )
28+ )
29+ . request ( ) ;
30+ expect ( response . isSuccess ( ) ) . toBeTruthy ( ) ;
31+ } ) ;
32+ } ) ;
You can’t perform that action at this time.
0 commit comments