@paystack/checkout-js 1.25.0-dev.9 → 1.26.0-dev.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/checkout.js +146 -28
- package/es/checkout.js +146 -28
- package/lib/checkout.js +146 -28
- package/package.json +1 -1
package/dist/checkout.js
CHANGED
|
@@ -6474,15 +6474,28 @@ var Paystack = (function (exports) {
|
|
|
6474
6474
|
var _excluded = ["message", "status", "errors"],
|
|
6475
6475
|
_excluded2 = ["message", "status", "errors"],
|
|
6476
6476
|
_excluded3 = ["message", "status", "errors"],
|
|
6477
|
-
_excluded4 = ["
|
|
6477
|
+
_excluded4 = ["message", "status", "errors"],
|
|
6478
|
+
_excluded5 = ["status", "message", "otpmessage"];
|
|
6478
6479
|
var PREAUTHORIZATION_STATE_AUTHORIZED = 'authorized';
|
|
6479
6480
|
var ChargeResponses = {
|
|
6480
|
-
|
|
6481
|
+
authorized: function authorized(response) {
|
|
6481
6482
|
var message = response.message;
|
|
6482
6483
|
response.status;
|
|
6483
6484
|
response.errors;
|
|
6484
6485
|
var cleanResponse = _objectWithoutProperties(response, _excluded);
|
|
6485
6486
|
|
|
6487
|
+
return {
|
|
6488
|
+
status: PREAUTHORIZATION_STATE_AUTHORIZED,
|
|
6489
|
+
message: message || 'Payment authorized successfully',
|
|
6490
|
+
data: cleanResponse
|
|
6491
|
+
};
|
|
6492
|
+
},
|
|
6493
|
+
success: function success(response) {
|
|
6494
|
+
var message = response.message;
|
|
6495
|
+
response.status;
|
|
6496
|
+
response.errors;
|
|
6497
|
+
var cleanResponse = _objectWithoutProperties(response, _excluded2);
|
|
6498
|
+
|
|
6486
6499
|
return {
|
|
6487
6500
|
status: 'success',
|
|
6488
6501
|
message: message || 'Successful',
|
|
@@ -6493,7 +6506,7 @@ var Paystack = (function (exports) {
|
|
|
6493
6506
|
var message = response.message;
|
|
6494
6507
|
response.status;
|
|
6495
6508
|
response.errors;
|
|
6496
|
-
var cleanResponse = _objectWithoutProperties(response,
|
|
6509
|
+
var cleanResponse = _objectWithoutProperties(response, _excluded3);
|
|
6497
6510
|
|
|
6498
6511
|
return {
|
|
6499
6512
|
status: 'pending',
|
|
@@ -6505,7 +6518,7 @@ var Paystack = (function (exports) {
|
|
|
6505
6518
|
var message = response.message,
|
|
6506
6519
|
status = response.status;
|
|
6507
6520
|
response.errors;
|
|
6508
|
-
var cleanResponse = _objectWithoutProperties(response,
|
|
6521
|
+
var cleanResponse = _objectWithoutProperties(response, _excluded4);
|
|
6509
6522
|
|
|
6510
6523
|
return {
|
|
6511
6524
|
status: status,
|
|
@@ -6517,7 +6530,7 @@ var Paystack = (function (exports) {
|
|
|
6517
6530
|
response.status;
|
|
6518
6531
|
var message = response.message,
|
|
6519
6532
|
otpmessage = response.otpmessage,
|
|
6520
|
-
cleanResponse = _objectWithoutProperties(response,
|
|
6533
|
+
cleanResponse = _objectWithoutProperties(response, _excluded5);
|
|
6521
6534
|
|
|
6522
6535
|
var authMessage = otpmessage || message;
|
|
6523
6536
|
return {
|
|
@@ -6569,10 +6582,14 @@ var Paystack = (function (exports) {
|
|
|
6569
6582
|
delete response.data;
|
|
6570
6583
|
}
|
|
6571
6584
|
|
|
6572
|
-
if (['true', true, 'success'
|
|
6585
|
+
if (['true', true, 'success'].includes(response.status)) {
|
|
6573
6586
|
return this.success(response);
|
|
6574
6587
|
}
|
|
6575
6588
|
|
|
6589
|
+
if (response.status === PREAUTHORIZATION_STATE_AUTHORIZED) {
|
|
6590
|
+
return this.authorized(response);
|
|
6591
|
+
}
|
|
6592
|
+
|
|
6576
6593
|
if (response.status === 'pending') {
|
|
6577
6594
|
return this.pending(response);
|
|
6578
6595
|
}
|
|
@@ -11554,6 +11571,38 @@ var Paystack = (function (exports) {
|
|
|
11554
11571
|
}).then(function (response) {
|
|
11555
11572
|
return ChargeResponses.parse(response.data);
|
|
11556
11573
|
});
|
|
11574
|
+
},
|
|
11575
|
+
incorrectAmountDecision: function incorrectAmountDecision(params, publicKey) {
|
|
11576
|
+
var language = getLanguage();
|
|
11577
|
+
|
|
11578
|
+
var headers = _objectSpread2({
|
|
11579
|
+
Authorization: "Bearer ".concat(publicKey)
|
|
11580
|
+
}, language && {
|
|
11581
|
+
'Accept-Language': language
|
|
11582
|
+
});
|
|
11583
|
+
|
|
11584
|
+
var url = new URL('pay-with-transfer/incorrect-amount/decision', configToUse.paystackApiUrl).toString();
|
|
11585
|
+
return axiosInstance.post(url, params, {
|
|
11586
|
+
headers: headers
|
|
11587
|
+
}).then(function (response) {
|
|
11588
|
+
return ChargeResponses.parse(response.data);
|
|
11589
|
+
});
|
|
11590
|
+
},
|
|
11591
|
+
authenticatePayer: function authenticatePayer(params, publicKey) {
|
|
11592
|
+
var language = getLanguage();
|
|
11593
|
+
|
|
11594
|
+
var headers = _objectSpread2({
|
|
11595
|
+
Authorization: "Bearer ".concat(publicKey)
|
|
11596
|
+
}, language && {
|
|
11597
|
+
'Accept-Language': language
|
|
11598
|
+
});
|
|
11599
|
+
|
|
11600
|
+
var url = new URL('pay-with-transfer/authenticate-payer', configToUse.paystackApiUrl).toString();
|
|
11601
|
+
return axiosInstance.post(url, params, {
|
|
11602
|
+
headers: headers
|
|
11603
|
+
}).then(function (response) {
|
|
11604
|
+
return ChargeResponses.parse(response.data);
|
|
11605
|
+
});
|
|
11557
11606
|
}
|
|
11558
11607
|
};
|
|
11559
11608
|
|
|
@@ -11584,6 +11633,25 @@ var Paystack = (function (exports) {
|
|
|
11584
11633
|
paymentMethod: 'bank_transfer'
|
|
11585
11634
|
};
|
|
11586
11635
|
return this.listenForCharge(listenerOptions, callback);
|
|
11636
|
+
},
|
|
11637
|
+
sendIncorrectAmountDecision: function sendIncorrectAmountDecision(decisionMade) {
|
|
11638
|
+
var params = {
|
|
11639
|
+
transaction_id: this.id,
|
|
11640
|
+
decision: decisionMade
|
|
11641
|
+
};
|
|
11642
|
+
return PayWithTransferAPI.incorrectAmountDecision(params, this.merchant.key);
|
|
11643
|
+
},
|
|
11644
|
+
sendAuthenticatePayer: function sendAuthenticatePayer(_ref2) {
|
|
11645
|
+
var amountPaid = _ref2.amountPaid,
|
|
11646
|
+
payerAccountNumber = _ref2.payerAccountNumber,
|
|
11647
|
+
payerBankSlug = _ref2.payerBankSlug;
|
|
11648
|
+
var params = {
|
|
11649
|
+
transaction_id: this.id,
|
|
11650
|
+
amount: amountPaid,
|
|
11651
|
+
payer_account_number: payerAccountNumber,
|
|
11652
|
+
payer_bank_slug: payerBankSlug
|
|
11653
|
+
};
|
|
11654
|
+
return PayWithTransferAPI.authenticatePayer(params, this.merchant.key);
|
|
11587
11655
|
}
|
|
11588
11656
|
};
|
|
11589
11657
|
|
|
@@ -18865,6 +18933,10 @@ var Paystack = (function (exports) {
|
|
|
18865
18933
|
};
|
|
18866
18934
|
|
|
18867
18935
|
var paymentMethod$4 = 'card';
|
|
18936
|
+
var savedCardMethods = {
|
|
18937
|
+
payment: 'saved card',
|
|
18938
|
+
authentication: 'otp'
|
|
18939
|
+
};
|
|
18868
18940
|
|
|
18869
18941
|
function validate$4(card, isSetter) {
|
|
18870
18942
|
return new Promise(function (resolve, reject) {
|
|
@@ -19052,29 +19124,32 @@ var Paystack = (function (exports) {
|
|
|
19052
19124
|
switch (_context.prev = _context.next) {
|
|
19053
19125
|
case 0:
|
|
19054
19126
|
_context.prev = 0;
|
|
19055
|
-
|
|
19127
|
+
|
|
19128
|
+
_this9.logAuth(savedCardMethods.authentication);
|
|
19129
|
+
|
|
19130
|
+
_context.next = 4;
|
|
19056
19131
|
return CardAPI$1.sendSavedCardsOTP({
|
|
19057
19132
|
phone: phone,
|
|
19058
19133
|
transaction: _this9.id
|
|
19059
19134
|
});
|
|
19060
19135
|
|
|
19061
|
-
case
|
|
19136
|
+
case 4:
|
|
19062
19137
|
response = _context.sent;
|
|
19063
19138
|
_this9.savedCardsTempAuthToken = response.data.token;
|
|
19064
19139
|
return _context.abrupt("return", response);
|
|
19065
19140
|
|
|
19066
|
-
case
|
|
19067
|
-
_context.prev =
|
|
19141
|
+
case 9:
|
|
19142
|
+
_context.prev = 9;
|
|
19068
19143
|
_context.t0 = _context["catch"](0);
|
|
19069
19144
|
_this9.savedCardsTempAuthToken = null;
|
|
19070
19145
|
throw _context.t0;
|
|
19071
19146
|
|
|
19072
|
-
case
|
|
19147
|
+
case 13:
|
|
19073
19148
|
case "end":
|
|
19074
19149
|
return _context.stop();
|
|
19075
19150
|
}
|
|
19076
19151
|
}
|
|
19077
|
-
}, _callee, null, [[0,
|
|
19152
|
+
}, _callee, null, [[0, 9]]);
|
|
19078
19153
|
}))();
|
|
19079
19154
|
},
|
|
19080
19155
|
verifySavedCardsOtp: function verifySavedCardsOtp(_ref4) {
|
|
@@ -19128,6 +19203,7 @@ var Paystack = (function (exports) {
|
|
|
19128
19203
|
},
|
|
19129
19204
|
chargeSavedCard: function chargeSavedCard(_ref5) {
|
|
19130
19205
|
var cardCode = _ref5.cardCode;
|
|
19206
|
+
this.logAttempt(savedCardMethods.payment);
|
|
19131
19207
|
return CardAPI$1.chargeSavedCard({
|
|
19132
19208
|
cardCode: cardCode,
|
|
19133
19209
|
transaction: this.id,
|
|
@@ -19396,7 +19472,8 @@ var Paystack = (function (exports) {
|
|
|
19396
19472
|
var bankId = _ref.bankId,
|
|
19397
19473
|
transactionId = _ref.transactionId,
|
|
19398
19474
|
phoneNumber = _ref.phoneNumber,
|
|
19399
|
-
payId = _ref.payId
|
|
19475
|
+
payId = _ref.payId,
|
|
19476
|
+
walletId = _ref.walletId;
|
|
19400
19477
|
var url = "".concat(configToUse.paymentBaseUrl, "bank/digitalbankmandate/").concat(bankId, "/").concat(transactionId);
|
|
19401
19478
|
var language = getLanguage();
|
|
19402
19479
|
|
|
@@ -19406,10 +19483,13 @@ var Paystack = (function (exports) {
|
|
|
19406
19483
|
'Accept-Language': language
|
|
19407
19484
|
});
|
|
19408
19485
|
|
|
19409
|
-
var params = {
|
|
19486
|
+
var params = _objectSpread2({}, walletId ? {
|
|
19487
|
+
wallet_id: walletId
|
|
19488
|
+
} : {
|
|
19410
19489
|
phone_number: phoneNumber,
|
|
19411
19490
|
token: payId
|
|
19412
|
-
};
|
|
19491
|
+
});
|
|
19492
|
+
|
|
19413
19493
|
var urlEncodedParams = formUrlencoded(params);
|
|
19414
19494
|
return axiosInstance.post(url, urlEncodedParams, {
|
|
19415
19495
|
headers: headers
|
|
@@ -19426,12 +19506,14 @@ var Paystack = (function (exports) {
|
|
|
19426
19506
|
|
|
19427
19507
|
var phoneNumber = _ref.phoneNumber,
|
|
19428
19508
|
payId = _ref.payId,
|
|
19429
|
-
bankId = _ref.bankId
|
|
19509
|
+
bankId = _ref.bankId,
|
|
19510
|
+
walletId = _ref.walletId;
|
|
19430
19511
|
var params = {
|
|
19431
19512
|
transactionId: this.id,
|
|
19432
19513
|
phoneNumber: phoneNumber,
|
|
19433
19514
|
payId: payId,
|
|
19434
|
-
bankId: bankId
|
|
19515
|
+
bankId: bankId,
|
|
19516
|
+
walletId: walletId
|
|
19435
19517
|
};
|
|
19436
19518
|
return DigitalBankMandateAPI.charge(params).then(function (response) {
|
|
19437
19519
|
_this.logAPIResponse(response, paymentMethod$2);
|
|
@@ -19782,34 +19864,62 @@ var Paystack = (function (exports) {
|
|
|
19782
19864
|
});
|
|
19783
19865
|
});
|
|
19784
19866
|
},
|
|
19785
|
-
|
|
19867
|
+
chargeMpesaOffline: function chargeMpesaOffline(_ref2) {
|
|
19786
19868
|
var _this2 = this;
|
|
19787
19869
|
|
|
19870
|
+
var provider = _ref2.provider,
|
|
19871
|
+
voucher = _ref2.voucher,
|
|
19872
|
+
registrationToken = _ref2.registrationToken;
|
|
19873
|
+
this.logAttempt('mobile money');
|
|
19874
|
+
var params = {
|
|
19875
|
+
provider: provider,
|
|
19876
|
+
voucher: voucher,
|
|
19877
|
+
registrationToken: registrationToken,
|
|
19878
|
+
transaction: this.id,
|
|
19879
|
+
phone: null,
|
|
19880
|
+
device: this.deviceFingerprint,
|
|
19881
|
+
channel_name: "MOBILE_MONEY_".concat(this.id)
|
|
19882
|
+
};
|
|
19883
|
+
return MobileMoneyAPI.charge(params).then(function (response) {
|
|
19884
|
+
if (response.status === 'success') {
|
|
19885
|
+
_this2.mobileMoney = response;
|
|
19886
|
+
|
|
19887
|
+
if (response.data && response.data.display && response.data.display.otpSentCount === 1) {
|
|
19888
|
+
_this2.logTokenRequest('mobile money');
|
|
19889
|
+
}
|
|
19890
|
+
}
|
|
19891
|
+
|
|
19892
|
+
return response;
|
|
19893
|
+
});
|
|
19894
|
+
},
|
|
19895
|
+
authenticateMobileMoney: function authenticateMobileMoney(payload) {
|
|
19896
|
+
var _this3 = this;
|
|
19897
|
+
|
|
19788
19898
|
var phoneNumber = payload.phoneNumber,
|
|
19789
19899
|
provider = payload.provider,
|
|
19790
19900
|
registrationToken = payload.registrationToken;
|
|
19791
19901
|
return validate$1(phoneNumber).then(function () {
|
|
19792
|
-
|
|
19902
|
+
_this3.logMobileMoneyActions(payload);
|
|
19793
19903
|
|
|
19794
19904
|
var params = {
|
|
19795
19905
|
provider: provider,
|
|
19796
19906
|
registrationToken: registrationToken,
|
|
19797
|
-
transaction:
|
|
19907
|
+
transaction: _this3.id,
|
|
19798
19908
|
phone: phoneNumber,
|
|
19799
|
-
device:
|
|
19800
|
-
channel_name: "MOBILE_MONEY_".concat(
|
|
19909
|
+
device: _this3.deviceFingerprint,
|
|
19910
|
+
channel_name: "MOBILE_MONEY_".concat(_this3.id)
|
|
19801
19911
|
};
|
|
19802
19912
|
return MobileMoneyAPI.charge(params).then(function (response) {
|
|
19803
19913
|
if (response.status === 'success') {
|
|
19804
|
-
|
|
19914
|
+
_this3.mobileMoney = response;
|
|
19805
19915
|
|
|
19806
19916
|
if (response.data && response.data.display && response.data.display.otpSentCount === 1) {
|
|
19807
|
-
|
|
19917
|
+
_this3.logTokenRequest('mobile money');
|
|
19808
19918
|
}
|
|
19809
19919
|
} else if (response.errors && response.errors.data && response.errors.data.status === 'awaiting_registration_token') {
|
|
19810
|
-
|
|
19920
|
+
_this3.logTokenAuthenticationFailure(response.message);
|
|
19811
19921
|
} else {
|
|
19812
|
-
|
|
19922
|
+
_this3.logError(response.message);
|
|
19813
19923
|
}
|
|
19814
19924
|
|
|
19815
19925
|
return response;
|
|
@@ -19817,13 +19927,13 @@ var Paystack = (function (exports) {
|
|
|
19817
19927
|
});
|
|
19818
19928
|
},
|
|
19819
19929
|
submitMobileMoneyCode: function submitMobileMoneyCode(payload) {
|
|
19820
|
-
var
|
|
19930
|
+
var _this4 = this;
|
|
19821
19931
|
|
|
19822
19932
|
return MobileMoneyAPI.submitCode({
|
|
19823
19933
|
code: payload.code,
|
|
19824
19934
|
transaction: this.id
|
|
19825
19935
|
}).then(function (response) {
|
|
19826
|
-
|
|
19936
|
+
_this4.logAPIResponse(response, 'mobile_money');
|
|
19827
19937
|
|
|
19828
19938
|
return response;
|
|
19829
19939
|
});
|
|
@@ -20281,6 +20391,14 @@ var Paystack = (function (exports) {
|
|
|
20281
20391
|
});
|
|
20282
20392
|
return this.saveLog();
|
|
20283
20393
|
},
|
|
20394
|
+
logSavedCardSelect: function logSavedCardSelect() {
|
|
20395
|
+
this.log.history.push({
|
|
20396
|
+
type: 'action',
|
|
20397
|
+
message: 'Selected saved card',
|
|
20398
|
+
time: this.getTimeSpent()
|
|
20399
|
+
});
|
|
20400
|
+
return this.saveLog();
|
|
20401
|
+
},
|
|
20284
20402
|
logAuthWindowOpen: function logAuthWindowOpen() {
|
|
20285
20403
|
this.log.history.push({
|
|
20286
20404
|
type: 'action',
|
package/es/checkout.js
CHANGED
|
@@ -6471,15 +6471,28 @@ addToUnscopables$2('includes');
|
|
|
6471
6471
|
var _excluded = ["message", "status", "errors"],
|
|
6472
6472
|
_excluded2 = ["message", "status", "errors"],
|
|
6473
6473
|
_excluded3 = ["message", "status", "errors"],
|
|
6474
|
-
_excluded4 = ["
|
|
6474
|
+
_excluded4 = ["message", "status", "errors"],
|
|
6475
|
+
_excluded5 = ["status", "message", "otpmessage"];
|
|
6475
6476
|
var PREAUTHORIZATION_STATE_AUTHORIZED = 'authorized';
|
|
6476
6477
|
var ChargeResponses = {
|
|
6477
|
-
|
|
6478
|
+
authorized: function authorized(response) {
|
|
6478
6479
|
var message = response.message;
|
|
6479
6480
|
response.status;
|
|
6480
6481
|
response.errors;
|
|
6481
6482
|
var cleanResponse = _objectWithoutProperties(response, _excluded);
|
|
6482
6483
|
|
|
6484
|
+
return {
|
|
6485
|
+
status: PREAUTHORIZATION_STATE_AUTHORIZED,
|
|
6486
|
+
message: message || 'Payment authorized successfully',
|
|
6487
|
+
data: cleanResponse
|
|
6488
|
+
};
|
|
6489
|
+
},
|
|
6490
|
+
success: function success(response) {
|
|
6491
|
+
var message = response.message;
|
|
6492
|
+
response.status;
|
|
6493
|
+
response.errors;
|
|
6494
|
+
var cleanResponse = _objectWithoutProperties(response, _excluded2);
|
|
6495
|
+
|
|
6483
6496
|
return {
|
|
6484
6497
|
status: 'success',
|
|
6485
6498
|
message: message || 'Successful',
|
|
@@ -6490,7 +6503,7 @@ var ChargeResponses = {
|
|
|
6490
6503
|
var message = response.message;
|
|
6491
6504
|
response.status;
|
|
6492
6505
|
response.errors;
|
|
6493
|
-
var cleanResponse = _objectWithoutProperties(response,
|
|
6506
|
+
var cleanResponse = _objectWithoutProperties(response, _excluded3);
|
|
6494
6507
|
|
|
6495
6508
|
return {
|
|
6496
6509
|
status: 'pending',
|
|
@@ -6502,7 +6515,7 @@ var ChargeResponses = {
|
|
|
6502
6515
|
var message = response.message,
|
|
6503
6516
|
status = response.status;
|
|
6504
6517
|
response.errors;
|
|
6505
|
-
var cleanResponse = _objectWithoutProperties(response,
|
|
6518
|
+
var cleanResponse = _objectWithoutProperties(response, _excluded4);
|
|
6506
6519
|
|
|
6507
6520
|
return {
|
|
6508
6521
|
status: status,
|
|
@@ -6514,7 +6527,7 @@ var ChargeResponses = {
|
|
|
6514
6527
|
response.status;
|
|
6515
6528
|
var message = response.message,
|
|
6516
6529
|
otpmessage = response.otpmessage,
|
|
6517
|
-
cleanResponse = _objectWithoutProperties(response,
|
|
6530
|
+
cleanResponse = _objectWithoutProperties(response, _excluded5);
|
|
6518
6531
|
|
|
6519
6532
|
var authMessage = otpmessage || message;
|
|
6520
6533
|
return {
|
|
@@ -6566,10 +6579,14 @@ var ChargeResponses = {
|
|
|
6566
6579
|
delete response.data;
|
|
6567
6580
|
}
|
|
6568
6581
|
|
|
6569
|
-
if (['true', true, 'success'
|
|
6582
|
+
if (['true', true, 'success'].includes(response.status)) {
|
|
6570
6583
|
return this.success(response);
|
|
6571
6584
|
}
|
|
6572
6585
|
|
|
6586
|
+
if (response.status === PREAUTHORIZATION_STATE_AUTHORIZED) {
|
|
6587
|
+
return this.authorized(response);
|
|
6588
|
+
}
|
|
6589
|
+
|
|
6573
6590
|
if (response.status === 'pending') {
|
|
6574
6591
|
return this.pending(response);
|
|
6575
6592
|
}
|
|
@@ -11551,6 +11568,38 @@ var PayWithTransferAPI = {
|
|
|
11551
11568
|
}).then(function (response) {
|
|
11552
11569
|
return ChargeResponses.parse(response.data);
|
|
11553
11570
|
});
|
|
11571
|
+
},
|
|
11572
|
+
incorrectAmountDecision: function incorrectAmountDecision(params, publicKey) {
|
|
11573
|
+
var language = getLanguage();
|
|
11574
|
+
|
|
11575
|
+
var headers = _objectSpread2({
|
|
11576
|
+
Authorization: "Bearer ".concat(publicKey)
|
|
11577
|
+
}, language && {
|
|
11578
|
+
'Accept-Language': language
|
|
11579
|
+
});
|
|
11580
|
+
|
|
11581
|
+
var url = new URL('pay-with-transfer/incorrect-amount/decision', configToUse.paystackApiUrl).toString();
|
|
11582
|
+
return axiosInstance.post(url, params, {
|
|
11583
|
+
headers: headers
|
|
11584
|
+
}).then(function (response) {
|
|
11585
|
+
return ChargeResponses.parse(response.data);
|
|
11586
|
+
});
|
|
11587
|
+
},
|
|
11588
|
+
authenticatePayer: function authenticatePayer(params, publicKey) {
|
|
11589
|
+
var language = getLanguage();
|
|
11590
|
+
|
|
11591
|
+
var headers = _objectSpread2({
|
|
11592
|
+
Authorization: "Bearer ".concat(publicKey)
|
|
11593
|
+
}, language && {
|
|
11594
|
+
'Accept-Language': language
|
|
11595
|
+
});
|
|
11596
|
+
|
|
11597
|
+
var url = new URL('pay-with-transfer/authenticate-payer', configToUse.paystackApiUrl).toString();
|
|
11598
|
+
return axiosInstance.post(url, params, {
|
|
11599
|
+
headers: headers
|
|
11600
|
+
}).then(function (response) {
|
|
11601
|
+
return ChargeResponses.parse(response.data);
|
|
11602
|
+
});
|
|
11554
11603
|
}
|
|
11555
11604
|
};
|
|
11556
11605
|
|
|
@@ -11581,6 +11630,25 @@ var PayWithTransferCharge = {
|
|
|
11581
11630
|
paymentMethod: 'bank_transfer'
|
|
11582
11631
|
};
|
|
11583
11632
|
return this.listenForCharge(listenerOptions, callback);
|
|
11633
|
+
},
|
|
11634
|
+
sendIncorrectAmountDecision: function sendIncorrectAmountDecision(decisionMade) {
|
|
11635
|
+
var params = {
|
|
11636
|
+
transaction_id: this.id,
|
|
11637
|
+
decision: decisionMade
|
|
11638
|
+
};
|
|
11639
|
+
return PayWithTransferAPI.incorrectAmountDecision(params, this.merchant.key);
|
|
11640
|
+
},
|
|
11641
|
+
sendAuthenticatePayer: function sendAuthenticatePayer(_ref2) {
|
|
11642
|
+
var amountPaid = _ref2.amountPaid,
|
|
11643
|
+
payerAccountNumber = _ref2.payerAccountNumber,
|
|
11644
|
+
payerBankSlug = _ref2.payerBankSlug;
|
|
11645
|
+
var params = {
|
|
11646
|
+
transaction_id: this.id,
|
|
11647
|
+
amount: amountPaid,
|
|
11648
|
+
payer_account_number: payerAccountNumber,
|
|
11649
|
+
payer_bank_slug: payerBankSlug
|
|
11650
|
+
};
|
|
11651
|
+
return PayWithTransferAPI.authenticatePayer(params, this.merchant.key);
|
|
11584
11652
|
}
|
|
11585
11653
|
};
|
|
11586
11654
|
|
|
@@ -18862,6 +18930,10 @@ var CardAPI$1 = {
|
|
|
18862
18930
|
};
|
|
18863
18931
|
|
|
18864
18932
|
var paymentMethod$4 = 'card';
|
|
18933
|
+
var savedCardMethods = {
|
|
18934
|
+
payment: 'saved card',
|
|
18935
|
+
authentication: 'otp'
|
|
18936
|
+
};
|
|
18865
18937
|
|
|
18866
18938
|
function validate$4(card, isSetter) {
|
|
18867
18939
|
return new Promise(function (resolve, reject) {
|
|
@@ -19049,29 +19121,32 @@ var CardCharge = {
|
|
|
19049
19121
|
switch (_context.prev = _context.next) {
|
|
19050
19122
|
case 0:
|
|
19051
19123
|
_context.prev = 0;
|
|
19052
|
-
|
|
19124
|
+
|
|
19125
|
+
_this9.logAuth(savedCardMethods.authentication);
|
|
19126
|
+
|
|
19127
|
+
_context.next = 4;
|
|
19053
19128
|
return CardAPI$1.sendSavedCardsOTP({
|
|
19054
19129
|
phone: phone,
|
|
19055
19130
|
transaction: _this9.id
|
|
19056
19131
|
});
|
|
19057
19132
|
|
|
19058
|
-
case
|
|
19133
|
+
case 4:
|
|
19059
19134
|
response = _context.sent;
|
|
19060
19135
|
_this9.savedCardsTempAuthToken = response.data.token;
|
|
19061
19136
|
return _context.abrupt("return", response);
|
|
19062
19137
|
|
|
19063
|
-
case
|
|
19064
|
-
_context.prev =
|
|
19138
|
+
case 9:
|
|
19139
|
+
_context.prev = 9;
|
|
19065
19140
|
_context.t0 = _context["catch"](0);
|
|
19066
19141
|
_this9.savedCardsTempAuthToken = null;
|
|
19067
19142
|
throw _context.t0;
|
|
19068
19143
|
|
|
19069
|
-
case
|
|
19144
|
+
case 13:
|
|
19070
19145
|
case "end":
|
|
19071
19146
|
return _context.stop();
|
|
19072
19147
|
}
|
|
19073
19148
|
}
|
|
19074
|
-
}, _callee, null, [[0,
|
|
19149
|
+
}, _callee, null, [[0, 9]]);
|
|
19075
19150
|
}))();
|
|
19076
19151
|
},
|
|
19077
19152
|
verifySavedCardsOtp: function verifySavedCardsOtp(_ref4) {
|
|
@@ -19125,6 +19200,7 @@ var CardCharge = {
|
|
|
19125
19200
|
},
|
|
19126
19201
|
chargeSavedCard: function chargeSavedCard(_ref5) {
|
|
19127
19202
|
var cardCode = _ref5.cardCode;
|
|
19203
|
+
this.logAttempt(savedCardMethods.payment);
|
|
19128
19204
|
return CardAPI$1.chargeSavedCard({
|
|
19129
19205
|
cardCode: cardCode,
|
|
19130
19206
|
transaction: this.id,
|
|
@@ -19393,7 +19469,8 @@ var DigitalBankMandateAPI = {
|
|
|
19393
19469
|
var bankId = _ref.bankId,
|
|
19394
19470
|
transactionId = _ref.transactionId,
|
|
19395
19471
|
phoneNumber = _ref.phoneNumber,
|
|
19396
|
-
payId = _ref.payId
|
|
19472
|
+
payId = _ref.payId,
|
|
19473
|
+
walletId = _ref.walletId;
|
|
19397
19474
|
var url = "".concat(configToUse.paymentBaseUrl, "bank/digitalbankmandate/").concat(bankId, "/").concat(transactionId);
|
|
19398
19475
|
var language = getLanguage();
|
|
19399
19476
|
|
|
@@ -19403,10 +19480,13 @@ var DigitalBankMandateAPI = {
|
|
|
19403
19480
|
'Accept-Language': language
|
|
19404
19481
|
});
|
|
19405
19482
|
|
|
19406
|
-
var params = {
|
|
19483
|
+
var params = _objectSpread2({}, walletId ? {
|
|
19484
|
+
wallet_id: walletId
|
|
19485
|
+
} : {
|
|
19407
19486
|
phone_number: phoneNumber,
|
|
19408
19487
|
token: payId
|
|
19409
|
-
};
|
|
19488
|
+
});
|
|
19489
|
+
|
|
19410
19490
|
var urlEncodedParams = formUrlencoded(params);
|
|
19411
19491
|
return axiosInstance.post(url, urlEncodedParams, {
|
|
19412
19492
|
headers: headers
|
|
@@ -19423,12 +19503,14 @@ var DigitalBankMandate = {
|
|
|
19423
19503
|
|
|
19424
19504
|
var phoneNumber = _ref.phoneNumber,
|
|
19425
19505
|
payId = _ref.payId,
|
|
19426
|
-
bankId = _ref.bankId
|
|
19506
|
+
bankId = _ref.bankId,
|
|
19507
|
+
walletId = _ref.walletId;
|
|
19427
19508
|
var params = {
|
|
19428
19509
|
transactionId: this.id,
|
|
19429
19510
|
phoneNumber: phoneNumber,
|
|
19430
19511
|
payId: payId,
|
|
19431
|
-
bankId: bankId
|
|
19512
|
+
bankId: bankId,
|
|
19513
|
+
walletId: walletId
|
|
19432
19514
|
};
|
|
19433
19515
|
return DigitalBankMandateAPI.charge(params).then(function (response) {
|
|
19434
19516
|
_this.logAPIResponse(response, paymentMethod$2);
|
|
@@ -19779,34 +19861,62 @@ var MobileMoneyCharge = {
|
|
|
19779
19861
|
});
|
|
19780
19862
|
});
|
|
19781
19863
|
},
|
|
19782
|
-
|
|
19864
|
+
chargeMpesaOffline: function chargeMpesaOffline(_ref2) {
|
|
19783
19865
|
var _this2 = this;
|
|
19784
19866
|
|
|
19867
|
+
var provider = _ref2.provider,
|
|
19868
|
+
voucher = _ref2.voucher,
|
|
19869
|
+
registrationToken = _ref2.registrationToken;
|
|
19870
|
+
this.logAttempt('mobile money');
|
|
19871
|
+
var params = {
|
|
19872
|
+
provider: provider,
|
|
19873
|
+
voucher: voucher,
|
|
19874
|
+
registrationToken: registrationToken,
|
|
19875
|
+
transaction: this.id,
|
|
19876
|
+
phone: null,
|
|
19877
|
+
device: this.deviceFingerprint,
|
|
19878
|
+
channel_name: "MOBILE_MONEY_".concat(this.id)
|
|
19879
|
+
};
|
|
19880
|
+
return MobileMoneyAPI.charge(params).then(function (response) {
|
|
19881
|
+
if (response.status === 'success') {
|
|
19882
|
+
_this2.mobileMoney = response;
|
|
19883
|
+
|
|
19884
|
+
if (response.data && response.data.display && response.data.display.otpSentCount === 1) {
|
|
19885
|
+
_this2.logTokenRequest('mobile money');
|
|
19886
|
+
}
|
|
19887
|
+
}
|
|
19888
|
+
|
|
19889
|
+
return response;
|
|
19890
|
+
});
|
|
19891
|
+
},
|
|
19892
|
+
authenticateMobileMoney: function authenticateMobileMoney(payload) {
|
|
19893
|
+
var _this3 = this;
|
|
19894
|
+
|
|
19785
19895
|
var phoneNumber = payload.phoneNumber,
|
|
19786
19896
|
provider = payload.provider,
|
|
19787
19897
|
registrationToken = payload.registrationToken;
|
|
19788
19898
|
return validate$1(phoneNumber).then(function () {
|
|
19789
|
-
|
|
19899
|
+
_this3.logMobileMoneyActions(payload);
|
|
19790
19900
|
|
|
19791
19901
|
var params = {
|
|
19792
19902
|
provider: provider,
|
|
19793
19903
|
registrationToken: registrationToken,
|
|
19794
|
-
transaction:
|
|
19904
|
+
transaction: _this3.id,
|
|
19795
19905
|
phone: phoneNumber,
|
|
19796
|
-
device:
|
|
19797
|
-
channel_name: "MOBILE_MONEY_".concat(
|
|
19906
|
+
device: _this3.deviceFingerprint,
|
|
19907
|
+
channel_name: "MOBILE_MONEY_".concat(_this3.id)
|
|
19798
19908
|
};
|
|
19799
19909
|
return MobileMoneyAPI.charge(params).then(function (response) {
|
|
19800
19910
|
if (response.status === 'success') {
|
|
19801
|
-
|
|
19911
|
+
_this3.mobileMoney = response;
|
|
19802
19912
|
|
|
19803
19913
|
if (response.data && response.data.display && response.data.display.otpSentCount === 1) {
|
|
19804
|
-
|
|
19914
|
+
_this3.logTokenRequest('mobile money');
|
|
19805
19915
|
}
|
|
19806
19916
|
} else if (response.errors && response.errors.data && response.errors.data.status === 'awaiting_registration_token') {
|
|
19807
|
-
|
|
19917
|
+
_this3.logTokenAuthenticationFailure(response.message);
|
|
19808
19918
|
} else {
|
|
19809
|
-
|
|
19919
|
+
_this3.logError(response.message);
|
|
19810
19920
|
}
|
|
19811
19921
|
|
|
19812
19922
|
return response;
|
|
@@ -19814,13 +19924,13 @@ var MobileMoneyCharge = {
|
|
|
19814
19924
|
});
|
|
19815
19925
|
},
|
|
19816
19926
|
submitMobileMoneyCode: function submitMobileMoneyCode(payload) {
|
|
19817
|
-
var
|
|
19927
|
+
var _this4 = this;
|
|
19818
19928
|
|
|
19819
19929
|
return MobileMoneyAPI.submitCode({
|
|
19820
19930
|
code: payload.code,
|
|
19821
19931
|
transaction: this.id
|
|
19822
19932
|
}).then(function (response) {
|
|
19823
|
-
|
|
19933
|
+
_this4.logAPIResponse(response, 'mobile_money');
|
|
19824
19934
|
|
|
19825
19935
|
return response;
|
|
19826
19936
|
});
|
|
@@ -20278,6 +20388,14 @@ var AnalyticsFunctions$1 = {
|
|
|
20278
20388
|
});
|
|
20279
20389
|
return this.saveLog();
|
|
20280
20390
|
},
|
|
20391
|
+
logSavedCardSelect: function logSavedCardSelect() {
|
|
20392
|
+
this.log.history.push({
|
|
20393
|
+
type: 'action',
|
|
20394
|
+
message: 'Selected saved card',
|
|
20395
|
+
time: this.getTimeSpent()
|
|
20396
|
+
});
|
|
20397
|
+
return this.saveLog();
|
|
20398
|
+
},
|
|
20281
20399
|
logAuthWindowOpen: function logAuthWindowOpen() {
|
|
20282
20400
|
this.log.history.push({
|
|
20283
20401
|
type: 'action',
|
package/lib/checkout.js
CHANGED
|
@@ -6475,15 +6475,28 @@ addToUnscopables$2('includes');
|
|
|
6475
6475
|
var _excluded = ["message", "status", "errors"],
|
|
6476
6476
|
_excluded2 = ["message", "status", "errors"],
|
|
6477
6477
|
_excluded3 = ["message", "status", "errors"],
|
|
6478
|
-
_excluded4 = ["
|
|
6478
|
+
_excluded4 = ["message", "status", "errors"],
|
|
6479
|
+
_excluded5 = ["status", "message", "otpmessage"];
|
|
6479
6480
|
var PREAUTHORIZATION_STATE_AUTHORIZED = 'authorized';
|
|
6480
6481
|
var ChargeResponses = {
|
|
6481
|
-
|
|
6482
|
+
authorized: function authorized(response) {
|
|
6482
6483
|
var message = response.message;
|
|
6483
6484
|
response.status;
|
|
6484
6485
|
response.errors;
|
|
6485
6486
|
var cleanResponse = _objectWithoutProperties(response, _excluded);
|
|
6486
6487
|
|
|
6488
|
+
return {
|
|
6489
|
+
status: PREAUTHORIZATION_STATE_AUTHORIZED,
|
|
6490
|
+
message: message || 'Payment authorized successfully',
|
|
6491
|
+
data: cleanResponse
|
|
6492
|
+
};
|
|
6493
|
+
},
|
|
6494
|
+
success: function success(response) {
|
|
6495
|
+
var message = response.message;
|
|
6496
|
+
response.status;
|
|
6497
|
+
response.errors;
|
|
6498
|
+
var cleanResponse = _objectWithoutProperties(response, _excluded2);
|
|
6499
|
+
|
|
6487
6500
|
return {
|
|
6488
6501
|
status: 'success',
|
|
6489
6502
|
message: message || 'Successful',
|
|
@@ -6494,7 +6507,7 @@ var ChargeResponses = {
|
|
|
6494
6507
|
var message = response.message;
|
|
6495
6508
|
response.status;
|
|
6496
6509
|
response.errors;
|
|
6497
|
-
var cleanResponse = _objectWithoutProperties(response,
|
|
6510
|
+
var cleanResponse = _objectWithoutProperties(response, _excluded3);
|
|
6498
6511
|
|
|
6499
6512
|
return {
|
|
6500
6513
|
status: 'pending',
|
|
@@ -6506,7 +6519,7 @@ var ChargeResponses = {
|
|
|
6506
6519
|
var message = response.message,
|
|
6507
6520
|
status = response.status;
|
|
6508
6521
|
response.errors;
|
|
6509
|
-
var cleanResponse = _objectWithoutProperties(response,
|
|
6522
|
+
var cleanResponse = _objectWithoutProperties(response, _excluded4);
|
|
6510
6523
|
|
|
6511
6524
|
return {
|
|
6512
6525
|
status: status,
|
|
@@ -6518,7 +6531,7 @@ var ChargeResponses = {
|
|
|
6518
6531
|
response.status;
|
|
6519
6532
|
var message = response.message,
|
|
6520
6533
|
otpmessage = response.otpmessage,
|
|
6521
|
-
cleanResponse = _objectWithoutProperties(response,
|
|
6534
|
+
cleanResponse = _objectWithoutProperties(response, _excluded5);
|
|
6522
6535
|
|
|
6523
6536
|
var authMessage = otpmessage || message;
|
|
6524
6537
|
return {
|
|
@@ -6570,10 +6583,14 @@ var ChargeResponses = {
|
|
|
6570
6583
|
delete response.data;
|
|
6571
6584
|
}
|
|
6572
6585
|
|
|
6573
|
-
if (['true', true, 'success'
|
|
6586
|
+
if (['true', true, 'success'].includes(response.status)) {
|
|
6574
6587
|
return this.success(response);
|
|
6575
6588
|
}
|
|
6576
6589
|
|
|
6590
|
+
if (response.status === PREAUTHORIZATION_STATE_AUTHORIZED) {
|
|
6591
|
+
return this.authorized(response);
|
|
6592
|
+
}
|
|
6593
|
+
|
|
6577
6594
|
if (response.status === 'pending') {
|
|
6578
6595
|
return this.pending(response);
|
|
6579
6596
|
}
|
|
@@ -11555,6 +11572,38 @@ var PayWithTransferAPI = {
|
|
|
11555
11572
|
}).then(function (response) {
|
|
11556
11573
|
return ChargeResponses.parse(response.data);
|
|
11557
11574
|
});
|
|
11575
|
+
},
|
|
11576
|
+
incorrectAmountDecision: function incorrectAmountDecision(params, publicKey) {
|
|
11577
|
+
var language = getLanguage();
|
|
11578
|
+
|
|
11579
|
+
var headers = _objectSpread2({
|
|
11580
|
+
Authorization: "Bearer ".concat(publicKey)
|
|
11581
|
+
}, language && {
|
|
11582
|
+
'Accept-Language': language
|
|
11583
|
+
});
|
|
11584
|
+
|
|
11585
|
+
var url = new URL('pay-with-transfer/incorrect-amount/decision', configToUse.paystackApiUrl).toString();
|
|
11586
|
+
return axiosInstance.post(url, params, {
|
|
11587
|
+
headers: headers
|
|
11588
|
+
}).then(function (response) {
|
|
11589
|
+
return ChargeResponses.parse(response.data);
|
|
11590
|
+
});
|
|
11591
|
+
},
|
|
11592
|
+
authenticatePayer: function authenticatePayer(params, publicKey) {
|
|
11593
|
+
var language = getLanguage();
|
|
11594
|
+
|
|
11595
|
+
var headers = _objectSpread2({
|
|
11596
|
+
Authorization: "Bearer ".concat(publicKey)
|
|
11597
|
+
}, language && {
|
|
11598
|
+
'Accept-Language': language
|
|
11599
|
+
});
|
|
11600
|
+
|
|
11601
|
+
var url = new URL('pay-with-transfer/authenticate-payer', configToUse.paystackApiUrl).toString();
|
|
11602
|
+
return axiosInstance.post(url, params, {
|
|
11603
|
+
headers: headers
|
|
11604
|
+
}).then(function (response) {
|
|
11605
|
+
return ChargeResponses.parse(response.data);
|
|
11606
|
+
});
|
|
11558
11607
|
}
|
|
11559
11608
|
};
|
|
11560
11609
|
|
|
@@ -11585,6 +11634,25 @@ var PayWithTransferCharge = {
|
|
|
11585
11634
|
paymentMethod: 'bank_transfer'
|
|
11586
11635
|
};
|
|
11587
11636
|
return this.listenForCharge(listenerOptions, callback);
|
|
11637
|
+
},
|
|
11638
|
+
sendIncorrectAmountDecision: function sendIncorrectAmountDecision(decisionMade) {
|
|
11639
|
+
var params = {
|
|
11640
|
+
transaction_id: this.id,
|
|
11641
|
+
decision: decisionMade
|
|
11642
|
+
};
|
|
11643
|
+
return PayWithTransferAPI.incorrectAmountDecision(params, this.merchant.key);
|
|
11644
|
+
},
|
|
11645
|
+
sendAuthenticatePayer: function sendAuthenticatePayer(_ref2) {
|
|
11646
|
+
var amountPaid = _ref2.amountPaid,
|
|
11647
|
+
payerAccountNumber = _ref2.payerAccountNumber,
|
|
11648
|
+
payerBankSlug = _ref2.payerBankSlug;
|
|
11649
|
+
var params = {
|
|
11650
|
+
transaction_id: this.id,
|
|
11651
|
+
amount: amountPaid,
|
|
11652
|
+
payer_account_number: payerAccountNumber,
|
|
11653
|
+
payer_bank_slug: payerBankSlug
|
|
11654
|
+
};
|
|
11655
|
+
return PayWithTransferAPI.authenticatePayer(params, this.merchant.key);
|
|
11588
11656
|
}
|
|
11589
11657
|
};
|
|
11590
11658
|
|
|
@@ -18866,6 +18934,10 @@ var CardAPI$1 = {
|
|
|
18866
18934
|
};
|
|
18867
18935
|
|
|
18868
18936
|
var paymentMethod$4 = 'card';
|
|
18937
|
+
var savedCardMethods = {
|
|
18938
|
+
payment: 'saved card',
|
|
18939
|
+
authentication: 'otp'
|
|
18940
|
+
};
|
|
18869
18941
|
|
|
18870
18942
|
function validate$4(card, isSetter) {
|
|
18871
18943
|
return new Promise(function (resolve, reject) {
|
|
@@ -19053,29 +19125,32 @@ var CardCharge = {
|
|
|
19053
19125
|
switch (_context.prev = _context.next) {
|
|
19054
19126
|
case 0:
|
|
19055
19127
|
_context.prev = 0;
|
|
19056
|
-
|
|
19128
|
+
|
|
19129
|
+
_this9.logAuth(savedCardMethods.authentication);
|
|
19130
|
+
|
|
19131
|
+
_context.next = 4;
|
|
19057
19132
|
return CardAPI$1.sendSavedCardsOTP({
|
|
19058
19133
|
phone: phone,
|
|
19059
19134
|
transaction: _this9.id
|
|
19060
19135
|
});
|
|
19061
19136
|
|
|
19062
|
-
case
|
|
19137
|
+
case 4:
|
|
19063
19138
|
response = _context.sent;
|
|
19064
19139
|
_this9.savedCardsTempAuthToken = response.data.token;
|
|
19065
19140
|
return _context.abrupt("return", response);
|
|
19066
19141
|
|
|
19067
|
-
case
|
|
19068
|
-
_context.prev =
|
|
19142
|
+
case 9:
|
|
19143
|
+
_context.prev = 9;
|
|
19069
19144
|
_context.t0 = _context["catch"](0);
|
|
19070
19145
|
_this9.savedCardsTempAuthToken = null;
|
|
19071
19146
|
throw _context.t0;
|
|
19072
19147
|
|
|
19073
|
-
case
|
|
19148
|
+
case 13:
|
|
19074
19149
|
case "end":
|
|
19075
19150
|
return _context.stop();
|
|
19076
19151
|
}
|
|
19077
19152
|
}
|
|
19078
|
-
}, _callee, null, [[0,
|
|
19153
|
+
}, _callee, null, [[0, 9]]);
|
|
19079
19154
|
}))();
|
|
19080
19155
|
},
|
|
19081
19156
|
verifySavedCardsOtp: function verifySavedCardsOtp(_ref4) {
|
|
@@ -19129,6 +19204,7 @@ var CardCharge = {
|
|
|
19129
19204
|
},
|
|
19130
19205
|
chargeSavedCard: function chargeSavedCard(_ref5) {
|
|
19131
19206
|
var cardCode = _ref5.cardCode;
|
|
19207
|
+
this.logAttempt(savedCardMethods.payment);
|
|
19132
19208
|
return CardAPI$1.chargeSavedCard({
|
|
19133
19209
|
cardCode: cardCode,
|
|
19134
19210
|
transaction: this.id,
|
|
@@ -19397,7 +19473,8 @@ var DigitalBankMandateAPI = {
|
|
|
19397
19473
|
var bankId = _ref.bankId,
|
|
19398
19474
|
transactionId = _ref.transactionId,
|
|
19399
19475
|
phoneNumber = _ref.phoneNumber,
|
|
19400
|
-
payId = _ref.payId
|
|
19476
|
+
payId = _ref.payId,
|
|
19477
|
+
walletId = _ref.walletId;
|
|
19401
19478
|
var url = "".concat(configToUse.paymentBaseUrl, "bank/digitalbankmandate/").concat(bankId, "/").concat(transactionId);
|
|
19402
19479
|
var language = getLanguage();
|
|
19403
19480
|
|
|
@@ -19407,10 +19484,13 @@ var DigitalBankMandateAPI = {
|
|
|
19407
19484
|
'Accept-Language': language
|
|
19408
19485
|
});
|
|
19409
19486
|
|
|
19410
|
-
var params = {
|
|
19487
|
+
var params = _objectSpread2({}, walletId ? {
|
|
19488
|
+
wallet_id: walletId
|
|
19489
|
+
} : {
|
|
19411
19490
|
phone_number: phoneNumber,
|
|
19412
19491
|
token: payId
|
|
19413
|
-
};
|
|
19492
|
+
});
|
|
19493
|
+
|
|
19414
19494
|
var urlEncodedParams = formUrlencoded(params);
|
|
19415
19495
|
return axiosInstance.post(url, urlEncodedParams, {
|
|
19416
19496
|
headers: headers
|
|
@@ -19427,12 +19507,14 @@ var DigitalBankMandate = {
|
|
|
19427
19507
|
|
|
19428
19508
|
var phoneNumber = _ref.phoneNumber,
|
|
19429
19509
|
payId = _ref.payId,
|
|
19430
|
-
bankId = _ref.bankId
|
|
19510
|
+
bankId = _ref.bankId,
|
|
19511
|
+
walletId = _ref.walletId;
|
|
19431
19512
|
var params = {
|
|
19432
19513
|
transactionId: this.id,
|
|
19433
19514
|
phoneNumber: phoneNumber,
|
|
19434
19515
|
payId: payId,
|
|
19435
|
-
bankId: bankId
|
|
19516
|
+
bankId: bankId,
|
|
19517
|
+
walletId: walletId
|
|
19436
19518
|
};
|
|
19437
19519
|
return DigitalBankMandateAPI.charge(params).then(function (response) {
|
|
19438
19520
|
_this.logAPIResponse(response, paymentMethod$2);
|
|
@@ -19783,34 +19865,62 @@ var MobileMoneyCharge = {
|
|
|
19783
19865
|
});
|
|
19784
19866
|
});
|
|
19785
19867
|
},
|
|
19786
|
-
|
|
19868
|
+
chargeMpesaOffline: function chargeMpesaOffline(_ref2) {
|
|
19787
19869
|
var _this2 = this;
|
|
19788
19870
|
|
|
19871
|
+
var provider = _ref2.provider,
|
|
19872
|
+
voucher = _ref2.voucher,
|
|
19873
|
+
registrationToken = _ref2.registrationToken;
|
|
19874
|
+
this.logAttempt('mobile money');
|
|
19875
|
+
var params = {
|
|
19876
|
+
provider: provider,
|
|
19877
|
+
voucher: voucher,
|
|
19878
|
+
registrationToken: registrationToken,
|
|
19879
|
+
transaction: this.id,
|
|
19880
|
+
phone: null,
|
|
19881
|
+
device: this.deviceFingerprint,
|
|
19882
|
+
channel_name: "MOBILE_MONEY_".concat(this.id)
|
|
19883
|
+
};
|
|
19884
|
+
return MobileMoneyAPI.charge(params).then(function (response) {
|
|
19885
|
+
if (response.status === 'success') {
|
|
19886
|
+
_this2.mobileMoney = response;
|
|
19887
|
+
|
|
19888
|
+
if (response.data && response.data.display && response.data.display.otpSentCount === 1) {
|
|
19889
|
+
_this2.logTokenRequest('mobile money');
|
|
19890
|
+
}
|
|
19891
|
+
}
|
|
19892
|
+
|
|
19893
|
+
return response;
|
|
19894
|
+
});
|
|
19895
|
+
},
|
|
19896
|
+
authenticateMobileMoney: function authenticateMobileMoney(payload) {
|
|
19897
|
+
var _this3 = this;
|
|
19898
|
+
|
|
19789
19899
|
var phoneNumber = payload.phoneNumber,
|
|
19790
19900
|
provider = payload.provider,
|
|
19791
19901
|
registrationToken = payload.registrationToken;
|
|
19792
19902
|
return validate$1(phoneNumber).then(function () {
|
|
19793
|
-
|
|
19903
|
+
_this3.logMobileMoneyActions(payload);
|
|
19794
19904
|
|
|
19795
19905
|
var params = {
|
|
19796
19906
|
provider: provider,
|
|
19797
19907
|
registrationToken: registrationToken,
|
|
19798
|
-
transaction:
|
|
19908
|
+
transaction: _this3.id,
|
|
19799
19909
|
phone: phoneNumber,
|
|
19800
|
-
device:
|
|
19801
|
-
channel_name: "MOBILE_MONEY_".concat(
|
|
19910
|
+
device: _this3.deviceFingerprint,
|
|
19911
|
+
channel_name: "MOBILE_MONEY_".concat(_this3.id)
|
|
19802
19912
|
};
|
|
19803
19913
|
return MobileMoneyAPI.charge(params).then(function (response) {
|
|
19804
19914
|
if (response.status === 'success') {
|
|
19805
|
-
|
|
19915
|
+
_this3.mobileMoney = response;
|
|
19806
19916
|
|
|
19807
19917
|
if (response.data && response.data.display && response.data.display.otpSentCount === 1) {
|
|
19808
|
-
|
|
19918
|
+
_this3.logTokenRequest('mobile money');
|
|
19809
19919
|
}
|
|
19810
19920
|
} else if (response.errors && response.errors.data && response.errors.data.status === 'awaiting_registration_token') {
|
|
19811
|
-
|
|
19921
|
+
_this3.logTokenAuthenticationFailure(response.message);
|
|
19812
19922
|
} else {
|
|
19813
|
-
|
|
19923
|
+
_this3.logError(response.message);
|
|
19814
19924
|
}
|
|
19815
19925
|
|
|
19816
19926
|
return response;
|
|
@@ -19818,13 +19928,13 @@ var MobileMoneyCharge = {
|
|
|
19818
19928
|
});
|
|
19819
19929
|
},
|
|
19820
19930
|
submitMobileMoneyCode: function submitMobileMoneyCode(payload) {
|
|
19821
|
-
var
|
|
19931
|
+
var _this4 = this;
|
|
19822
19932
|
|
|
19823
19933
|
return MobileMoneyAPI.submitCode({
|
|
19824
19934
|
code: payload.code,
|
|
19825
19935
|
transaction: this.id
|
|
19826
19936
|
}).then(function (response) {
|
|
19827
|
-
|
|
19937
|
+
_this4.logAPIResponse(response, 'mobile_money');
|
|
19828
19938
|
|
|
19829
19939
|
return response;
|
|
19830
19940
|
});
|
|
@@ -20282,6 +20392,14 @@ var AnalyticsFunctions$1 = {
|
|
|
20282
20392
|
});
|
|
20283
20393
|
return this.saveLog();
|
|
20284
20394
|
},
|
|
20395
|
+
logSavedCardSelect: function logSavedCardSelect() {
|
|
20396
|
+
this.log.history.push({
|
|
20397
|
+
type: 'action',
|
|
20398
|
+
message: 'Selected saved card',
|
|
20399
|
+
time: this.getTimeSpent()
|
|
20400
|
+
});
|
|
20401
|
+
return this.saveLog();
|
|
20402
|
+
},
|
|
20285
20403
|
logAuthWindowOpen: function logAuthWindowOpen() {
|
|
20286
20404
|
this.log.history.push({
|
|
20287
20405
|
type: 'action',
|