@paystack/checkout-js 1.45.1-dev.1 → 1.46.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 +115 -6
- package/dist/checkout.js.map +1 -0
- package/es/checkout.js +115 -6
- package/es/checkout.js.map +1 -0
- package/lib/checkout.js +115 -6
- package/lib/checkout.js.map +1 -0
- package/package.json +1 -1
package/lib/checkout.js
CHANGED
|
@@ -6340,19 +6340,22 @@ var devConfig = _objectSpread2(_objectSpread2({}, config), {}, {
|
|
|
6340
6340
|
checkoutUrl: 'http://localhost:8080/',
|
|
6341
6341
|
paymentBaseUrl: 'https://legacy-staging.paystack.co/',
|
|
6342
6342
|
paystackApiUrl: 'https://studio-api.paystack.co/',
|
|
6343
|
-
pusherKey: '1c7b262ee18455815893'
|
|
6343
|
+
pusherKey: '1c7b262ee18455815893',
|
|
6344
|
+
pusherUrl: 'https://s3-eu-west-1.amazonaws.com/pstk-public-files/js/pusher.min.js'
|
|
6344
6345
|
});
|
|
6345
6346
|
var stagingConfig = _objectSpread2(_objectSpread2({}, config), {}, {
|
|
6346
6347
|
checkoutUrl: 'https://checkout-studio.paystack.com/',
|
|
6347
6348
|
paymentBaseUrl: 'https://legacy-staging.paystack.co/',
|
|
6348
6349
|
paystackApiUrl: 'https://studio-api.paystack.co/',
|
|
6349
|
-
pusherKey: '1c7b262ee18455815893'
|
|
6350
|
+
pusherKey: '1c7b262ee18455815893',
|
|
6351
|
+
pusherUrl: 'https://s3-eu-west-1.amazonaws.com/pstk-public-files/js/pusher.min.js'
|
|
6350
6352
|
});
|
|
6351
6353
|
var productionConfig = _objectSpread2(_objectSpread2({}, config), {}, {
|
|
6352
6354
|
checkoutUrl: 'https://checkout.paystack.com/',
|
|
6353
6355
|
paymentBaseUrl: 'https://standard.paystack.co/',
|
|
6354
6356
|
paystackApiUrl: 'https://api.paystack.co/',
|
|
6355
|
-
pusherKey: '8e4b9b7ca3418bd5cdc8'
|
|
6357
|
+
pusherKey: '8e4b9b7ca3418bd5cdc8',
|
|
6358
|
+
pusherUrl: 'https://checkout.paystack.com/static/vendor/pusher.min.js'
|
|
6356
6359
|
});
|
|
6357
6360
|
var configToEnvironmentMapping = {
|
|
6358
6361
|
dev: devConfig,
|
|
@@ -12113,6 +12116,17 @@ var TransactionAPI = {
|
|
|
12113
12116
|
}).then(function (response) {
|
|
12114
12117
|
return response.data;
|
|
12115
12118
|
});
|
|
12119
|
+
},
|
|
12120
|
+
initializeCustomerSubscriptionAuthorization: function initializeCustomerSubscriptionAuthorization(params, publicKey) {
|
|
12121
|
+
var url = new URL('/customer/authorization/initialize_subscription', configToUse.paystackApiUrl).toString();
|
|
12122
|
+
var headers = {
|
|
12123
|
+
Authorization: "Bearer ".concat(publicKey)
|
|
12124
|
+
};
|
|
12125
|
+
return axiosInstance.post(url, params, {
|
|
12126
|
+
headers: headers
|
|
12127
|
+
}).then(function (response) {
|
|
12128
|
+
return response.data;
|
|
12129
|
+
});
|
|
12116
12130
|
}
|
|
12117
12131
|
};
|
|
12118
12132
|
|
|
@@ -12130,6 +12144,34 @@ var PayWithTransferAPI = {
|
|
|
12130
12144
|
}).then(function (response) {
|
|
12131
12145
|
return ChargeResponses.parse(response.data);
|
|
12132
12146
|
});
|
|
12147
|
+
},
|
|
12148
|
+
incorrectAmountDecision: function incorrectAmountDecision(params, publicKey) {
|
|
12149
|
+
var language = getLanguage();
|
|
12150
|
+
var headers = _objectSpread2({
|
|
12151
|
+
Authorization: "Bearer ".concat(publicKey)
|
|
12152
|
+
}, language && {
|
|
12153
|
+
'Accept-Language': language
|
|
12154
|
+
});
|
|
12155
|
+
var url = new URL('pay-with-transfer/incorrect-amount/decision', configToUse.paystackApiUrl).toString();
|
|
12156
|
+
return axiosInstance.post(url, params, {
|
|
12157
|
+
headers: headers
|
|
12158
|
+
}).then(function (response) {
|
|
12159
|
+
return ChargeResponses.parse(response.data);
|
|
12160
|
+
});
|
|
12161
|
+
},
|
|
12162
|
+
authenticatePayer: function authenticatePayer(params, publicKey) {
|
|
12163
|
+
var language = getLanguage();
|
|
12164
|
+
var headers = _objectSpread2({
|
|
12165
|
+
Authorization: "Bearer ".concat(publicKey)
|
|
12166
|
+
}, language && {
|
|
12167
|
+
'Accept-Language': language
|
|
12168
|
+
});
|
|
12169
|
+
var url = new URL('pay-with-transfer/authenticate-payer', configToUse.paystackApiUrl).toString();
|
|
12170
|
+
return axiosInstance.post(url, params, {
|
|
12171
|
+
headers: headers
|
|
12172
|
+
}).then(function (response) {
|
|
12173
|
+
return ChargeResponses.parse(response.data);
|
|
12174
|
+
});
|
|
12133
12175
|
}
|
|
12134
12176
|
};
|
|
12135
12177
|
|
|
@@ -12158,6 +12200,25 @@ var PayWithTransferCharge = {
|
|
|
12158
12200
|
paymentMethod: 'bank_transfer'
|
|
12159
12201
|
};
|
|
12160
12202
|
return this.listenForCharge(listenerOptions, callback);
|
|
12203
|
+
},
|
|
12204
|
+
sendIncorrectAmountDecision: function sendIncorrectAmountDecision(decisionMade) {
|
|
12205
|
+
var params = {
|
|
12206
|
+
transaction_id: this.id,
|
|
12207
|
+
decision: decisionMade
|
|
12208
|
+
};
|
|
12209
|
+
return PayWithTransferAPI.incorrectAmountDecision(params, this.merchant.key);
|
|
12210
|
+
},
|
|
12211
|
+
sendAuthenticatePayer: function sendAuthenticatePayer(_ref2) {
|
|
12212
|
+
var amountPaid = _ref2.amountPaid,
|
|
12213
|
+
payerAccountNumber = _ref2.payerAccountNumber,
|
|
12214
|
+
payerBankSlug = _ref2.payerBankSlug;
|
|
12215
|
+
var params = {
|
|
12216
|
+
transaction_id: this.id,
|
|
12217
|
+
amount: amountPaid,
|
|
12218
|
+
payer_account_number: payerAccountNumber,
|
|
12219
|
+
payer_bank_slug: payerBankSlug
|
|
12220
|
+
};
|
|
12221
|
+
return PayWithTransferAPI.authenticatePayer(params, this.merchant.key);
|
|
12161
12222
|
}
|
|
12162
12223
|
};
|
|
12163
12224
|
|
|
@@ -21150,6 +21211,10 @@ var AnalyticsFunctions$1 = _objectSpread2(_objectSpread2({}, CapitecPayAnalytics
|
|
|
21150
21211
|
},
|
|
21151
21212
|
saveReferrer: function saveReferrer(referrer) {
|
|
21152
21213
|
return AnalyticsAPI.saveReferrer(this.id, this.merchant.key, referrer);
|
|
21214
|
+
},
|
|
21215
|
+
setAmountByChannel: function setAmountByChannel(channelName) {
|
|
21216
|
+
var _this$channelFeesConf;
|
|
21217
|
+
this.amount = ((_this$channelFeesConf = this.channelFeesConfig[channelName]) === null || _this$channelFeesConf === void 0 ? void 0 : _this$channelFeesConf.amount) || this.originalAmount;
|
|
21153
21218
|
}
|
|
21154
21219
|
});
|
|
21155
21220
|
|
|
@@ -21293,7 +21358,7 @@ var linkAPI = {
|
|
|
21293
21358
|
}, _callee4);
|
|
21294
21359
|
}))();
|
|
21295
21360
|
},
|
|
21296
|
-
|
|
21361
|
+
generateDirectDebitManagedAccount: function generateDirectDebitManagedAccount(params) {
|
|
21297
21362
|
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee5() {
|
|
21298
21363
|
var url, language, headers, payload, response;
|
|
21299
21364
|
return regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
@@ -21460,12 +21525,28 @@ var linkChargeFunctions = {
|
|
|
21460
21525
|
});
|
|
21461
21526
|
},
|
|
21462
21527
|
generateLinkManagedAccount: function generateLinkManagedAccount(params) {
|
|
21463
|
-
return
|
|
21528
|
+
return this.getDirectDebitManagedAccount(params);
|
|
21529
|
+
},
|
|
21530
|
+
getDirectDebitManagedAccount: function getDirectDebitManagedAccount(params) {
|
|
21531
|
+
return linkAPI.generateDirectDebitManagedAccount(_objectSpread2(_objectSpread2({}, params), {}, {
|
|
21464
21532
|
device: this.deviceFingerprint,
|
|
21465
21533
|
transactionId: this.id
|
|
21466
21534
|
}));
|
|
21467
21535
|
},
|
|
21536
|
+
getManagedAccount: function getManagedAccount(_ref5) {
|
|
21537
|
+
var fulfilLateNotification = _ref5.fulfilLateNotification,
|
|
21538
|
+
preferredProvider = _ref5.preferredProvider;
|
|
21539
|
+
var params = {
|
|
21540
|
+
transaction_id: this.id,
|
|
21541
|
+
fulfil_late_notification: fulfilLateNotification,
|
|
21542
|
+
preferred_provider: preferredProvider
|
|
21543
|
+
};
|
|
21544
|
+
return PayWithTransferAPI.generateManagedAccount(params, this.merchant.key);
|
|
21545
|
+
},
|
|
21468
21546
|
listenForLinkBankPayWithTransferCharge: function listenForLinkBankPayWithTransferCharge(pusherChannel, callback) {
|
|
21547
|
+
return this.listenForBankPayWithTransferCharge(pusherChannel, callback);
|
|
21548
|
+
},
|
|
21549
|
+
listenForBankPayWithTransferCharge: function listenForBankPayWithTransferCharge(pusherChannel, callback) {
|
|
21469
21550
|
var listenerOptions = {
|
|
21470
21551
|
channel: pusherChannel,
|
|
21471
21552
|
paymentMethod: 'bank_transfer'
|
|
@@ -21499,6 +21580,7 @@ var TransactionInstance = /*#__PURE__*/function () {
|
|
|
21499
21580
|
this.status = data.transaction_status || data.status;
|
|
21500
21581
|
this.accessCode = data.access_code;
|
|
21501
21582
|
this.amount = data.amount;
|
|
21583
|
+
this.originalAmount = data.amount;
|
|
21502
21584
|
this.domain = data.domain;
|
|
21503
21585
|
this.isTest = data.domain === 'test';
|
|
21504
21586
|
this.currency = data.currency;
|
|
@@ -21604,6 +21686,13 @@ var TransactionInstance = /*#__PURE__*/function () {
|
|
|
21604
21686
|
return response && response.data;
|
|
21605
21687
|
});
|
|
21606
21688
|
}
|
|
21689
|
+
}, {
|
|
21690
|
+
key: "initializeCustomerSubscriptionAuthorization",
|
|
21691
|
+
value: function initializeCustomerSubscriptionAuthorization(payload) {
|
|
21692
|
+
return TransactionAPI.initializeCustomerSubscriptionAuthorization(payload, this.merchant.key).then(function (response) {
|
|
21693
|
+
return response && response.data;
|
|
21694
|
+
});
|
|
21695
|
+
}
|
|
21607
21696
|
}]);
|
|
21608
21697
|
return TransactionInstance;
|
|
21609
21698
|
}();
|
|
@@ -21667,7 +21756,7 @@ var Transaction = {
|
|
|
21667
21756
|
}
|
|
21668
21757
|
throw new Error('This function should be used with transaction data from the API');
|
|
21669
21758
|
case 5:
|
|
21670
|
-
return _context2.abrupt("return", Object.seal(new TransactionInstance(_objectSpread2(_objectSpread2({}, transactionData), {
|
|
21759
|
+
return _context2.abrupt("return", Object.seal(new TransactionInstance(_objectSpread2(_objectSpread2({}, transactionData), {
|
|
21671
21760
|
deviceFingerprint: deviceFingerprint
|
|
21672
21761
|
}))));
|
|
21673
21762
|
case 6:
|
|
@@ -21825,6 +21914,19 @@ var ToolkitAPI = {
|
|
|
21825
21914
|
resolvedCardBins[bin] = data;
|
|
21826
21915
|
return data;
|
|
21827
21916
|
});
|
|
21917
|
+
},
|
|
21918
|
+
resolveIPAddress: function resolveIPAddress(ipAddress) {
|
|
21919
|
+
var url = new URL("decision/resolve_ip/".concat(ipAddress), configToUse.paystackApiUrl).toString();
|
|
21920
|
+
var language = getLanguage();
|
|
21921
|
+
var headers = _objectSpread2({}, language && {
|
|
21922
|
+
'Accept-Language': language
|
|
21923
|
+
});
|
|
21924
|
+
return axiosInstance.get(url, {
|
|
21925
|
+
headers: headers
|
|
21926
|
+
}).then(function (_ref2) {
|
|
21927
|
+
var data = _ref2.data;
|
|
21928
|
+
return data;
|
|
21929
|
+
});
|
|
21828
21930
|
}
|
|
21829
21931
|
};
|
|
21830
21932
|
|
|
@@ -21882,6 +21984,11 @@ var Toolkit = /*#__PURE__*/function () {
|
|
|
21882
21984
|
value: function resolveCardBin(bin) {
|
|
21883
21985
|
return ToolkitAPI.resolveCardBin(bin);
|
|
21884
21986
|
}
|
|
21987
|
+
}, {
|
|
21988
|
+
key: "resolveIPAddress",
|
|
21989
|
+
value: function resolveIPAddress(ipAddress) {
|
|
21990
|
+
return ToolkitAPI.resolveIPAddress(ipAddress);
|
|
21991
|
+
}
|
|
21885
21992
|
}]);
|
|
21886
21993
|
return Toolkit;
|
|
21887
21994
|
}();
|
|
@@ -22169,6 +22276,7 @@ var AnalyticsFunctions = {
|
|
|
22169
22276
|
return this.saveLog();
|
|
22170
22277
|
},
|
|
22171
22278
|
logAPIResponse: function logAPIResponse(response, channel) {
|
|
22279
|
+
console.log('api response', response);
|
|
22172
22280
|
switch (response.status) {
|
|
22173
22281
|
case 'authorized':
|
|
22174
22282
|
return this.logAuthorized(channel);
|
|
@@ -22345,3 +22453,4 @@ exports.Card = Card$1;
|
|
|
22345
22453
|
exports.Preauthorization = Preauthorization;
|
|
22346
22454
|
exports.Toolkit = Toolkit;
|
|
22347
22455
|
exports.Transaction = Transaction;
|
|
22456
|
+
//# sourceMappingURL=checkout.js.map
|