@paystack/checkout-js 1.19.0-dev.23 → 1.19.0-dev.25
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 +523 -164
- package/es/checkout.js +523 -164
- package/lib/checkout.js +523 -164
- package/package.json +1 -1
package/dist/checkout.js
CHANGED
|
@@ -11646,7 +11646,7 @@ var Paystack = (function (exports) {
|
|
|
11646
11646
|
}
|
|
11647
11647
|
};
|
|
11648
11648
|
|
|
11649
|
-
var paymentMethod$
|
|
11649
|
+
var paymentMethod$7 = 'payattitude';
|
|
11650
11650
|
var PayattitudeCharge = {
|
|
11651
11651
|
chargePayattitude: function chargePayattitude(_ref) {
|
|
11652
11652
|
var _this = this;
|
|
@@ -11657,7 +11657,7 @@ var Paystack = (function (exports) {
|
|
|
11657
11657
|
phoneNumber: phoneNumber
|
|
11658
11658
|
};
|
|
11659
11659
|
return PayattitudeAPI.charge(params).then(function (response) {
|
|
11660
|
-
_this.logAPIResponse(response, paymentMethod$
|
|
11660
|
+
_this.logAPIResponse(response, paymentMethod$7);
|
|
11661
11661
|
|
|
11662
11662
|
return response;
|
|
11663
11663
|
});
|
|
@@ -11665,7 +11665,7 @@ var Paystack = (function (exports) {
|
|
|
11665
11665
|
listenForPayattitudeCharge: function listenForPayattitudeCharge(callback) {
|
|
11666
11666
|
var pusherChannel = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
11667
11667
|
var listenerOptions = {
|
|
11668
|
-
paymentMethod: paymentMethod$
|
|
11668
|
+
paymentMethod: paymentMethod$7,
|
|
11669
11669
|
channel: pusherChannel
|
|
11670
11670
|
};
|
|
11671
11671
|
return this.listenForCharge(listenerOptions, callback);
|
|
@@ -11748,7 +11748,7 @@ var Paystack = (function (exports) {
|
|
|
11748
11748
|
}
|
|
11749
11749
|
};
|
|
11750
11750
|
|
|
11751
|
-
var paymentMethod$
|
|
11751
|
+
var paymentMethod$6 = 'apple pay';
|
|
11752
11752
|
var ApplePayCharge = {
|
|
11753
11753
|
validateApplePaySession: function validateApplePaySession(_ref) {
|
|
11754
11754
|
var _this = this;
|
|
@@ -11756,7 +11756,7 @@ var Paystack = (function (exports) {
|
|
|
11756
11756
|
var sessionUrl = _ref.sessionUrl,
|
|
11757
11757
|
displayName = _ref.displayName,
|
|
11758
11758
|
domainName = _ref.domainName;
|
|
11759
|
-
this.logAttempt(paymentMethod$
|
|
11759
|
+
this.logAttempt(paymentMethod$6);
|
|
11760
11760
|
return ApplePayAPI.validateApplePaySession({
|
|
11761
11761
|
sessionUrl: sessionUrl,
|
|
11762
11762
|
displayName: displayName,
|
|
@@ -11777,7 +11777,7 @@ var Paystack = (function (exports) {
|
|
|
11777
11777
|
device: this.deviceFingerprint,
|
|
11778
11778
|
paymentObject: paymentObject
|
|
11779
11779
|
}).then(function (response) {
|
|
11780
|
-
_this2.logAPIResponse(response, paymentMethod$
|
|
11780
|
+
_this2.logAPIResponse(response, paymentMethod$6);
|
|
11781
11781
|
|
|
11782
11782
|
return response;
|
|
11783
11783
|
});
|
|
@@ -11833,12 +11833,12 @@ var Paystack = (function (exports) {
|
|
|
11833
11833
|
}
|
|
11834
11834
|
};
|
|
11835
11835
|
|
|
11836
|
-
var paymentMethod$
|
|
11836
|
+
var paymentMethod$5 = 'paypal';
|
|
11837
11837
|
var PayPalCharge = {
|
|
11838
11838
|
createPayPalOrder: function createPayPalOrder() {
|
|
11839
11839
|
var _this = this;
|
|
11840
11840
|
|
|
11841
|
-
this.logAttempt(paymentMethod$
|
|
11841
|
+
this.logAttempt(paymentMethod$5);
|
|
11842
11842
|
return PayPalAPI.createOrder(this.id).then(function (response) {
|
|
11843
11843
|
_this.logAPIResponseMessage(response.message);
|
|
11844
11844
|
|
|
@@ -11849,7 +11849,7 @@ var Paystack = (function (exports) {
|
|
|
11849
11849
|
var _this2 = this;
|
|
11850
11850
|
|
|
11851
11851
|
return PayPalAPI.captureOrder(this.id).then(function (response) {
|
|
11852
|
-
_this2.logAPIResponse(response, paymentMethod$
|
|
11852
|
+
_this2.logAPIResponse(response, paymentMethod$5);
|
|
11853
11853
|
|
|
11854
11854
|
return response;
|
|
11855
11855
|
});
|
|
@@ -17237,6 +17237,27 @@ var Paystack = (function (exports) {
|
|
|
17237
17237
|
return jsEncrypt.encrypt(toEncrypt);
|
|
17238
17238
|
}
|
|
17239
17239
|
|
|
17240
|
+
var $$2 = _export;
|
|
17241
|
+
var $find = arrayIteration.find;
|
|
17242
|
+
var addToUnscopables = addToUnscopables$3;
|
|
17243
|
+
|
|
17244
|
+
var FIND = 'find';
|
|
17245
|
+
var SKIPS_HOLES = true;
|
|
17246
|
+
|
|
17247
|
+
// Shouldn't skip holes
|
|
17248
|
+
if (FIND in []) Array(1)[FIND](function () { SKIPS_HOLES = false; });
|
|
17249
|
+
|
|
17250
|
+
// `Array.prototype.find` method
|
|
17251
|
+
// https://tc39.es/ecma262/#sec-array.prototype.find
|
|
17252
|
+
$$2({ target: 'Array', proto: true, forced: SKIPS_HOLES }, {
|
|
17253
|
+
find: function find(callbackfn /* , that = undefined */) {
|
|
17254
|
+
return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
|
|
17255
|
+
}
|
|
17256
|
+
});
|
|
17257
|
+
|
|
17258
|
+
// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
|
|
17259
|
+
addToUnscopables(FIND);
|
|
17260
|
+
|
|
17240
17261
|
/*
|
|
17241
17262
|
* Luhn algorithm implementation in JavaScript
|
|
17242
17263
|
* Copyright (c) 2009 Nicholas C. Zakas
|
|
@@ -18213,90 +18234,18 @@ var Paystack = (function (exports) {
|
|
|
18213
18234
|
values: createMethod(false)
|
|
18214
18235
|
};
|
|
18215
18236
|
|
|
18216
|
-
var $$
|
|
18237
|
+
var $$1 = _export;
|
|
18217
18238
|
var $values = objectToArray.values;
|
|
18218
18239
|
|
|
18219
18240
|
// `Object.values` method
|
|
18220
18241
|
// https://tc39.es/ecma262/#sec-object.values
|
|
18221
|
-
$$
|
|
18242
|
+
$$1({ target: 'Object', stat: true }, {
|
|
18222
18243
|
values: function values(O) {
|
|
18223
18244
|
return $values(O);
|
|
18224
18245
|
}
|
|
18225
18246
|
});
|
|
18226
18247
|
|
|
18227
|
-
var
|
|
18228
|
-
var $find = arrayIteration.find;
|
|
18229
|
-
var addToUnscopables = addToUnscopables$3;
|
|
18230
|
-
|
|
18231
|
-
var FIND = 'find';
|
|
18232
|
-
var SKIPS_HOLES = true;
|
|
18233
|
-
|
|
18234
|
-
// Shouldn't skip holes
|
|
18235
|
-
if (FIND in []) Array(1)[FIND](function () { SKIPS_HOLES = false; });
|
|
18236
|
-
|
|
18237
|
-
// `Array.prototype.find` method
|
|
18238
|
-
// https://tc39.es/ecma262/#sec-array.prototype.find
|
|
18239
|
-
$$1({ target: 'Array', proto: true, forced: SKIPS_HOLES }, {
|
|
18240
|
-
find: function find(callbackfn /* , that = undefined */) {
|
|
18241
|
-
return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
|
|
18242
|
-
}
|
|
18243
|
-
});
|
|
18244
|
-
|
|
18245
|
-
// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
|
|
18246
|
-
addToUnscopables(FIND);
|
|
18247
|
-
|
|
18248
|
-
var testCards = [{
|
|
18249
|
-
type: 'bank_auth',
|
|
18250
|
-
name: 'Bank authorization',
|
|
18251
|
-
number: '4084080000000409',
|
|
18252
|
-
cvv: '000',
|
|
18253
|
-
month: '01',
|
|
18254
|
-
year: '30'
|
|
18255
|
-
}, {
|
|
18256
|
-
type: 'success',
|
|
18257
|
-
name: 'Success',
|
|
18258
|
-
number: '4084084084084081',
|
|
18259
|
-
cvv: '408',
|
|
18260
|
-
month: '12',
|
|
18261
|
-
year: '30'
|
|
18262
|
-
}, {
|
|
18263
|
-
type: 'declined',
|
|
18264
|
-
name: 'Declined',
|
|
18265
|
-
number: '4084080000005408',
|
|
18266
|
-
cvv: '001',
|
|
18267
|
-
month: '12',
|
|
18268
|
-
year: '30'
|
|
18269
|
-
}, {
|
|
18270
|
-
type: 'pin',
|
|
18271
|
-
name: 'Pin only validation',
|
|
18272
|
-
number: '507850785078507812',
|
|
18273
|
-
cvv: '884',
|
|
18274
|
-
month: '01',
|
|
18275
|
-
year: '30'
|
|
18276
|
-
}, {
|
|
18277
|
-
type: 'pin+otp',
|
|
18278
|
-
name: 'Pin and OTP validation',
|
|
18279
|
-
number: '5060666666666666666',
|
|
18280
|
-
cvv: '123',
|
|
18281
|
-
month: '01',
|
|
18282
|
-
year: '30'
|
|
18283
|
-
}, {
|
|
18284
|
-
type: 'pin+phone+otp',
|
|
18285
|
-
name: 'Pin, phone and OTP validation',
|
|
18286
|
-
number: '507850785078507812',
|
|
18287
|
-
cvv: '884',
|
|
18288
|
-
month: '01',
|
|
18289
|
-
year: '30'
|
|
18290
|
-
}, {
|
|
18291
|
-
type: 'default',
|
|
18292
|
-
name: 'No validation',
|
|
18293
|
-
number: '4084084084084081',
|
|
18294
|
-
cvv: '408',
|
|
18295
|
-
month: '01',
|
|
18296
|
-
year: '30'
|
|
18297
|
-
}];
|
|
18298
|
-
|
|
18299
|
-
var Card$1 = {
|
|
18248
|
+
var Card$2 = {
|
|
18300
18249
|
getEncryptedPin: function getEncryptedPin(pin) {
|
|
18301
18250
|
return pin ? encrypt(pin) : undefined;
|
|
18302
18251
|
},
|
|
@@ -18355,7 +18304,7 @@ var Paystack = (function (exports) {
|
|
|
18355
18304
|
return cardValidator.number(value);
|
|
18356
18305
|
},
|
|
18357
18306
|
isNumberValid: function isNumberValid(value) {
|
|
18358
|
-
return Card$
|
|
18307
|
+
return Card$2.validateNumber(value).isValid;
|
|
18359
18308
|
},
|
|
18360
18309
|
validateCVV: function validateCVV(cvv, cardType) {
|
|
18361
18310
|
var isAmexCard = cardType === 'american-express';
|
|
@@ -18363,7 +18312,7 @@ var Paystack = (function (exports) {
|
|
|
18363
18312
|
return cardValidator.cvv(cvv, cvvLength);
|
|
18364
18313
|
},
|
|
18365
18314
|
isCvvValid: function isCvvValid(cvv, cardType) {
|
|
18366
|
-
return Card$
|
|
18315
|
+
return Card$2.validateCVV(cvv, cardType).isValid;
|
|
18367
18316
|
},
|
|
18368
18317
|
validateExpiry: function validateExpiry(value) {
|
|
18369
18318
|
if (_typeof$1(value) === 'object') {
|
|
@@ -18375,14 +18324,7 @@ var Paystack = (function (exports) {
|
|
|
18375
18324
|
return cardValidator.expirationDate(value);
|
|
18376
18325
|
},
|
|
18377
18326
|
isExpiryValid: function isExpiryValid(value) {
|
|
18378
|
-
return Card$
|
|
18379
|
-
},
|
|
18380
|
-
generateTestCard: function generateTestCard(cardType) {
|
|
18381
|
-
var type = cardType || 'default';
|
|
18382
|
-
var cardParams = testCards.find(function (card) {
|
|
18383
|
-
return card.type === type;
|
|
18384
|
-
});
|
|
18385
|
-
return new Card$1(cardParams);
|
|
18327
|
+
return Card$2.validateExpiry(value).isValid;
|
|
18386
18328
|
}
|
|
18387
18329
|
};
|
|
18388
18330
|
|
|
@@ -18399,7 +18341,7 @@ var Paystack = (function (exports) {
|
|
|
18399
18341
|
});
|
|
18400
18342
|
cardValidator.creditCardType.changeOrder('verve', 0);
|
|
18401
18343
|
|
|
18402
|
-
var Card = /*#__PURE__*/function () {
|
|
18344
|
+
var Card$1 = /*#__PURE__*/function () {
|
|
18403
18345
|
function Card(_ref) {
|
|
18404
18346
|
var number = _ref.number,
|
|
18405
18347
|
cvv = _ref.cvv,
|
|
@@ -18419,17 +18361,17 @@ var Paystack = (function (exports) {
|
|
|
18419
18361
|
_createClass(Card, [{
|
|
18420
18362
|
key: "getEncryptedPin",
|
|
18421
18363
|
value: function getEncryptedPin() {
|
|
18422
|
-
return Card$
|
|
18364
|
+
return Card$2.getEncryptedPin(this.pin);
|
|
18423
18365
|
}
|
|
18424
18366
|
}, {
|
|
18425
18367
|
key: "getLast4",
|
|
18426
18368
|
value: function getLast4() {
|
|
18427
|
-
return Card$
|
|
18369
|
+
return Card$2.getLast4(this.number);
|
|
18428
18370
|
}
|
|
18429
18371
|
}, {
|
|
18430
18372
|
key: "tokenize",
|
|
18431
18373
|
value: function tokenize() {
|
|
18432
|
-
return Card$
|
|
18374
|
+
return Card$2.tokenize({
|
|
18433
18375
|
number: this.number,
|
|
18434
18376
|
cvv: this.cvv,
|
|
18435
18377
|
month: this.month,
|
|
@@ -18439,7 +18381,7 @@ var Paystack = (function (exports) {
|
|
|
18439
18381
|
}], [{
|
|
18440
18382
|
key: "getType",
|
|
18441
18383
|
value: function getType(value) {
|
|
18442
|
-
return Card$
|
|
18384
|
+
return Card$2.getType(value);
|
|
18443
18385
|
}
|
|
18444
18386
|
}, {
|
|
18445
18387
|
key: "validate",
|
|
@@ -18448,7 +18390,7 @@ var Paystack = (function (exports) {
|
|
|
18448
18390
|
cvv = _ref2.cvv,
|
|
18449
18391
|
month = _ref2.month,
|
|
18450
18392
|
year = _ref2.year;
|
|
18451
|
-
return Card$
|
|
18393
|
+
return Card$2.validate({
|
|
18452
18394
|
number: number,
|
|
18453
18395
|
cvv: cvv,
|
|
18454
18396
|
month: month,
|
|
@@ -18458,44 +18400,48 @@ var Paystack = (function (exports) {
|
|
|
18458
18400
|
}, {
|
|
18459
18401
|
key: "validateNumber",
|
|
18460
18402
|
value: function validateNumber(value) {
|
|
18461
|
-
return Card$
|
|
18403
|
+
return Card$2.validateNumber(value);
|
|
18462
18404
|
}
|
|
18463
18405
|
}, {
|
|
18464
18406
|
key: "isNumberValid",
|
|
18465
18407
|
value: function isNumberValid(value) {
|
|
18466
|
-
return Card$
|
|
18408
|
+
return Card$2.isNumberValid(value);
|
|
18467
18409
|
}
|
|
18468
18410
|
}, {
|
|
18469
18411
|
key: "validateCVV",
|
|
18470
18412
|
value: function validateCVV(cvv, cardType) {
|
|
18471
|
-
return Card$
|
|
18413
|
+
return Card$2.validateCVV(cvv, cardType);
|
|
18472
18414
|
}
|
|
18473
18415
|
}, {
|
|
18474
18416
|
key: "isCvvValid",
|
|
18475
18417
|
value: function isCvvValid(cvv, cardType) {
|
|
18476
|
-
return Card$
|
|
18418
|
+
return Card$2.isCvvValid(cvv, cardType);
|
|
18477
18419
|
}
|
|
18478
18420
|
}, {
|
|
18479
18421
|
key: "validateExpiry",
|
|
18480
18422
|
value: function validateExpiry(value) {
|
|
18481
|
-
return Card$
|
|
18423
|
+
return Card$2.validateExpiry(value);
|
|
18482
18424
|
}
|
|
18483
18425
|
}, {
|
|
18484
18426
|
key: "isExpiryValid",
|
|
18485
18427
|
value: function isExpiryValid(value) {
|
|
18486
|
-
return Card$
|
|
18428
|
+
return Card$2.isExpiryValid(value);
|
|
18487
18429
|
}
|
|
18488
18430
|
}, {
|
|
18489
18431
|
key: "generateTestCard",
|
|
18490
18432
|
value: function generateTestCard(cardType) {
|
|
18491
|
-
|
|
18433
|
+
var type = cardType || 'default';
|
|
18434
|
+
var cardParams = testCards.find(function (card) {
|
|
18435
|
+
return card.type === type;
|
|
18436
|
+
});
|
|
18437
|
+
return new Card(cardParams);
|
|
18492
18438
|
}
|
|
18493
18439
|
}]);
|
|
18494
18440
|
|
|
18495
18441
|
return Card;
|
|
18496
18442
|
}();
|
|
18497
18443
|
|
|
18498
|
-
var CardAPI = {
|
|
18444
|
+
var CardAPI$1 = {
|
|
18499
18445
|
charge: function charge(_ref) {
|
|
18500
18446
|
var clientdata = _ref.clientdata,
|
|
18501
18447
|
last4 = _ref.last4,
|
|
@@ -18841,11 +18787,11 @@ var Paystack = (function (exports) {
|
|
|
18841
18787
|
}
|
|
18842
18788
|
};
|
|
18843
18789
|
|
|
18844
|
-
var paymentMethod$
|
|
18790
|
+
var paymentMethod$4 = 'card';
|
|
18845
18791
|
|
|
18846
|
-
function validate$
|
|
18792
|
+
function validate$4(card, isSetter) {
|
|
18847
18793
|
return new Promise(function (resolve, reject) {
|
|
18848
|
-
var validation = Card.validate(card);
|
|
18794
|
+
var validation = Card$1.validate(card);
|
|
18849
18795
|
|
|
18850
18796
|
if (!validation.isValid) {
|
|
18851
18797
|
var throwValidation = isSetter || card.number;
|
|
@@ -18864,8 +18810,8 @@ var Paystack = (function (exports) {
|
|
|
18864
18810
|
setCard: function setCard(params) {
|
|
18865
18811
|
var _this = this;
|
|
18866
18812
|
|
|
18867
|
-
return validate$
|
|
18868
|
-
_this.card = new Card(params);
|
|
18813
|
+
return validate$4(params, true).then(function () {
|
|
18814
|
+
_this.card = new Card$1(params);
|
|
18869
18815
|
});
|
|
18870
18816
|
},
|
|
18871
18817
|
rememberCard: function rememberCard() {
|
|
@@ -18880,8 +18826,8 @@ var Paystack = (function (exports) {
|
|
|
18880
18826
|
return this.chargeCardWithPin(customFields);
|
|
18881
18827
|
}
|
|
18882
18828
|
|
|
18883
|
-
return validate$
|
|
18884
|
-
_this2.logAttempt(paymentMethod$
|
|
18829
|
+
return validate$4(this.card).then(function () {
|
|
18830
|
+
_this2.logAttempt(paymentMethod$4);
|
|
18885
18831
|
|
|
18886
18832
|
var chargeParams = {
|
|
18887
18833
|
clientdata: _this2.card.tokenize(),
|
|
@@ -18894,8 +18840,8 @@ var Paystack = (function (exports) {
|
|
|
18894
18840
|
subscription: _this2.subscription,
|
|
18895
18841
|
customFields: customFields
|
|
18896
18842
|
};
|
|
18897
|
-
return CardAPI.charge(chargeParams).then(function (response) {
|
|
18898
|
-
_this2.logAPIResponse(response, paymentMethod$
|
|
18843
|
+
return CardAPI$1.charge(chargeParams).then(function (response) {
|
|
18844
|
+
_this2.logAPIResponse(response, paymentMethod$4);
|
|
18899
18845
|
|
|
18900
18846
|
return response;
|
|
18901
18847
|
});
|
|
@@ -18910,7 +18856,7 @@ var Paystack = (function (exports) {
|
|
|
18910
18856
|
var _this3 = this;
|
|
18911
18857
|
|
|
18912
18858
|
var customFields = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
18913
|
-
this.logAttempt(paymentMethod$
|
|
18859
|
+
this.logAttempt(paymentMethod$4);
|
|
18914
18860
|
var chargeParams = {
|
|
18915
18861
|
pin: encrypt(this.card.pin),
|
|
18916
18862
|
trans: this.id,
|
|
@@ -18920,8 +18866,8 @@ var Paystack = (function (exports) {
|
|
|
18920
18866
|
subscription: this.subscription,
|
|
18921
18867
|
customFields: customFields
|
|
18922
18868
|
};
|
|
18923
|
-
return CardAPI.charge(chargeParams).then(function (response) {
|
|
18924
|
-
_this3.logAPIResponse(response, paymentMethod$
|
|
18869
|
+
return CardAPI$1.charge(chargeParams).then(function (response) {
|
|
18870
|
+
_this3.logAPIResponse(response, paymentMethod$4);
|
|
18925
18871
|
|
|
18926
18872
|
return response;
|
|
18927
18873
|
});
|
|
@@ -18933,7 +18879,7 @@ var Paystack = (function (exports) {
|
|
|
18933
18879
|
authorizationCode = _ref.authorizationCode,
|
|
18934
18880
|
cardLast4 = _ref.cardLast4,
|
|
18935
18881
|
pin = _ref.pin;
|
|
18936
|
-
this.logAttempt(paymentMethod$
|
|
18882
|
+
this.logAttempt(paymentMethod$4);
|
|
18937
18883
|
var encryptedPin = encrypt(pin);
|
|
18938
18884
|
var chargeParams = {
|
|
18939
18885
|
authorizationCode: authorizationCode,
|
|
@@ -18945,8 +18891,8 @@ var Paystack = (function (exports) {
|
|
|
18945
18891
|
transactionType: this.transactionType,
|
|
18946
18892
|
subscription: this.subscription
|
|
18947
18893
|
};
|
|
18948
|
-
return CardAPI.chargeRememberedCard(chargeParams).then(function (response) {
|
|
18949
|
-
_this4.logAPIResponse(response, paymentMethod$
|
|
18894
|
+
return CardAPI$1.chargeRememberedCard(chargeParams).then(function (response) {
|
|
18895
|
+
_this4.logAPIResponse(response, paymentMethod$4);
|
|
18950
18896
|
|
|
18951
18897
|
return response;
|
|
18952
18898
|
});
|
|
@@ -18964,8 +18910,8 @@ var Paystack = (function (exports) {
|
|
|
18964
18910
|
device: this.deviceFingerprint
|
|
18965
18911
|
});
|
|
18966
18912
|
|
|
18967
|
-
return CardAPI.resumeCardCharge(params).then(function (response) {
|
|
18968
|
-
_this5.logAPIResponse(response, paymentMethod$
|
|
18913
|
+
return CardAPI$1.resumeCardCharge(params).then(function (response) {
|
|
18914
|
+
_this5.logAPIResponse(response, paymentMethod$4);
|
|
18969
18915
|
|
|
18970
18916
|
return response;
|
|
18971
18917
|
});
|
|
@@ -18977,8 +18923,8 @@ var Paystack = (function (exports) {
|
|
|
18977
18923
|
authorizationId: authorizationId,
|
|
18978
18924
|
publicKey: this.merchant.key
|
|
18979
18925
|
};
|
|
18980
|
-
return CardAPI.forgetRememberedCard(params).then(function (response) {
|
|
18981
|
-
_this6.logAPIResponse(response, paymentMethod$
|
|
18926
|
+
return CardAPI$1.forgetRememberedCard(params).then(function (response) {
|
|
18927
|
+
_this6.logAPIResponse(response, paymentMethod$4);
|
|
18982
18928
|
|
|
18983
18929
|
return response;
|
|
18984
18930
|
});
|
|
@@ -18986,8 +18932,8 @@ var Paystack = (function (exports) {
|
|
|
18986
18932
|
authenticateCard: function authenticateCard(token) {
|
|
18987
18933
|
var _this7 = this;
|
|
18988
18934
|
|
|
18989
|
-
return CardAPI.authenticate(this.id, token).then(function (response) {
|
|
18990
|
-
_this7.logAPIResponse(response, paymentMethod$
|
|
18935
|
+
return CardAPI$1.authenticate(this.id, token).then(function (response) {
|
|
18936
|
+
_this7.logAPIResponse(response, paymentMethod$4);
|
|
18991
18937
|
|
|
18992
18938
|
return response;
|
|
18993
18939
|
});
|
|
@@ -19006,8 +18952,8 @@ var Paystack = (function (exports) {
|
|
|
19006
18952
|
zipCode: zipCode,
|
|
19007
18953
|
transactionId: this.id
|
|
19008
18954
|
};
|
|
19009
|
-
return CardAPI.verifyAddress(payload).then(function (response) {
|
|
19010
|
-
_this8.logAPIResponse(response, paymentMethod$
|
|
18955
|
+
return CardAPI$1.verifyAddress(payload).then(function (response) {
|
|
18956
|
+
_this8.logAPIResponse(response, paymentMethod$4);
|
|
19011
18957
|
|
|
19012
18958
|
return response;
|
|
19013
18959
|
});
|
|
@@ -19015,12 +18961,12 @@ var Paystack = (function (exports) {
|
|
|
19015
18961
|
listenFor3DSCharge: function listenFor3DSCharge(callback) {
|
|
19016
18962
|
var listenerOptions = {
|
|
19017
18963
|
channel: "3DS_".concat(this.id),
|
|
19018
|
-
paymentMethod: paymentMethod$
|
|
18964
|
+
paymentMethod: paymentMethod$4
|
|
19019
18965
|
};
|
|
19020
18966
|
return this.listenForCharge(listenerOptions, callback);
|
|
19021
18967
|
},
|
|
19022
18968
|
requestSavedCardsOTP: function requestSavedCardsOTP(phoneNumber) {
|
|
19023
|
-
return CardAPI.requestSavedCardsOTP(phoneNumber);
|
|
18969
|
+
return CardAPI$1.requestSavedCardsOTP(phoneNumber);
|
|
19024
18970
|
},
|
|
19025
18971
|
verifySavedCardsOtp: function verifySavedCardsOtp(_ref4) {
|
|
19026
18972
|
var _this9 = this;
|
|
@@ -19039,7 +18985,7 @@ var Paystack = (function (exports) {
|
|
|
19039
18985
|
};
|
|
19040
18986
|
_context.prev = 2;
|
|
19041
18987
|
_context.next = 5;
|
|
19042
|
-
return CardAPI.verifySavedCardsOtp(payload);
|
|
18988
|
+
return CardAPI$1.verifySavedCardsOtp(payload);
|
|
19043
18989
|
|
|
19044
18990
|
case 5:
|
|
19045
18991
|
response = _context.sent;
|
|
@@ -19061,19 +19007,19 @@ var Paystack = (function (exports) {
|
|
|
19061
19007
|
}))();
|
|
19062
19008
|
},
|
|
19063
19009
|
getSavedCards: function getSavedCards() {
|
|
19064
|
-
return CardAPI.getSavedCards({
|
|
19010
|
+
return CardAPI$1.getSavedCards({
|
|
19065
19011
|
token: this.savedCardsToken
|
|
19066
19012
|
});
|
|
19067
19013
|
},
|
|
19068
19014
|
deleteSavedCard: function deleteSavedCard(cardCode) {
|
|
19069
|
-
return CardAPI.deleteSavedCard({
|
|
19015
|
+
return CardAPI$1.deleteSavedCard({
|
|
19070
19016
|
cardCode: cardCode,
|
|
19071
19017
|
token: this.savedCardsToken
|
|
19072
19018
|
});
|
|
19073
19019
|
},
|
|
19074
19020
|
chargeSavedCard: function chargeSavedCard(_ref5) {
|
|
19075
19021
|
var cardCode = _ref5.cardCode;
|
|
19076
|
-
return CardAPI.chargeSavedCard({
|
|
19022
|
+
return CardAPI$1.chargeSavedCard({
|
|
19077
19023
|
cardCode: cardCode,
|
|
19078
19024
|
transaction: this.id,
|
|
19079
19025
|
token: this.savedCardsToken,
|
|
@@ -19232,9 +19178,9 @@ var Paystack = (function (exports) {
|
|
|
19232
19178
|
}
|
|
19233
19179
|
};
|
|
19234
19180
|
|
|
19235
|
-
var paymentMethod$
|
|
19181
|
+
var paymentMethod$3 = 'bank account';
|
|
19236
19182
|
|
|
19237
|
-
function validate$
|
|
19183
|
+
function validate$3(bankAccount, isSetter) {
|
|
19238
19184
|
return new Promise(function (resolve, reject) {
|
|
19239
19185
|
var validation = BankAccount.validate(bankAccount);
|
|
19240
19186
|
|
|
@@ -19252,15 +19198,15 @@ var Paystack = (function (exports) {
|
|
|
19252
19198
|
setBankAccount: function setBankAccount(params) {
|
|
19253
19199
|
var _this = this;
|
|
19254
19200
|
|
|
19255
|
-
return validate$
|
|
19201
|
+
return validate$3(params, true).then(function () {
|
|
19256
19202
|
_this.bankAccount = new BankAccount(params);
|
|
19257
19203
|
});
|
|
19258
19204
|
},
|
|
19259
19205
|
chargeBankAccount: function chargeBankAccount() {
|
|
19260
19206
|
var _this2 = this;
|
|
19261
19207
|
|
|
19262
|
-
return validate$
|
|
19263
|
-
_this2.logAttempt(paymentMethod$
|
|
19208
|
+
return validate$3(this.bankAccount).then(function () {
|
|
19209
|
+
_this2.logAttempt(paymentMethod$3);
|
|
19264
19210
|
|
|
19265
19211
|
var verifyParams = {
|
|
19266
19212
|
bankId: _this2.bankAccount.bankId,
|
|
@@ -19269,7 +19215,7 @@ var Paystack = (function (exports) {
|
|
|
19269
19215
|
device: _this2.deviceFingerprint
|
|
19270
19216
|
};
|
|
19271
19217
|
return EMandateAPI.verify(verifyParams).then(function (response) {
|
|
19272
|
-
_this2.logAPIResponse(response, paymentMethod$
|
|
19218
|
+
_this2.logAPIResponse(response, paymentMethod$3);
|
|
19273
19219
|
|
|
19274
19220
|
return response;
|
|
19275
19221
|
});
|
|
@@ -19278,7 +19224,7 @@ var Paystack = (function (exports) {
|
|
|
19278
19224
|
registerBankAccount: function registerBankAccount(birthday) {
|
|
19279
19225
|
var _this3 = this;
|
|
19280
19226
|
|
|
19281
|
-
return validate$
|
|
19227
|
+
return validate$3(this.bankAccount).then(function () {
|
|
19282
19228
|
var registerParams = {
|
|
19283
19229
|
bankId: _this3.bankAccount.bankId,
|
|
19284
19230
|
transactionId: _this3.id,
|
|
@@ -19286,7 +19232,7 @@ var Paystack = (function (exports) {
|
|
|
19286
19232
|
birthday: birthday
|
|
19287
19233
|
};
|
|
19288
19234
|
return EMandateAPI.register(registerParams).then(function (response) {
|
|
19289
|
-
_this3.logAPIResponse(response, paymentMethod$
|
|
19235
|
+
_this3.logAPIResponse(response, paymentMethod$3);
|
|
19290
19236
|
|
|
19291
19237
|
return response;
|
|
19292
19238
|
});
|
|
@@ -19295,7 +19241,7 @@ var Paystack = (function (exports) {
|
|
|
19295
19241
|
authenticateBankAccount: function authenticateBankAccount(token) {
|
|
19296
19242
|
var _this4 = this;
|
|
19297
19243
|
|
|
19298
|
-
return validate$
|
|
19244
|
+
return validate$3(this.bankAccount).then(function () {
|
|
19299
19245
|
var chargeParams = {
|
|
19300
19246
|
bankId: _this4.bankAccount.bankId,
|
|
19301
19247
|
transactionId: _this4.id,
|
|
@@ -19303,7 +19249,7 @@ var Paystack = (function (exports) {
|
|
|
19303
19249
|
device: _this4.deviceFingerprint
|
|
19304
19250
|
};
|
|
19305
19251
|
return EMandateAPI.authenticate(chargeParams).then(function (response) {
|
|
19306
|
-
_this4.logAPIResponse(response, paymentMethod$
|
|
19252
|
+
_this4.logAPIResponse(response, paymentMethod$3);
|
|
19307
19253
|
|
|
19308
19254
|
return response;
|
|
19309
19255
|
});
|
|
@@ -19364,7 +19310,7 @@ var Paystack = (function (exports) {
|
|
|
19364
19310
|
}
|
|
19365
19311
|
};
|
|
19366
19312
|
|
|
19367
|
-
var paymentMethod$
|
|
19313
|
+
var paymentMethod$2 = 'bank';
|
|
19368
19314
|
var DigitalBankMandate = {
|
|
19369
19315
|
chargeDigitalBankMandate: function chargeDigitalBankMandate(_ref) {
|
|
19370
19316
|
var _this = this;
|
|
@@ -19379,7 +19325,7 @@ var Paystack = (function (exports) {
|
|
|
19379
19325
|
bankId: bankId
|
|
19380
19326
|
};
|
|
19381
19327
|
return DigitalBankMandateAPI.charge(params).then(function (response) {
|
|
19382
|
-
_this.logAPIResponse(response, paymentMethod$
|
|
19328
|
+
_this.logAPIResponse(response, paymentMethod$2);
|
|
19383
19329
|
|
|
19384
19330
|
return response;
|
|
19385
19331
|
});
|
|
@@ -19387,7 +19333,7 @@ var Paystack = (function (exports) {
|
|
|
19387
19333
|
listenForDigitalBankMandateCharge: function listenForDigitalBankMandateCharge(callback) {
|
|
19388
19334
|
var pusherChannel = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
19389
19335
|
var listenerOptions = {
|
|
19390
|
-
paymentMethod: paymentMethod$
|
|
19336
|
+
paymentMethod: paymentMethod$2,
|
|
19391
19337
|
channel: pusherChannel
|
|
19392
19338
|
};
|
|
19393
19339
|
return this.listenForCharge(listenerOptions, callback);
|
|
@@ -19520,7 +19466,7 @@ var Paystack = (function (exports) {
|
|
|
19520
19466
|
}
|
|
19521
19467
|
};
|
|
19522
19468
|
|
|
19523
|
-
function validate$
|
|
19469
|
+
function validate$2(channel) {
|
|
19524
19470
|
return new Promise(function (resolve, reject) {
|
|
19525
19471
|
var allowedChannels = ['visa', 'MPASS_OLTI'];
|
|
19526
19472
|
|
|
@@ -19538,7 +19484,7 @@ var Paystack = (function (exports) {
|
|
|
19538
19484
|
var _this = this;
|
|
19539
19485
|
|
|
19540
19486
|
var channel = _ref.channel;
|
|
19541
|
-
return validate$
|
|
19487
|
+
return validate$2(channel).then(function () {
|
|
19542
19488
|
if (_this.qr[channel]) {
|
|
19543
19489
|
return _this.qr[channel];
|
|
19544
19490
|
}
|
|
@@ -19560,7 +19506,7 @@ var Paystack = (function (exports) {
|
|
|
19560
19506
|
var _this2 = this;
|
|
19561
19507
|
|
|
19562
19508
|
var channel = _ref2.channel;
|
|
19563
|
-
return validate$
|
|
19509
|
+
return validate$2(channel).then(function () {
|
|
19564
19510
|
if (!_this2.qr[channel]) {
|
|
19565
19511
|
return Promise.reject(Error('Please generate qr code with Transaction.getQRCode()'));
|
|
19566
19512
|
}
|
|
@@ -19681,7 +19627,7 @@ var Paystack = (function (exports) {
|
|
|
19681
19627
|
}
|
|
19682
19628
|
};
|
|
19683
19629
|
|
|
19684
|
-
function validate(phoneNumber) {
|
|
19630
|
+
function validate$1(phoneNumber) {
|
|
19685
19631
|
return new Promise(function (resolve, reject) {
|
|
19686
19632
|
var validation = PhoneNumber.validate(phoneNumber);
|
|
19687
19633
|
|
|
@@ -19702,7 +19648,7 @@ var Paystack = (function (exports) {
|
|
|
19702
19648
|
provider = _ref.provider,
|
|
19703
19649
|
voucher = _ref.voucher,
|
|
19704
19650
|
registrationToken = _ref.registrationToken;
|
|
19705
|
-
return validate(phoneNumber).then(function () {
|
|
19651
|
+
return validate$1(phoneNumber).then(function () {
|
|
19706
19652
|
_this.logAttempt('mobile money');
|
|
19707
19653
|
|
|
19708
19654
|
var params = {
|
|
@@ -19733,7 +19679,7 @@ var Paystack = (function (exports) {
|
|
|
19733
19679
|
var phoneNumber = payload.phoneNumber,
|
|
19734
19680
|
provider = payload.provider,
|
|
19735
19681
|
registrationToken = payload.registrationToken;
|
|
19736
|
-
return validate(phoneNumber).then(function () {
|
|
19682
|
+
return validate$1(phoneNumber).then(function () {
|
|
19737
19683
|
_this2.logMobileMoneyActions(payload);
|
|
19738
19684
|
|
|
19739
19685
|
var params = {
|
|
@@ -19873,7 +19819,7 @@ var Paystack = (function (exports) {
|
|
|
19873
19819
|
}
|
|
19874
19820
|
};
|
|
19875
19821
|
|
|
19876
|
-
var paymentMethod = 'direct debit';
|
|
19822
|
+
var paymentMethod$1 = 'direct debit';
|
|
19877
19823
|
var DirectDebitCharge = {
|
|
19878
19824
|
loginToDirectDebitAccount: function loginToDirectDebitAccount(_ref) {
|
|
19879
19825
|
var _this = this;
|
|
@@ -19919,14 +19865,14 @@ var Paystack = (function (exports) {
|
|
|
19919
19865
|
return Promise.reject(Error('Please login with Transaction.loginToDirectDebitAccount() to start a Direct debit charge'));
|
|
19920
19866
|
}
|
|
19921
19867
|
|
|
19922
|
-
this.logAttempt(paymentMethod);
|
|
19868
|
+
this.logAttempt(paymentMethod$1);
|
|
19923
19869
|
var params = {
|
|
19924
19870
|
account_code: accountCode,
|
|
19925
19871
|
transaction: this.id,
|
|
19926
19872
|
token: this.directDebit.token
|
|
19927
19873
|
};
|
|
19928
19874
|
return DirectDebitAPI.charge(params).then(function (response) {
|
|
19929
|
-
_this2.logAPIResponse(response, paymentMethod);
|
|
19875
|
+
_this2.logAPIResponse(response, paymentMethod$1);
|
|
19930
19876
|
|
|
19931
19877
|
if (response.status) {
|
|
19932
19878
|
_this2.directDebit.chargeResponse = response;
|
|
@@ -19939,7 +19885,7 @@ var Paystack = (function (exports) {
|
|
|
19939
19885
|
var _this3 = this;
|
|
19940
19886
|
|
|
19941
19887
|
return DirectDebitAPI.getProvisionedAccounts(this.directDebit.token).then(function (response) {
|
|
19942
|
-
_this3.logAPIResponse(response, paymentMethod);
|
|
19888
|
+
_this3.logAPIResponse(response, paymentMethod$1);
|
|
19943
19889
|
|
|
19944
19890
|
var status = response.status,
|
|
19945
19891
|
data = response.data;
|
|
@@ -19964,7 +19910,7 @@ var Paystack = (function (exports) {
|
|
|
19964
19910
|
token: this.directDebit.token
|
|
19965
19911
|
};
|
|
19966
19912
|
return DirectDebitAPI.authenticate(params).then(function (response) {
|
|
19967
|
-
_this4.logAPIResponse(response, paymentMethod);
|
|
19913
|
+
_this4.logAPIResponse(response, paymentMethod$1);
|
|
19968
19914
|
|
|
19969
19915
|
return response;
|
|
19970
19916
|
});
|
|
@@ -20750,6 +20696,417 @@ var Paystack = (function (exports) {
|
|
|
20750
20696
|
return Toolkit;
|
|
20751
20697
|
}();
|
|
20752
20698
|
|
|
20699
|
+
cardValidator.creditCardType.addCard({
|
|
20700
|
+
niceType: 'Verve',
|
|
20701
|
+
type: 'verve',
|
|
20702
|
+
patterns: [[506000, 507999], [650000, 650009]],
|
|
20703
|
+
gaps: [4, 8, 12, 16],
|
|
20704
|
+
lengths: [16, 18, 19],
|
|
20705
|
+
code: {
|
|
20706
|
+
name: 'CVV',
|
|
20707
|
+
size: 3
|
|
20708
|
+
}
|
|
20709
|
+
});
|
|
20710
|
+
cardValidator.creditCardType.changeOrder('verve', 0);
|
|
20711
|
+
|
|
20712
|
+
var Card = /*#__PURE__*/function () {
|
|
20713
|
+
function Card(_ref) {
|
|
20714
|
+
var number = _ref.number,
|
|
20715
|
+
cvv = _ref.cvv,
|
|
20716
|
+
month = _ref.month,
|
|
20717
|
+
year = _ref.year,
|
|
20718
|
+
pin = _ref.pin;
|
|
20719
|
+
|
|
20720
|
+
_classCallCheck(this, Card);
|
|
20721
|
+
|
|
20722
|
+
this.number = number;
|
|
20723
|
+
this.cvv = cvv;
|
|
20724
|
+
this.month = month;
|
|
20725
|
+
this.year = year;
|
|
20726
|
+
this.pin = pin;
|
|
20727
|
+
}
|
|
20728
|
+
|
|
20729
|
+
_createClass(Card, [{
|
|
20730
|
+
key: "getEncryptedPin",
|
|
20731
|
+
value: function getEncryptedPin() {
|
|
20732
|
+
return Card$2.getEncryptedPin(this.pin);
|
|
20733
|
+
}
|
|
20734
|
+
}, {
|
|
20735
|
+
key: "getLast4",
|
|
20736
|
+
value: function getLast4() {
|
|
20737
|
+
return Card$2.getLast4(this.number);
|
|
20738
|
+
}
|
|
20739
|
+
}, {
|
|
20740
|
+
key: "tokenize",
|
|
20741
|
+
value: function tokenize() {
|
|
20742
|
+
return Card$2.tokenize({
|
|
20743
|
+
number: this.number,
|
|
20744
|
+
cvv: this.cvv,
|
|
20745
|
+
month: this.month,
|
|
20746
|
+
year: this.year
|
|
20747
|
+
});
|
|
20748
|
+
}
|
|
20749
|
+
}], [{
|
|
20750
|
+
key: "getType",
|
|
20751
|
+
value: function getType(value) {
|
|
20752
|
+
return Card$2.getType(value);
|
|
20753
|
+
}
|
|
20754
|
+
}, {
|
|
20755
|
+
key: "validate",
|
|
20756
|
+
value: function validate(_ref2) {
|
|
20757
|
+
var number = _ref2.number,
|
|
20758
|
+
cvv = _ref2.cvv,
|
|
20759
|
+
month = _ref2.month,
|
|
20760
|
+
year = _ref2.year;
|
|
20761
|
+
return Card$2.validate({
|
|
20762
|
+
number: number,
|
|
20763
|
+
cvv: cvv,
|
|
20764
|
+
month: month,
|
|
20765
|
+
year: year
|
|
20766
|
+
});
|
|
20767
|
+
}
|
|
20768
|
+
}, {
|
|
20769
|
+
key: "validateNumber",
|
|
20770
|
+
value: function validateNumber(value) {
|
|
20771
|
+
return Card$2.validateNumber(value);
|
|
20772
|
+
}
|
|
20773
|
+
}, {
|
|
20774
|
+
key: "isNumberValid",
|
|
20775
|
+
value: function isNumberValid(value) {
|
|
20776
|
+
return Card$2.isNumberValid(value);
|
|
20777
|
+
}
|
|
20778
|
+
}, {
|
|
20779
|
+
key: "validateCVV",
|
|
20780
|
+
value: function validateCVV(cvv, cardType) {
|
|
20781
|
+
return Card$2.validateCVV(cvv, cardType);
|
|
20782
|
+
}
|
|
20783
|
+
}, {
|
|
20784
|
+
key: "isCvvValid",
|
|
20785
|
+
value: function isCvvValid(cvv, cardType) {
|
|
20786
|
+
return Card$2.isCvvValid(cvv, cardType);
|
|
20787
|
+
}
|
|
20788
|
+
}, {
|
|
20789
|
+
key: "validateExpiry",
|
|
20790
|
+
value: function validateExpiry(value) {
|
|
20791
|
+
return Card$2.validateExpiry(value);
|
|
20792
|
+
}
|
|
20793
|
+
}, {
|
|
20794
|
+
key: "isExpiryValid",
|
|
20795
|
+
value: function isExpiryValid(value) {
|
|
20796
|
+
return Card$2.isExpiryValid(value);
|
|
20797
|
+
}
|
|
20798
|
+
}, {
|
|
20799
|
+
key: "generateTestCard",
|
|
20800
|
+
value: function generateTestCard(cardType) {
|
|
20801
|
+
var type = cardType || 'default';
|
|
20802
|
+
var cardParams = testCards.find(function (card) {
|
|
20803
|
+
return card.type === type;
|
|
20804
|
+
});
|
|
20805
|
+
return new Card(cardParams);
|
|
20806
|
+
}
|
|
20807
|
+
}]);
|
|
20808
|
+
|
|
20809
|
+
return Card;
|
|
20810
|
+
}();
|
|
20811
|
+
|
|
20812
|
+
var CardAPI = {
|
|
20813
|
+
reserve: function reserve(_ref) {
|
|
20814
|
+
var clientdata = _ref.clientdata,
|
|
20815
|
+
last4 = _ref.last4,
|
|
20816
|
+
preauthorizationId = _ref.preauthorizationId;
|
|
20817
|
+
var url = "".concat(configToUse.paystackApiUrl, "preauthorization/reserve");
|
|
20818
|
+
var language = getLanguage();
|
|
20819
|
+
|
|
20820
|
+
var headers = _objectSpread2({}, language && {
|
|
20821
|
+
'Accept-Language': language
|
|
20822
|
+
});
|
|
20823
|
+
|
|
20824
|
+
return axiosInstance.post(url, {
|
|
20825
|
+
clientdata: clientdata,
|
|
20826
|
+
last4: last4,
|
|
20827
|
+
preauthorization: preauthorizationId
|
|
20828
|
+
}, {
|
|
20829
|
+
headers: headers
|
|
20830
|
+
}).then(function (response) {
|
|
20831
|
+
return ChargeResponses.parse(response.data);
|
|
20832
|
+
});
|
|
20833
|
+
} // charge({
|
|
20834
|
+
// clientdata,
|
|
20835
|
+
// last4,
|
|
20836
|
+
// pin,
|
|
20837
|
+
// trans,
|
|
20838
|
+
// device,
|
|
20839
|
+
// rememberCard,
|
|
20840
|
+
// transactionType,
|
|
20841
|
+
// subscription,
|
|
20842
|
+
// customFields,
|
|
20843
|
+
// }) {
|
|
20844
|
+
// const url = `${config.paymentBaseUrl}charge/`;
|
|
20845
|
+
// const language = getLanguage();
|
|
20846
|
+
// const headers = {
|
|
20847
|
+
// 'Content-Type': 'application/x-www-form-urlencoded',
|
|
20848
|
+
// ...(language && { 'Accept-Language': language }),
|
|
20849
|
+
// };
|
|
20850
|
+
// const chargeParams = {
|
|
20851
|
+
// clientdata,
|
|
20852
|
+
// last4,
|
|
20853
|
+
// trans,
|
|
20854
|
+
// device,
|
|
20855
|
+
// offset: new Date().getTimezoneOffset(),
|
|
20856
|
+
// remember_card: rememberCard,
|
|
20857
|
+
// ...(transactionType && { transaction_type: transactionType }),
|
|
20858
|
+
// ...(subscription && { subscription }),
|
|
20859
|
+
// ...(customFields && customFields),
|
|
20860
|
+
// };
|
|
20861
|
+
// if (pin) {
|
|
20862
|
+
// chargeParams.handle = pin;
|
|
20863
|
+
// }
|
|
20864
|
+
// const urlEncodedParams = formurlencoded(chargeParams);
|
|
20865
|
+
// return axiosInstance
|
|
20866
|
+
// .post(url, urlEncodedParams, { headers })
|
|
20867
|
+
// .then((response) => ChargeResponses.parse(response.data));
|
|
20868
|
+
// },
|
|
20869
|
+
// resumeCardCharge({ device, accessCode, pin }) {
|
|
20870
|
+
// const url = `${config.paymentBaseUrl}charge/resume/${accessCode}`;
|
|
20871
|
+
// const language = getLanguage();
|
|
20872
|
+
// const headers = {
|
|
20873
|
+
// 'Content-Type': 'application/x-www-form-urlencoded',
|
|
20874
|
+
// ...(language && { 'Accept-Language': language }),
|
|
20875
|
+
// };
|
|
20876
|
+
// const data = { device, ...(pin && { handle: pin }) };
|
|
20877
|
+
// const urlEncodedData = formurlencoded(data);
|
|
20878
|
+
// return axiosInstance
|
|
20879
|
+
// .post(url, urlEncodedData, { headers })
|
|
20880
|
+
// .then((response) => ChargeResponses.parse(response.data));
|
|
20881
|
+
// },
|
|
20882
|
+
// chargeRememberedCard({
|
|
20883
|
+
// last4,
|
|
20884
|
+
// trans,
|
|
20885
|
+
// device,
|
|
20886
|
+
// authorizationCode,
|
|
20887
|
+
// cvv,
|
|
20888
|
+
// pin,
|
|
20889
|
+
// transactionType,
|
|
20890
|
+
// subscription,
|
|
20891
|
+
// }) {
|
|
20892
|
+
// const url = `${config.paymentBaseUrl}charge/`;
|
|
20893
|
+
// const language = getLanguage();
|
|
20894
|
+
// const headers = {
|
|
20895
|
+
// 'Content-Type': 'application/x-www-form-urlencoded',
|
|
20896
|
+
// ...(language && { 'Accept-Language': language }),
|
|
20897
|
+
// };
|
|
20898
|
+
// const chargeParams = {
|
|
20899
|
+
// last4,
|
|
20900
|
+
// trans,
|
|
20901
|
+
// device,
|
|
20902
|
+
// cvv,
|
|
20903
|
+
// handle: pin,
|
|
20904
|
+
// authorization_code: authorizationCode,
|
|
20905
|
+
// ...(transactionType && { transaction_type: transactionType }),
|
|
20906
|
+
// ...(subscription && { subscription }),
|
|
20907
|
+
// };
|
|
20908
|
+
// const urlEncodedParams = formurlencoded(chargeParams);
|
|
20909
|
+
// return axiosInstance
|
|
20910
|
+
// .post(url, urlEncodedParams, { headers })
|
|
20911
|
+
// .then((response) => ChargeResponses.parse(response.data));
|
|
20912
|
+
// },
|
|
20913
|
+
// verifyAddress({ address, city, state, zipCode, transactionId }) {
|
|
20914
|
+
// const url = `${config.paymentBaseUrl}charge/avs`;
|
|
20915
|
+
// const language = getLanguage();
|
|
20916
|
+
// const headers = {
|
|
20917
|
+
// 'Content-Type': 'application/x-www-form-urlencoded',
|
|
20918
|
+
// ...(language && { 'Accept-Language': language }),
|
|
20919
|
+
// };
|
|
20920
|
+
// const data = {
|
|
20921
|
+
// city,
|
|
20922
|
+
// state,
|
|
20923
|
+
// address,
|
|
20924
|
+
// zip_code: zipCode,
|
|
20925
|
+
// trans: transactionId,
|
|
20926
|
+
// };
|
|
20927
|
+
// const urlEncodedData = formurlencoded(data);
|
|
20928
|
+
// return axiosInstance
|
|
20929
|
+
// .post(url, urlEncodedData, { headers })
|
|
20930
|
+
// .then((response) => ChargeResponses.parse(response.data));
|
|
20931
|
+
// },
|
|
20932
|
+
// forgetRememberedCard({ authorizationId, publicKey }) {
|
|
20933
|
+
// const language = getLanguage();
|
|
20934
|
+
// const headers = {
|
|
20935
|
+
// Authorization: `Bearer ${publicKey}`,
|
|
20936
|
+
// ...(language && { 'Accept-Language': language }),
|
|
20937
|
+
// };
|
|
20938
|
+
// const params = {
|
|
20939
|
+
// authorization_id: authorizationId,
|
|
20940
|
+
// };
|
|
20941
|
+
// const url = `${config.paystackApiUrl}rememberme/forget_card`;
|
|
20942
|
+
// return axiosInstance
|
|
20943
|
+
// .post(url, params, { headers })
|
|
20944
|
+
// .then((response) => ChargeResponses.parse(response.data));
|
|
20945
|
+
// },
|
|
20946
|
+
|
|
20947
|
+
};
|
|
20948
|
+
|
|
20949
|
+
var paymentMethod = 'card';
|
|
20950
|
+
|
|
20951
|
+
function validate(card, isSetter) {
|
|
20952
|
+
return new Promise(function (resolve, reject) {
|
|
20953
|
+
var validation = Card.validate(card);
|
|
20954
|
+
|
|
20955
|
+
if (!validation.isValid) {
|
|
20956
|
+
var throwValidation = isSetter || card.number;
|
|
20957
|
+
var errors = Object.keys(validation.result).filter(function (value) {
|
|
20958
|
+
return validation.result[value] === false;
|
|
20959
|
+
});
|
|
20960
|
+
var errorMessage = "Invalid card details: ".concat(errors.join(', '));
|
|
20961
|
+
reject(Error(throwValidation ? errorMessage : 'Please set a valid card with setCard()'));
|
|
20962
|
+
}
|
|
20963
|
+
|
|
20964
|
+
resolve();
|
|
20965
|
+
});
|
|
20966
|
+
}
|
|
20967
|
+
|
|
20968
|
+
var ReserveCardFunds = {
|
|
20969
|
+
setCard: function setCard(params) {
|
|
20970
|
+
var _this = this;
|
|
20971
|
+
|
|
20972
|
+
return validate(params, true).then(function () {
|
|
20973
|
+
_this.card = new Card(params);
|
|
20974
|
+
});
|
|
20975
|
+
},
|
|
20976
|
+
reserve: function reserve(preauthorizationId) {
|
|
20977
|
+
var _this2 = this;
|
|
20978
|
+
|
|
20979
|
+
var customFields = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
20980
|
+
// TODO: Log payment method
|
|
20981
|
+
// https://paystack.atlassian.net/browse/RAILS-3070
|
|
20982
|
+
return validate(this.card).then(function () {
|
|
20983
|
+
var chargeParams = {
|
|
20984
|
+
clientdata: _this2.card.tokenize(),
|
|
20985
|
+
last4: _this2.card.getLast4(),
|
|
20986
|
+
preauthorization: preauthorizationId,
|
|
20987
|
+
customFields: customFields
|
|
20988
|
+
};
|
|
20989
|
+
return CardAPI.charge(chargeParams).then(function (response) {
|
|
20990
|
+
// TODO: Log API Response
|
|
20991
|
+
// https://paystack.atlassian.net/browse/RAILS-3070
|
|
20992
|
+
return response;
|
|
20993
|
+
});
|
|
20994
|
+
});
|
|
20995
|
+
},
|
|
20996
|
+
listenFor3DSCharge: function listenFor3DSCharge(callback) {
|
|
20997
|
+
var listenerOptions = {
|
|
20998
|
+
channel: "3DS_".concat(this.id),
|
|
20999
|
+
paymentMethod: paymentMethod
|
|
21000
|
+
};
|
|
21001
|
+
return this.listenForCharge(listenerOptions, callback);
|
|
21002
|
+
} // rememberCard() {
|
|
21003
|
+
// this.remember_card = true;
|
|
21004
|
+
// },
|
|
21005
|
+
// chargeCard(customFields = {}) {
|
|
21006
|
+
// if (!this.card.number && this.card.pin) {
|
|
21007
|
+
// return this.chargeCardWithPin(customFields);
|
|
21008
|
+
// }
|
|
21009
|
+
// return validate(this.card).then(() => {
|
|
21010
|
+
// this.logAttempt(paymentMethod);
|
|
21011
|
+
// const chargeParams = {
|
|
21012
|
+
// clientdata: this.card.tokenize(),
|
|
21013
|
+
// last4: this.card.getLast4(),
|
|
21014
|
+
// pin: this.card.getEncryptedPin(),
|
|
21015
|
+
// trans: this.id,
|
|
21016
|
+
// device: this.deviceFingerprint,
|
|
21017
|
+
// rememberCard: this.remember_card,
|
|
21018
|
+
// transactionType: this.transactionType,
|
|
21019
|
+
// subscription: this.subscription,
|
|
21020
|
+
// customFields,
|
|
21021
|
+
// };
|
|
21022
|
+
// return CardAPI.charge(chargeParams).then((response) => {
|
|
21023
|
+
// this.logAPIResponse(response, paymentMethod);
|
|
21024
|
+
// return response;
|
|
21025
|
+
// });
|
|
21026
|
+
// });
|
|
21027
|
+
// },
|
|
21028
|
+
|
|
21029
|
+
/**
|
|
21030
|
+
* Handles submitting a card pin after
|
|
21031
|
+
* other card details have been previously submitted.
|
|
21032
|
+
*/
|
|
21033
|
+
// chargeCardWithPin(customFields = {}) {
|
|
21034
|
+
// this.logAttempt(paymentMethod);
|
|
21035
|
+
// const chargeParams = {
|
|
21036
|
+
// pin: encrypt(this.card.pin),
|
|
21037
|
+
// trans: this.id,
|
|
21038
|
+
// device: this.deviceFingerprint,
|
|
21039
|
+
// rememberCard: this.remember_card,
|
|
21040
|
+
// transactionType: this.transactionType,
|
|
21041
|
+
// subscription: this.subscription,
|
|
21042
|
+
// customFields,
|
|
21043
|
+
// };
|
|
21044
|
+
// return CardAPI.charge(chargeParams).then((response) => {
|
|
21045
|
+
// this.logAPIResponse(response, paymentMethod);
|
|
21046
|
+
// return response;
|
|
21047
|
+
// });
|
|
21048
|
+
// },
|
|
21049
|
+
// chargeRememberedCard({ cvv, authorizationCode, cardLast4, pin }) {
|
|
21050
|
+
// this.logAttempt(paymentMethod);
|
|
21051
|
+
// const encryptedPin = encrypt(pin);
|
|
21052
|
+
// const chargeParams = {
|
|
21053
|
+
// authorizationCode,
|
|
21054
|
+
// cvv,
|
|
21055
|
+
// last4: cardLast4,
|
|
21056
|
+
// trans: this.id,
|
|
21057
|
+
// device: this.deviceFingerprint,
|
|
21058
|
+
// pin: encryptedPin,
|
|
21059
|
+
// transactionType: this.transactionType,
|
|
21060
|
+
// subscription: this.subscription,
|
|
21061
|
+
// };
|
|
21062
|
+
// return CardAPI.chargeRememberedCard(chargeParams).then((response) => {
|
|
21063
|
+
// this.logAPIResponse(response, paymentMethod);
|
|
21064
|
+
// return response;
|
|
21065
|
+
// });
|
|
21066
|
+
// },
|
|
21067
|
+
// resumeCardCharge({ accessCode, pin }) {
|
|
21068
|
+
// const params = {
|
|
21069
|
+
// ...(pin && { pin: encrypt(pin) }),
|
|
21070
|
+
// accessCode,
|
|
21071
|
+
// device: this.deviceFingerprint,
|
|
21072
|
+
// };
|
|
21073
|
+
// return CardAPI.resumeCardCharge(params).then((response) => {
|
|
21074
|
+
// this.logAPIResponse(response, paymentMethod);
|
|
21075
|
+
// return response;
|
|
21076
|
+
// });
|
|
21077
|
+
// },
|
|
21078
|
+
// forgetRememberedCard(authorizationId) {
|
|
21079
|
+
// const params = {
|
|
21080
|
+
// authorizationId,
|
|
21081
|
+
// publicKey: this.merchant.key,
|
|
21082
|
+
// };
|
|
21083
|
+
// return CardAPI.forgetRememberedCard(params).then((response) => {
|
|
21084
|
+
// this.logAPIResponse(response, paymentMethod);
|
|
21085
|
+
// return response;
|
|
21086
|
+
// });
|
|
21087
|
+
// },
|
|
21088
|
+
// authenticateCard(token) {
|
|
21089
|
+
// return CardAPI.authenticate(this.id, token).then((response) => {
|
|
21090
|
+
// this.logAPIResponse(response, paymentMethod);
|
|
21091
|
+
// return response;
|
|
21092
|
+
// });
|
|
21093
|
+
// },
|
|
21094
|
+
// verifyAddress({ address, city, state, zipCode }) {
|
|
21095
|
+
// const payload = {
|
|
21096
|
+
// city,
|
|
21097
|
+
// state,
|
|
21098
|
+
// address,
|
|
21099
|
+
// zipCode,
|
|
21100
|
+
// transactionId: this.id,
|
|
21101
|
+
// };
|
|
21102
|
+
// return CardAPI.verifyAddress(payload).then((response) => {
|
|
21103
|
+
// this.logAPIResponse(response, paymentMethod);
|
|
21104
|
+
// return response;
|
|
21105
|
+
// });
|
|
21106
|
+
// },
|
|
21107
|
+
|
|
21108
|
+
};
|
|
21109
|
+
|
|
20753
21110
|
var PreauthorizationInstance = /*#__PURE__*/function () {
|
|
20754
21111
|
function PreauthorizationInstance(data) {
|
|
20755
21112
|
_classCallCheck(this, PreauthorizationInstance);
|
|
@@ -20769,8 +21126,10 @@ var Paystack = (function (exports) {
|
|
|
20769
21126
|
name: data.merchant_name,
|
|
20770
21127
|
key: data.merchant_key
|
|
20771
21128
|
};
|
|
20772
|
-
loadPusher(); // TODO:
|
|
20773
|
-
// https://paystack.atlassian.net/browse/RAILS-
|
|
21129
|
+
loadPusher(); // TODO: Analytics
|
|
21130
|
+
// https://paystack.atlassian.net/browse/RAILS-3070
|
|
21131
|
+
|
|
21132
|
+
Object.assign(this, ReserveCardFunds);
|
|
20774
21133
|
}
|
|
20775
21134
|
|
|
20776
21135
|
_createClass(PreauthorizationInstance, [{
|
|
@@ -20852,7 +21211,7 @@ var Paystack = (function (exports) {
|
|
|
20852
21211
|
};
|
|
20853
21212
|
|
|
20854
21213
|
exports.BankAccount = BankAccount;
|
|
20855
|
-
exports.Card = Card;
|
|
21214
|
+
exports.Card = Card$1;
|
|
20856
21215
|
exports.Preauthorization = Preauthorization;
|
|
20857
21216
|
exports.Toolkit = Toolkit;
|
|
20858
21217
|
exports.Transaction = Transaction;
|