@kushki/js 1.36.0 → 1.37.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/Kushki.d.ts +17 -2
- package/lib/Kushki.js +132 -113
- package/lib/KushkiInfo.js +11 -14
- package/lib/constant/CreditCardEspecifications.js +2 -2
- package/lib/constant/Identifiers.js +21 -21
- package/lib/gateway/KushkiGateway.js +161 -276
- package/lib/gateway/SiftScience.js +42 -45
- package/lib/generic/AurusError.js +12 -28
- package/lib/generic/KushkiError.js +15 -33
- package/lib/infrastructure/BinCardTypeEnum.js +1 -1
- package/lib/infrastructure/CardBrandsEnum.d.ts +5 -0
- package/lib/infrastructure/CardBrandsEnum.js +8 -0
- package/lib/infrastructure/CognitoErrorEnum.js +1 -1
- package/lib/infrastructure/Container.js +41 -75
- package/lib/infrastructure/EnvironmentEnum.js +1 -1
- package/lib/infrastructure/ErrorEnum.d.ts +2 -1
- package/lib/infrastructure/ErrorEnum.js +42 -37
- package/lib/infrastructure/HeadersEnum.js +1 -1
- package/lib/infrastructure/KPayUserPoolEnum.js +1 -1
- package/lib/infrastructure/KpayPaymentKind.js +1 -1
- package/lib/infrastructure/PathEnum.js +1 -1
- package/lib/infrastructure/PlatformCodeEnum.js +15 -15
- package/lib/infrastructure/SiftScienceEnum.js +1 -1
- package/lib/infrastructure/StatusCodeEnum.js +1 -1
- package/lib/infrastructure/ThreeDSEnum.js +1 -1
- package/lib/infrastructure/VisaBrandingResourceUrlEnum.d.ts +2 -2
- package/lib/infrastructure/VisaBrandingResourceUrlEnum.js +3 -3
- package/lib/lib.js +1 -1
- package/lib/libs/MCSensoryBranding/mastercard-sensory-branding.d.ts +21 -0
- package/lib/libs/MCSensoryBranding/mastercard-sensory-branding.js +781 -0
- package/lib/libs/VisaSensoryBranding/visa-sensory-branding.d.ts +1 -1
- package/lib/libs/VisaSensoryBranding/visa-sensory-branding.js +630 -158
- package/lib/libs/cardinal/prod.js +10 -10
- package/lib/libs/cardinal/staging.js +9 -9
- package/lib/repository/IAntiFraud.js +1 -1
- package/lib/repository/IAuthService.js +1 -1
- package/lib/repository/ICardAsyncService.js +1 -1
- package/lib/repository/ICardDynamicService.js +1 -1
- package/lib/repository/ICardService.js +1 -1
- package/lib/repository/ICardSubscriptionDynamicService.js +1 -1
- package/lib/repository/ICashService.js +1 -1
- package/lib/repository/ICommissionService.js +1 -1
- package/lib/repository/IKPayService.js +1 -1
- package/lib/repository/IKushkiGateway.js +1 -1
- package/lib/repository/IKushkiService.d.ts +9 -2
- package/lib/repository/IKushkiService.js +1 -1
- package/lib/repository/IMobileProcessorService.js +1 -1
- package/lib/repository/IMultiMerchantService.js +1 -1
- package/lib/repository/IPayoutsCashService.js +1 -1
- package/lib/repository/IPayoutsTransferService.js +1 -1
- package/lib/repository/ISecureService.js +1 -1
- package/lib/repository/ISiftScienceService.js +1 -1
- package/lib/repository/ITransferService.js +1 -1
- package/lib/repository/ITransferSubscriptionService.js +1 -1
- package/lib/service/AuthService.js +99 -161
- package/lib/service/CardAsyncService.js +19 -26
- package/lib/service/CardDynamicService.js +32 -43
- package/lib/service/CardService.js +271 -382
- package/lib/service/CardSubscriptionDynamicService.js +31 -40
- package/lib/service/CashService.js +15 -16
- package/lib/service/CommissionService.js +13 -14
- package/lib/service/KPayService.js +19 -23
- package/lib/service/KushkiService.d.ts +2 -1
- package/lib/service/KushkiService.js +48 -33
- package/lib/service/MobileProcessorService.js +59 -70
- package/lib/service/MultiMerchantService.js +13 -14
- package/lib/service/PayoutsCashService.js +15 -16
- package/lib/service/PayoutsTransferService.js +17 -18
- package/lib/service/SecureService.js +13 -14
- package/lib/service/SiftScienceService.js +16 -20
- package/lib/service/TransferService.js +21 -36
- package/lib/service/TransferSubscriptionsService.js +16 -17
- package/lib/service/UtilsService.js +51 -57
- package/lib/types/card_branding_request.d.ts +40 -0
- package/package.json +2 -2
- package/lib/types/visa_branding_request.d.ts +0 -10
|
@@ -3,17 +3,6 @@
|
|
|
3
3
|
/**
|
|
4
4
|
* Card Service file
|
|
5
5
|
*/
|
|
6
|
-
var __assign = (this && this.__assign) || function () {
|
|
7
|
-
__assign = Object.assign || function(t) {
|
|
8
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
9
|
-
s = arguments[i];
|
|
10
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
11
|
-
t[p] = s[p];
|
|
12
|
-
}
|
|
13
|
-
return t;
|
|
14
|
-
};
|
|
15
|
-
return __assign.apply(this, arguments);
|
|
16
|
-
};
|
|
17
6
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
18
7
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
19
8
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -35,50 +24,23 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
35
24
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
36
25
|
});
|
|
37
26
|
};
|
|
38
|
-
var
|
|
39
|
-
|
|
40
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
41
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
42
|
-
function step(op) {
|
|
43
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
44
|
-
while (_) try {
|
|
45
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
46
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
47
|
-
switch (op[0]) {
|
|
48
|
-
case 0: case 1: t = op; break;
|
|
49
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
50
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
51
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
52
|
-
default:
|
|
53
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
54
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
55
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
56
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
57
|
-
if (t[2]) _.ops.pop();
|
|
58
|
-
_.trys.pop(); continue;
|
|
59
|
-
}
|
|
60
|
-
op = body.call(thisArg, _);
|
|
61
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
62
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
exports.__esModule = true;
|
|
27
|
+
var CardService_1;
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
66
29
|
exports.CardService = void 0;
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
30
|
+
const cardinal_sandbox_js_1 = require("@kushki/cardinal-sandbox-js");
|
|
31
|
+
const Identifiers_1 = require("./../../lib/constant/Identifiers");
|
|
32
|
+
const dot = require("dot-object");
|
|
33
|
+
const KushkiError_1 = require("./../../lib/generic/KushkiError");
|
|
34
|
+
const ErrorEnum_1 = require("./../../lib/infrastructure/ErrorEnum");
|
|
35
|
+
const ThreeDSEnum_1 = require("./../../lib/infrastructure/ThreeDSEnum");
|
|
36
|
+
const inversify_1 = require("inversify");
|
|
74
37
|
require("reflect-metadata");
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
var _a;
|
|
38
|
+
const rxjs_1 = require("rxjs");
|
|
39
|
+
const operators_1 = require("rxjs/operators");
|
|
40
|
+
const UtilsService_1 = require("./../../lib/service/UtilsService");
|
|
41
|
+
const Kushki_1 = require("./../../lib/Kushki");
|
|
42
|
+
let CardService = CardService_1 = class CardService {
|
|
43
|
+
constructor(gateway, authService, antiFraud) {
|
|
82
44
|
this._3Dsecure = "active_3dsecure";
|
|
83
45
|
this._cardNumber = "card.number";
|
|
84
46
|
this._sandboxEnable = false;
|
|
@@ -86,160 +48,143 @@ var CardService = /** @class */ (function () {
|
|
|
86
48
|
this._gateway = gateway;
|
|
87
49
|
this._antiFraud = antiFraud;
|
|
88
50
|
this._authService = authService;
|
|
89
|
-
this._receipt =
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
CardService_1 = CardService;
|
|
110
|
-
CardService.prototype.requestToken = function (request, mid, isTest, regional, callback) {
|
|
111
|
-
var _this = this;
|
|
51
|
+
this._receipt = {
|
|
52
|
+
amount: "totalAmount",
|
|
53
|
+
"card.cvc": "card.cvv",
|
|
54
|
+
"card.expiryMonth": "card.expiryMonth",
|
|
55
|
+
"card.expiryYear": "card.expiryYear",
|
|
56
|
+
"card.name": "card.name",
|
|
57
|
+
[this._cardNumber]: this._cardNumber,
|
|
58
|
+
currency: "currency",
|
|
59
|
+
emailRequest: "email",
|
|
60
|
+
isDeferred: "isDeferred",
|
|
61
|
+
jwt: "jwt",
|
|
62
|
+
merchantName: "merchantName",
|
|
63
|
+
months: "months",
|
|
64
|
+
savePaymentData: "savePaymentData",
|
|
65
|
+
sessionId: "sessionId",
|
|
66
|
+
userId: "userId",
|
|
67
|
+
walletId: "walletId",
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
requestToken(request, mid, isTest, regional, callback) {
|
|
112
71
|
this._gateway
|
|
113
72
|
.requestMerchantSettings(mid, isTest, regional)
|
|
114
|
-
.pipe(operators_1.switchMap(
|
|
115
|
-
|
|
73
|
+
.pipe(operators_1.switchMap((merchant) => {
|
|
74
|
+
this._setSandboxEnable(!!merchant.sandboxEnable);
|
|
116
75
|
return rxjs_1.forkJoin([
|
|
117
|
-
|
|
118
|
-
|
|
76
|
+
this._getScienceSession(request, mid, isTest, merchant),
|
|
77
|
+
this._getCybersourceJwt(merchant, mid, isTest, regional, Object.prototype.hasOwnProperty.call(request, "card")
|
|
119
78
|
? request.card.number
|
|
120
79
|
: undefined),
|
|
121
80
|
rxjs_1.of(merchant),
|
|
122
81
|
]);
|
|
123
|
-
}), operators_1.mergeMap(
|
|
124
|
-
var sift_object = _a[0], jwt = _a[1], merchant = _a[2];
|
|
82
|
+
}), operators_1.mergeMap(([sift_object, jwt, merchant]) => {
|
|
125
83
|
request.isDeferred =
|
|
126
84
|
request.isDeferred === undefined ? false : request.isDeferred;
|
|
127
85
|
if (Boolean(request.cvv))
|
|
128
86
|
request.card = { cvc: request.cvv };
|
|
129
|
-
|
|
130
|
-
|
|
87
|
+
this._checkRequestBody(request);
|
|
88
|
+
const data_to_transform = Object.assign(Object.assign({}, request), sift_object);
|
|
131
89
|
if (jwt !== undefined)
|
|
132
90
|
data_to_transform.jwt = jwt;
|
|
133
91
|
return rxjs_1.forkJoin([
|
|
134
|
-
rxjs_1.of(dot.transform(
|
|
92
|
+
rxjs_1.of(dot.transform(this._receipt, Object.assign(Object.assign({}, data_to_transform), { merchantName: merchant.merchant_name }))),
|
|
135
93
|
request.walletId
|
|
136
|
-
?
|
|
94
|
+
? this._authService.getAuthorizationToken()
|
|
137
95
|
: rxjs_1.of(undefined),
|
|
138
96
|
rxjs_1.of(merchant),
|
|
139
97
|
]);
|
|
140
98
|
}))
|
|
141
99
|
.subscribe({
|
|
142
|
-
error:
|
|
143
|
-
|
|
144
|
-
},
|
|
145
|
-
next: function (_a) {
|
|
146
|
-
var final_request = _a[0], authorization = _a[1], merchant = _a[2];
|
|
100
|
+
error: (err) => Kushki_1.Kushki.callbackError(err, callback),
|
|
101
|
+
next: ([final_request, authorization, merchant]) => {
|
|
147
102
|
if (final_request.jwt && !merchant.sandboxEnable) {
|
|
148
|
-
|
|
103
|
+
this._request3DSToken(isTest, () => {
|
|
149
104
|
window.Cardinal.off("payments.setupComplete");
|
|
150
105
|
// istanbul ignore next
|
|
151
|
-
|
|
106
|
+
this._requestTokenGateway(final_request, mid, isTest, regional, callback, authorization);
|
|
152
107
|
});
|
|
153
|
-
|
|
108
|
+
this._handleRetryRequestToken3DS(final_request, mid, isTest, regional, callback, authorization);
|
|
154
109
|
}
|
|
155
110
|
else
|
|
156
|
-
|
|
157
|
-
}
|
|
111
|
+
this._requestTokenGateway(final_request, mid, isTest, regional, callback, authorization);
|
|
112
|
+
},
|
|
158
113
|
});
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
var _this = this;
|
|
114
|
+
}
|
|
115
|
+
requestDeviceToken(request, mid, isTest, regional, callback) {
|
|
162
116
|
this._gateway
|
|
163
117
|
.requestMerchantSettings(mid, isTest, regional)
|
|
164
|
-
.pipe(operators_1.switchMap(
|
|
165
|
-
|
|
118
|
+
.pipe(operators_1.switchMap((merchant) => {
|
|
119
|
+
this._setSandboxEnable(!!merchant.sandboxEnable);
|
|
166
120
|
return rxjs_1.forkJoin([
|
|
167
|
-
|
|
168
|
-
|
|
121
|
+
this._getDeviceTokenSiftScienceObject(request, mid, isTest, merchant, regional),
|
|
122
|
+
this._getCybersourceJwtSubscription(merchant, mid, isTest, regional, request.subscriptionId),
|
|
169
123
|
]);
|
|
170
124
|
}))
|
|
171
125
|
.subscribe({
|
|
172
|
-
error:
|
|
173
|
-
|
|
174
|
-
},
|
|
175
|
-
next: function (_a) {
|
|
176
|
-
var sift_science_obj = _a[0], jwt = _a[1];
|
|
126
|
+
error: (err) => Kushki_1.Kushki.callbackError(err, callback),
|
|
127
|
+
next: ([sift_science_obj, jwt]) => {
|
|
177
128
|
if (sift_science_obj.userId === null)
|
|
178
129
|
delete sift_science_obj.userId;
|
|
179
130
|
if (sift_science_obj.sessionId === null)
|
|
180
131
|
delete sift_science_obj.sessionId;
|
|
181
|
-
if (jwt && !
|
|
182
|
-
sift_science_obj =
|
|
183
|
-
|
|
184
|
-
sift_science_obj =
|
|
185
|
-
|
|
132
|
+
if (jwt && !this._sandboxEnable) {
|
|
133
|
+
sift_science_obj = Object.assign(Object.assign({}, sift_science_obj), { jwt, amount: request.amount, cardHolderName: request.cardHolderName, currency: request.currency });
|
|
134
|
+
this._request3DSToken(isTest, () => {
|
|
135
|
+
sift_science_obj = Object.assign(Object.assign({}, sift_science_obj), { jwt });
|
|
136
|
+
this._requestDeviceToken(Object.assign({ subscriptionId: request.subscriptionId }, sift_science_obj), mid, isTest, regional, callback);
|
|
186
137
|
});
|
|
187
138
|
}
|
|
188
139
|
else {
|
|
189
|
-
sift_science_obj =
|
|
190
|
-
|
|
140
|
+
sift_science_obj = Object.assign(Object.assign({}, sift_science_obj), { jwt });
|
|
141
|
+
this._requestDeviceToken(Object.assign({ subscriptionId: request.subscriptionId }, sift_science_obj), mid, isTest, regional, callback);
|
|
191
142
|
}
|
|
192
|
-
}
|
|
143
|
+
},
|
|
193
144
|
});
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
var _this = this;
|
|
145
|
+
}
|
|
146
|
+
requestSubscriptionToken(subscriptionTokenRequest, mid, isTest, regional, callback) {
|
|
197
147
|
this._gateway
|
|
198
148
|
.requestMerchantSettings(mid, isTest, regional)
|
|
199
|
-
.pipe(operators_1.switchMap(
|
|
200
|
-
|
|
149
|
+
.pipe(operators_1.switchMap((merchant) => {
|
|
150
|
+
this._setSandboxEnable(!!merchant.sandboxEnable);
|
|
201
151
|
return rxjs_1.forkJoin([
|
|
202
|
-
|
|
203
|
-
|
|
152
|
+
this._getScienceSession(subscriptionTokenRequest, mid, isTest, merchant),
|
|
153
|
+
this._getCybersourceJwt(merchant, mid, isTest, regional, UtilsService_1.UtilsService.sGet(subscriptionTokenRequest, this._cardNumber)),
|
|
204
154
|
rxjs_1.of(merchant),
|
|
205
155
|
]);
|
|
206
|
-
}), operators_1.mergeMap(
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
var data_to_transform = _this._getCreateSubscriptionDataToTransform(sift_object, subscriptionTokenRequest);
|
|
156
|
+
}), operators_1.mergeMap(([sift_object, jwt, merchant]) => {
|
|
157
|
+
this._checkRequestBody(subscriptionTokenRequest);
|
|
158
|
+
const data_to_transform = this._getCreateSubscriptionDataToTransform(sift_object, subscriptionTokenRequest);
|
|
210
159
|
if (jwt !== undefined)
|
|
211
160
|
data_to_transform.jwt = jwt;
|
|
212
161
|
return rxjs_1.forkJoin([
|
|
213
|
-
rxjs_1.of(dot.transform(
|
|
162
|
+
rxjs_1.of(dot.transform(this._receipt, Object.assign(Object.assign({}, data_to_transform), { merchantName: merchant.merchant_name }))),
|
|
214
163
|
subscriptionTokenRequest.walletId
|
|
215
|
-
?
|
|
164
|
+
? this._authService.getAuthorizationToken()
|
|
216
165
|
: rxjs_1.of(undefined),
|
|
217
166
|
rxjs_1.of(merchant),
|
|
218
167
|
]);
|
|
219
168
|
}))
|
|
220
169
|
.subscribe({
|
|
221
|
-
error:
|
|
222
|
-
|
|
223
|
-
},
|
|
224
|
-
next: function (_a) {
|
|
225
|
-
var body = _a[0], jwt = _a[1], merchant = _a[2];
|
|
170
|
+
error: (err) => Kushki_1.Kushki.callbackError(err, callback),
|
|
171
|
+
next: ([body, jwt, merchant]) => {
|
|
226
172
|
if (body.jwt && !merchant.sandboxEnable)
|
|
227
|
-
|
|
228
|
-
|
|
173
|
+
this._request3DSToken(isTest, () => {
|
|
174
|
+
this._requestSubscriptionTokenGateway(body, mid, isTest, regional, callback, jwt);
|
|
229
175
|
});
|
|
230
176
|
else
|
|
231
|
-
|
|
232
|
-
}
|
|
177
|
+
this._requestSubscriptionTokenGateway(body, mid, isTest, regional, callback, jwt);
|
|
178
|
+
},
|
|
233
179
|
});
|
|
234
|
-
}
|
|
235
|
-
|
|
180
|
+
}
|
|
181
|
+
requestDeferred(binBody, mid, isTest, regional) {
|
|
236
182
|
return this._gateway.requestDeferredConditions(mid, binBody.bin, isTest, regional);
|
|
237
|
-
}
|
|
238
|
-
|
|
183
|
+
}
|
|
184
|
+
requestBinInfo(binBody, mid, isTest, regional) {
|
|
239
185
|
return this._gateway.requestBinInfo(mid, UtilsService_1.getBinFromCreditCardNumber(String(binBody.bin)), isTest, regional);
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
var _this = this;
|
|
186
|
+
}
|
|
187
|
+
validate3DS(body, mid, isTest, regional, callback) {
|
|
243
188
|
// tslint:disable-next-line
|
|
244
189
|
if (body.security === undefined)
|
|
245
190
|
return Kushki_1.Kushki.callbackError(new KushkiError_1.KushkiError(ErrorEnum_1.ERRORS.E012), callback);
|
|
@@ -256,341 +201,285 @@ var CardService = /** @class */ (function () {
|
|
|
256
201
|
return this._ccaSandbox(body, mid, isTest, regional, callback);
|
|
257
202
|
if (isTest) {
|
|
258
203
|
// tslint:disable-next-line:no-duplicate-string
|
|
259
|
-
Promise.resolve().then(
|
|
204
|
+
Promise.resolve().then(() => require("./../../lib/libs/cardinal/staging")).then(() => {
|
|
260
205
|
CardService_1._ccaCardinal(body);
|
|
261
206
|
});
|
|
262
|
-
Promise.resolve().then(
|
|
263
|
-
|
|
207
|
+
Promise.resolve().then(() => require("./../../lib/libs/cardinal/staging")).then(() => {
|
|
208
|
+
this._completeCardinal(body.secureId, mid, isTest, regional, callback);
|
|
264
209
|
});
|
|
265
210
|
}
|
|
266
211
|
else {
|
|
267
212
|
// tslint:disable-next-line:no-duplicate-string
|
|
268
|
-
Promise.resolve().then(
|
|
213
|
+
Promise.resolve().then(() => require("./../../lib/libs/cardinal/prod")).then(() => {
|
|
269
214
|
CardService_1._ccaCardinal(body);
|
|
270
215
|
});
|
|
271
|
-
Promise.resolve().then(
|
|
272
|
-
|
|
216
|
+
Promise.resolve().then(() => require("./../../lib/libs/cardinal/prod")).then(() => {
|
|
217
|
+
this._completeCardinal(body.secureId, mid, isTest, regional, callback);
|
|
273
218
|
});
|
|
274
219
|
}
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
}), operators_1.map(function (jwt) { return ({
|
|
283
|
-
jwt: jwt
|
|
284
|
-
}); }));
|
|
285
|
-
};
|
|
286
|
-
CardService.prototype.setAlreadyObtainedToken = function (alreadyObtainedToken) {
|
|
220
|
+
}
|
|
221
|
+
requestSecureInit(request, mid, isTest, regional) {
|
|
222
|
+
return rxjs_1.of(1).pipe(operators_1.map(() => this._checkCardLength(request, ErrorEnum_1.ErrorCode.E014)), operators_1.switchMap(() => this._getMerchantSettings(mid, isTest, regional)), operators_1.switchMap((merchantSettings) => rxjs_1.iif(() => this._is3DSSecureEnabled(merchantSettings), rxjs_1.of(merchantSettings), rxjs_1.throwError(new KushkiError_1.KushkiError(ErrorEnum_1.ERRORS.E013)))), operators_1.switchMap((merchant) => this._getCybersourceJwt(merchant, mid, isTest, regional, request.card.number)), operators_1.map((jwt) => ({
|
|
223
|
+
jwt: jwt,
|
|
224
|
+
})));
|
|
225
|
+
}
|
|
226
|
+
setAlreadyObtainedToken(alreadyObtainedToken) {
|
|
287
227
|
this._alreadyObtainedToken = alreadyObtainedToken;
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
var _this = this;
|
|
228
|
+
}
|
|
229
|
+
_handleRetryRequestToken3DS(finalRequest, mid, isTest, regional, callback, authorization) {
|
|
291
230
|
// istanbul ignore next
|
|
292
231
|
if (this._alreadyObtainedToken)
|
|
293
232
|
return;
|
|
294
233
|
window.Cardinal.complete({
|
|
295
|
-
Status: "Success"
|
|
234
|
+
Status: "Success",
|
|
235
|
+
})
|
|
236
|
+
.then(() => {
|
|
237
|
+
this._requestTokenGateway(finalRequest, mid, isTest, regional, callback, authorization);
|
|
296
238
|
})
|
|
297
|
-
.
|
|
298
|
-
|
|
299
|
-
})["catch"](function () {
|
|
300
|
-
var error = ErrorEnum_1.ERRORS[ErrorEnum_1.ErrorCode.E002];
|
|
239
|
+
.catch(() => {
|
|
240
|
+
const error = ErrorEnum_1.ERRORS[ErrorEnum_1.ErrorCode.E002];
|
|
301
241
|
Kushki_1.Kushki.callbackError(new KushkiError_1.KushkiError(error, ""), callback);
|
|
302
242
|
});
|
|
303
|
-
}
|
|
304
|
-
|
|
243
|
+
}
|
|
244
|
+
_getCreateSubscriptionDataToTransform(siftObject, subscriptionTokenRequest) {
|
|
305
245
|
if (siftObject.userId === null || siftObject.sessionId === null)
|
|
306
|
-
return
|
|
307
|
-
return
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
var _this = this;
|
|
246
|
+
return Object.assign({}, subscriptionTokenRequest);
|
|
247
|
+
return Object.assign(Object.assign({}, subscriptionTokenRequest), siftObject);
|
|
248
|
+
}
|
|
249
|
+
_request3DSToken(isTest, requestToken) {
|
|
311
250
|
if (isTest)
|
|
312
|
-
Promise.resolve().then(
|
|
313
|
-
|
|
251
|
+
Promise.resolve().then(() => require("./../../lib/libs/cardinal/staging")).then(() => {
|
|
252
|
+
this._setupCompleteCardinal(requestToken);
|
|
314
253
|
});
|
|
315
254
|
else
|
|
316
|
-
Promise.resolve().then(
|
|
317
|
-
|
|
255
|
+
Promise.resolve().then(() => require("./../../lib/libs/cardinal/prod")).then(() => {
|
|
256
|
+
this._setupCompleteCardinal(requestToken);
|
|
318
257
|
});
|
|
319
|
-
}
|
|
258
|
+
}
|
|
320
259
|
// istanbul ignore next
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
return [2 /*return*/];
|
|
327
|
-
});
|
|
328
|
-
}); });
|
|
329
|
-
};
|
|
260
|
+
_setupCompleteCardinal(requestToken) {
|
|
261
|
+
window.Cardinal.on("payments.setupComplete", () => __awaiter(this, void 0, void 0, function* () {
|
|
262
|
+
requestToken();
|
|
263
|
+
}));
|
|
264
|
+
}
|
|
330
265
|
// istanbul ignore next
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
var request_token = this._gateway.requestToken(body, mid, testEnv, regional, authorization);
|
|
266
|
+
_requestTokenGateway(body, mid, testEnv, regional, callback, authorization) {
|
|
267
|
+
const request_token = this._gateway.requestToken(body, mid, testEnv, regional, authorization);
|
|
334
268
|
return request_token.subscribe({
|
|
335
|
-
error:
|
|
336
|
-
|
|
337
|
-
},
|
|
338
|
-
next: function (response) {
|
|
269
|
+
error: (err) => Kushki_1.Kushki.callbackError(err, callback),
|
|
270
|
+
next: (response) => {
|
|
339
271
|
callback(response);
|
|
340
|
-
|
|
341
|
-
}
|
|
272
|
+
this._alreadyObtainedToken = true;
|
|
273
|
+
},
|
|
342
274
|
});
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
_this._setSandboxEnable(!!merchant.sandboxEnable);
|
|
275
|
+
}
|
|
276
|
+
_getMerchantSettings(mid, isTest, regional) {
|
|
277
|
+
return this._gateway.requestMerchantSettings(mid, isTest, regional).pipe(operators_1.map((merchant) => {
|
|
278
|
+
this._setSandboxEnable(!!merchant.sandboxEnable);
|
|
348
279
|
return merchant;
|
|
349
280
|
}));
|
|
350
|
-
}
|
|
351
|
-
|
|
281
|
+
}
|
|
282
|
+
_validateParameters(body) {
|
|
352
283
|
return (body.security.acsURL === undefined ||
|
|
353
284
|
body.security.paReq === undefined ||
|
|
354
285
|
body.security.authenticationTransactionId === undefined);
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
};
|
|
366
|
-
CardService.prototype._createSubscriptionSiftScienceSession = function (subscriptionId, mid, isTest, merchantSettingsResponse, regional, request) {
|
|
367
|
-
var _this = this;
|
|
368
|
-
return rxjs_1.of(1).pipe(operators_1.switchMap(function () {
|
|
369
|
-
return _this._getUserId(subscriptionId, mid, isTest, regional, request.userId);
|
|
370
|
-
}), operators_1.switchMap(function (getUserIdResponse) {
|
|
371
|
-
return _this._antiFraud.createSiftScienceSession(subscriptionId, "", mid, isTest, merchantSettingsResponse, UtilsService_1.UtilsService.sGet(getUserIdResponse, "userId"));
|
|
372
|
-
}));
|
|
373
|
-
};
|
|
374
|
-
CardService.prototype._checkCardLength = function (request, errorCode) {
|
|
375
|
-
if (errorCode === void 0) { errorCode = ErrorEnum_1.ErrorCode.E005; }
|
|
286
|
+
}
|
|
287
|
+
_getDeviceTokenSiftScienceObject(request, mid, isTest, merchant, regional) {
|
|
288
|
+
return rxjs_1.of(1).pipe(operators_1.switchMap(() => rxjs_1.iif(() => request.sessionId !== undefined &&
|
|
289
|
+
request.sessionId !== null &&
|
|
290
|
+
(request.userId !== undefined && request.userId !== null), this._getRequestSiftObject(request.userId, request.sessionId), this._createSubscriptionSiftScienceSession(request.subscriptionId, mid, isTest, merchant, regional, request))));
|
|
291
|
+
}
|
|
292
|
+
_createSubscriptionSiftScienceSession(subscriptionId, mid, isTest, merchantSettingsResponse, regional, request) {
|
|
293
|
+
return rxjs_1.of(1).pipe(operators_1.switchMap(() => this._getUserId(subscriptionId, mid, isTest, regional, request.userId)), operators_1.switchMap((getUserIdResponse) => this._antiFraud.createSiftScienceSession(subscriptionId, "", mid, isTest, merchantSettingsResponse, UtilsService_1.UtilsService.sGet(getUserIdResponse, "userId"))));
|
|
294
|
+
}
|
|
295
|
+
_checkCardLength(request, errorCode = ErrorEnum_1.ErrorCode.E005) {
|
|
376
296
|
if (request.card.number.length < 14 || request.card.number.length > 19)
|
|
377
297
|
throw new KushkiError_1.KushkiError(ErrorEnum_1.ERRORS[errorCode]);
|
|
378
|
-
}
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
return rxjs_1.of(1).pipe(operators_1.switchMap(function () {
|
|
298
|
+
}
|
|
299
|
+
_getScienceSession(request, mid, isTest, merchant) {
|
|
300
|
+
return rxjs_1.of(1).pipe(operators_1.switchMap(() => {
|
|
382
301
|
if (request.card && request.card.number !== undefined)
|
|
383
|
-
return
|
|
302
|
+
return this._antiFraud.createSiftScienceSession(UtilsService_1.getBinFromCreditCardNumberSift(request.card.number), request.card.number.slice(-4), mid, isTest, merchant);
|
|
384
303
|
return rxjs_1.of({
|
|
385
304
|
sessionId: null,
|
|
386
|
-
userId: null
|
|
305
|
+
userId: null,
|
|
387
306
|
});
|
|
388
307
|
}));
|
|
389
|
-
}
|
|
390
|
-
|
|
308
|
+
}
|
|
309
|
+
_checkCurrency(request) {
|
|
391
310
|
request.currency =
|
|
392
311
|
request.currency === undefined ? "USD" : request.currency;
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
return rxjs_1.of(1).pipe(operators_1.map(
|
|
396
|
-
sessionId
|
|
397
|
-
userId
|
|
398
|
-
})
|
|
399
|
-
}
|
|
400
|
-
|
|
312
|
+
}
|
|
313
|
+
_getRequestSiftObject(userId, sessionId) {
|
|
314
|
+
return rxjs_1.of(1).pipe(operators_1.map(() => ({
|
|
315
|
+
sessionId,
|
|
316
|
+
userId,
|
|
317
|
+
})));
|
|
318
|
+
}
|
|
319
|
+
_checkAmount(request) {
|
|
401
320
|
if (request.amount !== undefined && typeof request.amount === "string")
|
|
402
321
|
request.amount = parseFloat(request.amount);
|
|
403
|
-
}
|
|
404
|
-
|
|
322
|
+
}
|
|
323
|
+
_checkRequestBody(request) {
|
|
405
324
|
this._checkCurrency(request);
|
|
406
325
|
if (Boolean(request.card) && Boolean(request.card.number))
|
|
407
326
|
this._checkCardLength(request);
|
|
408
327
|
this._checkAmount(request);
|
|
409
|
-
}
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
if (_this._is3DSSecureEnabled(merchantSettings) &&
|
|
328
|
+
}
|
|
329
|
+
_getCybersourceJwt(merchantSettings, mid, isTest, regional, cardNumber) {
|
|
330
|
+
return rxjs_1.of(1).pipe(operators_1.switchMap(() => {
|
|
331
|
+
if (this._is3DSSecureEnabled(merchantSettings) &&
|
|
414
332
|
cardNumber !== undefined)
|
|
415
|
-
return rxjs_1.iif(
|
|
333
|
+
return rxjs_1.iif(() => this._isSandboxEnabled(merchantSettings), this._initCybersourceSandbox(mid, isTest, regional), this._initCybersource(cardNumber, mid, isTest, regional));
|
|
416
334
|
return rxjs_1.of(undefined);
|
|
417
335
|
}));
|
|
418
|
-
}
|
|
419
|
-
|
|
336
|
+
}
|
|
337
|
+
_isSandboxEnabled(merchantSettings) {
|
|
420
338
|
return !!merchantSettings.sandboxEnable;
|
|
421
|
-
}
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
return rxjs_1.iif(function () { return _this._isSandboxEnabled(merchantSettings); }, _this._initCybersourceSandbox(mid, isTest, regional), _this._initCybersourceSubscription(subscriptionId, mid, isTest, regional));
|
|
339
|
+
}
|
|
340
|
+
_getCybersourceJwtSubscription(merchantSettings, mid, isTest, regional, subscriptionId) {
|
|
341
|
+
return rxjs_1.of(1).pipe(operators_1.switchMap(() => {
|
|
342
|
+
if (this._is3DSSecureEnabled(merchantSettings))
|
|
343
|
+
return rxjs_1.iif(() => this._isSandboxEnabled(merchantSettings), this._initCybersourceSandbox(mid, isTest, regional), this._initCybersourceSubscription(subscriptionId, mid, isTest, regional));
|
|
427
344
|
return rxjs_1.of(undefined);
|
|
428
345
|
}));
|
|
429
|
-
}
|
|
430
|
-
|
|
346
|
+
}
|
|
347
|
+
_is3DSSecureEnabled(merchantSettings) {
|
|
431
348
|
return merchantSettings[this._3Dsecure] === true;
|
|
432
|
-
}
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
_this._initializeCardinal(isTest, jwtResponse.jwt, cardNumber);
|
|
349
|
+
}
|
|
350
|
+
_initCybersource(cardNumber, mid, isTest, regional) {
|
|
351
|
+
return rxjs_1.of(1).pipe(operators_1.switchMap(() => this._gateway.cybersourceJwt(mid, isTest, regional)), operators_1.map((jwtResponse) => {
|
|
352
|
+
this._initializeCardinal(isTest, jwtResponse.jwt, cardNumber);
|
|
437
353
|
return jwtResponse.jwt;
|
|
438
354
|
}));
|
|
439
|
-
}
|
|
440
|
-
|
|
355
|
+
}
|
|
356
|
+
_initializeCardinal(isTest, jwt, identifier) {
|
|
441
357
|
if (isTest)
|
|
442
|
-
Promise.resolve().then(
|
|
358
|
+
Promise.resolve().then(() => require("./../../lib/libs/cardinal/staging")).then(() => {
|
|
443
359
|
CardService_1._initCardinal(jwt, identifier);
|
|
444
360
|
});
|
|
445
361
|
else
|
|
446
|
-
Promise.resolve().then(
|
|
362
|
+
Promise.resolve().then(() => require("./../../lib/libs/cardinal/prod")).then(() => {
|
|
447
363
|
CardService_1._initCardinal(jwt, identifier);
|
|
448
364
|
});
|
|
449
|
-
}
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
}), operators_1.map(function (jwtResponse) {
|
|
455
|
-
var bin = Buffer.from(jwtResponse.identifier, "base64").toString("ascii");
|
|
456
|
-
_this._initializeCardinal(isTest, jwtResponse.jwt, bin);
|
|
365
|
+
}
|
|
366
|
+
_initCybersourceSubscription(subscriptionId, mid, isTest, regional) {
|
|
367
|
+
return rxjs_1.of(1).pipe(operators_1.switchMap(() => this._gateway.cybersourceJwt(mid, isTest, regional, subscriptionId)), operators_1.map((jwtResponse) => {
|
|
368
|
+
const bin = Buffer.from(jwtResponse.identifier, "base64").toString("ascii");
|
|
369
|
+
this._initializeCardinal(isTest, jwtResponse.jwt, bin);
|
|
457
370
|
return jwtResponse.jwt;
|
|
458
371
|
}));
|
|
459
|
-
}
|
|
372
|
+
}
|
|
460
373
|
// istanbul ignore next
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
next: function (response) {
|
|
476
|
-
callback({
|
|
477
|
-
isValid: CardService_1._is3dsValid(response)
|
|
478
|
-
});
|
|
479
|
-
}
|
|
480
|
-
})];
|
|
374
|
+
_completeCardinal(secureServiceId, mid, isTest, regional, callback) {
|
|
375
|
+
return window.Cardinal.on("payments.validated", () => __awaiter(this, void 0, void 0, function* () {
|
|
376
|
+
const otp_request = {
|
|
377
|
+
secureServiceId,
|
|
378
|
+
otpValue: "",
|
|
379
|
+
};
|
|
380
|
+
const secure = this._gateway.requestSecureServiceValidation(mid, otp_request, isTest, regional);
|
|
381
|
+
return secure.subscribe({
|
|
382
|
+
error: (err) => Kushki_1.Kushki.callbackError(err, callback),
|
|
383
|
+
next: (response) => {
|
|
384
|
+
callback({
|
|
385
|
+
isValid: CardService_1._is3dsValid(response),
|
|
386
|
+
});
|
|
387
|
+
},
|
|
481
388
|
});
|
|
482
|
-
})
|
|
483
|
-
}
|
|
484
|
-
|
|
389
|
+
}));
|
|
390
|
+
}
|
|
391
|
+
static _initCardinal(jwt, cardNumber) {
|
|
485
392
|
window.Cardinal.setup("init", {
|
|
486
|
-
jwt
|
|
393
|
+
jwt,
|
|
487
394
|
order: {
|
|
488
395
|
Consumer: {
|
|
489
396
|
Account: {
|
|
490
|
-
AccountNumber: cardNumber
|
|
491
|
-
}
|
|
492
|
-
}
|
|
493
|
-
}
|
|
397
|
+
AccountNumber: cardNumber,
|
|
398
|
+
},
|
|
399
|
+
},
|
|
400
|
+
},
|
|
494
401
|
});
|
|
495
|
-
}
|
|
496
|
-
|
|
497
|
-
window.Cardinal
|
|
402
|
+
}
|
|
403
|
+
static _ccaCardinal(tokenResponse) {
|
|
404
|
+
window.Cardinal.continue("cca", {
|
|
498
405
|
AcsUrl: tokenResponse.security.acsURL,
|
|
499
|
-
Payload: tokenResponse.security.paReq
|
|
406
|
+
Payload: tokenResponse.security.paReq,
|
|
500
407
|
}, {
|
|
501
408
|
OrderDetails: {
|
|
502
|
-
TransactionId: tokenResponse.security.authenticationTransactionId
|
|
503
|
-
}
|
|
409
|
+
TransactionId: tokenResponse.security.authenticationTransactionId,
|
|
410
|
+
},
|
|
504
411
|
});
|
|
505
|
-
}
|
|
412
|
+
}
|
|
506
413
|
// istanbul ignore next
|
|
507
|
-
|
|
414
|
+
static _is3dsValid(secureOtpResponse) {
|
|
508
415
|
return ("message" in secureOtpResponse &&
|
|
509
416
|
((secureOtpResponse.message === "3DS000" &&
|
|
510
417
|
secureOtpResponse.code === "ok") ||
|
|
511
418
|
(secureOtpResponse.code === "3DS000" &&
|
|
512
419
|
secureOtpResponse.message === "ok")));
|
|
513
|
-
}
|
|
514
|
-
|
|
420
|
+
}
|
|
421
|
+
_setSandboxEnable(payload) {
|
|
515
422
|
this._sandboxEnable = payload;
|
|
516
|
-
}
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
return rxjs_1.of(1).pipe(operators_1.switchMap(function () { return _this._gateway.cybersourceJwt(mid, isTest, regional); }), operators_1.map(function (jwtResponse) {
|
|
423
|
+
}
|
|
424
|
+
_initCybersourceSandbox(mid, isTest, regional) {
|
|
425
|
+
return rxjs_1.of(1).pipe(operators_1.switchMap(() => this._gateway.cybersourceJwt(mid, isTest, regional)), operators_1.map((jwtResponse) => {
|
|
520
426
|
cardinal_sandbox_js_1.KushkiCardinalSandbox.init();
|
|
521
427
|
return jwtResponse.jwt;
|
|
522
428
|
}));
|
|
523
|
-
}
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
cardinal_sandbox_js_1.KushkiCardinalSandbox["continue"]("cca", {
|
|
429
|
+
}
|
|
430
|
+
_ccaSandbox(body, mid, isTest, regional, callback) {
|
|
431
|
+
cardinal_sandbox_js_1.KushkiCardinalSandbox.continue("cca", {
|
|
527
432
|
AcsUrl: body.security.acsURL,
|
|
528
|
-
Payload: body.security.paReq
|
|
433
|
+
Payload: body.security.paReq,
|
|
529
434
|
}, {
|
|
530
435
|
OrderDetails: {
|
|
531
|
-
TransactionId: body.security.authenticationTransactionId
|
|
532
|
-
}
|
|
436
|
+
TransactionId: body.security.authenticationTransactionId,
|
|
437
|
+
},
|
|
533
438
|
});
|
|
534
439
|
// istanbul ignore next
|
|
535
|
-
cardinal_sandbox_js_1.KushkiCardinalSandbox.on("payments.validated",
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
},
|
|
549
|
-
next: function (response) {
|
|
550
|
-
return callback({
|
|
551
|
-
isValid: CardService_1._is3dsValid(response)
|
|
552
|
-
});
|
|
553
|
-
}
|
|
554
|
-
})];
|
|
440
|
+
cardinal_sandbox_js_1.KushkiCardinalSandbox.on("payments.validated", (isErrorFlow) => __awaiter(this, void 0, void 0, function* () {
|
|
441
|
+
if (isErrorFlow === true)
|
|
442
|
+
return Kushki_1.Kushki.callbackError(new KushkiError_1.KushkiError(ErrorEnum_1.ERRORS.E008), callback);
|
|
443
|
+
const otp_request = {
|
|
444
|
+
otpValue: "",
|
|
445
|
+
secureServiceId: body.secureId,
|
|
446
|
+
};
|
|
447
|
+
const secure = this._gateway.requestSecureServiceValidation(mid, otp_request, isTest, regional);
|
|
448
|
+
return secure.subscribe({
|
|
449
|
+
error: (err) => Kushki_1.Kushki.callbackError(err, callback),
|
|
450
|
+
next: (response) => callback({
|
|
451
|
+
isValid: CardService_1._is3dsValid(response),
|
|
452
|
+
}),
|
|
555
453
|
});
|
|
556
|
-
})
|
|
557
|
-
}
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
}), operators_1.catchError(function () { return rxjs_1.of(undefined); }));
|
|
563
|
-
};
|
|
564
|
-
CardService.prototype._requestSubscriptionTokenGateway = function (body, mid, testEnv, regional, callback, authorization) {
|
|
454
|
+
}));
|
|
455
|
+
}
|
|
456
|
+
_getUserId(subscriptionId, mid, testEnv, regional, userId) {
|
|
457
|
+
return rxjs_1.of(1).pipe(operators_1.switchMap(() => rxjs_1.iif(() => UtilsService_1.UtilsService.sIsEmpty(userId), this._gateway.getUserId(subscriptionId, mid, testEnv, regional), rxjs_1.of(undefined))), operators_1.catchError(() => rxjs_1.of(undefined)));
|
|
458
|
+
}
|
|
459
|
+
_requestSubscriptionTokenGateway(body, mid, testEnv, regional, callback, authorization) {
|
|
565
460
|
this._gateway
|
|
566
461
|
.requestSubscriptionToken(body, mid, testEnv, regional, authorization)
|
|
567
462
|
.subscribe({
|
|
568
|
-
error:
|
|
569
|
-
|
|
570
|
-
},
|
|
571
|
-
next: function (response) {
|
|
463
|
+
error: (err) => Kushki_1.Kushki.callbackError(err, callback),
|
|
464
|
+
next: (response) => {
|
|
572
465
|
callback(response);
|
|
573
|
-
}
|
|
466
|
+
},
|
|
574
467
|
});
|
|
575
|
-
}
|
|
576
|
-
|
|
468
|
+
}
|
|
469
|
+
_requestDeviceToken(body, mid, testEnv, regional, callback) {
|
|
577
470
|
this._gateway.requestDeviceToken(body, mid, testEnv, regional).subscribe({
|
|
578
|
-
error:
|
|
579
|
-
|
|
580
|
-
},
|
|
581
|
-
next: function (response) {
|
|
471
|
+
error: (err) => Kushki_1.Kushki.callbackError(err, callback),
|
|
472
|
+
next: (response) => {
|
|
582
473
|
callback(response);
|
|
583
|
-
}
|
|
474
|
+
},
|
|
584
475
|
});
|
|
585
|
-
}
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
return CardService;
|
|
595
|
-
}());
|
|
476
|
+
}
|
|
477
|
+
};
|
|
478
|
+
CardService = CardService_1 = __decorate([
|
|
479
|
+
inversify_1.injectable(),
|
|
480
|
+
__param(0, inversify_1.inject(Identifiers_1.IDENTIFIERS.KushkiGateway)),
|
|
481
|
+
__param(1, inversify_1.inject(Identifiers_1.IDENTIFIERS.AuthService)),
|
|
482
|
+
__param(2, inversify_1.inject(Identifiers_1.IDENTIFIERS.AntiFraud)),
|
|
483
|
+
__metadata("design:paramtypes", [Object, Object, Object])
|
|
484
|
+
], CardService);
|
|
596
485
|
exports.CardService = CardService;
|