@xsolla/payment-client-core 0.2.82 → 0.2.84
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/cvv/cvv.converter.mjs +3 -3
- package/esm2022/lib/core/payment/form/converters/zip/zip.converter.mjs +25 -9
- package/esm2022/lib/core/payment/payment.service.mjs +7 -4
- package/esm2022/lib/core/payment/requests/initialize/initialize.service.mjs +7 -4
- package/esm2022/lib/core/payment/requests/sync/sync.service.mjs +7 -4
- package/esm2022/lib/core/sdk-payment-systems/google-pay/google-pay-button-configuration.interface.mjs +2 -0
- package/esm2022/lib/core/sdk-payment-systems/google-pay/google-pay-library.interface.mjs +1 -1
- package/esm2022/lib/core/sdk-payment-systems/google-pay/google-pay.service.mjs +46 -3
- package/esm2022/lib/core/sdk-payment-systems/sdk-payment-systems-initial-data.interface.mjs +1 -1
- package/esm2022/lib/shared/translate/translate.helper.mjs +3 -3
- package/fesm2022/xsolla-payment-client-core.mjs +160 -95
- package/fesm2022/xsolla-payment-client-core.mjs.map +1 -1
- package/lib/core/payment/form/converters/zip/zip.converter.d.ts +4 -1
- package/lib/core/payment/payment.service.d.ts +3 -1
- package/lib/core/payment/requests/initialize/initialize.service.d.ts +3 -1
- package/lib/core/payment/requests/sync/sync.service.d.ts +3 -1
- package/lib/core/sdk-payment-systems/google-pay/google-pay-button-configuration.interface.d.ts +5 -0
- package/lib/core/sdk-payment-systems/google-pay/google-pay-library.interface.d.ts +1 -0
- package/lib/core/sdk-payment-systems/google-pay/google-pay.service.d.ts +3 -2
- package/lib/core/sdk-payment-systems/sdk-payment-systems-initial-data.interface.d.ts +1 -0
- package/package.json +1 -1
- package/src/i18n/ar.json +3 -1
- package/src/i18n/bg.json +3 -1
- package/src/i18n/cs.json +3 -1
- package/src/i18n/de.json +3 -1
- package/src/i18n/en.json +3 -1
- package/src/i18n/es.json +3 -1
- package/src/i18n/fil.json +3 -1
- package/src/i18n/fr.json +3 -1
- package/src/i18n/he.json +3 -1
- package/src/i18n/id.json +3 -1
- package/src/i18n/it.json +3 -1
- package/src/i18n/ja.json +3 -1
- package/src/i18n/km.json +3 -1
- package/src/i18n/ko.json +3 -1
- package/src/i18n/lo.json +3 -1
- package/src/i18n/ms.json +3 -1
- package/src/i18n/my.json +3 -1
- package/src/i18n/ne.json +3 -1
- package/src/i18n/nl.json +3 -1
- package/src/i18n/pl.json +4 -2
- package/src/i18n/pt.json +3 -1
- package/src/i18n/ro.json +3 -1
- package/src/i18n/ru.json +3 -1
- package/src/i18n/th.json +3 -1
- package/src/i18n/tr.json +3 -1
- package/src/i18n/vi.json +3 -1
- package/src/i18n/zh_HANS.json +3 -1
- package/src/i18n/zh_HANT.json +3 -1
- package/xsolla-payment-client-core-0.2.84.tgz +0 -0
- package/xsolla-payment-client-core-0.2.82.tgz +0 -0
|
@@ -6,7 +6,7 @@ import { HttpParams, HttpHeaders, HttpClientModule, HTTP_INTERCEPTORS, provideHt
|
|
|
6
6
|
import { UntypedFormGroup, Validators, UntypedFormControl, FormGroup, ReactiveFormsModule } from '@angular/forms';
|
|
7
7
|
import JSEncrypt from 'jsencrypt';
|
|
8
8
|
import { filter, map as map$1, tap, debounce, debounceTime, catchError } from 'rxjs/operators';
|
|
9
|
-
import * as
|
|
9
|
+
import * as i19 from '@ngx-translate/core';
|
|
10
10
|
import { provideTranslateService, MissingTranslationHandler } from '@ngx-translate/core';
|
|
11
11
|
import * as i1$1 from '@angular/router';
|
|
12
12
|
import { CommonModule } from '@angular/common';
|
|
@@ -22,10 +22,10 @@ class TranslateHelper {
|
|
|
22
22
|
}
|
|
23
23
|
static getLocale(locale) {
|
|
24
24
|
if (locale.toLowerCase() === 'tw') {
|
|
25
|
-
return '
|
|
25
|
+
return 'zh_HANT';
|
|
26
26
|
}
|
|
27
27
|
if (locale.toLowerCase() === 'cn') {
|
|
28
|
-
return '
|
|
28
|
+
return 'zh_HANS';
|
|
29
29
|
}
|
|
30
30
|
if (locale.toLowerCase() === 'ph') {
|
|
31
31
|
return 'fil';
|
|
@@ -2978,8 +2978,67 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImpor
|
|
|
2978
2978
|
}]
|
|
2979
2979
|
}] });
|
|
2980
2980
|
|
|
2981
|
+
function isNull(value) {
|
|
2982
|
+
return value === null;
|
|
2983
|
+
}
|
|
2984
|
+
|
|
2985
|
+
function isUndefined(value) {
|
|
2986
|
+
return typeof value === 'undefined';
|
|
2987
|
+
}
|
|
2988
|
+
|
|
2989
|
+
class SessionService {
|
|
2990
|
+
constructor(window, settingsService) {
|
|
2991
|
+
this.window = window;
|
|
2992
|
+
this.settingsService = settingsService;
|
|
2993
|
+
this.cache = {};
|
|
2994
|
+
}
|
|
2995
|
+
/**
|
|
2996
|
+
* @param {string} key must be uniq entire all app
|
|
2997
|
+
* @param {unknown} value can be anything
|
|
2998
|
+
*/
|
|
2999
|
+
set(key, value) {
|
|
3000
|
+
this.cache[key] = value;
|
|
3001
|
+
try {
|
|
3002
|
+
this.window.sessionStorage.setItem(this.getStorageKey(key), JSON.stringify(value));
|
|
3003
|
+
}
|
|
3004
|
+
catch (error) {
|
|
3005
|
+
console.warn('Session storage not available.');
|
|
3006
|
+
}
|
|
3007
|
+
}
|
|
3008
|
+
get(key) {
|
|
3009
|
+
const cacheValue = this.cache[key];
|
|
3010
|
+
if (!isUndefined(cacheValue)) {
|
|
3011
|
+
return cacheValue;
|
|
3012
|
+
}
|
|
3013
|
+
try {
|
|
3014
|
+
const storageValue = this.window.sessionStorage.getItem(this.getStorageKey(key));
|
|
3015
|
+
if (isNull(storageValue)) {
|
|
3016
|
+
return null;
|
|
3017
|
+
}
|
|
3018
|
+
return JSON.parse(storageValue);
|
|
3019
|
+
}
|
|
3020
|
+
catch (error) {
|
|
3021
|
+
return null;
|
|
3022
|
+
}
|
|
3023
|
+
}
|
|
3024
|
+
getStorageKey(key) {
|
|
3025
|
+
return `${key}${this.settingsService.token}`;
|
|
3026
|
+
}
|
|
3027
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: SessionService, deps: [{ token: windowToken }, { token: SettingsService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
3028
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: SessionService, providedIn: 'root' }); }
|
|
3029
|
+
}
|
|
3030
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: SessionService, decorators: [{
|
|
3031
|
+
type: Injectable,
|
|
3032
|
+
args: [{
|
|
3033
|
+
providedIn: 'root',
|
|
3034
|
+
}]
|
|
3035
|
+
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
3036
|
+
type: Inject,
|
|
3037
|
+
args: [windowToken]
|
|
3038
|
+
}] }, { type: SettingsService }] });
|
|
3039
|
+
|
|
2981
3040
|
class InitializeService {
|
|
2982
|
-
constructor(responseFactory, xpsApiService, settingsService, countryService, nextActionService, xpsResponseErrorsMappingService, encryptCreditCardService, showErrorsActionCreator, userBehaviourAnalyticsService, paymentSettingsService) {
|
|
3041
|
+
constructor(responseFactory, xpsApiService, settingsService, countryService, nextActionService, xpsResponseErrorsMappingService, encryptCreditCardService, showErrorsActionCreator, userBehaviourAnalyticsService, paymentSettingsService, sessionService) {
|
|
2983
3042
|
this.responseFactory = responseFactory;
|
|
2984
3043
|
this.xpsApiService = xpsApiService;
|
|
2985
3044
|
this.settingsService = settingsService;
|
|
@@ -2990,9 +3049,11 @@ class InitializeService {
|
|
|
2990
3049
|
this.showErrorsActionCreator = showErrorsActionCreator;
|
|
2991
3050
|
this.userBehaviourAnalyticsService = userBehaviourAnalyticsService;
|
|
2992
3051
|
this.paymentSettingsService = paymentSettingsService;
|
|
3052
|
+
this.sessionService = sessionService;
|
|
2993
3053
|
}
|
|
2994
3054
|
async request(config) {
|
|
2995
3055
|
const paymentSettingsParams = this.paymentSettingsService.getPaymentSettingsParams(config);
|
|
3056
|
+
this.sessionService.set('cardNumberCountry', null);
|
|
2996
3057
|
const requestParams = {
|
|
2997
3058
|
access_token: this.settingsService.token,
|
|
2998
3059
|
pid: String(config.paymentMethodId),
|
|
@@ -3039,7 +3100,7 @@ class InitializeService {
|
|
|
3039
3100
|
}
|
|
3040
3101
|
this.encryptCreditCardService.setPublicKey(atob(publicKeyField.value));
|
|
3041
3102
|
}
|
|
3042
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: InitializeService, deps: [{ token: initializeResponseFactoryToken }, { token: XpsApiService }, { token: SettingsService }, { token: CountryService }, { token: NextActionService }, { token: XpsResponseErrorsMappingService }, { token: EncryptCreditCardService }, { token: ShowErrorsActionCreator }, { token: UserBehaviourAnalyticsService }, { token: PaymentSettingsService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
3103
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: InitializeService, deps: [{ token: initializeResponseFactoryToken }, { token: XpsApiService }, { token: SettingsService }, { token: CountryService }, { token: NextActionService }, { token: XpsResponseErrorsMappingService }, { token: EncryptCreditCardService }, { token: ShowErrorsActionCreator }, { token: UserBehaviourAnalyticsService }, { token: PaymentSettingsService }, { token: SessionService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
3043
3104
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: InitializeService, providedIn: 'root' }); }
|
|
3044
3105
|
}
|
|
3045
3106
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: InitializeService, decorators: [{
|
|
@@ -3050,7 +3111,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImpor
|
|
|
3050
3111
|
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
3051
3112
|
type: Inject,
|
|
3052
3113
|
args: [initializeResponseFactoryToken]
|
|
3053
|
-
}] }, { type: XpsApiService }, { type: SettingsService }, { type: CountryService }, { type: NextActionService }, { type: XpsResponseErrorsMappingService }, { type: EncryptCreditCardService }, { type: ShowErrorsActionCreator }, { type: UserBehaviourAnalyticsService }, { type: PaymentSettingsService }] });
|
|
3114
|
+
}] }, { type: XpsApiService }, { type: SettingsService }, { type: CountryService }, { type: NextActionService }, { type: XpsResponseErrorsMappingService }, { type: EncryptCreditCardService }, { type: ShowErrorsActionCreator }, { type: UserBehaviourAnalyticsService }, { type: PaymentSettingsService }, { type: SessionService }] });
|
|
3054
3115
|
|
|
3055
3116
|
class XpsApiPartRequest {
|
|
3056
3117
|
addXpsParameters(parameters) {
|
|
@@ -3321,7 +3382,7 @@ const syncResponseFactoryProvider = {
|
|
|
3321
3382
|
};
|
|
3322
3383
|
|
|
3323
3384
|
class SyncService extends EmitDataService {
|
|
3324
|
-
constructor(requestFactory, responseFactory, xpsApiService, nextActionService, settingsService, xpsResponseErrorsMappingService, encryptCreditCardService, showErrorsActionCreator, userBehaviourAnalyticsService, paymentSettingsService) {
|
|
3385
|
+
constructor(requestFactory, responseFactory, xpsApiService, nextActionService, settingsService, xpsResponseErrorsMappingService, encryptCreditCardService, showErrorsActionCreator, userBehaviourAnalyticsService, paymentSettingsService, sessionService) {
|
|
3325
3386
|
super();
|
|
3326
3387
|
this.requestFactory = requestFactory;
|
|
3327
3388
|
this.responseFactory = responseFactory;
|
|
@@ -3333,6 +3394,7 @@ class SyncService extends EmitDataService {
|
|
|
3333
3394
|
this.showErrorsActionCreator = showErrorsActionCreator;
|
|
3334
3395
|
this.userBehaviourAnalyticsService = userBehaviourAnalyticsService;
|
|
3335
3396
|
this.paymentSettingsService = paymentSettingsService;
|
|
3397
|
+
this.sessionService = sessionService;
|
|
3336
3398
|
this.prevFieldSyncStates = {};
|
|
3337
3399
|
this.form = new UntypedFormGroup({});
|
|
3338
3400
|
this.paymentConfiguration = null;
|
|
@@ -3436,6 +3498,7 @@ class SyncService extends EmitDataService {
|
|
|
3436
3498
|
.directPaymentRequest(encryptedRequest)
|
|
3437
3499
|
.then((xpsResponse) => {
|
|
3438
3500
|
const response = this.xpsResponseErrorsMappingService.mapErrors(xpsResponse);
|
|
3501
|
+
this.sessionService.set('cardNumberCountry', response.cardBinCountry);
|
|
3439
3502
|
this.emitFormErrors(response);
|
|
3440
3503
|
this.emit(response);
|
|
3441
3504
|
return this.responseFactory(field, response);
|
|
@@ -3471,7 +3534,7 @@ class SyncService extends EmitDataService {
|
|
|
3471
3534
|
}
|
|
3472
3535
|
this.fieldSyncTimers[field.name] = timerId;
|
|
3473
3536
|
}
|
|
3474
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: SyncService, deps: [{ token: syncRequestFactoryToken }, { token: syncResponseFactoryToken }, { token: XpsApiService }, { token: NextActionService }, { token: SettingsService }, { token: XpsResponseErrorsMappingService }, { token: EncryptCreditCardService }, { token: ShowErrorsActionCreator }, { token: UserBehaviourAnalyticsService }, { token: PaymentSettingsService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
3537
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: SyncService, deps: [{ token: syncRequestFactoryToken }, { token: syncResponseFactoryToken }, { token: XpsApiService }, { token: NextActionService }, { token: SettingsService }, { token: XpsResponseErrorsMappingService }, { token: EncryptCreditCardService }, { token: ShowErrorsActionCreator }, { token: UserBehaviourAnalyticsService }, { token: PaymentSettingsService }, { token: SessionService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
3475
3538
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: SyncService, providedIn: 'root' }); }
|
|
3476
3539
|
}
|
|
3477
3540
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: SyncService, decorators: [{
|
|
@@ -3485,7 +3548,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImpor
|
|
|
3485
3548
|
}] }, { type: undefined, decorators: [{
|
|
3486
3549
|
type: Inject,
|
|
3487
3550
|
args: [syncResponseFactoryToken]
|
|
3488
|
-
}] }, { type: XpsApiService }, { type: NextActionService }, { type: SettingsService }, { type: XpsResponseErrorsMappingService }, { type: EncryptCreditCardService }, { type: ShowErrorsActionCreator }, { type: UserBehaviourAnalyticsService }, { type: PaymentSettingsService }] });
|
|
3551
|
+
}] }, { type: XpsApiService }, { type: NextActionService }, { type: SettingsService }, { type: XpsResponseErrorsMappingService }, { type: EncryptCreditCardService }, { type: ShowErrorsActionCreator }, { type: UserBehaviourAnalyticsService }, { type: PaymentSettingsService }, { type: SessionService }] });
|
|
3489
3552
|
|
|
3490
3553
|
function isObject(value) {
|
|
3491
3554
|
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
@@ -3640,18 +3703,6 @@ class TextControlConfig extends ControlConfig {
|
|
|
3640
3703
|
}
|
|
3641
3704
|
}
|
|
3642
3705
|
|
|
3643
|
-
function minLengthValidator(minLength) {
|
|
3644
|
-
return convert(Validators.minLength(minLength), TranslateHelper.t('errors.validation.min-length', `Enter at least ${minLength} characters`, { minLength }), {
|
|
3645
|
-
minLength,
|
|
3646
|
-
});
|
|
3647
|
-
}
|
|
3648
|
-
|
|
3649
|
-
function maxLengthValidator(maxLength) {
|
|
3650
|
-
return convert(Validators.maxLength(maxLength), TranslateHelper.t('errors.validation.max-length', `Enter no more than ${maxLength} characters`, { maxLength }), {
|
|
3651
|
-
maxLength,
|
|
3652
|
-
});
|
|
3653
|
-
}
|
|
3654
|
-
|
|
3655
3706
|
const restrictedValueValidator = (restrictedValue) => {
|
|
3656
3707
|
return ({ value }) => {
|
|
3657
3708
|
return value !== restrictedValue
|
|
@@ -3666,24 +3717,38 @@ const restrictedValueValidator = (restrictedValue) => {
|
|
|
3666
3717
|
};
|
|
3667
3718
|
|
|
3668
3719
|
class ZipConverter extends Converter {
|
|
3669
|
-
constructor(syncService, countryService) {
|
|
3720
|
+
constructor(syncService, countryService, sessionService) {
|
|
3670
3721
|
super(syncService);
|
|
3671
3722
|
this.countryService = countryService;
|
|
3723
|
+
this.sessionService = sessionService;
|
|
3672
3724
|
this.minLength = 3;
|
|
3673
3725
|
this.maxLength = 10;
|
|
3674
3726
|
this.usCountryLength = 5;
|
|
3675
3727
|
}
|
|
3676
3728
|
get isUsCountry() {
|
|
3677
|
-
|
|
3729
|
+
const currentCountry = this.countryService.getCountry().toUpperCase();
|
|
3730
|
+
const cardNumberCountry = this.sessionService.get('cardNumberCountry');
|
|
3731
|
+
return (cardNumberCountry ?? currentCountry) === 'US';
|
|
3732
|
+
}
|
|
3733
|
+
get isCanadaCountry() {
|
|
3734
|
+
const currentCountry = this.countryService.getCountry().toUpperCase();
|
|
3735
|
+
const cardNumberCountry = this.sessionService.get('cardNumberCountry');
|
|
3736
|
+
return (cardNumberCountry ?? currentCountry) === 'CA';
|
|
3678
3737
|
}
|
|
3679
3738
|
getValidators(field) {
|
|
3680
3739
|
const minLength = this.isUsCountry ? this.usCountryLength : this.minLength;
|
|
3681
3740
|
const maxLength = this.isUsCountry ? this.usCountryLength : this.maxLength;
|
|
3682
3741
|
const validators = super
|
|
3683
3742
|
.getValidators(field)
|
|
3684
|
-
.concat([
|
|
3743
|
+
.concat([
|
|
3744
|
+
convert(Validators.minLength(minLength), TranslateHelper.t('errors.validation.min-length', `Enter at least ${minLength} characters`, { minLength })),
|
|
3745
|
+
convert(Validators.maxLength(maxLength), TranslateHelper.t('errors.validation.max-length', `Enter no more than ${maxLength} characters`, { maxLength })),
|
|
3746
|
+
]);
|
|
3685
3747
|
if (this.isUsCountry) {
|
|
3686
|
-
validators.push(convert(restrictedValueValidator('00000'), TranslateHelper.t('errors.validation.zip-pattern', 'Enter a valid ZIP code')
|
|
3748
|
+
validators.push(convert(restrictedValueValidator('00000'), TranslateHelper.t('errors.validation.zip-pattern', 'Enter a valid ZIP code')));
|
|
3749
|
+
}
|
|
3750
|
+
if (this.isCanadaCountry) {
|
|
3751
|
+
validators.push(convert(Validators.pattern(/^[A-Za-z0-9]{3}\s?[A-Za-z0-9]{0,3}$/), TranslateHelper.t('errors.validation.zip-pattern-non-us', 'Enter a valid postal code')));
|
|
3687
3752
|
}
|
|
3688
3753
|
return validators;
|
|
3689
3754
|
}
|
|
@@ -3698,10 +3763,12 @@ class ZipConverter extends Converter {
|
|
|
3698
3763
|
unmaskModelValue: true,
|
|
3699
3764
|
showMask: true,
|
|
3700
3765
|
};
|
|
3766
|
+
config.placeholder = TranslateHelper.t('zip.converter.placeholder', 'ZIP code');
|
|
3701
3767
|
config.inputMode = 'numeric';
|
|
3702
3768
|
}
|
|
3703
3769
|
else {
|
|
3704
3770
|
config.maxLength = this.maxLength;
|
|
3771
|
+
config.placeholder = TranslateHelper.t('zip.converter.placeholder-non-us', 'Postal code');
|
|
3705
3772
|
}
|
|
3706
3773
|
return config;
|
|
3707
3774
|
}
|
|
@@ -3711,12 +3778,12 @@ class ZipConverter extends Converter {
|
|
|
3711
3778
|
getDataType() {
|
|
3712
3779
|
return 'text';
|
|
3713
3780
|
}
|
|
3714
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: ZipConverter, deps: [{ token: SyncService }, { token: CountryService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
3781
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: ZipConverter, deps: [{ token: SyncService }, { token: CountryService }, { token: SessionService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
3715
3782
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: ZipConverter }); }
|
|
3716
3783
|
}
|
|
3717
3784
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: ZipConverter, decorators: [{
|
|
3718
3785
|
type: Injectable
|
|
3719
|
-
}], ctorParameters: () => [{ type: SyncService }, { type: CountryService }] });
|
|
3786
|
+
}], ctorParameters: () => [{ type: SyncService }, { type: CountryService }, { type: SessionService }] });
|
|
3720
3787
|
|
|
3721
3788
|
function isEmptyInputValue(value) {
|
|
3722
3789
|
return value == null || value.length === 0;
|
|
@@ -3964,8 +4031,8 @@ class CvvConverter extends Converter {
|
|
|
3964
4031
|
break;
|
|
3965
4032
|
}
|
|
3966
4033
|
case CreditCardTypes.MAESTRO: {
|
|
3967
|
-
this.maxFieldLength =
|
|
3968
|
-
validators.push(getPatternValidator(
|
|
4034
|
+
this.maxFieldLength = 4;
|
|
4035
|
+
validators.push(getPatternValidator(/^(?:\d{3,4})?$/));
|
|
3969
4036
|
break;
|
|
3970
4037
|
}
|
|
3971
4038
|
default: {
|
|
@@ -4473,6 +4540,18 @@ function phoneValidator() {
|
|
|
4473
4540
|
return convert(Validators.pattern(/^\d*$/), TranslateHelper.t('errors.validation.phone-pattern', 'Enter a valid phone'));
|
|
4474
4541
|
}
|
|
4475
4542
|
|
|
4543
|
+
function minLengthValidator(minLength) {
|
|
4544
|
+
return convert(Validators.minLength(minLength), TranslateHelper.t('errors.validation.min-length', `Enter at least ${minLength} characters`, { minLength }), {
|
|
4545
|
+
minLength,
|
|
4546
|
+
});
|
|
4547
|
+
}
|
|
4548
|
+
|
|
4549
|
+
function maxLengthValidator(maxLength) {
|
|
4550
|
+
return convert(Validators.maxLength(maxLength), TranslateHelper.t('errors.validation.max-length', `Enter no more than ${maxLength} characters`, { maxLength }), {
|
|
4551
|
+
maxLength,
|
|
4552
|
+
});
|
|
4553
|
+
}
|
|
4554
|
+
|
|
4476
4555
|
class PhoneControlConfig extends ControlConfig {
|
|
4477
4556
|
constructor() {
|
|
4478
4557
|
super(...arguments);
|
|
@@ -4938,65 +5017,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImpor
|
|
|
4938
5017
|
args: [statusResponseFactoryToken]
|
|
4939
5018
|
}] }] });
|
|
4940
5019
|
|
|
4941
|
-
function isNull(value) {
|
|
4942
|
-
return value === null;
|
|
4943
|
-
}
|
|
4944
|
-
|
|
4945
|
-
function isUndefined(value) {
|
|
4946
|
-
return typeof value === 'undefined';
|
|
4947
|
-
}
|
|
4948
|
-
|
|
4949
|
-
class SessionService {
|
|
4950
|
-
constructor(window, settingsService) {
|
|
4951
|
-
this.window = window;
|
|
4952
|
-
this.settingsService = settingsService;
|
|
4953
|
-
this.cache = {};
|
|
4954
|
-
}
|
|
4955
|
-
/**
|
|
4956
|
-
* @param {string} key must be uniq entire all app
|
|
4957
|
-
* @param {unknown} value can be anything
|
|
4958
|
-
*/
|
|
4959
|
-
set(key, value) {
|
|
4960
|
-
this.cache[key] = value;
|
|
4961
|
-
try {
|
|
4962
|
-
this.window.sessionStorage.setItem(this.getStorageKey(key), JSON.stringify(value));
|
|
4963
|
-
}
|
|
4964
|
-
catch (error) {
|
|
4965
|
-
console.warn('Session storage not available.');
|
|
4966
|
-
}
|
|
4967
|
-
}
|
|
4968
|
-
get(key) {
|
|
4969
|
-
const cacheValue = this.cache[key];
|
|
4970
|
-
if (!isUndefined(cacheValue)) {
|
|
4971
|
-
return cacheValue;
|
|
4972
|
-
}
|
|
4973
|
-
try {
|
|
4974
|
-
const storageValue = this.window.sessionStorage.getItem(this.getStorageKey(key));
|
|
4975
|
-
if (isNull(storageValue)) {
|
|
4976
|
-
return null;
|
|
4977
|
-
}
|
|
4978
|
-
return JSON.parse(storageValue);
|
|
4979
|
-
}
|
|
4980
|
-
catch (error) {
|
|
4981
|
-
return null;
|
|
4982
|
-
}
|
|
4983
|
-
}
|
|
4984
|
-
getStorageKey(key) {
|
|
4985
|
-
return `${key}${this.settingsService.token}`;
|
|
4986
|
-
}
|
|
4987
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: SessionService, deps: [{ token: windowToken }, { token: SettingsService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
4988
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: SessionService, providedIn: 'root' }); }
|
|
4989
|
-
}
|
|
4990
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: SessionService, decorators: [{
|
|
4991
|
-
type: Injectable,
|
|
4992
|
-
args: [{
|
|
4993
|
-
providedIn: 'root',
|
|
4994
|
-
}]
|
|
4995
|
-
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
4996
|
-
type: Inject,
|
|
4997
|
-
args: [windowToken]
|
|
4998
|
-
}] }, { type: SettingsService }] });
|
|
4999
|
-
|
|
5000
5020
|
function extractMoneyCurrency(money, allowZero = true) {
|
|
5001
5021
|
return {
|
|
5002
5022
|
amount: money?.amount ?? (allowZero ? 0 : null),
|
|
@@ -7253,7 +7273,7 @@ class PaymentService {
|
|
|
7253
7273
|
get formResponseValue() {
|
|
7254
7274
|
return this._formResponse$.getValue();
|
|
7255
7275
|
}
|
|
7256
|
-
constructor(loggerService, initializeService, submitService, syncService, formService, statusService, financeDetailsService, creditCardStateService, nextActionService, initializeNextActionService, controlConfigService, threeDsService, formMessagesService, settingsService, countryService, checkStatusActionCreator, printInstructionService, paymentBehaviourService) {
|
|
7276
|
+
constructor(loggerService, initializeService, submitService, syncService, formService, statusService, financeDetailsService, creditCardStateService, nextActionService, initializeNextActionService, controlConfigService, threeDsService, formMessagesService, settingsService, countryService, checkStatusActionCreator, printInstructionService, paymentBehaviourService, translateService) {
|
|
7257
7277
|
this.loggerService = loggerService;
|
|
7258
7278
|
this.initializeService = initializeService;
|
|
7259
7279
|
this.submitService = submitService;
|
|
@@ -7272,6 +7292,7 @@ class PaymentService {
|
|
|
7272
7292
|
this.checkStatusActionCreator = checkStatusActionCreator;
|
|
7273
7293
|
this.printInstructionService = printInstructionService;
|
|
7274
7294
|
this.paymentBehaviourService = paymentBehaviourService;
|
|
7295
|
+
this.translateService = translateService;
|
|
7275
7296
|
this.form = null;
|
|
7276
7297
|
this.data = null;
|
|
7277
7298
|
this.financeDetails = null;
|
|
@@ -7414,6 +7435,7 @@ class PaymentService {
|
|
|
7414
7435
|
fields: sdkPaymentData.fields,
|
|
7415
7436
|
submitResponse: isSubmitResponse(this.data) ? this.data : null,
|
|
7416
7437
|
summary: sdkPaymentData.summary,
|
|
7438
|
+
locale: this.translateService.getCurrentLang(),
|
|
7417
7439
|
});
|
|
7418
7440
|
}
|
|
7419
7441
|
getQrCode() {
|
|
@@ -7720,7 +7742,7 @@ class PaymentService {
|
|
|
7720
7742
|
return;
|
|
7721
7743
|
updateAfterErrorRules.forEach((rule) => rule.apply(submitResponse, this.form));
|
|
7722
7744
|
}
|
|
7723
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: PaymentService, deps: [{ token: LoggerService }, { token: InitializeService }, { token: SubmitService }, { token: SyncService }, { token: FormService }, { token: StatusService }, { token: FinanceDetailsService }, { token: CreditCardStateService }, { token: NextActionService }, { token: InitializeNextActionService }, { token: ControlConfigService }, { token: ThreeDsService }, { token: FormMessagesService }, { token: SettingsService }, { token: CountryService }, { token: CheckStatusActionCreator }, { token: PrintInstructionService }, { token: PaymentBehaviourService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
7745
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: PaymentService, deps: [{ token: LoggerService }, { token: InitializeService }, { token: SubmitService }, { token: SyncService }, { token: FormService }, { token: StatusService }, { token: FinanceDetailsService }, { token: CreditCardStateService }, { token: NextActionService }, { token: InitializeNextActionService }, { token: ControlConfigService }, { token: ThreeDsService }, { token: FormMessagesService }, { token: SettingsService }, { token: CountryService }, { token: CheckStatusActionCreator }, { token: PrintInstructionService }, { token: PaymentBehaviourService }, { token: i19.TranslateService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
7724
7746
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: PaymentService, providedIn: 'root' }); }
|
|
7725
7747
|
}
|
|
7726
7748
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: PaymentService, decorators: [{
|
|
@@ -7728,7 +7750,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImpor
|
|
|
7728
7750
|
args: [{
|
|
7729
7751
|
providedIn: 'root',
|
|
7730
7752
|
}]
|
|
7731
|
-
}], ctorParameters: () => [{ type: LoggerService }, { type: InitializeService }, { type: SubmitService }, { type: SyncService }, { type: FormService }, { type: StatusService }, { type: FinanceDetailsService }, { type: CreditCardStateService }, { type: NextActionService }, { type: InitializeNextActionService }, { type: ControlConfigService }, { type: ThreeDsService }, { type: FormMessagesService }, { type: SettingsService }, { type: CountryService }, { type: CheckStatusActionCreator }, { type: PrintInstructionService }, { type: PaymentBehaviourService }] });
|
|
7753
|
+
}], ctorParameters: () => [{ type: LoggerService }, { type: InitializeService }, { type: SubmitService }, { type: SyncService }, { type: FormService }, { type: StatusService }, { type: FinanceDetailsService }, { type: CreditCardStateService }, { type: NextActionService }, { type: InitializeNextActionService }, { type: ControlConfigService }, { type: ThreeDsService }, { type: FormMessagesService }, { type: SettingsService }, { type: CountryService }, { type: CheckStatusActionCreator }, { type: PrintInstructionService }, { type: PaymentBehaviourService }, { type: i19.TranslateService }] });
|
|
7732
7754
|
|
|
7733
7755
|
const euCountries = new Set([
|
|
7734
7756
|
'AT',
|
|
@@ -8542,7 +8564,7 @@ class CoreLibraryService {
|
|
|
8542
8564
|
get commonLogAttributes() {
|
|
8543
8565
|
return this.commonLogAttributesService.getAttributes();
|
|
8544
8566
|
}
|
|
8545
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: CoreLibraryService, deps: [{ token: SettingsService }, { token: LoggerService }, { token: CountryService }, { token: PaymentMethodsService }, { token: SavedMethodsService }, { token: UserBalanceService }, { token: PaymentConfigService }, { token: PaymentService }, { token: DeviceFingerPrintService }, { token: FinanceDetailsService }, { token: LegalService }, { token: StatusService }, { token: NextActionService }, { token: CreditCardService }, { token: CreditCardStateService }, { token: FormMessagesService }, { token: EditSavedMethodsService }, { token: UserBehaviourAnalyticsService }, { token: PerformanceService }, { token: CombinedPaymentMethodsService }, { token: CountriesApiService }, { token: SendInstructionService }, { token: ScriptTrackerService }, { token:
|
|
8567
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: CoreLibraryService, deps: [{ token: SettingsService }, { token: LoggerService }, { token: CountryService }, { token: PaymentMethodsService }, { token: SavedMethodsService }, { token: UserBalanceService }, { token: PaymentConfigService }, { token: PaymentService }, { token: DeviceFingerPrintService }, { token: FinanceDetailsService }, { token: LegalService }, { token: StatusService }, { token: NextActionService }, { token: CreditCardService }, { token: CreditCardStateService }, { token: FormMessagesService }, { token: EditSavedMethodsService }, { token: UserBehaviourAnalyticsService }, { token: PerformanceService }, { token: CombinedPaymentMethodsService }, { token: CountriesApiService }, { token: SendInstructionService }, { token: ScriptTrackerService }, { token: i19.TranslateService }, { token: CommonLogAttributesService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
8546
8568
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: CoreLibraryService, providedIn: 'root' }); }
|
|
8547
8569
|
}
|
|
8548
8570
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: CoreLibraryService, decorators: [{
|
|
@@ -8550,7 +8572,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImpor
|
|
|
8550
8572
|
args: [{
|
|
8551
8573
|
providedIn: 'root',
|
|
8552
8574
|
}]
|
|
8553
|
-
}], ctorParameters: () => [{ type: SettingsService }, { type: LoggerService }, { type: CountryService }, { type: PaymentMethodsService }, { type: SavedMethodsService }, { type: UserBalanceService }, { type: PaymentConfigService }, { type: PaymentService }, { type: DeviceFingerPrintService }, { type: FinanceDetailsService }, { type: LegalService }, { type: StatusService }, { type: NextActionService }, { type: CreditCardService }, { type: CreditCardStateService }, { type: FormMessagesService }, { type: EditSavedMethodsService }, { type: UserBehaviourAnalyticsService }, { type: PerformanceService }, { type: CombinedPaymentMethodsService }, { type: CountriesApiService }, { type: SendInstructionService }, { type: ScriptTrackerService }, { type:
|
|
8575
|
+
}], ctorParameters: () => [{ type: SettingsService }, { type: LoggerService }, { type: CountryService }, { type: PaymentMethodsService }, { type: SavedMethodsService }, { type: UserBalanceService }, { type: PaymentConfigService }, { type: PaymentService }, { type: DeviceFingerPrintService }, { type: FinanceDetailsService }, { type: LegalService }, { type: StatusService }, { type: NextActionService }, { type: CreditCardService }, { type: CreditCardStateService }, { type: FormMessagesService }, { type: EditSavedMethodsService }, { type: UserBehaviourAnalyticsService }, { type: PerformanceService }, { type: CombinedPaymentMethodsService }, { type: CountriesApiService }, { type: SendInstructionService }, { type: ScriptTrackerService }, { type: i19.TranslateService }, { type: CommonLogAttributesService }] });
|
|
8554
8576
|
|
|
8555
8577
|
class HttpError extends AppError {
|
|
8556
8578
|
constructor(error, req) {
|
|
@@ -9548,7 +9570,7 @@ class GooglePayService {
|
|
|
9548
9570
|
return checkStatusAction;
|
|
9549
9571
|
}
|
|
9550
9572
|
}
|
|
9551
|
-
createButton(onClickHandler,
|
|
9573
|
+
createButton(onClickHandler, configuration) {
|
|
9552
9574
|
if (!this.googlePaymentClient) {
|
|
9553
9575
|
return null;
|
|
9554
9576
|
}
|
|
@@ -9558,7 +9580,8 @@ class GooglePayService {
|
|
|
9558
9580
|
allowedPaymentMethods: allowedPaymentMethods,
|
|
9559
9581
|
buttonSizeMode: 'fill',
|
|
9560
9582
|
buttonType: 'buy',
|
|
9561
|
-
buttonColor,
|
|
9583
|
+
buttonColor: configuration.color ?? 'default',
|
|
9584
|
+
buttonLocale: this.getLocaleForButton(configuration.locale),
|
|
9562
9585
|
});
|
|
9563
9586
|
}
|
|
9564
9587
|
setupGooglePayClient() {
|
|
@@ -9606,6 +9629,48 @@ class GooglePayService {
|
|
|
9606
9629
|
isCanceledStatus(statusCode) {
|
|
9607
9630
|
return statusCode.toLowerCase() === 'canceled';
|
|
9608
9631
|
}
|
|
9632
|
+
getLocaleForButton(userLocale) {
|
|
9633
|
+
const allowedLocales = [
|
|
9634
|
+
'en',
|
|
9635
|
+
'ar',
|
|
9636
|
+
'bg',
|
|
9637
|
+
'ca',
|
|
9638
|
+
'cs',
|
|
9639
|
+
'da',
|
|
9640
|
+
'de',
|
|
9641
|
+
'el',
|
|
9642
|
+
'es',
|
|
9643
|
+
'et',
|
|
9644
|
+
'fi',
|
|
9645
|
+
'fr',
|
|
9646
|
+
'hr',
|
|
9647
|
+
'id',
|
|
9648
|
+
'it',
|
|
9649
|
+
'ja',
|
|
9650
|
+
'ko',
|
|
9651
|
+
'ms',
|
|
9652
|
+
'nl',
|
|
9653
|
+
'no',
|
|
9654
|
+
'pl',
|
|
9655
|
+
'pt',
|
|
9656
|
+
'ru',
|
|
9657
|
+
'sk',
|
|
9658
|
+
'sl',
|
|
9659
|
+
'sr',
|
|
9660
|
+
'sv',
|
|
9661
|
+
'th',
|
|
9662
|
+
'tr',
|
|
9663
|
+
'uk',
|
|
9664
|
+
'zh',
|
|
9665
|
+
];
|
|
9666
|
+
if (['cn', 'zh_HANT'].includes(userLocale)) {
|
|
9667
|
+
return 'zh';
|
|
9668
|
+
}
|
|
9669
|
+
if (['zh_HANS'].includes(userLocale)) {
|
|
9670
|
+
return 'tw';
|
|
9671
|
+
}
|
|
9672
|
+
return allowedLocales.find((locale) => locale === userLocale) ?? 'en';
|
|
9673
|
+
}
|
|
9609
9674
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: GooglePayService, deps: [{ token: windowToken }, { token: LoggerService }, { token: PaymentSystemProcessingService }, { token: GooglePayCheckoutPaymentService }, { token: GooglePayInstantPaymentService }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
9610
9675
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: GooglePayService, providedIn: 'root' }); }
|
|
9611
9676
|
}
|