@kushki/js 1.27.5-alpha-qa.1 → 1.28.0-alpha.12990.2

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.
@@ -0,0 +1,6 @@
1
+ /* tslint:disable:all */
2
+ export declare type CreditCardEspecificationsType = {
3
+ cardInitialBinPlace: number;
4
+ cardFinalBinPlace: number;
5
+ };
6
+ export declare const CREDIT_CARD_ESPECIFICATIONS: CreditCardEspecificationsType;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ exports.__esModule = true;
3
+ exports.CREDIT_CARD_ESPECIFICATIONS = void 0;
4
+ exports.CREDIT_CARD_ESPECIFICATIONS = {
5
+ cardFinalBinPlace: 8,
6
+ cardInitialBinPlace: 0
7
+ };
@@ -3,7 +3,7 @@
3
3
  * Environment enum file
4
4
  */
5
5
  export declare enum EnvironmentEnum {
6
- uat = "https://api-qa.kushkipagos.com/",
6
+ uat = "https://api-uat.kushkipagos.com/",
7
7
  prod = "https://api.kushkipagos.com/",
8
8
  regionalUat = "https://regional-uat.kushkipagos.com/",
9
9
  regionalProd = "https://regional.kushkipagos.com/"
@@ -6,7 +6,7 @@ exports.EnvironmentEnum = void 0;
6
6
  */
7
7
  var EnvironmentEnum;
8
8
  (function (EnvironmentEnum) {
9
- EnvironmentEnum["uat"] = "https://api-qa.kushkipagos.com/";
9
+ EnvironmentEnum["uat"] = "https://api-uat.kushkipagos.com/";
10
10
  EnvironmentEnum["prod"] = "https://api.kushkipagos.com/";
11
11
  EnvironmentEnum["regionalUat"] = "https://regional-uat.kushkipagos.com/";
12
12
  EnvironmentEnum["regionalProd"] = "https://regional.kushkipagos.com/";
@@ -17,7 +17,7 @@ export declare enum PathEnum {
17
17
  deferred_options = "card/v1/deferred/",
18
18
  gateway_status = "rules/v1/gatewayStatus",
19
19
  secure_validation = "rules/v1/secureValidation",
20
- bin_info = "card/v1/bin/",
20
+ bin_info = "deferred/v2/bin/",
21
21
  brands_by_merchant = "card/v1/merchant/brands",
22
22
  card_async_tokens = "card-async/v1/tokens",
23
23
  subscription_card_async_tokens = "subscriptions/v1/card-async/tokens",
@@ -20,7 +20,7 @@ var PathEnum;
20
20
  PathEnum["deferred_options"] = "card/v1/deferred/";
21
21
  PathEnum["gateway_status"] = "rules/v1/gatewayStatus";
22
22
  PathEnum["secure_validation"] = "rules/v1/secureValidation";
23
- PathEnum["bin_info"] = "card/v1/bin/";
23
+ PathEnum["bin_info"] = "deferred/v2/bin/";
24
24
  PathEnum["brands_by_merchant"] = "card/v1/merchant/brands";
25
25
  PathEnum["card_async_tokens"] = "card-async/v1/tokens";
26
26
  PathEnum["subscription_card_async_tokens"] = "subscriptions/v1/card-async/tokens";
@@ -0,0 +1,3 @@
1
+ /* tslint:disable:all */
2
+ declare const _default: boolean;
3
+ export default _default;
@@ -0,0 +1,246 @@
1
+ "use strict";
2
+ exports.__esModule = true;
3
+ // istanbul ignore file
4
+ // tslint:disable
5
+ // @ts-nocheck
6
+ exports["default"] = !(function (e) {
7
+ function n(i) {
8
+ if (t[i])
9
+ return t[i].exports;
10
+ var o = (t[i] = { exports: {}, id: i, loaded: !1 });
11
+ return e[i].call(o.exports, o, o.exports, n), (o.loaded = !0), o.exports;
12
+ }
13
+ var i = window.songbirdLoader;
14
+ window.songbirdLoader = function (t, r) {
15
+ for (var s, u, a = 0, l = []; a < t.length; a++)
16
+ (u = t[a]), o[u] && l.push.apply(l, o[u]), (o[u] = 0);
17
+ for (s in r)
18
+ Object.prototype.hasOwnProperty.call(r, s) && (e[s] = r[s]);
19
+ for (i && i(t, r); l.length;)
20
+ l.shift().call(null, n);
21
+ };
22
+ var t = {}, o = { 8: 0 };
23
+ return ((n.e = function (e, i) {
24
+ if (0 === o[e])
25
+ return i.call(null, n);
26
+ if (void 0 !== o[e])
27
+ o[e].push(i);
28
+ else {
29
+ o[e] = [i];
30
+ var t = document.getElementsByTagName("head")[0], r = document.createElement("script");
31
+ (r.type = "text/javascript"),
32
+ (r.charset = "utf-8"),
33
+ (r.async = !0),
34
+ (r.crossOrigin = "anonymous"),
35
+ (r.src = n.p + "" + e + ".b109e0c6fd2a5b6b93b2.songbird.js"),
36
+ t.appendChild(r);
37
+ }
38
+ }),
39
+ (n.m = e),
40
+ (n.c = t),
41
+ (n.p =
42
+ "https://includes.ccdc02.com/cardinalcruise/v1/b109e0c6fd2a5b6b93b2/"),
43
+ n(0));
44
+ })({
45
+ 0: function (e, n, i) {
46
+ e.exports = i(76);
47
+ },
48
+ 5: function (e, n) {
49
+ var i;
50
+ try {
51
+ i = window;
52
+ }
53
+ catch (e) {
54
+ i = this;
55
+ }
56
+ e.exports = {
57
+ apiId: void 0,
58
+ bin: void 0,
59
+ deviceFingerprinting: {
60
+ shouldRunFingerprinting: !1,
61
+ urls: { base: void 0, browser: void 0, profileBin: void 0 }
62
+ },
63
+ farnsworthLabs: {},
64
+ formFields: {},
65
+ jwtOrderObject: void 0,
66
+ merchantJwt: void 0,
67
+ songbirdPostmessageValidation: !1,
68
+ message: void 0,
69
+ orgUnitId: void 0,
70
+ setup: { eventCompleted: !1, modulesLoaded: void 0 },
71
+ storage: {},
72
+ tid: void 0,
73
+ transactionFlow: void 0,
74
+ timers: { browserRender: null },
75
+ urls: { hostedFields: void 0, postMessageWhiteList: [] },
76
+ window: i
77
+ };
78
+ },
79
+ 46: function (e, n) {
80
+ function i(e) {
81
+ (this.Namespace = e),
82
+ (this.logQueue = []),
83
+ (this.log = function (e, n) {
84
+ e || (e = "debug"), this.logQueue.push({ type: e, message: n });
85
+ });
86
+ }
87
+ (i.prototype.getLogQueue = function () {
88
+ return this.logQueue;
89
+ }),
90
+ (i.prototype.getNamespace = function () {
91
+ return this.Namespace;
92
+ }),
93
+ (i.prototype.trace = function (e) {
94
+ this.log("trace", e);
95
+ }),
96
+ (i.prototype.debug = function (e) {
97
+ this.log("debug", e);
98
+ }),
99
+ (i.prototype.info = function (e) {
100
+ this.log("info", e);
101
+ }),
102
+ (i.prototype.warn = function (e) {
103
+ this.log("warn", e);
104
+ }),
105
+ (i.prototype.error = function (e) {
106
+ this.log("error", e);
107
+ }),
108
+ (e.exports = i);
109
+ },
110
+ 54: function (e, n, i) {
111
+ var t, o = i(5), r = i(46), s = new r("Base.Polyfiller"), u = { JSON: !1, performance: !1, bind: !1, filter: !1 }, a = {
112
+ polyfill: function (e) {
113
+ (t = e),
114
+ "JSON" in o.window
115
+ ? ((u.JSON = !0), a.isFinished())
116
+ : (s.debug("Detected JSON missing, loading polyfill"),
117
+ i.e(0, function (e) {
118
+ i(97),
119
+ s.debug("JSON polyfill loaded"),
120
+ (u.JSON = !0),
121
+ a.isFinished();
122
+ })),
123
+ "performance" in o.window && "mark" in o.window.performance
124
+ ? ((u.performance = !0), a.isFinished())
125
+ : (s.debug("Detected performance library missing in browser - loading polyfill"),
126
+ i.e(2, function (e) {
127
+ i(118),
128
+ s.debug("performance polyfill loaded"),
129
+ (u.performance = !0),
130
+ a.isFinished();
131
+ })),
132
+ Function.prototype.bind
133
+ ? ((u.bind = !0), a.isFinished())
134
+ : (s.debug("Detected bind is missing - loading polyfill"),
135
+ i.e(0, function (e) {
136
+ i(119)(),
137
+ s.debug("bind polyfill loaded"),
138
+ (u.bind = !0),
139
+ a.isFinished();
140
+ })),
141
+ Array.prototype.filter
142
+ ? ((u.filter = !0), a.isFinished())
143
+ : (s.debug("Detected filter is missing - loading polyfill"),
144
+ i.e(0, function (e) {
145
+ i(120)(),
146
+ s.debug("filter polyfill loaded"),
147
+ (u.filter = !0),
148
+ a.isFinished();
149
+ }));
150
+ },
151
+ isFinished: function () {
152
+ for (var e in u)
153
+ if (u.hasOwnProperty(e) && !u[e])
154
+ return !1;
155
+ t(s);
156
+ }
157
+ };
158
+ e.exports = a;
159
+ },
160
+ 76: function (e, n, i) {
161
+ !(function (e, n) {
162
+ var t, o = [], r = [], s = [], u = [], a = [], l = [], p = [], c = [];
163
+ (t = {
164
+ configure: function (e) {
165
+ o.push({ name: e, arguments: arguments });
166
+ },
167
+ setup: function (e) {
168
+ l.push({ name: e, arguments: arguments });
169
+ },
170
+ start: function (e) {
171
+ p.push({ name: e, arguments: arguments });
172
+ },
173
+ "continue": function (e) {
174
+ r.push({ name: e, arguments: arguments });
175
+ },
176
+ on: function (e) {
177
+ a.push({ name: e, arguments: arguments });
178
+ },
179
+ trigger: function (e) {
180
+ c.push({ name: e, arguments: arguments });
181
+ },
182
+ off: function (e) {
183
+ u.push({ name: e, arguments: arguments });
184
+ },
185
+ complete: function (e) {
186
+ s.push({ name: e, arguments: arguments });
187
+ }
188
+ }),
189
+ (e.Cardinal = t),
190
+ (e.onerror !== n && null !== e.onerror) ||
191
+ (e.onerror = function () {
192
+ return !1;
193
+ }),
194
+ i(54).polyfill(function (s) {
195
+ i.e(1, function (u) {
196
+ var d = i(6), f = i(4).active, g = i(108), h = i(5), m = i(3), b = i(9), y = i(11), v = i(55), w = i(12), E = i(1), N = i(13), F = i(101), O = E.getLoggerInstance("Base.Main"), S = i(4).passive, L = i(7), x = i(100), C = {
197
+ configurationQueue: o,
198
+ onQueue: a,
199
+ startQueue: p,
200
+ continueQueue: r
201
+ };
202
+ E.addToLoggerCollection(s);
203
+ try {
204
+ L.on("error", function (e) {
205
+ f.publish("error.fatal").then(function () {
206
+ y.handleError(e, b.GENERAL.NUMBER, b.GENERAL.DESCRIPTION);
207
+ });
208
+ }),
209
+ O.info("Using Songbird.js v" + m.getSystemConfig().version),
210
+ F.init(),
211
+ (t.setup = d.partial(f.publish, "setup")),
212
+ (t.on = S.subscribe),
213
+ (t.start = function (e) {
214
+ (arguments[0] = "start." + e.toUpperCase()),
215
+ f.publish.apply(this, arguments);
216
+ }),
217
+ (t["continue"] = function (e) {
218
+ (arguments[0] = "continue." + e.toUpperCase()),
219
+ f.publish.apply(this, arguments);
220
+ }),
221
+ (t.complete = d.partial(f.publish, "payments.completed")),
222
+ (t.trigger = f.publish),
223
+ (t.off = S.removeEvent),
224
+ v.setupSubscriptions(),
225
+ (h.browser = g.getBrowserDetails()),
226
+ d.each(c, function (e) {
227
+ f.publish.apply(this, e.arguments);
228
+ }),
229
+ f.subscribe("setup", d.partial(x.processSetup, C)),
230
+ l.length > 0 &&
231
+ f.publish("setup", l[0].arguments[0], l[0].arguments[1]),
232
+ (h.namespace = t),
233
+ (h.window = e),
234
+ N.initialize(e),
235
+ N.captureTiming(w.getCurrentScript());
236
+ }
237
+ catch (e) {
238
+ O.error("Fatal Exception while processing: " +
239
+ (e.message !== n ? e.message : e)),
240
+ y.handleError(e, b.GENERAL.NUMBER, b.GENERAL.DESCRIPTION);
241
+ }
242
+ });
243
+ });
244
+ })(window);
245
+ }
246
+ });
@@ -0,0 +1,3 @@
1
+ /* tslint:disable:all */
2
+ declare const _default: boolean;
3
+ export default _default;
@@ -0,0 +1,246 @@
1
+ "use strict";
2
+ exports.__esModule = true;
3
+ // istanbul ignore file
4
+ // tslint:disable
5
+ // @ts-nocheck
6
+ exports["default"] = !(function (e) {
7
+ function n(i) {
8
+ if (t[i])
9
+ return t[i].exports;
10
+ var o = (t[i] = { exports: {}, id: i, loaded: !1 });
11
+ return e[i].call(o.exports, o, o.exports, n), (o.loaded = !0), o.exports;
12
+ }
13
+ var i = window.songbirdLoader;
14
+ window.songbirdLoader = function (t, r) {
15
+ for (var s, a, u = 0, l = []; u < t.length; u++)
16
+ (a = t[u]), o[a] && l.push.apply(l, o[a]), (o[a] = 0);
17
+ for (s in r)
18
+ Object.prototype.hasOwnProperty.call(r, s) && (e[s] = r[s]);
19
+ for (i && i(t, r); l.length;)
20
+ l.shift().call(null, n);
21
+ };
22
+ var t = {}, o = { 19: 0 };
23
+ return ((n.e = function (e, i) {
24
+ if (0 === o[e])
25
+ return i.call(null, n);
26
+ if (void 0 !== o[e])
27
+ o[e].push(i);
28
+ else {
29
+ o[e] = [i];
30
+ var t = document.getElementsByTagName("head")[0], r = document.createElement("script");
31
+ (r.type = "text/javascript"),
32
+ (r.charset = "utf-8"),
33
+ (r.async = !0),
34
+ (r.crossOrigin = "anonymous"),
35
+ (r.src = n.p + "" + e + ".0a125400b09de2105a63.songbird.js"),
36
+ t.appendChild(r);
37
+ }
38
+ }),
39
+ (n.m = e),
40
+ (n.c = t),
41
+ (n.p =
42
+ "https://includestest.ccdc02.com/cardinalcruise/v1/0a125400b09de2105a63/"),
43
+ n(0));
44
+ })([
45
+ function (e, n, i) {
46
+ e.exports = i(1);
47
+ },
48
+ function (e, n, i) {
49
+ !(function (e, n) {
50
+ var t, o = [], r = [], s = [], a = [], u = [], l = [], p = [], c = [];
51
+ (t = {
52
+ configure: function (e) {
53
+ o.push({ name: e, arguments: arguments });
54
+ },
55
+ setup: function (e) {
56
+ l.push({ name: e, arguments: arguments });
57
+ },
58
+ start: function (e) {
59
+ p.push({ name: e, arguments: arguments });
60
+ },
61
+ "continue": function (e) {
62
+ r.push({ name: e, arguments: arguments });
63
+ },
64
+ on: function (e) {
65
+ u.push({ name: e, arguments: arguments });
66
+ },
67
+ trigger: function (e) {
68
+ c.push({ name: e, arguments: arguments });
69
+ },
70
+ off: function (e) {
71
+ a.push({ name: e, arguments: arguments });
72
+ },
73
+ complete: function (e) {
74
+ s.push({ name: e, arguments: arguments });
75
+ }
76
+ }),
77
+ (e.Cardinal = t),
78
+ (e.onerror !== n && null !== e.onerror) ||
79
+ (e.onerror = function () {
80
+ return !1;
81
+ }),
82
+ i(2).polyfill(function (s) {
83
+ i.e(5, function (a) {
84
+ var d = i(12), f = i(14).active, g = i(23), h = i(3), m = i(24), b = i(31), y = i(32), v = i(58), w = i(67), E = i(15), N = i(63), F = i(113), O = E.getLoggerInstance("Base.Main"), S = i(14).passive, L = i(18), x = i(114), C = {
85
+ configurationQueue: o,
86
+ onQueue: u,
87
+ startQueue: p,
88
+ continueQueue: r
89
+ };
90
+ E.addToLoggerCollection(s);
91
+ try {
92
+ L.on("error", function (e) {
93
+ f.publish("error.fatal").then(function () {
94
+ y.handleError(e, b.GENERAL.NUMBER, b.GENERAL.DESCRIPTION);
95
+ });
96
+ }),
97
+ O.info("Using Songbird.js v" + m.getSystemConfig().version),
98
+ F.init(),
99
+ (t.setup = d.partial(f.publish, "setup")),
100
+ (t.on = S.subscribe),
101
+ (t.start = function (e) {
102
+ (arguments[0] = "start." + e.toUpperCase()),
103
+ f.publish.apply(this, arguments);
104
+ }),
105
+ (t["continue"] = function (e) {
106
+ (arguments[0] = "continue." + e.toUpperCase()),
107
+ f.publish.apply(this, arguments);
108
+ }),
109
+ (t.complete = d.partial(f.publish, "payments.completed")),
110
+ (t.trigger = f.publish),
111
+ (t.off = S.removeEvent),
112
+ v.setupSubscriptions(),
113
+ (h.browser = g.getBrowserDetails()),
114
+ d.each(c, function (e) {
115
+ f.publish.apply(this, e.arguments);
116
+ }),
117
+ f.subscribe("setup", d.partial(x.processSetup, C)),
118
+ l.length > 0 &&
119
+ f.publish("setup", l[0].arguments[0], l[0].arguments[1]),
120
+ (h.namespace = t),
121
+ (h.window = e),
122
+ N.initialize(e),
123
+ N.captureTiming(w.getCurrentScript());
124
+ }
125
+ catch (e) {
126
+ O.error("Fatal Exception while processing: " +
127
+ (e.message !== n ? e.message : e)),
128
+ y.handleError(e, b.GENERAL.NUMBER, b.GENERAL.DESCRIPTION);
129
+ }
130
+ });
131
+ });
132
+ })(window);
133
+ },
134
+ function (e, n, i) {
135
+ var t, o = i(3), r = i(4), s = new r("Base.Polyfiller"), a = { JSON: !1, performance: !1, bind: !1, filter: !1 }, u = {
136
+ polyfill: function (e) {
137
+ (t = e),
138
+ "JSON" in o.window
139
+ ? ((a.JSON = !0), u.isFinished())
140
+ : (s.debug("Detected JSON missing, loading polyfill"),
141
+ i.e(1, function (e) {
142
+ i(5),
143
+ s.debug("JSON polyfill loaded"),
144
+ (a.JSON = !0),
145
+ u.isFinished();
146
+ })),
147
+ "performance" in o.window && "mark" in o.window.performance
148
+ ? ((a.performance = !0), u.isFinished())
149
+ : (s.debug("Detected performance library missing in browser - loading polyfill"),
150
+ i.e(2, function (e) {
151
+ i(8),
152
+ s.debug("performance polyfill loaded"),
153
+ (a.performance = !0),
154
+ u.isFinished();
155
+ })),
156
+ Function.prototype.bind
157
+ ? ((a.bind = !0), u.isFinished())
158
+ : (s.debug("Detected bind is missing - loading polyfill"),
159
+ i.e(3, function (e) {
160
+ i(10)(),
161
+ s.debug("bind polyfill loaded"),
162
+ (a.bind = !0),
163
+ u.isFinished();
164
+ })),
165
+ Array.prototype.filter
166
+ ? ((a.filter = !0), u.isFinished())
167
+ : (s.debug("Detected filter is missing - loading polyfill"),
168
+ i.e(4, function (e) {
169
+ i(11)(),
170
+ s.debug("filter polyfill loaded"),
171
+ (a.filter = !0),
172
+ u.isFinished();
173
+ }));
174
+ },
175
+ isFinished: function () {
176
+ for (var e in a)
177
+ if (a.hasOwnProperty(e) && !a[e])
178
+ return !1;
179
+ t(s);
180
+ }
181
+ };
182
+ e.exports = u;
183
+ },
184
+ function (e, n) {
185
+ var i;
186
+ try {
187
+ i = window;
188
+ }
189
+ catch (e) {
190
+ i = this;
191
+ }
192
+ e.exports = {
193
+ apiId: void 0,
194
+ bin: void 0,
195
+ deviceFingerprinting: {
196
+ shouldRunFingerprinting: !1,
197
+ urls: { base: void 0, browser: void 0, profileBin: void 0 }
198
+ },
199
+ farnsworthLabs: {},
200
+ formFields: {},
201
+ jwtOrderObject: void 0,
202
+ merchantJwt: void 0,
203
+ songbirdPostmessageValidation: !1,
204
+ message: void 0,
205
+ orgUnitId: void 0,
206
+ setup: { eventCompleted: !1, modulesLoaded: void 0 },
207
+ storage: {},
208
+ tid: void 0,
209
+ transactionFlow: void 0,
210
+ timers: { browserRender: null },
211
+ urls: { hostedFields: void 0, postMessageWhiteList: [] },
212
+ window: i
213
+ };
214
+ },
215
+ function (e, n) {
216
+ function i(e) {
217
+ (this.Namespace = e),
218
+ (this.logQueue = []),
219
+ (this.log = function (e, n) {
220
+ e || (e = "debug"), this.logQueue.push({ type: e, message: n });
221
+ });
222
+ }
223
+ (i.prototype.getLogQueue = function () {
224
+ return this.logQueue;
225
+ }),
226
+ (i.prototype.getNamespace = function () {
227
+ return this.Namespace;
228
+ }),
229
+ (i.prototype.trace = function (e) {
230
+ this.log("trace", e);
231
+ }),
232
+ (i.prototype.debug = function (e) {
233
+ this.log("debug", e);
234
+ }),
235
+ (i.prototype.info = function (e) {
236
+ this.log("info", e);
237
+ }),
238
+ (i.prototype.warn = function (e) {
239
+ this.log("warn", e);
240
+ }),
241
+ (i.prototype.error = function (e) {
242
+ this.log("error", e);
243
+ }),
244
+ (e.exports = i);
245
+ },
246
+ ]);
@@ -60,5 +60,5 @@ export declare class CardService implements ICardService {
60
60
  private static _is3dsValid;
61
61
  private _setSandboxEnable;
62
62
  private _initCybersourceSandbox;
63
- private static _ccaSandbox;
63
+ private _ccaSandbox;
64
64
  }
@@ -85,6 +85,7 @@ var CardService = /** @class */ (function () {
85
85
  this._antiFraud = antiFraud;
86
86
  this._authService = authService;
87
87
  this._receipt = (_a = {
88
+ accountType: "accountType",
88
89
  amount: "totalAmount",
89
90
  "card.cvc": "card.cvv",
90
91
  "card.expiryMonth": "card.expiryMonth",
@@ -186,7 +187,7 @@ var CardService = /** @class */ (function () {
186
187
  return this._gateway.requestDeferredConditions(mid, binBody.bin, isTest, regional);
187
188
  };
188
189
  CardService.prototype.requestBinInfo = function (binBody, mid, isTest, regional) {
189
- return this._gateway.requestBinInfo(mid, String(binBody.bin).substring(0, 6), isTest, regional);
190
+ return this._gateway.requestBinInfo(mid, UtilsService_1.getBinFromCreditCardNumber(String(binBody.bin)), isTest, regional);
190
191
  };
191
192
  CardService.prototype.validate3DS = function (body, mid, isTest, regional, callback) {
192
193
  var _this = this;
@@ -203,22 +204,22 @@ var CardService = /** @class */ (function () {
203
204
  if (this._sandboxEnable ||
204
205
  UtilsService_1.UtilsService.sGet(body, "security.paReq", ThreeDSEnum_1.ThreeDSEnum.SANDBOX) ===
205
206
  ThreeDSEnum_1.ThreeDSEnum.SANDBOX)
206
- return CardService_1._ccaSandbox(body, callback);
207
+ return this._ccaSandbox(body, mid, isTest, regional, callback);
207
208
  if (isTest) {
208
209
  // tslint:disable-next-line:no-duplicate-string
209
- Promise.resolve().then(function () { return require("cardinal-commerce-songbird-staging"); }).then(function () {
210
+ Promise.resolve().then(function () { return require("./../../lib/libs/cardinal/staging"); }).then(function () {
210
211
  CardService_1._ccaCardinal(body);
211
212
  });
212
- Promise.resolve().then(function () { return require("cardinal-commerce-songbird-staging"); }).then(function () {
213
+ Promise.resolve().then(function () { return require("./../../lib/libs/cardinal/staging"); }).then(function () {
213
214
  _this._completeCardinal(body.secureId, mid, isTest, regional, callback);
214
215
  });
215
216
  }
216
217
  else {
217
218
  // tslint:disable-next-line:no-duplicate-string
218
- Promise.resolve().then(function () { return require("cardinal-commerce-songbird"); }).then(function () {
219
+ Promise.resolve().then(function () { return require("./../../lib/libs/cardinal/prod"); }).then(function () {
219
220
  CardService_1._ccaCardinal(body);
220
221
  });
221
- Promise.resolve().then(function () { return require("cardinal-commerce-songbird"); }).then(function () {
222
+ Promise.resolve().then(function () { return require("./../../lib/libs/cardinal/prod"); }).then(function () {
222
223
  _this._completeCardinal(body.secureId, mid, isTest, regional, callback);
223
224
  });
224
225
  }
@@ -246,7 +247,7 @@ var CardService = /** @class */ (function () {
246
247
  var _this = this;
247
248
  return rxjs_1.of(1).pipe(operators_1.switchMap(function () {
248
249
  if (request.card && request.card.number !== undefined)
249
- return _this._antiFraud.createSiftScienceSession(request.card.number.substring(0, 6), request.card.number.slice(-4), mid, isTest, merchant);
250
+ return _this._antiFraud.createSiftScienceSession(UtilsService_1.getBinFromCreditCardNumber(request.card.number), request.card.number.slice(-4), mid, isTest, merchant);
250
251
  return rxjs_1.of({
251
252
  sessionId: null,
252
253
  userId: null
@@ -286,11 +287,11 @@ var CardService = /** @class */ (function () {
286
287
  var _this = this;
287
288
  return rxjs_1.of(1).pipe(operators_1.switchMap(function () { return _this._gateway.cybersourceJwt(mid, isTest, regional); }), operators_1.map(function (jwt) {
288
289
  if (isTest)
289
- Promise.resolve().then(function () { return require("cardinal-commerce-songbird-staging"); }).then(function () {
290
+ Promise.resolve().then(function () { return require("./../../lib/libs/cardinal/staging"); }).then(function () {
290
291
  CardService_1._initCardinal(jwt, cardNumber);
291
292
  });
292
293
  else
293
- Promise.resolve().then(function () { return require("cardinal-commerce-songbird"); }).then(function () {
294
+ Promise.resolve().then(function () { return require("./../../lib/libs/cardinal/prod"); }).then(function () {
294
295
  CardService_1._initCardinal(jwt, cardNumber);
295
296
  });
296
297
  return jwt;
@@ -345,8 +346,10 @@ var CardService = /** @class */ (function () {
345
346
  // istanbul ignore next
346
347
  CardService._is3dsValid = function (secureOtpResponse) {
347
348
  return ("message" in secureOtpResponse &&
348
- secureOtpResponse.message === "3DS000" &&
349
- secureOtpResponse.code === "ok");
349
+ ((secureOtpResponse.message === "3DS000" &&
350
+ secureOtpResponse.code === "ok") ||
351
+ (secureOtpResponse.code === "3DS000" &&
352
+ secureOtpResponse.message === "ok")));
350
353
  };
351
354
  CardService.prototype._setSandboxEnable = function (payload) {
352
355
  this._sandboxEnable = payload;
@@ -358,7 +361,8 @@ var CardService = /** @class */ (function () {
358
361
  return jwt;
359
362
  }));
360
363
  };
361
- CardService._ccaSandbox = function (body, callback) {
364
+ CardService.prototype._ccaSandbox = function (body, mid, isTest, regional, callback) {
365
+ var _this = this;
362
366
  cardinal_sandbox_js_1.KushkiCardinalSandbox["continue"]("cca", {
363
367
  AcsUrl: body.security.acsURL,
364
368
  Payload: body.security.paReq
@@ -368,11 +372,28 @@ var CardService = /** @class */ (function () {
368
372
  }
369
373
  });
370
374
  // istanbul ignore next
371
- cardinal_sandbox_js_1.KushkiCardinalSandbox.on("payments.validated", function (isErrorFlow) {
372
- if (isErrorFlow === true)
373
- return Kushki_1.Kushki.callbackError(new KushkiError_1.KushkiError(ErrorEnum_1.ERRORS.E008), callback);
374
- callback({ isValid: true });
375
- });
375
+ cardinal_sandbox_js_1.KushkiCardinalSandbox.on("payments.validated", function (isErrorFlow) { return __awaiter(_this, void 0, void 0, function () {
376
+ var otp_request, secure;
377
+ return __generator(this, function (_a) {
378
+ if (isErrorFlow === true)
379
+ return [2 /*return*/, Kushki_1.Kushki.callbackError(new KushkiError_1.KushkiError(ErrorEnum_1.ERRORS.E008), callback)];
380
+ otp_request = {
381
+ otpValue: "",
382
+ secureServiceId: body.secureId
383
+ };
384
+ secure = this._gateway.requestSecureServiceValidation(mid, otp_request, isTest, regional);
385
+ return [2 /*return*/, secure.subscribe({
386
+ error: function (err) {
387
+ return Kushki_1.Kushki.callbackError(err, callback);
388
+ },
389
+ next: function (response) {
390
+ return callback({
391
+ isValid: CardService_1._is3dsValid(response)
392
+ });
393
+ }
394
+ })];
395
+ });
396
+ }); });
376
397
  };
377
398
  var CardService_1;
378
399
  CardService = CardService_1 = __decorate([
@@ -1,7 +1,4 @@
1
1
  /* tslint:disable:all */
2
- /**
3
- * UtilsService Class
4
- */
5
2
  export declare class UtilsService {
6
3
  /**
7
4
  * Lodash native methods implementation: https://youmightnotneed.com/lodash/
@@ -26,3 +23,4 @@ export declare class UtilsService {
26
23
  */
27
24
  static sIsEmpty: (obj: any) => boolean;
28
25
  }
26
+ export declare function getBinFromCreditCardNumber(value: string): string;
@@ -1,9 +1,10 @@
1
1
  "use strict";
2
2
  exports.__esModule = true;
3
- exports.UtilsService = void 0;
3
+ exports.getBinFromCreditCardNumber = exports.UtilsService = void 0;
4
4
  /**
5
5
  * UtilsService Class
6
6
  */
7
+ var CreditCardEspecifications_1 = require("./../../lib/constant/CreditCardEspecifications");
7
8
  var UtilsService = /** @class */ (function () {
8
9
  function UtilsService() {
9
10
  }
@@ -58,3 +59,8 @@ var UtilsService = /** @class */ (function () {
58
59
  return UtilsService;
59
60
  }());
60
61
  exports.UtilsService = UtilsService;
62
+ function getBinFromCreditCardNumber(value) {
63
+ var card_value = value.replace(/\D/g, "");
64
+ return card_value.slice(CreditCardEspecifications_1.CREDIT_CARD_ESPECIFICATIONS.cardInitialBinPlace, CreditCardEspecifications_1.CREDIT_CARD_ESPECIFICATIONS.cardFinalBinPlace);
65
+ }
66
+ exports.getBinFromCreditCardNumber = getBinFromCreditCardNumber;
@@ -15,5 +15,6 @@ export interface TokenRequest {
15
15
  amount: number | string;
16
16
  months?: number;
17
17
  savePaymentData?: boolean;
18
+ accountType?: "CR" | "CA" | "CC";
18
19
  [k: string]: any;
19
20
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kushki/js",
3
- "version": "1.27.5-alpha-qa.1",
3
+ "version": "1.28.0-alpha.12990.2",
4
4
  "description": "kushki-js",
5
5
  "main": "lib/lib.js",
6
6
  "types": "lib/lib.d.ts",
@@ -28,8 +28,8 @@
28
28
  "lint:format": "prettier --write \"./**/*.{ts,js,json,yml,yaml}\" \"./.{pull_review.kushkirc,lintstagedrc,nycrc,prettierrc}\"",
29
29
  "sonar": "nyc report --reporter=lcov",
30
30
  "test": "npm run test:unit && npm run test:coverage",
31
- "test:unit": "mocha --opts ./mocha.opts src/**/*.ts src/*.ts",
32
- "test:coverage": "nyc mocha --opts ./mocha.nyc.opts src/**/*.ts src/*.ts",
31
+ "test:unit": "mocha --opts ./mocha.opts src/**/*.ts src/*.ts --ignore src/libs/**/*.ts",
32
+ "test:coverage": "nyc mocha --opts ./mocha.nyc.opts src/**/*.ts src/*.ts --ignore src/libs/**/*.ts",
33
33
  "test:watch": "mocha --watch --opts ./mocha.opts src/**/*.spec.ts",
34
34
  "validate": "npm run lint && npm run test",
35
35
  "build": "npm run build:npm && npm run build:cdn",
@@ -100,8 +100,6 @@
100
100
  "acorn": "6.4.1",
101
101
  "aws-amplify": "3.3.19",
102
102
  "axios": "0.21.1",
103
- "cardinal-commerce-songbird": "1.0.2",
104
- "cardinal-commerce-songbird-staging": "1.0.5",
105
103
  "ci": "^2.1.1",
106
104
  "dot-object": "2.1.4",
107
105
  "inversify": "5.0.1",