@paystack/checkout-js 1.15.0-dev.1 → 1.15.0-dev.3
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 +2 -2
- package/es/checkout.js +30 -18
- package/lib/checkout.js +30 -18
- package/package.json +1 -1
package/es/checkout.js
CHANGED
|
@@ -6503,7 +6503,8 @@ var _excluded = ["message", "status", "errors"],
|
|
|
6503
6503
|
_excluded2 = ["message", "status", "errors"],
|
|
6504
6504
|
_excluded3 = ["message", "status", "errors"],
|
|
6505
6505
|
_excluded4 = ["message", "status", "errors"],
|
|
6506
|
-
_excluded5 = ["
|
|
6506
|
+
_excluded5 = ["message", "status", "errors"],
|
|
6507
|
+
_excluded6 = ["status", "message", "otpmessage"];
|
|
6507
6508
|
var ChargeResponses = {
|
|
6508
6509
|
success: function success(response) {
|
|
6509
6510
|
var message = response.message;
|
|
@@ -6553,11 +6554,23 @@ var ChargeResponses = {
|
|
|
6553
6554
|
data: cleanResponse
|
|
6554
6555
|
};
|
|
6555
6556
|
},
|
|
6557
|
+
awaitingRegistrationToken: function awaitingRegistrationToken(response) {
|
|
6558
|
+
var message = response.message,
|
|
6559
|
+
status = response.status;
|
|
6560
|
+
response.errors;
|
|
6561
|
+
var cleanResponse = _objectWithoutProperties(response, _excluded5);
|
|
6562
|
+
|
|
6563
|
+
return {
|
|
6564
|
+
status: status,
|
|
6565
|
+
message: message,
|
|
6566
|
+
data: cleanResponse
|
|
6567
|
+
};
|
|
6568
|
+
},
|
|
6556
6569
|
auth: function auth(response) {
|
|
6557
6570
|
response.status;
|
|
6558
6571
|
var message = response.message,
|
|
6559
6572
|
otpmessage = response.otpmessage,
|
|
6560
|
-
cleanResponse = _objectWithoutProperties(response,
|
|
6573
|
+
cleanResponse = _objectWithoutProperties(response, _excluded6);
|
|
6561
6574
|
|
|
6562
6575
|
var authMessage = otpmessage || message;
|
|
6563
6576
|
return {
|
|
@@ -6633,6 +6646,10 @@ var ChargeResponses = {
|
|
|
6633
6646
|
return this.incorrectAmountSent(response);
|
|
6634
6647
|
}
|
|
6635
6648
|
|
|
6649
|
+
if (response.status === 'awaiting_registration_token') {
|
|
6650
|
+
return this.awaitingRegistrationToken(response);
|
|
6651
|
+
}
|
|
6652
|
+
|
|
6636
6653
|
if (response.auth && response.auth !== 'none') {
|
|
6637
6654
|
return this.auth(response);
|
|
6638
6655
|
}
|
|
@@ -19248,16 +19265,9 @@ var MobileMoneyAPI = {
|
|
|
19248
19265
|
headers: headers
|
|
19249
19266
|
}).then(function (response) {
|
|
19250
19267
|
return ChargeResponses.parse(response.data);
|
|
19251
|
-
}).catch(function (
|
|
19252
|
-
var
|
|
19253
|
-
|
|
19254
|
-
if (errorData) {
|
|
19255
|
-
return ChargeResponses.parse(_objectSpread2(_objectSpread2({}, errorData), {}, {
|
|
19256
|
-
errors: errorData
|
|
19257
|
-
}));
|
|
19258
|
-
}
|
|
19259
|
-
|
|
19260
|
-
return ChargeResponses.parse(error);
|
|
19268
|
+
}).catch(function (_ref2) {
|
|
19269
|
+
var response = _ref2.response;
|
|
19270
|
+
return ChargeResponses.parse(response.data);
|
|
19261
19271
|
});
|
|
19262
19272
|
}
|
|
19263
19273
|
};
|
|
@@ -19281,13 +19291,15 @@ var MobileMoneyCharge = {
|
|
|
19281
19291
|
|
|
19282
19292
|
var phoneNumber = _ref.phoneNumber,
|
|
19283
19293
|
provider = _ref.provider,
|
|
19284
|
-
voucher = _ref.voucher
|
|
19294
|
+
voucher = _ref.voucher,
|
|
19295
|
+
registrationToken = _ref.registrationToken;
|
|
19285
19296
|
return validate$1(phoneNumber).then(function () {
|
|
19286
19297
|
_this.logAttempt('mobile money');
|
|
19287
19298
|
|
|
19288
19299
|
var params = {
|
|
19289
19300
|
provider: provider,
|
|
19290
19301
|
voucher: voucher,
|
|
19302
|
+
registrationToken: registrationToken,
|
|
19291
19303
|
transaction: _this.id,
|
|
19292
19304
|
phone: phoneNumber,
|
|
19293
19305
|
device: _this.deviceFingerprint,
|
|
@@ -20015,11 +20027,11 @@ var AnalyticsFunctions = {
|
|
|
20015
20027
|
}
|
|
20016
20028
|
},
|
|
20017
20029
|
logMobileMoneyActions: function logMobileMoneyActions(_ref2) {
|
|
20018
|
-
var
|
|
20030
|
+
var isResendTokenRequest = _ref2.isResendTokenRequest,
|
|
20019
20031
|
registrationToken = _ref2.registrationToken;
|
|
20020
20032
|
|
|
20021
|
-
if (
|
|
20022
|
-
this.logTokenRequest('mobile money',
|
|
20033
|
+
if (isResendTokenRequest) {
|
|
20034
|
+
this.logTokenRequest('mobile money', isResendTokenRequest);
|
|
20023
20035
|
} else if (registrationToken) {
|
|
20024
20036
|
this.logTokenSubmitted('mobile money');
|
|
20025
20037
|
} else {
|
|
@@ -20050,8 +20062,8 @@ var AnalyticsFunctions = {
|
|
|
20050
20062
|
return this.saveLog();
|
|
20051
20063
|
},
|
|
20052
20064
|
logTokenRequest: function logTokenRequest(channel) {
|
|
20053
|
-
var
|
|
20054
|
-
var message =
|
|
20065
|
+
var isResendTokenRequest = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
20066
|
+
var message = isResendTokenRequest ? 'Customer requested to resend OTP' : 'Waiting for customer to submit OTP';
|
|
20055
20067
|
this.log.history.push({
|
|
20056
20068
|
type: 'action',
|
|
20057
20069
|
message: message,
|
package/lib/checkout.js
CHANGED
|
@@ -6507,7 +6507,8 @@ var _excluded = ["message", "status", "errors"],
|
|
|
6507
6507
|
_excluded2 = ["message", "status", "errors"],
|
|
6508
6508
|
_excluded3 = ["message", "status", "errors"],
|
|
6509
6509
|
_excluded4 = ["message", "status", "errors"],
|
|
6510
|
-
_excluded5 = ["
|
|
6510
|
+
_excluded5 = ["message", "status", "errors"],
|
|
6511
|
+
_excluded6 = ["status", "message", "otpmessage"];
|
|
6511
6512
|
var ChargeResponses = {
|
|
6512
6513
|
success: function success(response) {
|
|
6513
6514
|
var message = response.message;
|
|
@@ -6557,11 +6558,23 @@ var ChargeResponses = {
|
|
|
6557
6558
|
data: cleanResponse
|
|
6558
6559
|
};
|
|
6559
6560
|
},
|
|
6561
|
+
awaitingRegistrationToken: function awaitingRegistrationToken(response) {
|
|
6562
|
+
var message = response.message,
|
|
6563
|
+
status = response.status;
|
|
6564
|
+
response.errors;
|
|
6565
|
+
var cleanResponse = _objectWithoutProperties(response, _excluded5);
|
|
6566
|
+
|
|
6567
|
+
return {
|
|
6568
|
+
status: status,
|
|
6569
|
+
message: message,
|
|
6570
|
+
data: cleanResponse
|
|
6571
|
+
};
|
|
6572
|
+
},
|
|
6560
6573
|
auth: function auth(response) {
|
|
6561
6574
|
response.status;
|
|
6562
6575
|
var message = response.message,
|
|
6563
6576
|
otpmessage = response.otpmessage,
|
|
6564
|
-
cleanResponse = _objectWithoutProperties(response,
|
|
6577
|
+
cleanResponse = _objectWithoutProperties(response, _excluded6);
|
|
6565
6578
|
|
|
6566
6579
|
var authMessage = otpmessage || message;
|
|
6567
6580
|
return {
|
|
@@ -6637,6 +6650,10 @@ var ChargeResponses = {
|
|
|
6637
6650
|
return this.incorrectAmountSent(response);
|
|
6638
6651
|
}
|
|
6639
6652
|
|
|
6653
|
+
if (response.status === 'awaiting_registration_token') {
|
|
6654
|
+
return this.awaitingRegistrationToken(response);
|
|
6655
|
+
}
|
|
6656
|
+
|
|
6640
6657
|
if (response.auth && response.auth !== 'none') {
|
|
6641
6658
|
return this.auth(response);
|
|
6642
6659
|
}
|
|
@@ -19252,16 +19269,9 @@ var MobileMoneyAPI = {
|
|
|
19252
19269
|
headers: headers
|
|
19253
19270
|
}).then(function (response) {
|
|
19254
19271
|
return ChargeResponses.parse(response.data);
|
|
19255
|
-
}).catch(function (
|
|
19256
|
-
var
|
|
19257
|
-
|
|
19258
|
-
if (errorData) {
|
|
19259
|
-
return ChargeResponses.parse(_objectSpread2(_objectSpread2({}, errorData), {}, {
|
|
19260
|
-
errors: errorData
|
|
19261
|
-
}));
|
|
19262
|
-
}
|
|
19263
|
-
|
|
19264
|
-
return ChargeResponses.parse(error);
|
|
19272
|
+
}).catch(function (_ref2) {
|
|
19273
|
+
var response = _ref2.response;
|
|
19274
|
+
return ChargeResponses.parse(response.data);
|
|
19265
19275
|
});
|
|
19266
19276
|
}
|
|
19267
19277
|
};
|
|
@@ -19285,13 +19295,15 @@ var MobileMoneyCharge = {
|
|
|
19285
19295
|
|
|
19286
19296
|
var phoneNumber = _ref.phoneNumber,
|
|
19287
19297
|
provider = _ref.provider,
|
|
19288
|
-
voucher = _ref.voucher
|
|
19298
|
+
voucher = _ref.voucher,
|
|
19299
|
+
registrationToken = _ref.registrationToken;
|
|
19289
19300
|
return validate$1(phoneNumber).then(function () {
|
|
19290
19301
|
_this.logAttempt('mobile money');
|
|
19291
19302
|
|
|
19292
19303
|
var params = {
|
|
19293
19304
|
provider: provider,
|
|
19294
19305
|
voucher: voucher,
|
|
19306
|
+
registrationToken: registrationToken,
|
|
19295
19307
|
transaction: _this.id,
|
|
19296
19308
|
phone: phoneNumber,
|
|
19297
19309
|
device: _this.deviceFingerprint,
|
|
@@ -20019,11 +20031,11 @@ var AnalyticsFunctions = {
|
|
|
20019
20031
|
}
|
|
20020
20032
|
},
|
|
20021
20033
|
logMobileMoneyActions: function logMobileMoneyActions(_ref2) {
|
|
20022
|
-
var
|
|
20034
|
+
var isResendTokenRequest = _ref2.isResendTokenRequest,
|
|
20023
20035
|
registrationToken = _ref2.registrationToken;
|
|
20024
20036
|
|
|
20025
|
-
if (
|
|
20026
|
-
this.logTokenRequest('mobile money',
|
|
20037
|
+
if (isResendTokenRequest) {
|
|
20038
|
+
this.logTokenRequest('mobile money', isResendTokenRequest);
|
|
20027
20039
|
} else if (registrationToken) {
|
|
20028
20040
|
this.logTokenSubmitted('mobile money');
|
|
20029
20041
|
} else {
|
|
@@ -20054,8 +20066,8 @@ var AnalyticsFunctions = {
|
|
|
20054
20066
|
return this.saveLog();
|
|
20055
20067
|
},
|
|
20056
20068
|
logTokenRequest: function logTokenRequest(channel) {
|
|
20057
|
-
var
|
|
20058
|
-
var message =
|
|
20069
|
+
var isResendTokenRequest = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
20070
|
+
var message = isResendTokenRequest ? 'Customer requested to resend OTP' : 'Waiting for customer to submit OTP';
|
|
20059
20071
|
this.log.history.push({
|
|
20060
20072
|
type: 'action',
|
|
20061
20073
|
message: message,
|