@xsolla/payment-client-core 0.2.98 → 0.2.100
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/esm2022/lib/core/payment/actions/next-action.interface.mjs +1 -1
- package/esm2022/lib/core/payment/actions/next-actions.mjs +3 -1
- package/esm2022/lib/core/payment/actions/three-ds-redirect/three-ds-redirect.action.class.mjs +34 -0
- package/esm2022/lib/core/payment/actions/three-ds-redirect/three-ds-redirect.action.type.mjs +2 -0
- package/esm2022/lib/core/payment/three-ds/api/status-three-ds/response/status-three-ds-response.class.mjs +2 -1
- package/esm2022/lib/core/payment/three-ds/api/status-three-ds/status-three-ds-response.interface.mjs +1 -1
- package/esm2022/lib/core/payment/three-ds/api/status-three-ds/status-three-ds.service.mjs +2 -1
- package/esm2022/lib/core/payment/three-ds/api/status-three-ds/status-types.enum.mjs +2 -1
- package/esm2022/lib/core/payment/three-ds/reinsurance-check/reinsurance-check.service.mjs +2 -2
- package/esm2022/lib/core/payment/three-ds/reinsurance-check/timer.interface.mjs +1 -1
- package/esm2022/lib/core/payment/three-ds/three-ds-20/status-update.interface.mjs +1 -1
- package/esm2022/lib/core/payment/three-ds/three-ds-20/three-ds20.service.mjs +28 -7
- package/esm2022/lib/core/payment/three-ds/three-ds.service.mjs +13 -7
- package/esm2022/lib/core/user-behaviour-analytics/user-behaviour-event-name.enum.mjs +2 -1
- package/fesm2022/xsolla-payment-client-core.mjs +76 -13
- package/fesm2022/xsolla-payment-client-core.mjs.map +1 -1
- package/lib/core/payment/actions/next-action.interface.d.ts +2 -1
- package/lib/core/payment/actions/three-ds-redirect/three-ds-redirect.action.class.d.ts +11 -0
- package/lib/core/payment/actions/three-ds-redirect/three-ds-redirect.action.type.d.ts +5 -0
- package/lib/core/payment/three-ds/api/status-three-ds/response/status-three-ds-response.class.d.ts +2 -0
- package/lib/core/payment/three-ds/api/status-three-ds/status-three-ds-response.interface.d.ts +2 -0
- package/lib/core/payment/three-ds/api/status-three-ds/status-types.enum.d.ts +1 -0
- package/lib/core/payment/three-ds/reinsurance-check/timer.interface.d.ts +1 -1
- package/lib/core/payment/three-ds/three-ds-20/status-update.interface.d.ts +5 -1
- package/lib/core/payment/three-ds/three-ds-20/three-ds20.service.d.ts +3 -0
- package/lib/core/payment/three-ds/three-ds.service.d.ts +3 -1
- package/lib/core/user-behaviour-analytics/user-behaviour-event-name.enum.d.ts +1 -0
- package/package.json +1 -1
- package/xsolla-payment-client-core-0.2.100.tgz +0 -0
- package/xsolla-payment-client-core-0.2.98.tgz +0 -0
|
@@ -1499,6 +1499,7 @@ var UserBehaviourEventName;
|
|
|
1499
1499
|
UserBehaviourEventName["syncRequest"] = "sync-request";
|
|
1500
1500
|
UserBehaviourEventName["threeDs2complete"] = "3DS-2.0-complete";
|
|
1501
1501
|
UserBehaviourEventName["threeDs2challenge"] = "3DS-2.0-challenge";
|
|
1502
|
+
UserBehaviourEventName["threeDs2checkout"] = "3DS-2.0-checkout";
|
|
1502
1503
|
UserBehaviourEventName["threeDs2collectDfp"] = "3DS-2.0-collect-dfp";
|
|
1503
1504
|
// Apple Pay
|
|
1504
1505
|
UserBehaviourEventName["applePayRecalculateCartTaxes"] = "apple-pay-recalculate-cart-taxes";
|
|
@@ -2246,6 +2247,38 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImpor
|
|
|
2246
2247
|
type: Injectable
|
|
2247
2248
|
}] });
|
|
2248
2249
|
|
|
2250
|
+
class ThreeDsRedirectActionCreator {
|
|
2251
|
+
constructor() {
|
|
2252
|
+
this.type = 'redirect';
|
|
2253
|
+
}
|
|
2254
|
+
getActionData(actionData) {
|
|
2255
|
+
return {
|
|
2256
|
+
type: this.type,
|
|
2257
|
+
data: {
|
|
2258
|
+
fields: [],
|
|
2259
|
+
errors: [],
|
|
2260
|
+
messages: [],
|
|
2261
|
+
order: {},
|
|
2262
|
+
invoiceId: '',
|
|
2263
|
+
redirect: {
|
|
2264
|
+
isNewWindowRequired: false,
|
|
2265
|
+
isSameWindowRequired: false,
|
|
2266
|
+
redirectUrl: actionData.data?.action ?? '',
|
|
2267
|
+
data: actionData.data?.params ?? {},
|
|
2268
|
+
},
|
|
2269
|
+
},
|
|
2270
|
+
};
|
|
2271
|
+
}
|
|
2272
|
+
isSuitable() {
|
|
2273
|
+
return false;
|
|
2274
|
+
}
|
|
2275
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: ThreeDsRedirectActionCreator, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
2276
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: ThreeDsRedirectActionCreator }); }
|
|
2277
|
+
}
|
|
2278
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: ThreeDsRedirectActionCreator, decorators: [{
|
|
2279
|
+
type: Injectable
|
|
2280
|
+
}] });
|
|
2281
|
+
|
|
2249
2282
|
const nextActionsToken = new InjectionToken('Action');
|
|
2250
2283
|
const nextActions = [
|
|
2251
2284
|
GoogleThreeDsRedirectActionCreator,
|
|
@@ -2262,6 +2295,7 @@ const flowUpdateNextActions = [
|
|
|
2262
2295
|
ShowErrorsActionCreator,
|
|
2263
2296
|
StatusUpdatedActionCreator,
|
|
2264
2297
|
ThreeDsActionCreator,
|
|
2298
|
+
ThreeDsRedirectActionCreator,
|
|
2265
2299
|
];
|
|
2266
2300
|
|
|
2267
2301
|
const oneTimeAnalyticsEvents = new Set([]);
|
|
@@ -6813,6 +6847,7 @@ var ThreeDsStatusTypes;
|
|
|
6813
6847
|
(function (ThreeDsStatusTypes) {
|
|
6814
6848
|
ThreeDsStatusTypes["completed"] = "completed";
|
|
6815
6849
|
ThreeDsStatusTypes["challenge"] = "challenge";
|
|
6850
|
+
ThreeDsStatusTypes["checkout"] = "checkout";
|
|
6816
6851
|
ThreeDsStatusTypes["collectDfp"] = "collect_dfp";
|
|
6817
6852
|
})(ThreeDsStatusTypes || (ThreeDsStatusTypes = {}));
|
|
6818
6853
|
|
|
@@ -6833,6 +6868,7 @@ class StatusThreeDsResponse {
|
|
|
6833
6868
|
constructor(params) {
|
|
6834
6869
|
this.status = params.status;
|
|
6835
6870
|
this.checkoutForm = params.checkoutForm;
|
|
6871
|
+
this.collectDfpParameters = params.collectDfpParameters;
|
|
6836
6872
|
}
|
|
6837
6873
|
}
|
|
6838
6874
|
|
|
@@ -6869,6 +6905,7 @@ class StatusThreeDsService {
|
|
|
6869
6905
|
const statusResponse = this.responseFactory({
|
|
6870
6906
|
status: response.secure3d.status,
|
|
6871
6907
|
checkoutForm: response.secure3d.checkout_form,
|
|
6908
|
+
collectDfpParameters: response.secure3d.collect_dfp_parameters,
|
|
6872
6909
|
});
|
|
6873
6910
|
this.response.next(statusResponse);
|
|
6874
6911
|
}))).catch((error) => {
|
|
@@ -7063,7 +7100,7 @@ class ReinsuranceCheckService {
|
|
|
7063
7100
|
this.removeTimer(timer.id);
|
|
7064
7101
|
this.timers[timer.id] = timer;
|
|
7065
7102
|
const timerInStorage = this.timers[timer.id];
|
|
7066
|
-
this.window.setTimeout(() => {
|
|
7103
|
+
timerInStorage.timeoutRef = this.window.setTimeout(() => {
|
|
7067
7104
|
timerInStorage.callback();
|
|
7068
7105
|
this.timers[timer.id] = null;
|
|
7069
7106
|
}, timerInStorage.timeoutMs);
|
|
@@ -7103,6 +7140,7 @@ class ThreeDs20Service {
|
|
|
7103
7140
|
this.webSocketClient = null;
|
|
7104
7141
|
this.statusUpdates = new Subject();
|
|
7105
7142
|
this.statusRequestSubscription = null;
|
|
7143
|
+
this.latestDfpParameters = null;
|
|
7106
7144
|
this.notifyDfpTimerId = 'notify-dfp';
|
|
7107
7145
|
this.notifyDfpTimeoutMs = 10000;
|
|
7108
7146
|
this.statusThreeDsTimerId = 'status-three-ds';
|
|
@@ -7112,11 +7150,13 @@ class ThreeDs20Service {
|
|
|
7112
7150
|
if (!threeDsForm) {
|
|
7113
7151
|
return;
|
|
7114
7152
|
}
|
|
7153
|
+
this.clearLatestDfpParameters();
|
|
7115
7154
|
this.reinsuranceCheckService.addTimer({
|
|
7116
7155
|
id: this.notifyDfpTimerId,
|
|
7117
7156
|
timeoutMs: this.notifyDfpTimeoutMs,
|
|
7118
7157
|
callback: () => {
|
|
7119
|
-
this.
|
|
7158
|
+
const threeDsTransactionId = this.latestDfpParameters?.threeDSTrXid ?? threeDsForm.threeDSTrXid;
|
|
7159
|
+
this.notifyDfpStatusService.request(threeDsTransactionId, false);
|
|
7120
7160
|
},
|
|
7121
7161
|
});
|
|
7122
7162
|
this.webSocketClient = this.webSocketFactory.createWebSocketClient(threeDsForm.webSocketChannelUrl, threeDsForm.webSocketClientType);
|
|
@@ -7126,23 +7166,26 @@ class ThreeDs20Service {
|
|
|
7126
7166
|
if (message !== ThreeDsStatusWebSocketTypes.status3DS_changed) {
|
|
7127
7167
|
return;
|
|
7128
7168
|
}
|
|
7129
|
-
this.
|
|
7169
|
+
this.requestThreeDsStatus(threeDsForm);
|
|
7130
7170
|
});
|
|
7131
7171
|
this.webSocketReconnectionSubscription?.unsubscribe();
|
|
7132
7172
|
this.webSocketReconnectionSubscription =
|
|
7133
7173
|
this.webSocketClient.subscribeOnSuccessfulReconnection(() => {
|
|
7134
|
-
this.
|
|
7174
|
+
this.requestThreeDsStatus(threeDsForm);
|
|
7135
7175
|
});
|
|
7136
7176
|
this.handleThreeDsUpdates(threeDsForm);
|
|
7137
|
-
this.
|
|
7177
|
+
this.requestThreeDsStatus(threeDsForm);
|
|
7138
7178
|
this.reinsuranceCheckService.addTimer({
|
|
7139
7179
|
id: this.statusThreeDsTimerId,
|
|
7140
7180
|
timeoutMs: this.statusThreeDsTimeoutMs,
|
|
7141
7181
|
callback: () => {
|
|
7142
|
-
this.
|
|
7182
|
+
this.requestThreeDsStatus(threeDsForm);
|
|
7143
7183
|
},
|
|
7144
7184
|
});
|
|
7145
7185
|
}
|
|
7186
|
+
requestThreeDsStatus(threeDsForm) {
|
|
7187
|
+
this.statusThreeDsService.request(this.latestDfpParameters ?? threeDsForm);
|
|
7188
|
+
}
|
|
7146
7189
|
handleThreeDsUpdates(threeDsForm) {
|
|
7147
7190
|
this.statusRequestSubscription?.unsubscribe();
|
|
7148
7191
|
this.statusRequestSubscription =
|
|
@@ -7150,6 +7193,9 @@ class ThreeDs20Service {
|
|
|
7150
7193
|
if (!threeDsStatus) {
|
|
7151
7194
|
return;
|
|
7152
7195
|
}
|
|
7196
|
+
if (threeDsStatus.collectDfpParameters) {
|
|
7197
|
+
this.latestDfpParameters = threeDsStatus.collectDfpParameters;
|
|
7198
|
+
}
|
|
7153
7199
|
if (threeDsStatus.status === ThreeDsStatusTypes.completed) {
|
|
7154
7200
|
this.stopReinsuranceMethods();
|
|
7155
7201
|
this.userBehaviourAnalyticsService.send(UserBehaviourEventName.threeDs2complete, userBehaviourEventTypes.manual);
|
|
@@ -7171,9 +7217,18 @@ class ThreeDs20Service {
|
|
|
7171
7217
|
});
|
|
7172
7218
|
}
|
|
7173
7219
|
if (threeDsStatus.status === ThreeDsStatusTypes.collectDfp) {
|
|
7174
|
-
this.dfpCollectService.collectDfpStatus(threeDsForm);
|
|
7220
|
+
this.dfpCollectService.collectDfpStatus(this.latestDfpParameters ?? threeDsForm);
|
|
7175
7221
|
this.userBehaviourAnalyticsService.send(UserBehaviourEventName.threeDs2collectDfp, userBehaviourEventTypes.manual);
|
|
7176
7222
|
}
|
|
7223
|
+
if (threeDsStatus.status === ThreeDsStatusTypes.checkout &&
|
|
7224
|
+
threeDsStatus.checkoutForm) {
|
|
7225
|
+
this.stopReinsuranceMethods();
|
|
7226
|
+
this.userBehaviourAnalyticsService.send(UserBehaviourEventName.threeDs2checkout, userBehaviourEventTypes.manual);
|
|
7227
|
+
this.statusUpdates.next({
|
|
7228
|
+
type: 'checkout',
|
|
7229
|
+
data: threeDsStatus.checkoutForm,
|
|
7230
|
+
});
|
|
7231
|
+
}
|
|
7177
7232
|
});
|
|
7178
7233
|
}
|
|
7179
7234
|
stopReinsuranceMethods() {
|
|
@@ -7182,6 +7237,9 @@ class ThreeDs20Service {
|
|
|
7182
7237
|
this.webSocketClient?.close();
|
|
7183
7238
|
this.statusRequestSubscription?.unsubscribe();
|
|
7184
7239
|
}
|
|
7240
|
+
clearLatestDfpParameters() {
|
|
7241
|
+
this.latestDfpParameters = null;
|
|
7242
|
+
}
|
|
7185
7243
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: ThreeDs20Service, deps: [{ token: StatusThreeDsService }, { token: NotifyDfpStatusService }, { token: WebSocketFactory }, { token: DfpCollectService }, { token: ReinsuranceCheckService }, { token: UserBehaviourAnalyticsService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
7186
7244
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: ThreeDs20Service, providedIn: 'root' }); }
|
|
7187
7245
|
}
|
|
@@ -7193,11 +7251,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImpor
|
|
|
7193
7251
|
}], ctorParameters: () => [{ type: StatusThreeDsService }, { type: NotifyDfpStatusService }, { type: WebSocketFactory }, { type: DfpCollectService }, { type: ReinsuranceCheckService }, { type: UserBehaviourAnalyticsService }] });
|
|
7194
7252
|
|
|
7195
7253
|
class ThreeDsService {
|
|
7196
|
-
constructor(threeDs20Service, nextActionService, checkStatusActionCreator, threeDsActionCreator) {
|
|
7254
|
+
constructor(threeDs20Service, nextActionService, checkStatusActionCreator, threeDsActionCreator, threeDsRedirectActionCreator) {
|
|
7197
7255
|
this.threeDs20Service = threeDs20Service;
|
|
7198
7256
|
this.nextActionService = nextActionService;
|
|
7199
7257
|
this.checkStatusActionCreator = checkStatusActionCreator;
|
|
7200
7258
|
this.threeDsActionCreator = threeDsActionCreator;
|
|
7259
|
+
this.threeDsRedirectActionCreator = threeDsRedirectActionCreator;
|
|
7201
7260
|
this.statusSubscription = null;
|
|
7202
7261
|
}
|
|
7203
7262
|
checkThreeDs(params) {
|
|
@@ -7209,16 +7268,20 @@ class ThreeDsService {
|
|
|
7209
7268
|
void this.threeDs20Service.checkThreeDs20(params.parameters.threeDSForm);
|
|
7210
7269
|
this.statusSubscription?.unsubscribe();
|
|
7211
7270
|
this.statusSubscription = this.threeDs20Service.statusUpdates$.subscribe((statusUpdate) => {
|
|
7212
|
-
|
|
7213
|
-
|
|
7271
|
+
switch (statusUpdate.type) {
|
|
7272
|
+
case 'complete':
|
|
7273
|
+
return this.nextActionService.emitFlowUpdates(this.checkStatusActionCreator.getActionData());
|
|
7274
|
+
case 'challenge':
|
|
7275
|
+
return this.nextActionService.emitFlowUpdates(this.threeDsActionCreator.getActionData(statusUpdate));
|
|
7276
|
+
case 'checkout':
|
|
7277
|
+
return this.nextActionService.emitFlowUpdates(this.threeDsRedirectActionCreator.getActionData(statusUpdate));
|
|
7214
7278
|
}
|
|
7215
|
-
this.nextActionService.emitFlowUpdates(this.threeDsActionCreator.getActionData(statusUpdate));
|
|
7216
7279
|
});
|
|
7217
7280
|
}
|
|
7218
7281
|
stopChecking() {
|
|
7219
7282
|
this.statusSubscription?.unsubscribe();
|
|
7220
7283
|
}
|
|
7221
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: ThreeDsService, deps: [{ token: ThreeDs20Service }, { token: NextActionService }, { token: CheckStatusActionCreator }, { token: ThreeDsActionCreator }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
7284
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: ThreeDsService, deps: [{ token: ThreeDs20Service }, { token: NextActionService }, { token: CheckStatusActionCreator }, { token: ThreeDsActionCreator }, { token: ThreeDsRedirectActionCreator }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
7222
7285
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: ThreeDsService, providedIn: 'root' }); }
|
|
7223
7286
|
}
|
|
7224
7287
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: ThreeDsService, decorators: [{
|
|
@@ -7226,7 +7289,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImpor
|
|
|
7226
7289
|
args: [{
|
|
7227
7290
|
providedIn: 'root',
|
|
7228
7291
|
}]
|
|
7229
|
-
}], ctorParameters: () => [{ type: ThreeDs20Service }, { type: NextActionService }, { type: CheckStatusActionCreator }, { type: ThreeDsActionCreator }] });
|
|
7292
|
+
}], ctorParameters: () => [{ type: ThreeDs20Service }, { type: NextActionService }, { type: CheckStatusActionCreator }, { type: ThreeDsActionCreator }, { type: ThreeDsRedirectActionCreator }] });
|
|
7230
7293
|
|
|
7231
7294
|
class FormMessagesService extends EmitDataService {
|
|
7232
7295
|
constructor(unescapeHtmlPipe) {
|