@xsolla/payment-client-core 0.5.4 → 0.5.6
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/form/converters/card-number/card-number.converter.mjs +3 -1
- package/esm2022/lib/core/payment/form/validators/credit-card-zeros-bin/credit-card-zeros-bin.validator.mjs +20 -0
- package/esm2022/lib/core/payment/payment.service.mjs +2 -1
- package/esm2022/lib/core/payment/three-ds/dfp-collect/dfp-collect.service.mjs +15 -14
- package/esm2022/lib/core/payment/three-ds/three-ds-20/three-ds20.service.mjs +2 -5
- package/esm2022/lib/version.mjs +2 -2
- package/fesm2022/xsolla-payment-client-core.mjs +35 -18
- package/fesm2022/xsolla-payment-client-core.mjs.map +1 -1
- package/lib/core/payment/form/validators/credit-card-zeros-bin/credit-card-zeros-bin.validator.d.ts +2 -0
- package/lib/core/payment/three-ds/dfp-collect/dfp-collect.service.d.ts +1 -0
- package/lib/core/payment/three-ds/three-ds-20/three-ds20.service.d.ts +0 -1
- package/lib/version.d.ts +1 -1
- package/package.json +1 -1
|
@@ -13,7 +13,7 @@ import { CommonModule } from '@angular/common';
|
|
|
13
13
|
import { provideTranslateHttpLoader } from '@ngx-translate/http-loader';
|
|
14
14
|
|
|
15
15
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
16
|
-
const PAYMENT_CLIENT_CORE_VERSION = '0.5.
|
|
16
|
+
const PAYMENT_CLIENT_CORE_VERSION = '0.5.6';
|
|
17
17
|
|
|
18
18
|
class TranslateHelper {
|
|
19
19
|
static init(service) {
|
|
@@ -4307,6 +4307,23 @@ const luhnFormulaValidator = ({ value }) => {
|
|
|
4307
4307
|
return resultSum % modBase === 0 ? null : error;
|
|
4308
4308
|
};
|
|
4309
4309
|
|
|
4310
|
+
const creditBinZerosValidator = ({ value }) => {
|
|
4311
|
+
if (isEmptyInputValue(value) || !isString(value)) {
|
|
4312
|
+
return null;
|
|
4313
|
+
}
|
|
4314
|
+
const error = {
|
|
4315
|
+
rewritableError: {
|
|
4316
|
+
message: TranslateHelper.t('errors.validation.cardNumber', 'Enter a valid card number'),
|
|
4317
|
+
},
|
|
4318
|
+
};
|
|
4319
|
+
const binLength = 6;
|
|
4320
|
+
const binNumber = value.replace(/\D/g, '').slice(0, binLength);
|
|
4321
|
+
if (binNumber === '000000') {
|
|
4322
|
+
return error;
|
|
4323
|
+
}
|
|
4324
|
+
return null;
|
|
4325
|
+
};
|
|
4326
|
+
|
|
4310
4327
|
class CardNumberConfig extends ControlConfig {
|
|
4311
4328
|
constructor() {
|
|
4312
4329
|
super(...arguments);
|
|
@@ -4387,6 +4404,7 @@ class CardNumberConverter extends Converter {
|
|
|
4387
4404
|
.getValidators(field)
|
|
4388
4405
|
.concat([
|
|
4389
4406
|
luhnFormulaValidator,
|
|
4407
|
+
creditBinZerosValidator,
|
|
4390
4408
|
this.minLengthValidator.validate,
|
|
4391
4409
|
this.maxLengthValidator.validate,
|
|
4392
4410
|
]);
|
|
@@ -7434,29 +7452,30 @@ class DfpCollectService {
|
|
|
7434
7452
|
this.formName = 'formDFP';
|
|
7435
7453
|
}
|
|
7436
7454
|
collectDfpStatus(threeDsForm) {
|
|
7437
|
-
this.window.document.getElementById(this.iframeName)?.remove();
|
|
7438
|
-
this.window.document.getElementById(this.formName)?.remove();
|
|
7439
|
-
/*
|
|
7440
|
-
* With waitCallback (e.g. GPayments) the DFP URL is loaded directly into the
|
|
7441
|
-
* iframe as its src, and the result is delivered back via the websocket
|
|
7442
|
-
* callback instead of an onload notification. The legacy EMV 3DS Method flow
|
|
7443
|
-
* posts threeDSMethodData to a blank iframe and notifies on load.
|
|
7444
|
-
*/
|
|
7445
7455
|
if (threeDsForm.waitCallback) {
|
|
7446
|
-
this.
|
|
7447
|
-
|
|
7456
|
+
this.openIframeWithPostRequest(threeDsForm, false);
|
|
7457
|
+
}
|
|
7458
|
+
else {
|
|
7459
|
+
this.openIframeWithPostRequest(threeDsForm, true);
|
|
7448
7460
|
}
|
|
7449
|
-
|
|
7461
|
+
}
|
|
7462
|
+
/*
|
|
7463
|
+
* This method create invisible iframe with required params and after that it submit form in iframe
|
|
7464
|
+
* */
|
|
7465
|
+
openIframeWithPostRequest(threeDsForm, isNeedNotifyAfterLoad) {
|
|
7466
|
+
this.window.document.getElementById(this.iframeName)?.remove();
|
|
7467
|
+
this.window.document.getElementById(this.formName)?.remove();
|
|
7468
|
+
this.createIframe(isNeedNotifyAfterLoad, threeDsForm.threeDSTrXid);
|
|
7450
7469
|
this.postFormToIframe(threeDsForm.threeDSMethod, threeDsForm.threeDSMethodData);
|
|
7451
7470
|
}
|
|
7452
7471
|
/*
|
|
7453
7472
|
* isNeedNotifyAfterLoad is need to send notification of dft to server
|
|
7454
7473
|
* */
|
|
7455
|
-
createIframe(isNeedNotifyAfterLoad, threeDsTrXid
|
|
7474
|
+
createIframe(isNeedNotifyAfterLoad, threeDsTrXid) {
|
|
7456
7475
|
const attributes = {
|
|
7457
7476
|
name: this.iframeName,
|
|
7458
7477
|
id: this.iframeName,
|
|
7459
|
-
src,
|
|
7478
|
+
src: 'about:blank',
|
|
7460
7479
|
style: 'display:none',
|
|
7461
7480
|
};
|
|
7462
7481
|
const iFrame = this.window.document.createElement('iframe');
|
|
@@ -7582,7 +7601,6 @@ class ThreeDs20Service {
|
|
|
7582
7601
|
this.latestDfpParameters = null;
|
|
7583
7602
|
this.notifyDfpTimerId = 'notify-dfp';
|
|
7584
7603
|
this.notifyDfpTimeoutMs = 10000;
|
|
7585
|
-
this.waitCallbackNotifyDfpTimeoutMs = 20000;
|
|
7586
7604
|
this.statusThreeDsTimerId = 'status-three-ds';
|
|
7587
7605
|
this.statusThreeDsTimeoutMs = 180000;
|
|
7588
7606
|
}
|
|
@@ -7593,9 +7611,7 @@ class ThreeDs20Service {
|
|
|
7593
7611
|
this.clearLatestDfpParameters();
|
|
7594
7612
|
this.reinsuranceCheckService.addTimer({
|
|
7595
7613
|
id: this.notifyDfpTimerId,
|
|
7596
|
-
timeoutMs:
|
|
7597
|
-
? this.waitCallbackNotifyDfpTimeoutMs
|
|
7598
|
-
: this.notifyDfpTimeoutMs,
|
|
7614
|
+
timeoutMs: this.notifyDfpTimeoutMs,
|
|
7599
7615
|
callback: () => {
|
|
7600
7616
|
const threeDsTransactionId = this.latestDfpParameters?.threeDSTrXid ?? threeDsForm.threeDSTrXid;
|
|
7601
7617
|
this.notifyDfpStatusService.request(threeDsTransactionId, false);
|
|
@@ -8094,6 +8110,7 @@ class PaymentService {
|
|
|
8094
8110
|
this.fields = this.getFields();
|
|
8095
8111
|
this.form = this.formService.createForm(this.fields);
|
|
8096
8112
|
this.listenFormStatusChanges(this.form);
|
|
8113
|
+
this.emitFormFieldsStatus(this.form);
|
|
8097
8114
|
this.syncService.setup(this.form, this.fields, this.config);
|
|
8098
8115
|
return nextAction;
|
|
8099
8116
|
}
|