@paystack/checkout-js 1.57.0-beta.3 → 1.57.0-beta.4
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 +9 -81
- package/es/checkout.js +9 -81
- package/lib/checkout.js +9 -81
- package/package.json +1 -1
package/dist/checkout.js
CHANGED
|
@@ -6562,58 +6562,6 @@ var Paystack = (function (exports) {
|
|
|
6562
6562
|
});
|
|
6563
6563
|
};
|
|
6564
6564
|
|
|
6565
|
-
// Duplicated from `subscribeToChargeEvents` on purpose. Hoisting that function's locals
|
|
6566
|
-
// to module scope so both could share them would modify the shared path, which
|
|
6567
|
-
// RAILS-12006 AC5 requires to stay byte-identical. Do not "clean this up".
|
|
6568
|
-
var confirmationUndefinedError = {
|
|
6569
|
-
status: 'error',
|
|
6570
|
-
message: 'We could not listen for charge response.'
|
|
6571
|
-
};
|
|
6572
|
-
var confirmationSubscriptionError = {
|
|
6573
|
-
status: 'error',
|
|
6574
|
-
message: 'We could not listen for charge response. Use transaction.requery() to check the status.'
|
|
6575
|
-
};
|
|
6576
|
-
|
|
6577
|
-
// Dedicated listener for the Ghana mobile money USSD confirmation channel.
|
|
6578
|
-
// Deliberately separate from `subscribeToChargeEvents`: that function is the shared
|
|
6579
|
-
// path for every channel and market, and this flow needs an unsubscribe available
|
|
6580
|
-
// before any event arrives. `context` is used only for logAPIResponse -- unlike the
|
|
6581
|
-
// shared path this never writes `context.isListening`, because the confirmation
|
|
6582
|
-
// channel runs alongside the main charge subscription and the two would otherwise
|
|
6583
|
-
// fight over a single flag on the same transaction.
|
|
6584
|
-
var subscribeToConfirmationEvents = function subscribeToConfirmationEvents(options, context, callback) {
|
|
6585
|
-
var channel = options.channel,
|
|
6586
|
-
paymentMethod = options.paymentMethod;
|
|
6587
|
-
if (!window || !window.Pusher) {
|
|
6588
|
-
callback(confirmationUndefinedError, noOp);
|
|
6589
|
-
return noOp;
|
|
6590
|
-
}
|
|
6591
|
-
var pusher = new window.Pusher(configToUse.pusherKey, {
|
|
6592
|
-
cluster: 'eu',
|
|
6593
|
-
disableStats: true
|
|
6594
|
-
});
|
|
6595
|
-
var hasUnsubscribed = false;
|
|
6596
|
-
var unsubscribe = function unsubscribe() {
|
|
6597
|
-
if (hasUnsubscribed) {
|
|
6598
|
-
return;
|
|
6599
|
-
}
|
|
6600
|
-
hasUnsubscribed = true;
|
|
6601
|
-
pusher.unsubscribe(channel);
|
|
6602
|
-
pusher.disconnect();
|
|
6603
|
-
};
|
|
6604
|
-
var pusherSubscription = pusher.subscribe(channel);
|
|
6605
|
-
pusherSubscription.bind('pusher:subscription_error', function () {
|
|
6606
|
-
unsubscribe();
|
|
6607
|
-
callback(confirmationSubscriptionError, unsubscribe);
|
|
6608
|
-
});
|
|
6609
|
-
pusherSubscription.bind('response', function (response) {
|
|
6610
|
-
var formattedResponse = ChargeResponses.parse(response);
|
|
6611
|
-
context.logAPIResponse(formattedResponse, paymentMethod);
|
|
6612
|
-
callback(formattedResponse, unsubscribe);
|
|
6613
|
-
});
|
|
6614
|
-
return unsubscribe;
|
|
6615
|
-
};
|
|
6616
|
-
|
|
6617
6565
|
var uncurryThis$7 = functionUncurryThis;
|
|
6618
6566
|
var PROPER_FUNCTION_NAME$2 = functionName.PROPER;
|
|
6619
6567
|
var redefine$4 = redefine$a.exports;
|
|
@@ -20438,10 +20386,6 @@ var Paystack = (function (exports) {
|
|
|
20438
20386
|
}
|
|
20439
20387
|
};
|
|
20440
20388
|
|
|
20441
|
-
// Charge statuses that leave the transaction with a Pusher channel worth listening on.
|
|
20442
|
-
// `awaiting_ussd_confirmation` is mid-flight, not settled, but it still carries the
|
|
20443
|
-
// `channel_name` the outcome will arrive on.
|
|
20444
|
-
var LISTENABLE_CHARGE_STATUSES = ['success', 'awaiting_ussd_confirmation'];
|
|
20445
20389
|
function validate$1(phoneNumber) {
|
|
20446
20390
|
return new Promise(function (resolve, reject) {
|
|
20447
20391
|
var validation = PhoneNumber.validate(phoneNumber);
|
|
@@ -20481,11 +20425,11 @@ var Paystack = (function (exports) {
|
|
|
20481
20425
|
mobileMoneyChargeAPI: function mobileMoneyChargeAPI(params) {
|
|
20482
20426
|
var _this = this;
|
|
20483
20427
|
return MobileMoneyAPI.charge(params).then(function (response) {
|
|
20484
|
-
if (
|
|
20428
|
+
if (response.status === 'success') {
|
|
20485
20429
|
_this.mobileMoney = response;
|
|
20486
|
-
|
|
20487
|
-
|
|
20488
|
-
|
|
20430
|
+
if (response.data && response.data.display && response.data.display.otpSentCount === 1) {
|
|
20431
|
+
_this.logTokenRequest('mobile money');
|
|
20432
|
+
}
|
|
20489
20433
|
}
|
|
20490
20434
|
return response;
|
|
20491
20435
|
});
|
|
@@ -20558,33 +20502,17 @@ var Paystack = (function (exports) {
|
|
|
20558
20502
|
});
|
|
20559
20503
|
},
|
|
20560
20504
|
listenForMobileMoneyCharge: function listenForMobileMoneyCharge(callback) {
|
|
20561
|
-
if (
|
|
20562
|
-
return Promise.reject(Error('Please start a mobile money charge with Transaction.chargeMobileMoney()'));
|
|
20563
|
-
}
|
|
20564
|
-
var _ref2 = this.mobileMoney.data || {},
|
|
20565
|
-
channel = _ref2.channel,
|
|
20566
|
-
channelName = _ref2.channel_name;
|
|
20567
|
-
var listenerChannel = channel || channelName;
|
|
20568
|
-
if (!listenerChannel) {
|
|
20505
|
+
if (this.mobileMoney.status !== 'success') {
|
|
20569
20506
|
return Promise.reject(Error('Please start a mobile money charge with Transaction.chargeMobileMoney()'));
|
|
20570
20507
|
}
|
|
20508
|
+
var _this$mobileMoney$dat = this.mobileMoney.data,
|
|
20509
|
+
channel = _this$mobileMoney$dat.channel,
|
|
20510
|
+
channelName = _this$mobileMoney$dat.channel_name;
|
|
20571
20511
|
var listenerOptions = {
|
|
20572
|
-
channel:
|
|
20512
|
+
channel: channel || channelName,
|
|
20573
20513
|
paymentMethod: 'mobile_money'
|
|
20574
20514
|
};
|
|
20575
20515
|
return this.listenForCharge(listenerOptions, callback);
|
|
20576
|
-
},
|
|
20577
|
-
listenForMobileMoneyConfirmation: function listenForMobileMoneyConfirmation(callback, pusherChannel) {
|
|
20578
|
-
var data = this.mobileMoney.data;
|
|
20579
|
-
var confirmationChannel = pusherChannel || data && data.confirm_channel_name;
|
|
20580
|
-
if (!confirmationChannel) {
|
|
20581
|
-
throw new Error('Please provide the confirm_channel_name returned by Transaction.chargeMobileMoney()');
|
|
20582
|
-
}
|
|
20583
|
-
var listenerOptions = {
|
|
20584
|
-
channel: confirmationChannel,
|
|
20585
|
-
paymentMethod: 'mobile_money'
|
|
20586
|
-
};
|
|
20587
|
-
return subscribeToConfirmationEvents(listenerOptions, this, callback);
|
|
20588
20516
|
}
|
|
20589
20517
|
};
|
|
20590
20518
|
|
package/es/checkout.js
CHANGED
|
@@ -6559,58 +6559,6 @@ var subscribeToChargeEvents = function subscribeToChargeEvents(options, context,
|
|
|
6559
6559
|
});
|
|
6560
6560
|
};
|
|
6561
6561
|
|
|
6562
|
-
// Duplicated from `subscribeToChargeEvents` on purpose. Hoisting that function's locals
|
|
6563
|
-
// to module scope so both could share them would modify the shared path, which
|
|
6564
|
-
// RAILS-12006 AC5 requires to stay byte-identical. Do not "clean this up".
|
|
6565
|
-
var confirmationUndefinedError = {
|
|
6566
|
-
status: 'error',
|
|
6567
|
-
message: 'We could not listen for charge response.'
|
|
6568
|
-
};
|
|
6569
|
-
var confirmationSubscriptionError = {
|
|
6570
|
-
status: 'error',
|
|
6571
|
-
message: 'We could not listen for charge response. Use transaction.requery() to check the status.'
|
|
6572
|
-
};
|
|
6573
|
-
|
|
6574
|
-
// Dedicated listener for the Ghana mobile money USSD confirmation channel.
|
|
6575
|
-
// Deliberately separate from `subscribeToChargeEvents`: that function is the shared
|
|
6576
|
-
// path for every channel and market, and this flow needs an unsubscribe available
|
|
6577
|
-
// before any event arrives. `context` is used only for logAPIResponse -- unlike the
|
|
6578
|
-
// shared path this never writes `context.isListening`, because the confirmation
|
|
6579
|
-
// channel runs alongside the main charge subscription and the two would otherwise
|
|
6580
|
-
// fight over a single flag on the same transaction.
|
|
6581
|
-
var subscribeToConfirmationEvents = function subscribeToConfirmationEvents(options, context, callback) {
|
|
6582
|
-
var channel = options.channel,
|
|
6583
|
-
paymentMethod = options.paymentMethod;
|
|
6584
|
-
if (!window || !window.Pusher) {
|
|
6585
|
-
callback(confirmationUndefinedError, noOp);
|
|
6586
|
-
return noOp;
|
|
6587
|
-
}
|
|
6588
|
-
var pusher = new window.Pusher(configToUse.pusherKey, {
|
|
6589
|
-
cluster: 'eu',
|
|
6590
|
-
disableStats: true
|
|
6591
|
-
});
|
|
6592
|
-
var hasUnsubscribed = false;
|
|
6593
|
-
var unsubscribe = function unsubscribe() {
|
|
6594
|
-
if (hasUnsubscribed) {
|
|
6595
|
-
return;
|
|
6596
|
-
}
|
|
6597
|
-
hasUnsubscribed = true;
|
|
6598
|
-
pusher.unsubscribe(channel);
|
|
6599
|
-
pusher.disconnect();
|
|
6600
|
-
};
|
|
6601
|
-
var pusherSubscription = pusher.subscribe(channel);
|
|
6602
|
-
pusherSubscription.bind('pusher:subscription_error', function () {
|
|
6603
|
-
unsubscribe();
|
|
6604
|
-
callback(confirmationSubscriptionError, unsubscribe);
|
|
6605
|
-
});
|
|
6606
|
-
pusherSubscription.bind('response', function (response) {
|
|
6607
|
-
var formattedResponse = ChargeResponses.parse(response);
|
|
6608
|
-
context.logAPIResponse(formattedResponse, paymentMethod);
|
|
6609
|
-
callback(formattedResponse, unsubscribe);
|
|
6610
|
-
});
|
|
6611
|
-
return unsubscribe;
|
|
6612
|
-
};
|
|
6613
|
-
|
|
6614
6562
|
var uncurryThis$7 = functionUncurryThis;
|
|
6615
6563
|
var PROPER_FUNCTION_NAME$2 = functionName.PROPER;
|
|
6616
6564
|
var redefine$4 = redefine$a.exports;
|
|
@@ -20435,10 +20383,6 @@ var MobileMoneyAPI = {
|
|
|
20435
20383
|
}
|
|
20436
20384
|
};
|
|
20437
20385
|
|
|
20438
|
-
// Charge statuses that leave the transaction with a Pusher channel worth listening on.
|
|
20439
|
-
// `awaiting_ussd_confirmation` is mid-flight, not settled, but it still carries the
|
|
20440
|
-
// `channel_name` the outcome will arrive on.
|
|
20441
|
-
var LISTENABLE_CHARGE_STATUSES = ['success', 'awaiting_ussd_confirmation'];
|
|
20442
20386
|
function validate$1(phoneNumber) {
|
|
20443
20387
|
return new Promise(function (resolve, reject) {
|
|
20444
20388
|
var validation = PhoneNumber.validate(phoneNumber);
|
|
@@ -20478,11 +20422,11 @@ var MobileMoneyCharge = {
|
|
|
20478
20422
|
mobileMoneyChargeAPI: function mobileMoneyChargeAPI(params) {
|
|
20479
20423
|
var _this = this;
|
|
20480
20424
|
return MobileMoneyAPI.charge(params).then(function (response) {
|
|
20481
|
-
if (
|
|
20425
|
+
if (response.status === 'success') {
|
|
20482
20426
|
_this.mobileMoney = response;
|
|
20483
|
-
|
|
20484
|
-
|
|
20485
|
-
|
|
20427
|
+
if (response.data && response.data.display && response.data.display.otpSentCount === 1) {
|
|
20428
|
+
_this.logTokenRequest('mobile money');
|
|
20429
|
+
}
|
|
20486
20430
|
}
|
|
20487
20431
|
return response;
|
|
20488
20432
|
});
|
|
@@ -20555,33 +20499,17 @@ var MobileMoneyCharge = {
|
|
|
20555
20499
|
});
|
|
20556
20500
|
},
|
|
20557
20501
|
listenForMobileMoneyCharge: function listenForMobileMoneyCharge(callback) {
|
|
20558
|
-
if (
|
|
20559
|
-
return Promise.reject(Error('Please start a mobile money charge with Transaction.chargeMobileMoney()'));
|
|
20560
|
-
}
|
|
20561
|
-
var _ref2 = this.mobileMoney.data || {},
|
|
20562
|
-
channel = _ref2.channel,
|
|
20563
|
-
channelName = _ref2.channel_name;
|
|
20564
|
-
var listenerChannel = channel || channelName;
|
|
20565
|
-
if (!listenerChannel) {
|
|
20502
|
+
if (this.mobileMoney.status !== 'success') {
|
|
20566
20503
|
return Promise.reject(Error('Please start a mobile money charge with Transaction.chargeMobileMoney()'));
|
|
20567
20504
|
}
|
|
20505
|
+
var _this$mobileMoney$dat = this.mobileMoney.data,
|
|
20506
|
+
channel = _this$mobileMoney$dat.channel,
|
|
20507
|
+
channelName = _this$mobileMoney$dat.channel_name;
|
|
20568
20508
|
var listenerOptions = {
|
|
20569
|
-
channel:
|
|
20509
|
+
channel: channel || channelName,
|
|
20570
20510
|
paymentMethod: 'mobile_money'
|
|
20571
20511
|
};
|
|
20572
20512
|
return this.listenForCharge(listenerOptions, callback);
|
|
20573
|
-
},
|
|
20574
|
-
listenForMobileMoneyConfirmation: function listenForMobileMoneyConfirmation(callback, pusherChannel) {
|
|
20575
|
-
var data = this.mobileMoney.data;
|
|
20576
|
-
var confirmationChannel = pusherChannel || data && data.confirm_channel_name;
|
|
20577
|
-
if (!confirmationChannel) {
|
|
20578
|
-
throw new Error('Please provide the confirm_channel_name returned by Transaction.chargeMobileMoney()');
|
|
20579
|
-
}
|
|
20580
|
-
var listenerOptions = {
|
|
20581
|
-
channel: confirmationChannel,
|
|
20582
|
-
paymentMethod: 'mobile_money'
|
|
20583
|
-
};
|
|
20584
|
-
return subscribeToConfirmationEvents(listenerOptions, this, callback);
|
|
20585
20513
|
}
|
|
20586
20514
|
};
|
|
20587
20515
|
|
package/lib/checkout.js
CHANGED
|
@@ -6563,58 +6563,6 @@ var subscribeToChargeEvents = function subscribeToChargeEvents(options, context,
|
|
|
6563
6563
|
});
|
|
6564
6564
|
};
|
|
6565
6565
|
|
|
6566
|
-
// Duplicated from `subscribeToChargeEvents` on purpose. Hoisting that function's locals
|
|
6567
|
-
// to module scope so both could share them would modify the shared path, which
|
|
6568
|
-
// RAILS-12006 AC5 requires to stay byte-identical. Do not "clean this up".
|
|
6569
|
-
var confirmationUndefinedError = {
|
|
6570
|
-
status: 'error',
|
|
6571
|
-
message: 'We could not listen for charge response.'
|
|
6572
|
-
};
|
|
6573
|
-
var confirmationSubscriptionError = {
|
|
6574
|
-
status: 'error',
|
|
6575
|
-
message: 'We could not listen for charge response. Use transaction.requery() to check the status.'
|
|
6576
|
-
};
|
|
6577
|
-
|
|
6578
|
-
// Dedicated listener for the Ghana mobile money USSD confirmation channel.
|
|
6579
|
-
// Deliberately separate from `subscribeToChargeEvents`: that function is the shared
|
|
6580
|
-
// path for every channel and market, and this flow needs an unsubscribe available
|
|
6581
|
-
// before any event arrives. `context` is used only for logAPIResponse -- unlike the
|
|
6582
|
-
// shared path this never writes `context.isListening`, because the confirmation
|
|
6583
|
-
// channel runs alongside the main charge subscription and the two would otherwise
|
|
6584
|
-
// fight over a single flag on the same transaction.
|
|
6585
|
-
var subscribeToConfirmationEvents = function subscribeToConfirmationEvents(options, context, callback) {
|
|
6586
|
-
var channel = options.channel,
|
|
6587
|
-
paymentMethod = options.paymentMethod;
|
|
6588
|
-
if (!window || !window.Pusher) {
|
|
6589
|
-
callback(confirmationUndefinedError, noOp);
|
|
6590
|
-
return noOp;
|
|
6591
|
-
}
|
|
6592
|
-
var pusher = new window.Pusher(configToUse.pusherKey, {
|
|
6593
|
-
cluster: 'eu',
|
|
6594
|
-
disableStats: true
|
|
6595
|
-
});
|
|
6596
|
-
var hasUnsubscribed = false;
|
|
6597
|
-
var unsubscribe = function unsubscribe() {
|
|
6598
|
-
if (hasUnsubscribed) {
|
|
6599
|
-
return;
|
|
6600
|
-
}
|
|
6601
|
-
hasUnsubscribed = true;
|
|
6602
|
-
pusher.unsubscribe(channel);
|
|
6603
|
-
pusher.disconnect();
|
|
6604
|
-
};
|
|
6605
|
-
var pusherSubscription = pusher.subscribe(channel);
|
|
6606
|
-
pusherSubscription.bind('pusher:subscription_error', function () {
|
|
6607
|
-
unsubscribe();
|
|
6608
|
-
callback(confirmationSubscriptionError, unsubscribe);
|
|
6609
|
-
});
|
|
6610
|
-
pusherSubscription.bind('response', function (response) {
|
|
6611
|
-
var formattedResponse = ChargeResponses.parse(response);
|
|
6612
|
-
context.logAPIResponse(formattedResponse, paymentMethod);
|
|
6613
|
-
callback(formattedResponse, unsubscribe);
|
|
6614
|
-
});
|
|
6615
|
-
return unsubscribe;
|
|
6616
|
-
};
|
|
6617
|
-
|
|
6618
6566
|
var uncurryThis$7 = functionUncurryThis;
|
|
6619
6567
|
var PROPER_FUNCTION_NAME$2 = functionName.PROPER;
|
|
6620
6568
|
var redefine$4 = redefine$a.exports;
|
|
@@ -20439,10 +20387,6 @@ var MobileMoneyAPI = {
|
|
|
20439
20387
|
}
|
|
20440
20388
|
};
|
|
20441
20389
|
|
|
20442
|
-
// Charge statuses that leave the transaction with a Pusher channel worth listening on.
|
|
20443
|
-
// `awaiting_ussd_confirmation` is mid-flight, not settled, but it still carries the
|
|
20444
|
-
// `channel_name` the outcome will arrive on.
|
|
20445
|
-
var LISTENABLE_CHARGE_STATUSES = ['success', 'awaiting_ussd_confirmation'];
|
|
20446
20390
|
function validate$1(phoneNumber) {
|
|
20447
20391
|
return new Promise(function (resolve, reject) {
|
|
20448
20392
|
var validation = PhoneNumber.validate(phoneNumber);
|
|
@@ -20482,11 +20426,11 @@ var MobileMoneyCharge = {
|
|
|
20482
20426
|
mobileMoneyChargeAPI: function mobileMoneyChargeAPI(params) {
|
|
20483
20427
|
var _this = this;
|
|
20484
20428
|
return MobileMoneyAPI.charge(params).then(function (response) {
|
|
20485
|
-
if (
|
|
20429
|
+
if (response.status === 'success') {
|
|
20486
20430
|
_this.mobileMoney = response;
|
|
20487
|
-
|
|
20488
|
-
|
|
20489
|
-
|
|
20431
|
+
if (response.data && response.data.display && response.data.display.otpSentCount === 1) {
|
|
20432
|
+
_this.logTokenRequest('mobile money');
|
|
20433
|
+
}
|
|
20490
20434
|
}
|
|
20491
20435
|
return response;
|
|
20492
20436
|
});
|
|
@@ -20559,33 +20503,17 @@ var MobileMoneyCharge = {
|
|
|
20559
20503
|
});
|
|
20560
20504
|
},
|
|
20561
20505
|
listenForMobileMoneyCharge: function listenForMobileMoneyCharge(callback) {
|
|
20562
|
-
if (
|
|
20563
|
-
return Promise.reject(Error('Please start a mobile money charge with Transaction.chargeMobileMoney()'));
|
|
20564
|
-
}
|
|
20565
|
-
var _ref2 = this.mobileMoney.data || {},
|
|
20566
|
-
channel = _ref2.channel,
|
|
20567
|
-
channelName = _ref2.channel_name;
|
|
20568
|
-
var listenerChannel = channel || channelName;
|
|
20569
|
-
if (!listenerChannel) {
|
|
20506
|
+
if (this.mobileMoney.status !== 'success') {
|
|
20570
20507
|
return Promise.reject(Error('Please start a mobile money charge with Transaction.chargeMobileMoney()'));
|
|
20571
20508
|
}
|
|
20509
|
+
var _this$mobileMoney$dat = this.mobileMoney.data,
|
|
20510
|
+
channel = _this$mobileMoney$dat.channel,
|
|
20511
|
+
channelName = _this$mobileMoney$dat.channel_name;
|
|
20572
20512
|
var listenerOptions = {
|
|
20573
|
-
channel:
|
|
20513
|
+
channel: channel || channelName,
|
|
20574
20514
|
paymentMethod: 'mobile_money'
|
|
20575
20515
|
};
|
|
20576
20516
|
return this.listenForCharge(listenerOptions, callback);
|
|
20577
|
-
},
|
|
20578
|
-
listenForMobileMoneyConfirmation: function listenForMobileMoneyConfirmation(callback, pusherChannel) {
|
|
20579
|
-
var data = this.mobileMoney.data;
|
|
20580
|
-
var confirmationChannel = pusherChannel || data && data.confirm_channel_name;
|
|
20581
|
-
if (!confirmationChannel) {
|
|
20582
|
-
throw new Error('Please provide the confirm_channel_name returned by Transaction.chargeMobileMoney()');
|
|
20583
|
-
}
|
|
20584
|
-
var listenerOptions = {
|
|
20585
|
-
channel: confirmationChannel,
|
|
20586
|
-
paymentMethod: 'mobile_money'
|
|
20587
|
-
};
|
|
20588
|
-
return subscribeToConfirmationEvents(listenerOptions, this, callback);
|
|
20589
20517
|
}
|
|
20590
20518
|
};
|
|
20591
20519
|
|