1- 'use strict' ;
2-
3- Object . defineProperty ( exports , "__esModule" , {
4- value : true
5- } ) ;
6-
7- var _extends = Object . assign || function ( target ) { for ( var i = 1 ; i < arguments . length ; i ++ ) { var source = arguments [ i ] ; for ( var key in source ) { if ( Object . prototype . hasOwnProperty . call ( source , key ) ) { target [ key ] = source [ key ] ; } } } return target ; } ;
1+ "use strict" ;
82
3+ exports . __esModule = true ;
94exports . cancelCardTransaction = cancelCardTransaction ;
105exports . commitCardTransaction = commitCardTransaction ;
116exports . createCardTransaction = createCardTransaction ;
127exports . getCardTransactions = getCardTransactions ;
138exports . resendCardTransaction = resendCardTransaction ;
149
15- var _lodash = require ( 'lodash.merge' ) ;
16-
17- var _lodash2 = _interopRequireDefault ( _lodash ) ;
10+ var _merge = _interopRequireDefault ( require ( "lodash/merge" ) ) ;
1811
1912function _interopRequireDefault ( obj ) { return obj && obj . __esModule ? obj : { default : obj } ; }
2013
2114function cancelCardTransaction ( cardId , transactionId , options ) {
22- return this . api ( `/me/cards/${ cardId } /transactions/${ transactionId } /cancel` , _extends ( {
15+ return this . api ( `/me/cards/${ cardId } /transactions/${ transactionId } /cancel` , Object . assign ( {
2316 method : 'post'
2417 } , options ) ) ;
25- }
18+ } // eslint-disable-next-line max-params
2619
27- // eslint-disable-next-line max-params
28- function commitCardTransaction ( cardId , transactionId , _ref , otp , options ) {
29- let message = _ref . message ,
30- securityCode = _ref . securityCode ;
3120
32- options = ( 0 , _lodash2 . default ) ( {
21+ function commitCardTransaction ( cardId , transactionId , {
22+ message,
23+ securityCode
24+ } , otp , options ) {
25+ options = ( 0 , _merge . default ) ( {
3326 body : {
34- message : message ,
35- securityCode : securityCode
27+ message,
28+ securityCode
3629 } ,
3730 method : 'post'
3831 } , options ) ;
3932
4033 if ( otp ) {
41- options . headers = _extends ( {
34+ options . headers = Object . assign ( {
4235 'otp-token' : otp
4336 } , options . headers ) ;
4437 }
4538
4639 return this . api ( `/me/cards/${ cardId } /transactions/${ transactionId } /commit` , options ) ;
47- }
48-
49- // eslint-disable-next-line max-params
50- function createCardTransaction ( cardId , _ref2 , commit , otp , options ) {
51- let amount = _ref2 . amount ,
52- currency = _ref2 . currency ,
53- destination = _ref2 . destination ,
54- origin = _ref2 . origin ,
55- message = _ref2 . message ,
56- securityCode = _ref2 . securityCode ;
57-
58- options = ( 0 , _lodash2 . default ) ( {
40+ } // eslint-disable-next-line max-params
41+
42+
43+ function createCardTransaction ( cardId , {
44+ amount,
45+ currency,
46+ destination,
47+ message ,
48+ origin ,
49+ securityCode
50+ } , commit , otp , options ) {
51+ options = ( 0 , _merge . default ) ( {
5952 body : {
6053 denomination : {
61- amount : amount ,
62- currency : currency
54+ amount,
55+ currency
6356 } ,
64- destination : destination ,
65- message : message ,
66- origin : origin ,
67- securityCode : securityCode
57+ destination,
58+ message,
59+ origin,
60+ securityCode
6861 } ,
6962 method : 'post'
7063 } , options ) ;
7164
7265 if ( commit ) {
73- options . queryParams = _extends ( {
66+ options . queryParams = Object . assign ( {
7467 commit : true
7568 } , options . queryParams ) ;
7669 }
7770
7871 if ( otp ) {
79- options . headers = _extends ( {
72+ options . headers = Object . assign ( {
8073 'otp-token' : otp
8174 } , options . headers ) ;
8275 }
@@ -89,7 +82,7 @@ function getCardTransactions(cardId, page, itemsPerPage, options) {
8982}
9083
9184function resendCardTransaction ( cardId , transactionId , options ) {
92- return this . api ( `/me/cards/${ cardId } /transactions/${ transactionId } /resend` , _extends ( {
85+ return this . api ( `/me/cards/${ cardId } /transactions/${ transactionId } /resend` , Object . assign ( {
9386 method : 'post'
9487 } , options ) ) ;
9588}
0 commit comments