@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/es/checkout.js
CHANGED
|
@@ -11643,7 +11643,7 @@ var PayattitudeAPI = {
|
|
|
11643
11643
|
}
|
|
11644
11644
|
};
|
|
11645
11645
|
|
|
11646
|
-
var paymentMethod$
|
|
11646
|
+
var paymentMethod$7 = 'payattitude';
|
|
11647
11647
|
var PayattitudeCharge = {
|
|
11648
11648
|
chargePayattitude: function chargePayattitude(_ref) {
|
|
11649
11649
|
var _this = this;
|
|
@@ -11654,7 +11654,7 @@ var PayattitudeCharge = {
|
|
|
11654
11654
|
phoneNumber: phoneNumber
|
|
11655
11655
|
};
|
|
11656
11656
|
return PayattitudeAPI.charge(params).then(function (response) {
|
|
11657
|
-
_this.logAPIResponse(response, paymentMethod$
|
|
11657
|
+
_this.logAPIResponse(response, paymentMethod$7);
|
|
11658
11658
|
|
|
11659
11659
|
return response;
|
|
11660
11660
|
});
|
|
@@ -11662,7 +11662,7 @@ var PayattitudeCharge = {
|
|
|
11662
11662
|
listenForPayattitudeCharge: function listenForPayattitudeCharge(callback) {
|
|
11663
11663
|
var pusherChannel = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
11664
11664
|
var listenerOptions = {
|
|
11665
|
-
paymentMethod: paymentMethod$
|
|
11665
|
+
paymentMethod: paymentMethod$7,
|
|
11666
11666
|
channel: pusherChannel
|
|
11667
11667
|
};
|
|
11668
11668
|
return this.listenForCharge(listenerOptions, callback);
|
|
@@ -11745,7 +11745,7 @@ var ApplePayAPI = {
|
|
|
11745
11745
|
}
|
|
11746
11746
|
};
|
|
11747
11747
|
|
|
11748
|
-
var paymentMethod$
|
|
11748
|
+
var paymentMethod$6 = 'apple pay';
|
|
11749
11749
|
var ApplePayCharge = {
|
|
11750
11750
|
validateApplePaySession: function validateApplePaySession(_ref) {
|
|
11751
11751
|
var _this = this;
|
|
@@ -11753,7 +11753,7 @@ var ApplePayCharge = {
|
|
|
11753
11753
|
var sessionUrl = _ref.sessionUrl,
|
|
11754
11754
|
displayName = _ref.displayName,
|
|
11755
11755
|
domainName = _ref.domainName;
|
|
11756
|
-
this.logAttempt(paymentMethod$
|
|
11756
|
+
this.logAttempt(paymentMethod$6);
|
|
11757
11757
|
return ApplePayAPI.validateApplePaySession({
|
|
11758
11758
|
sessionUrl: sessionUrl,
|
|
11759
11759
|
displayName: displayName,
|
|
@@ -11774,7 +11774,7 @@ var ApplePayCharge = {
|
|
|
11774
11774
|
device: this.deviceFingerprint,
|
|
11775
11775
|
paymentObject: paymentObject
|
|
11776
11776
|
}).then(function (response) {
|
|
11777
|
-
_this2.logAPIResponse(response, paymentMethod$
|
|
11777
|
+
_this2.logAPIResponse(response, paymentMethod$6);
|
|
11778
11778
|
|
|
11779
11779
|
return response;
|
|
11780
11780
|
});
|
|
@@ -11830,12 +11830,12 @@ var PayPalAPI = {
|
|
|
11830
11830
|
}
|
|
11831
11831
|
};
|
|
11832
11832
|
|
|
11833
|
-
var paymentMethod$
|
|
11833
|
+
var paymentMethod$5 = 'paypal';
|
|
11834
11834
|
var PayPalCharge = {
|
|
11835
11835
|
createPayPalOrder: function createPayPalOrder() {
|
|
11836
11836
|
var _this = this;
|
|
11837
11837
|
|
|
11838
|
-
this.logAttempt(paymentMethod$
|
|
11838
|
+
this.logAttempt(paymentMethod$5);
|
|
11839
11839
|
return PayPalAPI.createOrder(this.id).then(function (response) {
|
|
11840
11840
|
_this.logAPIResponseMessage(response.message);
|
|
11841
11841
|
|
|
@@ -11846,7 +11846,7 @@ var PayPalCharge = {
|
|
|
11846
11846
|
var _this2 = this;
|
|
11847
11847
|
|
|
11848
11848
|
return PayPalAPI.captureOrder(this.id).then(function (response) {
|
|
11849
|
-
_this2.logAPIResponse(response, paymentMethod$
|
|
11849
|
+
_this2.logAPIResponse(response, paymentMethod$5);
|
|
11850
11850
|
|
|
11851
11851
|
return response;
|
|
11852
11852
|
});
|
|
@@ -17234,6 +17234,27 @@ function encrypt(toEncrypt) {
|
|
|
17234
17234
|
return jsEncrypt.encrypt(toEncrypt);
|
|
17235
17235
|
}
|
|
17236
17236
|
|
|
17237
|
+
var $$2 = _export;
|
|
17238
|
+
var $find = arrayIteration.find;
|
|
17239
|
+
var addToUnscopables = addToUnscopables$3;
|
|
17240
|
+
|
|
17241
|
+
var FIND = 'find';
|
|
17242
|
+
var SKIPS_HOLES = true;
|
|
17243
|
+
|
|
17244
|
+
// Shouldn't skip holes
|
|
17245
|
+
if (FIND in []) Array(1)[FIND](function () { SKIPS_HOLES = false; });
|
|
17246
|
+
|
|
17247
|
+
// `Array.prototype.find` method
|
|
17248
|
+
// https://tc39.es/ecma262/#sec-array.prototype.find
|
|
17249
|
+
$$2({ target: 'Array', proto: true, forced: SKIPS_HOLES }, {
|
|
17250
|
+
find: function find(callbackfn /* , that = undefined */) {
|
|
17251
|
+
return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
|
|
17252
|
+
}
|
|
17253
|
+
});
|
|
17254
|
+
|
|
17255
|
+
// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
|
|
17256
|
+
addToUnscopables(FIND);
|
|
17257
|
+
|
|
17237
17258
|
/*
|
|
17238
17259
|
* Luhn algorithm implementation in JavaScript
|
|
17239
17260
|
* Copyright (c) 2009 Nicholas C. Zakas
|
|
@@ -18210,90 +18231,18 @@ var objectToArray = {
|
|
|
18210
18231
|
values: createMethod(false)
|
|
18211
18232
|
};
|
|
18212
18233
|
|
|
18213
|
-
var $$
|
|
18234
|
+
var $$1 = _export;
|
|
18214
18235
|
var $values = objectToArray.values;
|
|
18215
18236
|
|
|
18216
18237
|
// `Object.values` method
|
|
18217
18238
|
// https://tc39.es/ecma262/#sec-object.values
|
|
18218
|
-
$$
|
|
18239
|
+
$$1({ target: 'Object', stat: true }, {
|
|
18219
18240
|
values: function values(O) {
|
|
18220
18241
|
return $values(O);
|
|
18221
18242
|
}
|
|
18222
18243
|
});
|
|
18223
18244
|
|
|
18224
|
-
var
|
|
18225
|
-
var $find = arrayIteration.find;
|
|
18226
|
-
var addToUnscopables = addToUnscopables$3;
|
|
18227
|
-
|
|
18228
|
-
var FIND = 'find';
|
|
18229
|
-
var SKIPS_HOLES = true;
|
|
18230
|
-
|
|
18231
|
-
// Shouldn't skip holes
|
|
18232
|
-
if (FIND in []) Array(1)[FIND](function () { SKIPS_HOLES = false; });
|
|
18233
|
-
|
|
18234
|
-
// `Array.prototype.find` method
|
|
18235
|
-
// https://tc39.es/ecma262/#sec-array.prototype.find
|
|
18236
|
-
$$1({ target: 'Array', proto: true, forced: SKIPS_HOLES }, {
|
|
18237
|
-
find: function find(callbackfn /* , that = undefined */) {
|
|
18238
|
-
return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
|
|
18239
|
-
}
|
|
18240
|
-
});
|
|
18241
|
-
|
|
18242
|
-
// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
|
|
18243
|
-
addToUnscopables(FIND);
|
|
18244
|
-
|
|
18245
|
-
var testCards = [{
|
|
18246
|
-
type: 'bank_auth',
|
|
18247
|
-
name: 'Bank authorization',
|
|
18248
|
-
number: '4084080000000409',
|
|
18249
|
-
cvv: '000',
|
|
18250
|
-
month: '01',
|
|
18251
|
-
year: '30'
|
|
18252
|
-
}, {
|
|
18253
|
-
type: 'success',
|
|
18254
|
-
name: 'Success',
|
|
18255
|
-
number: '4084084084084081',
|
|
18256
|
-
cvv: '408',
|
|
18257
|
-
month: '12',
|
|
18258
|
-
year: '30'
|
|
18259
|
-
}, {
|
|
18260
|
-
type: 'declined',
|
|
18261
|
-
name: 'Declined',
|
|
18262
|
-
number: '4084080000005408',
|
|
18263
|
-
cvv: '001',
|
|
18264
|
-
month: '12',
|
|
18265
|
-
year: '30'
|
|
18266
|
-
}, {
|
|
18267
|
-
type: 'pin',
|
|
18268
|
-
name: 'Pin only validation',
|
|
18269
|
-
number: '507850785078507812',
|
|
18270
|
-
cvv: '884',
|
|
18271
|
-
month: '01',
|
|
18272
|
-
year: '30'
|
|
18273
|
-
}, {
|
|
18274
|
-
type: 'pin+otp',
|
|
18275
|
-
name: 'Pin and OTP validation',
|
|
18276
|
-
number: '5060666666666666666',
|
|
18277
|
-
cvv: '123',
|
|
18278
|
-
month: '01',
|
|
18279
|
-
year: '30'
|
|
18280
|
-
}, {
|
|
18281
|
-
type: 'pin+phone+otp',
|
|
18282
|
-
name: 'Pin, phone and OTP validation',
|
|
18283
|
-
number: '507850785078507812',
|
|
18284
|
-
cvv: '884',
|
|
18285
|
-
month: '01',
|
|
18286
|
-
year: '30'
|
|
18287
|
-
}, {
|
|
18288
|
-
type: 'default',
|
|
18289
|
-
name: 'No validation',
|
|
18290
|
-
number: '4084084084084081',
|
|
18291
|
-
cvv: '408',
|
|
18292
|
-
month: '01',
|
|
18293
|
-
year: '30'
|
|
18294
|
-
}];
|
|
18295
|
-
|
|
18296
|
-
var Card$1 = {
|
|
18245
|
+
var Card$2 = {
|
|
18297
18246
|
getEncryptedPin: function getEncryptedPin(pin) {
|
|
18298
18247
|
return pin ? encrypt(pin) : undefined;
|
|
18299
18248
|
},
|
|
@@ -18352,7 +18301,7 @@ var Card$1 = {
|
|
|
18352
18301
|
return cardValidator.number(value);
|
|
18353
18302
|
},
|
|
18354
18303
|
isNumberValid: function isNumberValid(value) {
|
|
18355
|
-
return Card$
|
|
18304
|
+
return Card$2.validateNumber(value).isValid;
|
|
18356
18305
|
},
|
|
18357
18306
|
validateCVV: function validateCVV(cvv, cardType) {
|
|
18358
18307
|
var isAmexCard = cardType === 'american-express';
|
|
@@ -18360,7 +18309,7 @@ var Card$1 = {
|
|
|
18360
18309
|
return cardValidator.cvv(cvv, cvvLength);
|
|
18361
18310
|
},
|
|
18362
18311
|
isCvvValid: function isCvvValid(cvv, cardType) {
|
|
18363
|
-
return Card$
|
|
18312
|
+
return Card$2.validateCVV(cvv, cardType).isValid;
|
|
18364
18313
|
},
|
|
18365
18314
|
validateExpiry: function validateExpiry(value) {
|
|
18366
18315
|
if (_typeof$1(value) === 'object') {
|
|
@@ -18372,14 +18321,7 @@ var Card$1 = {
|
|
|
18372
18321
|
return cardValidator.expirationDate(value);
|
|
18373
18322
|
},
|
|
18374
18323
|
isExpiryValid: function isExpiryValid(value) {
|
|
18375
|
-
return Card$
|
|
18376
|
-
},
|
|
18377
|
-
generateTestCard: function generateTestCard(cardType) {
|
|
18378
|
-
var type = cardType || 'default';
|
|
18379
|
-
var cardParams = testCards.find(function (card) {
|
|
18380
|
-
return card.type === type;
|
|
18381
|
-
});
|
|
18382
|
-
return new Card$1(cardParams);
|
|
18324
|
+
return Card$2.validateExpiry(value).isValid;
|
|
18383
18325
|
}
|
|
18384
18326
|
};
|
|
18385
18327
|
|
|
@@ -18396,7 +18338,7 @@ cardValidator.creditCardType.addCard({
|
|
|
18396
18338
|
});
|
|
18397
18339
|
cardValidator.creditCardType.changeOrder('verve', 0);
|
|
18398
18340
|
|
|
18399
|
-
var Card = /*#__PURE__*/function () {
|
|
18341
|
+
var Card$1 = /*#__PURE__*/function () {
|
|
18400
18342
|
function Card(_ref) {
|
|
18401
18343
|
var number = _ref.number,
|
|
18402
18344
|
cvv = _ref.cvv,
|
|
@@ -18416,17 +18358,17 @@ var Card = /*#__PURE__*/function () {
|
|
|
18416
18358
|
_createClass(Card, [{
|
|
18417
18359
|
key: "getEncryptedPin",
|
|
18418
18360
|
value: function getEncryptedPin() {
|
|
18419
|
-
return Card$
|
|
18361
|
+
return Card$2.getEncryptedPin(this.pin);
|
|
18420
18362
|
}
|
|
18421
18363
|
}, {
|
|
18422
18364
|
key: "getLast4",
|
|
18423
18365
|
value: function getLast4() {
|
|
18424
|
-
return Card$
|
|
18366
|
+
return Card$2.getLast4(this.number);
|
|
18425
18367
|
}
|
|
18426
18368
|
}, {
|
|
18427
18369
|
key: "tokenize",
|
|
18428
18370
|
value: function tokenize() {
|
|
18429
|
-
return Card$
|
|
18371
|
+
return Card$2.tokenize({
|
|
18430
18372
|
number: this.number,
|
|
18431
18373
|
cvv: this.cvv,
|
|
18432
18374
|
month: this.month,
|
|
@@ -18436,7 +18378,7 @@ var Card = /*#__PURE__*/function () {
|
|
|
18436
18378
|
}], [{
|
|
18437
18379
|
key: "getType",
|
|
18438
18380
|
value: function getType(value) {
|
|
18439
|
-
return Card$
|
|
18381
|
+
return Card$2.getType(value);
|
|
18440
18382
|
}
|
|
18441
18383
|
}, {
|
|
18442
18384
|
key: "validate",
|
|
@@ -18445,7 +18387,7 @@ var Card = /*#__PURE__*/function () {
|
|
|
18445
18387
|
cvv = _ref2.cvv,
|
|
18446
18388
|
month = _ref2.month,
|
|
18447
18389
|
year = _ref2.year;
|
|
18448
|
-
return Card$
|
|
18390
|
+
return Card$2.validate({
|
|
18449
18391
|
number: number,
|
|
18450
18392
|
cvv: cvv,
|
|
18451
18393
|
month: month,
|
|
@@ -18455,44 +18397,48 @@ var Card = /*#__PURE__*/function () {
|
|
|
18455
18397
|
}, {
|
|
18456
18398
|
key: "validateNumber",
|
|
18457
18399
|
value: function validateNumber(value) {
|
|
18458
|
-
return Card$
|
|
18400
|
+
return Card$2.validateNumber(value);
|
|
18459
18401
|
}
|
|
18460
18402
|
}, {
|
|
18461
18403
|
key: "isNumberValid",
|
|
18462
18404
|
value: function isNumberValid(value) {
|
|
18463
|
-
return Card$
|
|
18405
|
+
return Card$2.isNumberValid(value);
|
|
18464
18406
|
}
|
|
18465
18407
|
}, {
|
|
18466
18408
|
key: "validateCVV",
|
|
18467
18409
|
value: function validateCVV(cvv, cardType) {
|
|
18468
|
-
return Card$
|
|
18410
|
+
return Card$2.validateCVV(cvv, cardType);
|
|
18469
18411
|
}
|
|
18470
18412
|
}, {
|
|
18471
18413
|
key: "isCvvValid",
|
|
18472
18414
|
value: function isCvvValid(cvv, cardType) {
|
|
18473
|
-
return Card$
|
|
18415
|
+
return Card$2.isCvvValid(cvv, cardType);
|
|
18474
18416
|
}
|
|
18475
18417
|
}, {
|
|
18476
18418
|
key: "validateExpiry",
|
|
18477
18419
|
value: function validateExpiry(value) {
|
|
18478
|
-
return Card$
|
|
18420
|
+
return Card$2.validateExpiry(value);
|
|
18479
18421
|
}
|
|
18480
18422
|
}, {
|
|
18481
18423
|
key: "isExpiryValid",
|
|
18482
18424
|
value: function isExpiryValid(value) {
|
|
18483
|
-
return Card$
|
|
18425
|
+
return Card$2.isExpiryValid(value);
|
|
18484
18426
|
}
|
|
18485
18427
|
}, {
|
|
18486
18428
|
key: "generateTestCard",
|
|
18487
18429
|
value: function generateTestCard(cardType) {
|
|
18488
|
-
|
|
18430
|
+
var type = cardType || 'default';
|
|
18431
|
+
var cardParams = testCards.find(function (card) {
|
|
18432
|
+
return card.type === type;
|
|
18433
|
+
});
|
|
18434
|
+
return new Card(cardParams);
|
|
18489
18435
|
}
|
|
18490
18436
|
}]);
|
|
18491
18437
|
|
|
18492
18438
|
return Card;
|
|
18493
18439
|
}();
|
|
18494
18440
|
|
|
18495
|
-
var CardAPI = {
|
|
18441
|
+
var CardAPI$1 = {
|
|
18496
18442
|
charge: function charge(_ref) {
|
|
18497
18443
|
var clientdata = _ref.clientdata,
|
|
18498
18444
|
last4 = _ref.last4,
|
|
@@ -18838,11 +18784,11 @@ var CardAPI = {
|
|
|
18838
18784
|
}
|
|
18839
18785
|
};
|
|
18840
18786
|
|
|
18841
|
-
var paymentMethod$
|
|
18787
|
+
var paymentMethod$4 = 'card';
|
|
18842
18788
|
|
|
18843
|
-
function validate$
|
|
18789
|
+
function validate$4(card, isSetter) {
|
|
18844
18790
|
return new Promise(function (resolve, reject) {
|
|
18845
|
-
var validation = Card.validate(card);
|
|
18791
|
+
var validation = Card$1.validate(card);
|
|
18846
18792
|
|
|
18847
18793
|
if (!validation.isValid) {
|
|
18848
18794
|
var throwValidation = isSetter || card.number;
|
|
@@ -18861,8 +18807,8 @@ var CardCharge = {
|
|
|
18861
18807
|
setCard: function setCard(params) {
|
|
18862
18808
|
var _this = this;
|
|
18863
18809
|
|
|
18864
|
-
return validate$
|
|
18865
|
-
_this.card = new Card(params);
|
|
18810
|
+
return validate$4(params, true).then(function () {
|
|
18811
|
+
_this.card = new Card$1(params);
|
|
18866
18812
|
});
|
|
18867
18813
|
},
|
|
18868
18814
|
rememberCard: function rememberCard() {
|
|
@@ -18877,8 +18823,8 @@ var CardCharge = {
|
|
|
18877
18823
|
return this.chargeCardWithPin(customFields);
|
|
18878
18824
|
}
|
|
18879
18825
|
|
|
18880
|
-
return validate$
|
|
18881
|
-
_this2.logAttempt(paymentMethod$
|
|
18826
|
+
return validate$4(this.card).then(function () {
|
|
18827
|
+
_this2.logAttempt(paymentMethod$4);
|
|
18882
18828
|
|
|
18883
18829
|
var chargeParams = {
|
|
18884
18830
|
clientdata: _this2.card.tokenize(),
|
|
@@ -18891,8 +18837,8 @@ var CardCharge = {
|
|
|
18891
18837
|
subscription: _this2.subscription,
|
|
18892
18838
|
customFields: customFields
|
|
18893
18839
|
};
|
|
18894
|
-
return CardAPI.charge(chargeParams).then(function (response) {
|
|
18895
|
-
_this2.logAPIResponse(response, paymentMethod$
|
|
18840
|
+
return CardAPI$1.charge(chargeParams).then(function (response) {
|
|
18841
|
+
_this2.logAPIResponse(response, paymentMethod$4);
|
|
18896
18842
|
|
|
18897
18843
|
return response;
|
|
18898
18844
|
});
|
|
@@ -18907,7 +18853,7 @@ var CardCharge = {
|
|
|
18907
18853
|
var _this3 = this;
|
|
18908
18854
|
|
|
18909
18855
|
var customFields = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
18910
|
-
this.logAttempt(paymentMethod$
|
|
18856
|
+
this.logAttempt(paymentMethod$4);
|
|
18911
18857
|
var chargeParams = {
|
|
18912
18858
|
pin: encrypt(this.card.pin),
|
|
18913
18859
|
trans: this.id,
|
|
@@ -18917,8 +18863,8 @@ var CardCharge = {
|
|
|
18917
18863
|
subscription: this.subscription,
|
|
18918
18864
|
customFields: customFields
|
|
18919
18865
|
};
|
|
18920
|
-
return CardAPI.charge(chargeParams).then(function (response) {
|
|
18921
|
-
_this3.logAPIResponse(response, paymentMethod$
|
|
18866
|
+
return CardAPI$1.charge(chargeParams).then(function (response) {
|
|
18867
|
+
_this3.logAPIResponse(response, paymentMethod$4);
|
|
18922
18868
|
|
|
18923
18869
|
return response;
|
|
18924
18870
|
});
|
|
@@ -18930,7 +18876,7 @@ var CardCharge = {
|
|
|
18930
18876
|
authorizationCode = _ref.authorizationCode,
|
|
18931
18877
|
cardLast4 = _ref.cardLast4,
|
|
18932
18878
|
pin = _ref.pin;
|
|
18933
|
-
this.logAttempt(paymentMethod$
|
|
18879
|
+
this.logAttempt(paymentMethod$4);
|
|
18934
18880
|
var encryptedPin = encrypt(pin);
|
|
18935
18881
|
var chargeParams = {
|
|
18936
18882
|
authorizationCode: authorizationCode,
|
|
@@ -18942,8 +18888,8 @@ var CardCharge = {
|
|
|
18942
18888
|
transactionType: this.transactionType,
|
|
18943
18889
|
subscription: this.subscription
|
|
18944
18890
|
};
|
|
18945
|
-
return CardAPI.chargeRememberedCard(chargeParams).then(function (response) {
|
|
18946
|
-
_this4.logAPIResponse(response, paymentMethod$
|
|
18891
|
+
return CardAPI$1.chargeRememberedCard(chargeParams).then(function (response) {
|
|
18892
|
+
_this4.logAPIResponse(response, paymentMethod$4);
|
|
18947
18893
|
|
|
18948
18894
|
return response;
|
|
18949
18895
|
});
|
|
@@ -18961,8 +18907,8 @@ var CardCharge = {
|
|
|
18961
18907
|
device: this.deviceFingerprint
|
|
18962
18908
|
});
|
|
18963
18909
|
|
|
18964
|
-
return CardAPI.resumeCardCharge(params).then(function (response) {
|
|
18965
|
-
_this5.logAPIResponse(response, paymentMethod$
|
|
18910
|
+
return CardAPI$1.resumeCardCharge(params).then(function (response) {
|
|
18911
|
+
_this5.logAPIResponse(response, paymentMethod$4);
|
|
18966
18912
|
|
|
18967
18913
|
return response;
|
|
18968
18914
|
});
|
|
@@ -18974,8 +18920,8 @@ var CardCharge = {
|
|
|
18974
18920
|
authorizationId: authorizationId,
|
|
18975
18921
|
publicKey: this.merchant.key
|
|
18976
18922
|
};
|
|
18977
|
-
return CardAPI.forgetRememberedCard(params).then(function (response) {
|
|
18978
|
-
_this6.logAPIResponse(response, paymentMethod$
|
|
18923
|
+
return CardAPI$1.forgetRememberedCard(params).then(function (response) {
|
|
18924
|
+
_this6.logAPIResponse(response, paymentMethod$4);
|
|
18979
18925
|
|
|
18980
18926
|
return response;
|
|
18981
18927
|
});
|
|
@@ -18983,8 +18929,8 @@ var CardCharge = {
|
|
|
18983
18929
|
authenticateCard: function authenticateCard(token) {
|
|
18984
18930
|
var _this7 = this;
|
|
18985
18931
|
|
|
18986
|
-
return CardAPI.authenticate(this.id, token).then(function (response) {
|
|
18987
|
-
_this7.logAPIResponse(response, paymentMethod$
|
|
18932
|
+
return CardAPI$1.authenticate(this.id, token).then(function (response) {
|
|
18933
|
+
_this7.logAPIResponse(response, paymentMethod$4);
|
|
18988
18934
|
|
|
18989
18935
|
return response;
|
|
18990
18936
|
});
|
|
@@ -19003,8 +18949,8 @@ var CardCharge = {
|
|
|
19003
18949
|
zipCode: zipCode,
|
|
19004
18950
|
transactionId: this.id
|
|
19005
18951
|
};
|
|
19006
|
-
return CardAPI.verifyAddress(payload).then(function (response) {
|
|
19007
|
-
_this8.logAPIResponse(response, paymentMethod$
|
|
18952
|
+
return CardAPI$1.verifyAddress(payload).then(function (response) {
|
|
18953
|
+
_this8.logAPIResponse(response, paymentMethod$4);
|
|
19008
18954
|
|
|
19009
18955
|
return response;
|
|
19010
18956
|
});
|
|
@@ -19012,12 +18958,12 @@ var CardCharge = {
|
|
|
19012
18958
|
listenFor3DSCharge: function listenFor3DSCharge(callback) {
|
|
19013
18959
|
var listenerOptions = {
|
|
19014
18960
|
channel: "3DS_".concat(this.id),
|
|
19015
|
-
paymentMethod: paymentMethod$
|
|
18961
|
+
paymentMethod: paymentMethod$4
|
|
19016
18962
|
};
|
|
19017
18963
|
return this.listenForCharge(listenerOptions, callback);
|
|
19018
18964
|
},
|
|
19019
18965
|
requestSavedCardsOTP: function requestSavedCardsOTP(phoneNumber) {
|
|
19020
|
-
return CardAPI.requestSavedCardsOTP(phoneNumber);
|
|
18966
|
+
return CardAPI$1.requestSavedCardsOTP(phoneNumber);
|
|
19021
18967
|
},
|
|
19022
18968
|
verifySavedCardsOtp: function verifySavedCardsOtp(_ref4) {
|
|
19023
18969
|
var _this9 = this;
|
|
@@ -19036,7 +18982,7 @@ var CardCharge = {
|
|
|
19036
18982
|
};
|
|
19037
18983
|
_context.prev = 2;
|
|
19038
18984
|
_context.next = 5;
|
|
19039
|
-
return CardAPI.verifySavedCardsOtp(payload);
|
|
18985
|
+
return CardAPI$1.verifySavedCardsOtp(payload);
|
|
19040
18986
|
|
|
19041
18987
|
case 5:
|
|
19042
18988
|
response = _context.sent;
|
|
@@ -19058,19 +19004,19 @@ var CardCharge = {
|
|
|
19058
19004
|
}))();
|
|
19059
19005
|
},
|
|
19060
19006
|
getSavedCards: function getSavedCards() {
|
|
19061
|
-
return CardAPI.getSavedCards({
|
|
19007
|
+
return CardAPI$1.getSavedCards({
|
|
19062
19008
|
token: this.savedCardsToken
|
|
19063
19009
|
});
|
|
19064
19010
|
},
|
|
19065
19011
|
deleteSavedCard: function deleteSavedCard(cardCode) {
|
|
19066
|
-
return CardAPI.deleteSavedCard({
|
|
19012
|
+
return CardAPI$1.deleteSavedCard({
|
|
19067
19013
|
cardCode: cardCode,
|
|
19068
19014
|
token: this.savedCardsToken
|
|
19069
19015
|
});
|
|
19070
19016
|
},
|
|
19071
19017
|
chargeSavedCard: function chargeSavedCard(_ref5) {
|
|
19072
19018
|
var cardCode = _ref5.cardCode;
|
|
19073
|
-
return CardAPI.chargeSavedCard({
|
|
19019
|
+
return CardAPI$1.chargeSavedCard({
|
|
19074
19020
|
cardCode: cardCode,
|
|
19075
19021
|
transaction: this.id,
|
|
19076
19022
|
token: this.savedCardsToken,
|
|
@@ -19229,9 +19175,9 @@ var EMandateAPI = {
|
|
|
19229
19175
|
}
|
|
19230
19176
|
};
|
|
19231
19177
|
|
|
19232
|
-
var paymentMethod$
|
|
19178
|
+
var paymentMethod$3 = 'bank account';
|
|
19233
19179
|
|
|
19234
|
-
function validate$
|
|
19180
|
+
function validate$3(bankAccount, isSetter) {
|
|
19235
19181
|
return new Promise(function (resolve, reject) {
|
|
19236
19182
|
var validation = BankAccount.validate(bankAccount);
|
|
19237
19183
|
|
|
@@ -19249,15 +19195,15 @@ var EMandate = {
|
|
|
19249
19195
|
setBankAccount: function setBankAccount(params) {
|
|
19250
19196
|
var _this = this;
|
|
19251
19197
|
|
|
19252
|
-
return validate$
|
|
19198
|
+
return validate$3(params, true).then(function () {
|
|
19253
19199
|
_this.bankAccount = new BankAccount(params);
|
|
19254
19200
|
});
|
|
19255
19201
|
},
|
|
19256
19202
|
chargeBankAccount: function chargeBankAccount() {
|
|
19257
19203
|
var _this2 = this;
|
|
19258
19204
|
|
|
19259
|
-
return validate$
|
|
19260
|
-
_this2.logAttempt(paymentMethod$
|
|
19205
|
+
return validate$3(this.bankAccount).then(function () {
|
|
19206
|
+
_this2.logAttempt(paymentMethod$3);
|
|
19261
19207
|
|
|
19262
19208
|
var verifyParams = {
|
|
19263
19209
|
bankId: _this2.bankAccount.bankId,
|
|
@@ -19266,7 +19212,7 @@ var EMandate = {
|
|
|
19266
19212
|
device: _this2.deviceFingerprint
|
|
19267
19213
|
};
|
|
19268
19214
|
return EMandateAPI.verify(verifyParams).then(function (response) {
|
|
19269
|
-
_this2.logAPIResponse(response, paymentMethod$
|
|
19215
|
+
_this2.logAPIResponse(response, paymentMethod$3);
|
|
19270
19216
|
|
|
19271
19217
|
return response;
|
|
19272
19218
|
});
|
|
@@ -19275,7 +19221,7 @@ var EMandate = {
|
|
|
19275
19221
|
registerBankAccount: function registerBankAccount(birthday) {
|
|
19276
19222
|
var _this3 = this;
|
|
19277
19223
|
|
|
19278
|
-
return validate$
|
|
19224
|
+
return validate$3(this.bankAccount).then(function () {
|
|
19279
19225
|
var registerParams = {
|
|
19280
19226
|
bankId: _this3.bankAccount.bankId,
|
|
19281
19227
|
transactionId: _this3.id,
|
|
@@ -19283,7 +19229,7 @@ var EMandate = {
|
|
|
19283
19229
|
birthday: birthday
|
|
19284
19230
|
};
|
|
19285
19231
|
return EMandateAPI.register(registerParams).then(function (response) {
|
|
19286
|
-
_this3.logAPIResponse(response, paymentMethod$
|
|
19232
|
+
_this3.logAPIResponse(response, paymentMethod$3);
|
|
19287
19233
|
|
|
19288
19234
|
return response;
|
|
19289
19235
|
});
|
|
@@ -19292,7 +19238,7 @@ var EMandate = {
|
|
|
19292
19238
|
authenticateBankAccount: function authenticateBankAccount(token) {
|
|
19293
19239
|
var _this4 = this;
|
|
19294
19240
|
|
|
19295
|
-
return validate$
|
|
19241
|
+
return validate$3(this.bankAccount).then(function () {
|
|
19296
19242
|
var chargeParams = {
|
|
19297
19243
|
bankId: _this4.bankAccount.bankId,
|
|
19298
19244
|
transactionId: _this4.id,
|
|
@@ -19300,7 +19246,7 @@ var EMandate = {
|
|
|
19300
19246
|
device: _this4.deviceFingerprint
|
|
19301
19247
|
};
|
|
19302
19248
|
return EMandateAPI.authenticate(chargeParams).then(function (response) {
|
|
19303
|
-
_this4.logAPIResponse(response, paymentMethod$
|
|
19249
|
+
_this4.logAPIResponse(response, paymentMethod$3);
|
|
19304
19250
|
|
|
19305
19251
|
return response;
|
|
19306
19252
|
});
|
|
@@ -19361,7 +19307,7 @@ var DigitalBankMandateAPI = {
|
|
|
19361
19307
|
}
|
|
19362
19308
|
};
|
|
19363
19309
|
|
|
19364
|
-
var paymentMethod$
|
|
19310
|
+
var paymentMethod$2 = 'bank';
|
|
19365
19311
|
var DigitalBankMandate = {
|
|
19366
19312
|
chargeDigitalBankMandate: function chargeDigitalBankMandate(_ref) {
|
|
19367
19313
|
var _this = this;
|
|
@@ -19376,7 +19322,7 @@ var DigitalBankMandate = {
|
|
|
19376
19322
|
bankId: bankId
|
|
19377
19323
|
};
|
|
19378
19324
|
return DigitalBankMandateAPI.charge(params).then(function (response) {
|
|
19379
|
-
_this.logAPIResponse(response, paymentMethod$
|
|
19325
|
+
_this.logAPIResponse(response, paymentMethod$2);
|
|
19380
19326
|
|
|
19381
19327
|
return response;
|
|
19382
19328
|
});
|
|
@@ -19384,7 +19330,7 @@ var DigitalBankMandate = {
|
|
|
19384
19330
|
listenForDigitalBankMandateCharge: function listenForDigitalBankMandateCharge(callback) {
|
|
19385
19331
|
var pusherChannel = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
19386
19332
|
var listenerOptions = {
|
|
19387
|
-
paymentMethod: paymentMethod$
|
|
19333
|
+
paymentMethod: paymentMethod$2,
|
|
19388
19334
|
channel: pusherChannel
|
|
19389
19335
|
};
|
|
19390
19336
|
return this.listenForCharge(listenerOptions, callback);
|
|
@@ -19517,7 +19463,7 @@ var QrAPI = {
|
|
|
19517
19463
|
}
|
|
19518
19464
|
};
|
|
19519
19465
|
|
|
19520
|
-
function validate$
|
|
19466
|
+
function validate$2(channel) {
|
|
19521
19467
|
return new Promise(function (resolve, reject) {
|
|
19522
19468
|
var allowedChannels = ['visa', 'MPASS_OLTI'];
|
|
19523
19469
|
|
|
@@ -19535,7 +19481,7 @@ var QRCharge = {
|
|
|
19535
19481
|
var _this = this;
|
|
19536
19482
|
|
|
19537
19483
|
var channel = _ref.channel;
|
|
19538
|
-
return validate$
|
|
19484
|
+
return validate$2(channel).then(function () {
|
|
19539
19485
|
if (_this.qr[channel]) {
|
|
19540
19486
|
return _this.qr[channel];
|
|
19541
19487
|
}
|
|
@@ -19557,7 +19503,7 @@ var QRCharge = {
|
|
|
19557
19503
|
var _this2 = this;
|
|
19558
19504
|
|
|
19559
19505
|
var channel = _ref2.channel;
|
|
19560
|
-
return validate$
|
|
19506
|
+
return validate$2(channel).then(function () {
|
|
19561
19507
|
if (!_this2.qr[channel]) {
|
|
19562
19508
|
return Promise.reject(Error('Please generate qr code with Transaction.getQRCode()'));
|
|
19563
19509
|
}
|
|
@@ -19678,7 +19624,7 @@ var MobileMoneyAPI = {
|
|
|
19678
19624
|
}
|
|
19679
19625
|
};
|
|
19680
19626
|
|
|
19681
|
-
function validate(phoneNumber) {
|
|
19627
|
+
function validate$1(phoneNumber) {
|
|
19682
19628
|
return new Promise(function (resolve, reject) {
|
|
19683
19629
|
var validation = PhoneNumber.validate(phoneNumber);
|
|
19684
19630
|
|
|
@@ -19699,7 +19645,7 @@ var MobileMoneyCharge = {
|
|
|
19699
19645
|
provider = _ref.provider,
|
|
19700
19646
|
voucher = _ref.voucher,
|
|
19701
19647
|
registrationToken = _ref.registrationToken;
|
|
19702
|
-
return validate(phoneNumber).then(function () {
|
|
19648
|
+
return validate$1(phoneNumber).then(function () {
|
|
19703
19649
|
_this.logAttempt('mobile money');
|
|
19704
19650
|
|
|
19705
19651
|
var params = {
|
|
@@ -19730,7 +19676,7 @@ var MobileMoneyCharge = {
|
|
|
19730
19676
|
var phoneNumber = payload.phoneNumber,
|
|
19731
19677
|
provider = payload.provider,
|
|
19732
19678
|
registrationToken = payload.registrationToken;
|
|
19733
|
-
return validate(phoneNumber).then(function () {
|
|
19679
|
+
return validate$1(phoneNumber).then(function () {
|
|
19734
19680
|
_this2.logMobileMoneyActions(payload);
|
|
19735
19681
|
|
|
19736
19682
|
var params = {
|
|
@@ -19870,7 +19816,7 @@ var DirectDebitAPI = {
|
|
|
19870
19816
|
}
|
|
19871
19817
|
};
|
|
19872
19818
|
|
|
19873
|
-
var paymentMethod = 'direct debit';
|
|
19819
|
+
var paymentMethod$1 = 'direct debit';
|
|
19874
19820
|
var DirectDebitCharge = {
|
|
19875
19821
|
loginToDirectDebitAccount: function loginToDirectDebitAccount(_ref) {
|
|
19876
19822
|
var _this = this;
|
|
@@ -19916,14 +19862,14 @@ var DirectDebitCharge = {
|
|
|
19916
19862
|
return Promise.reject(Error('Please login with Transaction.loginToDirectDebitAccount() to start a Direct debit charge'));
|
|
19917
19863
|
}
|
|
19918
19864
|
|
|
19919
|
-
this.logAttempt(paymentMethod);
|
|
19865
|
+
this.logAttempt(paymentMethod$1);
|
|
19920
19866
|
var params = {
|
|
19921
19867
|
account_code: accountCode,
|
|
19922
19868
|
transaction: this.id,
|
|
19923
19869
|
token: this.directDebit.token
|
|
19924
19870
|
};
|
|
19925
19871
|
return DirectDebitAPI.charge(params).then(function (response) {
|
|
19926
|
-
_this2.logAPIResponse(response, paymentMethod);
|
|
19872
|
+
_this2.logAPIResponse(response, paymentMethod$1);
|
|
19927
19873
|
|
|
19928
19874
|
if (response.status) {
|
|
19929
19875
|
_this2.directDebit.chargeResponse = response;
|
|
@@ -19936,7 +19882,7 @@ var DirectDebitCharge = {
|
|
|
19936
19882
|
var _this3 = this;
|
|
19937
19883
|
|
|
19938
19884
|
return DirectDebitAPI.getProvisionedAccounts(this.directDebit.token).then(function (response) {
|
|
19939
|
-
_this3.logAPIResponse(response, paymentMethod);
|
|
19885
|
+
_this3.logAPIResponse(response, paymentMethod$1);
|
|
19940
19886
|
|
|
19941
19887
|
var status = response.status,
|
|
19942
19888
|
data = response.data;
|
|
@@ -19961,7 +19907,7 @@ var DirectDebitCharge = {
|
|
|
19961
19907
|
token: this.directDebit.token
|
|
19962
19908
|
};
|
|
19963
19909
|
return DirectDebitAPI.authenticate(params).then(function (response) {
|
|
19964
|
-
_this4.logAPIResponse(response, paymentMethod);
|
|
19910
|
+
_this4.logAPIResponse(response, paymentMethod$1);
|
|
19965
19911
|
|
|
19966
19912
|
return response;
|
|
19967
19913
|
});
|
|
@@ -20747,6 +20693,417 @@ var Toolkit = /*#__PURE__*/function () {
|
|
|
20747
20693
|
return Toolkit;
|
|
20748
20694
|
}();
|
|
20749
20695
|
|
|
20696
|
+
cardValidator.creditCardType.addCard({
|
|
20697
|
+
niceType: 'Verve',
|
|
20698
|
+
type: 'verve',
|
|
20699
|
+
patterns: [[506000, 507999], [650000, 650009]],
|
|
20700
|
+
gaps: [4, 8, 12, 16],
|
|
20701
|
+
lengths: [16, 18, 19],
|
|
20702
|
+
code: {
|
|
20703
|
+
name: 'CVV',
|
|
20704
|
+
size: 3
|
|
20705
|
+
}
|
|
20706
|
+
});
|
|
20707
|
+
cardValidator.creditCardType.changeOrder('verve', 0);
|
|
20708
|
+
|
|
20709
|
+
var Card = /*#__PURE__*/function () {
|
|
20710
|
+
function Card(_ref) {
|
|
20711
|
+
var number = _ref.number,
|
|
20712
|
+
cvv = _ref.cvv,
|
|
20713
|
+
month = _ref.month,
|
|
20714
|
+
year = _ref.year,
|
|
20715
|
+
pin = _ref.pin;
|
|
20716
|
+
|
|
20717
|
+
_classCallCheck(this, Card);
|
|
20718
|
+
|
|
20719
|
+
this.number = number;
|
|
20720
|
+
this.cvv = cvv;
|
|
20721
|
+
this.month = month;
|
|
20722
|
+
this.year = year;
|
|
20723
|
+
this.pin = pin;
|
|
20724
|
+
}
|
|
20725
|
+
|
|
20726
|
+
_createClass(Card, [{
|
|
20727
|
+
key: "getEncryptedPin",
|
|
20728
|
+
value: function getEncryptedPin() {
|
|
20729
|
+
return Card$2.getEncryptedPin(this.pin);
|
|
20730
|
+
}
|
|
20731
|
+
}, {
|
|
20732
|
+
key: "getLast4",
|
|
20733
|
+
value: function getLast4() {
|
|
20734
|
+
return Card$2.getLast4(this.number);
|
|
20735
|
+
}
|
|
20736
|
+
}, {
|
|
20737
|
+
key: "tokenize",
|
|
20738
|
+
value: function tokenize() {
|
|
20739
|
+
return Card$2.tokenize({
|
|
20740
|
+
number: this.number,
|
|
20741
|
+
cvv: this.cvv,
|
|
20742
|
+
month: this.month,
|
|
20743
|
+
year: this.year
|
|
20744
|
+
});
|
|
20745
|
+
}
|
|
20746
|
+
}], [{
|
|
20747
|
+
key: "getType",
|
|
20748
|
+
value: function getType(value) {
|
|
20749
|
+
return Card$2.getType(value);
|
|
20750
|
+
}
|
|
20751
|
+
}, {
|
|
20752
|
+
key: "validate",
|
|
20753
|
+
value: function validate(_ref2) {
|
|
20754
|
+
var number = _ref2.number,
|
|
20755
|
+
cvv = _ref2.cvv,
|
|
20756
|
+
month = _ref2.month,
|
|
20757
|
+
year = _ref2.year;
|
|
20758
|
+
return Card$2.validate({
|
|
20759
|
+
number: number,
|
|
20760
|
+
cvv: cvv,
|
|
20761
|
+
month: month,
|
|
20762
|
+
year: year
|
|
20763
|
+
});
|
|
20764
|
+
}
|
|
20765
|
+
}, {
|
|
20766
|
+
key: "validateNumber",
|
|
20767
|
+
value: function validateNumber(value) {
|
|
20768
|
+
return Card$2.validateNumber(value);
|
|
20769
|
+
}
|
|
20770
|
+
}, {
|
|
20771
|
+
key: "isNumberValid",
|
|
20772
|
+
value: function isNumberValid(value) {
|
|
20773
|
+
return Card$2.isNumberValid(value);
|
|
20774
|
+
}
|
|
20775
|
+
}, {
|
|
20776
|
+
key: "validateCVV",
|
|
20777
|
+
value: function validateCVV(cvv, cardType) {
|
|
20778
|
+
return Card$2.validateCVV(cvv, cardType);
|
|
20779
|
+
}
|
|
20780
|
+
}, {
|
|
20781
|
+
key: "isCvvValid",
|
|
20782
|
+
value: function isCvvValid(cvv, cardType) {
|
|
20783
|
+
return Card$2.isCvvValid(cvv, cardType);
|
|
20784
|
+
}
|
|
20785
|
+
}, {
|
|
20786
|
+
key: "validateExpiry",
|
|
20787
|
+
value: function validateExpiry(value) {
|
|
20788
|
+
return Card$2.validateExpiry(value);
|
|
20789
|
+
}
|
|
20790
|
+
}, {
|
|
20791
|
+
key: "isExpiryValid",
|
|
20792
|
+
value: function isExpiryValid(value) {
|
|
20793
|
+
return Card$2.isExpiryValid(value);
|
|
20794
|
+
}
|
|
20795
|
+
}, {
|
|
20796
|
+
key: "generateTestCard",
|
|
20797
|
+
value: function generateTestCard(cardType) {
|
|
20798
|
+
var type = cardType || 'default';
|
|
20799
|
+
var cardParams = testCards.find(function (card) {
|
|
20800
|
+
return card.type === type;
|
|
20801
|
+
});
|
|
20802
|
+
return new Card(cardParams);
|
|
20803
|
+
}
|
|
20804
|
+
}]);
|
|
20805
|
+
|
|
20806
|
+
return Card;
|
|
20807
|
+
}();
|
|
20808
|
+
|
|
20809
|
+
var CardAPI = {
|
|
20810
|
+
reserve: function reserve(_ref) {
|
|
20811
|
+
var clientdata = _ref.clientdata,
|
|
20812
|
+
last4 = _ref.last4,
|
|
20813
|
+
preauthorizationId = _ref.preauthorizationId;
|
|
20814
|
+
var url = "".concat(configToUse.paystackApiUrl, "preauthorization/reserve");
|
|
20815
|
+
var language = getLanguage();
|
|
20816
|
+
|
|
20817
|
+
var headers = _objectSpread2({}, language && {
|
|
20818
|
+
'Accept-Language': language
|
|
20819
|
+
});
|
|
20820
|
+
|
|
20821
|
+
return axiosInstance.post(url, {
|
|
20822
|
+
clientdata: clientdata,
|
|
20823
|
+
last4: last4,
|
|
20824
|
+
preauthorization: preauthorizationId
|
|
20825
|
+
}, {
|
|
20826
|
+
headers: headers
|
|
20827
|
+
}).then(function (response) {
|
|
20828
|
+
return ChargeResponses.parse(response.data);
|
|
20829
|
+
});
|
|
20830
|
+
} // charge({
|
|
20831
|
+
// clientdata,
|
|
20832
|
+
// last4,
|
|
20833
|
+
// pin,
|
|
20834
|
+
// trans,
|
|
20835
|
+
// device,
|
|
20836
|
+
// rememberCard,
|
|
20837
|
+
// transactionType,
|
|
20838
|
+
// subscription,
|
|
20839
|
+
// customFields,
|
|
20840
|
+
// }) {
|
|
20841
|
+
// const url = `${config.paymentBaseUrl}charge/`;
|
|
20842
|
+
// const language = getLanguage();
|
|
20843
|
+
// const headers = {
|
|
20844
|
+
// 'Content-Type': 'application/x-www-form-urlencoded',
|
|
20845
|
+
// ...(language && { 'Accept-Language': language }),
|
|
20846
|
+
// };
|
|
20847
|
+
// const chargeParams = {
|
|
20848
|
+
// clientdata,
|
|
20849
|
+
// last4,
|
|
20850
|
+
// trans,
|
|
20851
|
+
// device,
|
|
20852
|
+
// offset: new Date().getTimezoneOffset(),
|
|
20853
|
+
// remember_card: rememberCard,
|
|
20854
|
+
// ...(transactionType && { transaction_type: transactionType }),
|
|
20855
|
+
// ...(subscription && { subscription }),
|
|
20856
|
+
// ...(customFields && customFields),
|
|
20857
|
+
// };
|
|
20858
|
+
// if (pin) {
|
|
20859
|
+
// chargeParams.handle = pin;
|
|
20860
|
+
// }
|
|
20861
|
+
// const urlEncodedParams = formurlencoded(chargeParams);
|
|
20862
|
+
// return axiosInstance
|
|
20863
|
+
// .post(url, urlEncodedParams, { headers })
|
|
20864
|
+
// .then((response) => ChargeResponses.parse(response.data));
|
|
20865
|
+
// },
|
|
20866
|
+
// resumeCardCharge({ device, accessCode, pin }) {
|
|
20867
|
+
// const url = `${config.paymentBaseUrl}charge/resume/${accessCode}`;
|
|
20868
|
+
// const language = getLanguage();
|
|
20869
|
+
// const headers = {
|
|
20870
|
+
// 'Content-Type': 'application/x-www-form-urlencoded',
|
|
20871
|
+
// ...(language && { 'Accept-Language': language }),
|
|
20872
|
+
// };
|
|
20873
|
+
// const data = { device, ...(pin && { handle: pin }) };
|
|
20874
|
+
// const urlEncodedData = formurlencoded(data);
|
|
20875
|
+
// return axiosInstance
|
|
20876
|
+
// .post(url, urlEncodedData, { headers })
|
|
20877
|
+
// .then((response) => ChargeResponses.parse(response.data));
|
|
20878
|
+
// },
|
|
20879
|
+
// chargeRememberedCard({
|
|
20880
|
+
// last4,
|
|
20881
|
+
// trans,
|
|
20882
|
+
// device,
|
|
20883
|
+
// authorizationCode,
|
|
20884
|
+
// cvv,
|
|
20885
|
+
// pin,
|
|
20886
|
+
// transactionType,
|
|
20887
|
+
// subscription,
|
|
20888
|
+
// }) {
|
|
20889
|
+
// const url = `${config.paymentBaseUrl}charge/`;
|
|
20890
|
+
// const language = getLanguage();
|
|
20891
|
+
// const headers = {
|
|
20892
|
+
// 'Content-Type': 'application/x-www-form-urlencoded',
|
|
20893
|
+
// ...(language && { 'Accept-Language': language }),
|
|
20894
|
+
// };
|
|
20895
|
+
// const chargeParams = {
|
|
20896
|
+
// last4,
|
|
20897
|
+
// trans,
|
|
20898
|
+
// device,
|
|
20899
|
+
// cvv,
|
|
20900
|
+
// handle: pin,
|
|
20901
|
+
// authorization_code: authorizationCode,
|
|
20902
|
+
// ...(transactionType && { transaction_type: transactionType }),
|
|
20903
|
+
// ...(subscription && { subscription }),
|
|
20904
|
+
// };
|
|
20905
|
+
// const urlEncodedParams = formurlencoded(chargeParams);
|
|
20906
|
+
// return axiosInstance
|
|
20907
|
+
// .post(url, urlEncodedParams, { headers })
|
|
20908
|
+
// .then((response) => ChargeResponses.parse(response.data));
|
|
20909
|
+
// },
|
|
20910
|
+
// verifyAddress({ address, city, state, zipCode, transactionId }) {
|
|
20911
|
+
// const url = `${config.paymentBaseUrl}charge/avs`;
|
|
20912
|
+
// const language = getLanguage();
|
|
20913
|
+
// const headers = {
|
|
20914
|
+
// 'Content-Type': 'application/x-www-form-urlencoded',
|
|
20915
|
+
// ...(language && { 'Accept-Language': language }),
|
|
20916
|
+
// };
|
|
20917
|
+
// const data = {
|
|
20918
|
+
// city,
|
|
20919
|
+
// state,
|
|
20920
|
+
// address,
|
|
20921
|
+
// zip_code: zipCode,
|
|
20922
|
+
// trans: transactionId,
|
|
20923
|
+
// };
|
|
20924
|
+
// const urlEncodedData = formurlencoded(data);
|
|
20925
|
+
// return axiosInstance
|
|
20926
|
+
// .post(url, urlEncodedData, { headers })
|
|
20927
|
+
// .then((response) => ChargeResponses.parse(response.data));
|
|
20928
|
+
// },
|
|
20929
|
+
// forgetRememberedCard({ authorizationId, publicKey }) {
|
|
20930
|
+
// const language = getLanguage();
|
|
20931
|
+
// const headers = {
|
|
20932
|
+
// Authorization: `Bearer ${publicKey}`,
|
|
20933
|
+
// ...(language && { 'Accept-Language': language }),
|
|
20934
|
+
// };
|
|
20935
|
+
// const params = {
|
|
20936
|
+
// authorization_id: authorizationId,
|
|
20937
|
+
// };
|
|
20938
|
+
// const url = `${config.paystackApiUrl}rememberme/forget_card`;
|
|
20939
|
+
// return axiosInstance
|
|
20940
|
+
// .post(url, params, { headers })
|
|
20941
|
+
// .then((response) => ChargeResponses.parse(response.data));
|
|
20942
|
+
// },
|
|
20943
|
+
|
|
20944
|
+
};
|
|
20945
|
+
|
|
20946
|
+
var paymentMethod = 'card';
|
|
20947
|
+
|
|
20948
|
+
function validate(card, isSetter) {
|
|
20949
|
+
return new Promise(function (resolve, reject) {
|
|
20950
|
+
var validation = Card.validate(card);
|
|
20951
|
+
|
|
20952
|
+
if (!validation.isValid) {
|
|
20953
|
+
var throwValidation = isSetter || card.number;
|
|
20954
|
+
var errors = Object.keys(validation.result).filter(function (value) {
|
|
20955
|
+
return validation.result[value] === false;
|
|
20956
|
+
});
|
|
20957
|
+
var errorMessage = "Invalid card details: ".concat(errors.join(', '));
|
|
20958
|
+
reject(Error(throwValidation ? errorMessage : 'Please set a valid card with setCard()'));
|
|
20959
|
+
}
|
|
20960
|
+
|
|
20961
|
+
resolve();
|
|
20962
|
+
});
|
|
20963
|
+
}
|
|
20964
|
+
|
|
20965
|
+
var ReserveCardFunds = {
|
|
20966
|
+
setCard: function setCard(params) {
|
|
20967
|
+
var _this = this;
|
|
20968
|
+
|
|
20969
|
+
return validate(params, true).then(function () {
|
|
20970
|
+
_this.card = new Card(params);
|
|
20971
|
+
});
|
|
20972
|
+
},
|
|
20973
|
+
reserve: function reserve(preauthorizationId) {
|
|
20974
|
+
var _this2 = this;
|
|
20975
|
+
|
|
20976
|
+
var customFields = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
20977
|
+
// TODO: Log payment method
|
|
20978
|
+
// https://paystack.atlassian.net/browse/RAILS-3070
|
|
20979
|
+
return validate(this.card).then(function () {
|
|
20980
|
+
var chargeParams = {
|
|
20981
|
+
clientdata: _this2.card.tokenize(),
|
|
20982
|
+
last4: _this2.card.getLast4(),
|
|
20983
|
+
preauthorization: preauthorizationId,
|
|
20984
|
+
customFields: customFields
|
|
20985
|
+
};
|
|
20986
|
+
return CardAPI.charge(chargeParams).then(function (response) {
|
|
20987
|
+
// TODO: Log API Response
|
|
20988
|
+
// https://paystack.atlassian.net/browse/RAILS-3070
|
|
20989
|
+
return response;
|
|
20990
|
+
});
|
|
20991
|
+
});
|
|
20992
|
+
},
|
|
20993
|
+
listenFor3DSCharge: function listenFor3DSCharge(callback) {
|
|
20994
|
+
var listenerOptions = {
|
|
20995
|
+
channel: "3DS_".concat(this.id),
|
|
20996
|
+
paymentMethod: paymentMethod
|
|
20997
|
+
};
|
|
20998
|
+
return this.listenForCharge(listenerOptions, callback);
|
|
20999
|
+
} // rememberCard() {
|
|
21000
|
+
// this.remember_card = true;
|
|
21001
|
+
// },
|
|
21002
|
+
// chargeCard(customFields = {}) {
|
|
21003
|
+
// if (!this.card.number && this.card.pin) {
|
|
21004
|
+
// return this.chargeCardWithPin(customFields);
|
|
21005
|
+
// }
|
|
21006
|
+
// return validate(this.card).then(() => {
|
|
21007
|
+
// this.logAttempt(paymentMethod);
|
|
21008
|
+
// const chargeParams = {
|
|
21009
|
+
// clientdata: this.card.tokenize(),
|
|
21010
|
+
// last4: this.card.getLast4(),
|
|
21011
|
+
// pin: this.card.getEncryptedPin(),
|
|
21012
|
+
// trans: this.id,
|
|
21013
|
+
// device: this.deviceFingerprint,
|
|
21014
|
+
// rememberCard: this.remember_card,
|
|
21015
|
+
// transactionType: this.transactionType,
|
|
21016
|
+
// subscription: this.subscription,
|
|
21017
|
+
// customFields,
|
|
21018
|
+
// };
|
|
21019
|
+
// return CardAPI.charge(chargeParams).then((response) => {
|
|
21020
|
+
// this.logAPIResponse(response, paymentMethod);
|
|
21021
|
+
// return response;
|
|
21022
|
+
// });
|
|
21023
|
+
// });
|
|
21024
|
+
// },
|
|
21025
|
+
|
|
21026
|
+
/**
|
|
21027
|
+
* Handles submitting a card pin after
|
|
21028
|
+
* other card details have been previously submitted.
|
|
21029
|
+
*/
|
|
21030
|
+
// chargeCardWithPin(customFields = {}) {
|
|
21031
|
+
// this.logAttempt(paymentMethod);
|
|
21032
|
+
// const chargeParams = {
|
|
21033
|
+
// pin: encrypt(this.card.pin),
|
|
21034
|
+
// trans: this.id,
|
|
21035
|
+
// device: this.deviceFingerprint,
|
|
21036
|
+
// rememberCard: this.remember_card,
|
|
21037
|
+
// transactionType: this.transactionType,
|
|
21038
|
+
// subscription: this.subscription,
|
|
21039
|
+
// customFields,
|
|
21040
|
+
// };
|
|
21041
|
+
// return CardAPI.charge(chargeParams).then((response) => {
|
|
21042
|
+
// this.logAPIResponse(response, paymentMethod);
|
|
21043
|
+
// return response;
|
|
21044
|
+
// });
|
|
21045
|
+
// },
|
|
21046
|
+
// chargeRememberedCard({ cvv, authorizationCode, cardLast4, pin }) {
|
|
21047
|
+
// this.logAttempt(paymentMethod);
|
|
21048
|
+
// const encryptedPin = encrypt(pin);
|
|
21049
|
+
// const chargeParams = {
|
|
21050
|
+
// authorizationCode,
|
|
21051
|
+
// cvv,
|
|
21052
|
+
// last4: cardLast4,
|
|
21053
|
+
// trans: this.id,
|
|
21054
|
+
// device: this.deviceFingerprint,
|
|
21055
|
+
// pin: encryptedPin,
|
|
21056
|
+
// transactionType: this.transactionType,
|
|
21057
|
+
// subscription: this.subscription,
|
|
21058
|
+
// };
|
|
21059
|
+
// return CardAPI.chargeRememberedCard(chargeParams).then((response) => {
|
|
21060
|
+
// this.logAPIResponse(response, paymentMethod);
|
|
21061
|
+
// return response;
|
|
21062
|
+
// });
|
|
21063
|
+
// },
|
|
21064
|
+
// resumeCardCharge({ accessCode, pin }) {
|
|
21065
|
+
// const params = {
|
|
21066
|
+
// ...(pin && { pin: encrypt(pin) }),
|
|
21067
|
+
// accessCode,
|
|
21068
|
+
// device: this.deviceFingerprint,
|
|
21069
|
+
// };
|
|
21070
|
+
// return CardAPI.resumeCardCharge(params).then((response) => {
|
|
21071
|
+
// this.logAPIResponse(response, paymentMethod);
|
|
21072
|
+
// return response;
|
|
21073
|
+
// });
|
|
21074
|
+
// },
|
|
21075
|
+
// forgetRememberedCard(authorizationId) {
|
|
21076
|
+
// const params = {
|
|
21077
|
+
// authorizationId,
|
|
21078
|
+
// publicKey: this.merchant.key,
|
|
21079
|
+
// };
|
|
21080
|
+
// return CardAPI.forgetRememberedCard(params).then((response) => {
|
|
21081
|
+
// this.logAPIResponse(response, paymentMethod);
|
|
21082
|
+
// return response;
|
|
21083
|
+
// });
|
|
21084
|
+
// },
|
|
21085
|
+
// authenticateCard(token) {
|
|
21086
|
+
// return CardAPI.authenticate(this.id, token).then((response) => {
|
|
21087
|
+
// this.logAPIResponse(response, paymentMethod);
|
|
21088
|
+
// return response;
|
|
21089
|
+
// });
|
|
21090
|
+
// },
|
|
21091
|
+
// verifyAddress({ address, city, state, zipCode }) {
|
|
21092
|
+
// const payload = {
|
|
21093
|
+
// city,
|
|
21094
|
+
// state,
|
|
21095
|
+
// address,
|
|
21096
|
+
// zipCode,
|
|
21097
|
+
// transactionId: this.id,
|
|
21098
|
+
// };
|
|
21099
|
+
// return CardAPI.verifyAddress(payload).then((response) => {
|
|
21100
|
+
// this.logAPIResponse(response, paymentMethod);
|
|
21101
|
+
// return response;
|
|
21102
|
+
// });
|
|
21103
|
+
// },
|
|
21104
|
+
|
|
21105
|
+
};
|
|
21106
|
+
|
|
20750
21107
|
var PreauthorizationInstance = /*#__PURE__*/function () {
|
|
20751
21108
|
function PreauthorizationInstance(data) {
|
|
20752
21109
|
_classCallCheck(this, PreauthorizationInstance);
|
|
@@ -20766,8 +21123,10 @@ var PreauthorizationInstance = /*#__PURE__*/function () {
|
|
|
20766
21123
|
name: data.merchant_name,
|
|
20767
21124
|
key: data.merchant_key
|
|
20768
21125
|
};
|
|
20769
|
-
loadPusher(); // TODO:
|
|
20770
|
-
// https://paystack.atlassian.net/browse/RAILS-
|
|
21126
|
+
loadPusher(); // TODO: Analytics
|
|
21127
|
+
// https://paystack.atlassian.net/browse/RAILS-3070
|
|
21128
|
+
|
|
21129
|
+
Object.assign(this, ReserveCardFunds);
|
|
20771
21130
|
}
|
|
20772
21131
|
|
|
20773
21132
|
_createClass(PreauthorizationInstance, [{
|
|
@@ -20848,4 +21207,4 @@ var Preauthorization = {
|
|
|
20848
21207
|
}
|
|
20849
21208
|
};
|
|
20850
21209
|
|
|
20851
|
-
export { BankAccount, Card, Preauthorization, Toolkit, Transaction };
|
|
21210
|
+
export { BankAccount, Card$1 as Card, Preauthorization, Toolkit, Transaction };
|