@xsolla/payment-client-core 0.2.36 → 0.2.38
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/config/config.service.mjs +1 -1
- package/esm2022/lib/core/payment/credit-card-payment-methods-id.variable.mjs +2 -1
- package/esm2022/lib/core/payment/field-names.enum.mjs +2 -1
- package/esm2022/lib/core/payment/form/converters/card-expiration/card-expiration.converter.mjs +39 -0
- package/esm2022/lib/core/payment/form/converters/converters-map.mjs +3 -1
- package/esm2022/lib/core/payment/form/form.module.mjs +4 -1
- package/esm2022/lib/core/payment/form/validators/card-expiration-date-validator/card-expiration-date.validator.mjs +61 -0
- package/esm2022/lib/core/payment/initialize/initialize.service.mjs +8 -4
- package/esm2022/lib/core/payment/payment-configuration.interface.mjs +2 -0
- package/esm2022/lib/core/payment/payment-settings/payment-settings-request-params.interface.mjs +2 -0
- package/esm2022/lib/core/payment/payment-settings/payment-settings.service.mjs +20 -0
- package/esm2022/lib/core/payment/payment.service.mjs +6 -6
- package/esm2022/lib/core/payment/submit/request/submit-request.class.mjs +15 -3
- package/esm2022/lib/core/payment/submit/submit.service.mjs +9 -5
- package/esm2022/lib/core/payment/sync/request/sync-request.class.mjs +6 -5
- package/esm2022/lib/core/payment/sync/sync.service.mjs +12 -5
- package/esm2022/lib/core/payment/xps-api-part-request.abstract.mjs +6 -1
- package/esm2022/lib/core/saved-methods/saved-method-api.interface.mjs +1 -1
- package/esm2022/lib/core/saved-methods/saved-method.interface.mjs +1 -1
- package/esm2022/lib/core/saved-methods/saved-methods-response.class.mjs +3 -1
- package/esm2022/lib/core-library.service.mjs +1 -1
- package/fesm2022/xsolla-payment-client-core.mjs +187 -40
- package/fesm2022/xsolla-payment-client-core.mjs.map +1 -1
- package/lib/core/payment/config/config.service.d.ts +2 -2
- package/lib/core/payment/credit-card-payment-methods-id.variable.d.ts +1 -1
- package/lib/core/payment/field-names.enum.d.ts +1 -0
- package/lib/core/payment/form/converters/card-expiration/card-expiration.converter.d.ts +17 -0
- package/lib/core/payment/form/validators/card-expiration-date-validator/card-expiration-date.validator.d.ts +10 -0
- package/lib/core/payment/initialize/initialize.service.d.ts +5 -3
- package/lib/core/payment/payment-configuration.interface.d.ts +22 -0
- package/lib/core/payment/payment-settings/payment-settings-request-params.interface.d.ts +4 -0
- package/lib/core/payment/payment-settings/payment-settings.service.d.ts +8 -0
- package/lib/core/payment/payment.service.d.ts +2 -2
- package/lib/core/payment/submit/request/submit-request.class.d.ts +1 -0
- package/lib/core/payment/submit/submit.service.d.ts +5 -2
- package/lib/core/payment/sync/request/sync-request.class.d.ts +2 -1
- package/lib/core/payment/sync/sync.service.d.ts +6 -2
- package/lib/core/payment/xps-api-part-request.abstract.d.ts +4 -1
- package/lib/core/saved-methods/saved-method-api.interface.d.ts +6 -0
- package/lib/core/saved-methods/saved-method.interface.d.ts +6 -0
- package/lib/core-library.service.d.ts +2 -2
- package/package.json +1 -1
- package/xsolla-payment-client-core-0.2.38.tgz +0 -0
- package/esm2022/lib/core/payment/payment-config.interface.mjs +0 -2
- package/lib/core/payment/payment-config.interface.d.ts +0 -8
- package/xsolla-payment-client-core-0.2.36.tgz +0 -0
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { SettingsService } from '../../settings/settings.service';
|
|
2
2
|
import { UrlService } from '../../url/url.service';
|
|
3
|
-
import {
|
|
3
|
+
import { PaymentConfiguration } from '../payment-configuration.interface';
|
|
4
4
|
import * as i0 from "@angular/core";
|
|
5
5
|
export declare class PaymentConfigService {
|
|
6
6
|
private readonly urlService;
|
|
7
7
|
private readonly settingsService;
|
|
8
8
|
constructor(urlService: UrlService, settingsService: SettingsService);
|
|
9
|
-
enrich(config:
|
|
9
|
+
enrich(config: PaymentConfiguration): PaymentConfiguration;
|
|
10
10
|
private enrichReturnUrl;
|
|
11
11
|
static ɵfac: i0.ɵɵFactoryDeclaration<PaymentConfigService, never>;
|
|
12
12
|
static ɵprov: i0.ɵɵInjectableDeclaration<PaymentConfigService>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare const masterCardAndVisaPaymentMethodId = 26;
|
|
2
2
|
export declare const maestroPaymentMethodId = 490;
|
|
3
|
-
export declare const creditCardPaymentMethodId
|
|
3
|
+
export declare const creditCardPaymentMethodId: 1380;
|
|
4
4
|
export declare const americanExpressMethodId = 714;
|
|
5
5
|
export declare const specialCards: number[];
|
|
6
6
|
export declare const cardsWith3ds: number[];
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Converter } from '../converter.abstract';
|
|
2
|
+
import { SyncService } from '../../../sync/sync.service';
|
|
3
|
+
import { Field } from '../../../field.interface';
|
|
4
|
+
import { ValidatorFn } from '../../validators/validator-fn.type';
|
|
5
|
+
import { FormState } from '../../form-state.interface';
|
|
6
|
+
import { TextControlConfig } from '../../controls/text-control.config';
|
|
7
|
+
import * as i0 from "@angular/core";
|
|
8
|
+
export declare const maxMonths = 12;
|
|
9
|
+
export declare class CardExpirationConverter extends Converter {
|
|
10
|
+
constructor(syncService: SyncService);
|
|
11
|
+
getValidators(field: Field): ValidatorFn[];
|
|
12
|
+
protected createControlConfig(field: Field, formState: FormState): TextControlConfig;
|
|
13
|
+
protected getAutocomplete(): string;
|
|
14
|
+
protected getDataType(): string;
|
|
15
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CardExpirationConverter, never>;
|
|
16
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<CardExpirationConverter>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { AbstractControl } from '@angular/forms';
|
|
2
|
+
import { ValidationErrors } from '../validation-errors.interface';
|
|
3
|
+
export declare const getMinMonth: (parsedYear: string) => number;
|
|
4
|
+
export declare const getLastCharactersInYear: (str?: string) => string;
|
|
5
|
+
export declare const sliceMmYy: (value: string) => {
|
|
6
|
+
month: string;
|
|
7
|
+
year: string;
|
|
8
|
+
};
|
|
9
|
+
export declare const maxYearsCount = 50;
|
|
10
|
+
export declare function cardExpValidator(control: AbstractControl): ValidationErrors | null;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CountryService } from '../../country/country.service';
|
|
2
2
|
import { EncryptCreditCardService } from '../../encrypt-credit-card/encrypt-credit-card.service';
|
|
3
3
|
import { SettingsService } from '../../settings/settings.service';
|
|
4
|
-
import {
|
|
4
|
+
import { PaymentConfiguration } from '../payment-configuration.interface';
|
|
5
5
|
import { NextActionService } from '../actions/next-action.service';
|
|
6
6
|
import { ShowErrorsActionCreator } from '../actions/show-errors/show-errors.action.class';
|
|
7
7
|
import { XpsApiService } from '../xps-api/xps-api.service';
|
|
@@ -9,6 +9,7 @@ import { InitializeResponseFactory } from './response/initialize-response.token'
|
|
|
9
9
|
import { InitializeResponse } from './response/initialize-response.class';
|
|
10
10
|
import { XpsResponseErrorsMappingService } from '../../errors-mapping/xps-response-errors-mapping.service';
|
|
11
11
|
import { UserBehaviourAnalyticsService } from '../../user-behaviour-analytics/user-behaviour-analytics.service';
|
|
12
|
+
import { PaymentSettingsService } from '../payment-settings/payment-settings.service';
|
|
12
13
|
import * as i0 from "@angular/core";
|
|
13
14
|
export declare class InitializeService {
|
|
14
15
|
protected readonly responseFactory: InitializeResponseFactory;
|
|
@@ -20,8 +21,9 @@ export declare class InitializeService {
|
|
|
20
21
|
private readonly encryptCreditCardService;
|
|
21
22
|
private readonly showErrorsActionCreator;
|
|
22
23
|
private readonly userBehaviourAnalyticsService;
|
|
23
|
-
|
|
24
|
-
|
|
24
|
+
private readonly paymentSettingsService;
|
|
25
|
+
constructor(responseFactory: InitializeResponseFactory, xpsApiService: XpsApiService, settingsService: SettingsService, countryService: CountryService, nextActionService: NextActionService, xpsResponseErrorsMappingService: XpsResponseErrorsMappingService, encryptCreditCardService: EncryptCreditCardService, showErrorsActionCreator: ShowErrorsActionCreator, userBehaviourAnalyticsService: UserBehaviourAnalyticsService, paymentSettingsService: PaymentSettingsService);
|
|
26
|
+
request(config: PaymentConfiguration): Promise<InitializeResponse>;
|
|
25
27
|
private setCreditCardEncryptKey;
|
|
26
28
|
static ɵfac: i0.ɵɵFactoryDeclaration<InitializeService, never>;
|
|
27
29
|
static ɵprov: i0.ɵɵInjectableDeclaration<InitializeService>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { creditCardPaymentMethodId } from './credit-card-payment-methods-id.variable';
|
|
2
|
+
export interface BasePaymentConfiguration {
|
|
3
|
+
paymentMethodId: number;
|
|
4
|
+
returnUrl: string;
|
|
5
|
+
accountId?: number;
|
|
6
|
+
paymentWithSavedMethod?: boolean;
|
|
7
|
+
savedMethodId?: number;
|
|
8
|
+
savePaymentMethod?: boolean;
|
|
9
|
+
}
|
|
10
|
+
interface SpecialPaymentSettings {
|
|
11
|
+
useSingleExpirationDateField?: boolean;
|
|
12
|
+
}
|
|
13
|
+
interface PaymentConfigurationCreditCardSettings extends BasePaymentConfiguration {
|
|
14
|
+
paymentMethodId: typeof creditCardPaymentMethodId;
|
|
15
|
+
paymentMethodSettings: SpecialPaymentSettings;
|
|
16
|
+
}
|
|
17
|
+
interface PaymentConfigurationWithGeneralSettings extends BasePaymentConfiguration {
|
|
18
|
+
paymentMethodId: Exclude<number, typeof creditCardPaymentMethodId>;
|
|
19
|
+
paymentMethodSettings?: never;
|
|
20
|
+
}
|
|
21
|
+
export type PaymentConfiguration = PaymentConfigurationCreditCardSettings | PaymentConfigurationWithGeneralSettings;
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { PaymentConfiguration } from '../payment-configuration.interface';
|
|
2
|
+
import { PaymentSettingsRequestParams } from './payment-settings-request-params.interface';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
export declare class PaymentSettingsService {
|
|
5
|
+
getPaymentSettingsParams(config: PaymentConfiguration | null): PaymentSettingsRequestParams;
|
|
6
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<PaymentSettingsService, never>;
|
|
7
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<PaymentSettingsService>;
|
|
8
|
+
}
|
|
@@ -13,7 +13,7 @@ import { FinanceDetails } from './finance-details/finance-details.interface';
|
|
|
13
13
|
import { FinanceDetailsService } from './finance-details/finance-details.service';
|
|
14
14
|
import { NextAction } from './actions/next-action.interface';
|
|
15
15
|
import { Field } from './field.interface';
|
|
16
|
-
import {
|
|
16
|
+
import { PaymentConfiguration } from './payment-configuration.interface';
|
|
17
17
|
import { ValidationErrors } from './form/validators/validation-errors.interface';
|
|
18
18
|
import { InputEventName } from './form/input-event.enum';
|
|
19
19
|
import { FormFieldsStatus } from './form/form-fields-status.interface';
|
|
@@ -65,7 +65,7 @@ export declare class PaymentService {
|
|
|
65
65
|
private readonly _formResponse$;
|
|
66
66
|
private isSavingMethodMode;
|
|
67
67
|
constructor(initializeService: InitializeService, submitService: SubmitService, syncService: SyncService, formService: FormService, statusService: StatusService, financeDetailsService: FinanceDetailsService, creditCardStateService: CreditCardStateService, nextActionService: NextActionService, controlConfigService: ControlConfigService, threeDsService: ThreeDsService, formMessagesService: FormMessagesService, settingsService: SettingsService, countryService: CountryService, checkStatusActionCreator: CheckStatusActionCreator, printInstructionService: PrintInstructionService);
|
|
68
|
-
initialize(config:
|
|
68
|
+
initialize(config: PaymentConfiguration): Promise<InitializedForm>;
|
|
69
69
|
submit(): Promise<NextAction | null | void>;
|
|
70
70
|
getFields(): Field[];
|
|
71
71
|
getControlStatus(name: FieldNames): ControlStatus | null;
|
|
@@ -9,6 +9,8 @@ import { XpsApiService } from '../xps-api/xps-api.service';
|
|
|
9
9
|
import { EncryptCreditCardService } from '../../encrypt-credit-card/encrypt-credit-card.service';
|
|
10
10
|
import { XpsResponseErrorsMappingService } from '../../errors-mapping/xps-response-errors-mapping.service';
|
|
11
11
|
import { UserBehaviourAnalyticsService } from '../../user-behaviour-analytics/user-behaviour-analytics.service';
|
|
12
|
+
import { PaymentConfiguration } from '../payment-configuration.interface';
|
|
13
|
+
import { PaymentSettingsService } from '../payment-settings/payment-settings.service';
|
|
12
14
|
import * as i0 from "@angular/core";
|
|
13
15
|
export declare class SubmitService {
|
|
14
16
|
private readonly requestFactory;
|
|
@@ -19,8 +21,9 @@ export declare class SubmitService {
|
|
|
19
21
|
private readonly xpsResponseErrorsMappingService;
|
|
20
22
|
private readonly encryptCreditCardService;
|
|
21
23
|
private readonly userBehaviourAnalyticsService;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
+
private readonly paymentSettingsService;
|
|
25
|
+
constructor(requestFactory: SubmitRequestFactory, responseFactory: SubmitResponseFactory, settingsService: SettingsService, deviceFingerPrintService: DeviceFingerPrintService, xpsApiService: XpsApiService, xpsResponseErrorsMappingService: XpsResponseErrorsMappingService, encryptCreditCardService: EncryptCreditCardService, userBehaviourAnalyticsService: UserBehaviourAnalyticsService, paymentSettingsService: PaymentSettingsService);
|
|
26
|
+
request(fields: Field[], form: UntypedFormGroup, config: PaymentConfiguration): Promise<SubmitResponse>;
|
|
24
27
|
private fillUserSession;
|
|
25
28
|
static ɵfac: i0.ɵɵFactoryDeclaration<SubmitService, never>;
|
|
26
29
|
static ɵprov: i0.ɵɵInjectableDeclaration<SubmitService>;
|
|
@@ -4,11 +4,12 @@ import { XpsApiPartRequest } from '../../xps-api-part-request.abstract';
|
|
|
4
4
|
export declare class SyncRequest extends XpsApiPartRequest {
|
|
5
5
|
readonly access_token: string;
|
|
6
6
|
readonly xps_fix_command = "calculate";
|
|
7
|
-
constructor(parameters: {
|
|
7
|
+
constructor({ token, changedField, fields, form, ...parameters }: {
|
|
8
8
|
token: string;
|
|
9
9
|
changedField: Field;
|
|
10
10
|
fields: Field[];
|
|
11
11
|
form: UntypedFormGroup;
|
|
12
|
+
[key: string]: unknown;
|
|
12
13
|
});
|
|
13
14
|
private getFieldsValues;
|
|
14
15
|
private getFieldsMap;
|
|
@@ -14,6 +14,8 @@ import { FieldAsyncValidation } from './field-async-validation.interface';
|
|
|
14
14
|
import { EncryptCreditCardService } from '../../encrypt-credit-card/encrypt-credit-card.service';
|
|
15
15
|
import { XpsResponseErrorsMappingService } from '../../errors-mapping/xps-response-errors-mapping.service';
|
|
16
16
|
import { UserBehaviourAnalyticsService } from '../../user-behaviour-analytics/user-behaviour-analytics.service';
|
|
17
|
+
import { PaymentConfiguration } from '../payment-configuration.interface';
|
|
18
|
+
import { PaymentSettingsService } from '../payment-settings/payment-settings.service';
|
|
17
19
|
import * as i0 from "@angular/core";
|
|
18
20
|
export declare class SyncService extends EmitDataService<XpsResponse> {
|
|
19
21
|
private readonly requestFactory;
|
|
@@ -25,14 +27,16 @@ export declare class SyncService extends EmitDataService<XpsResponse> {
|
|
|
25
27
|
private readonly encryptCreditCardService;
|
|
26
28
|
private readonly showErrorsActionCreator;
|
|
27
29
|
private readonly userBehaviourAnalyticsService;
|
|
30
|
+
private readonly paymentSettingsService;
|
|
28
31
|
private prevFieldSyncStates;
|
|
29
32
|
private form;
|
|
33
|
+
private paymentConfiguration;
|
|
30
34
|
private fields;
|
|
31
35
|
private fieldSyncTimers;
|
|
32
36
|
private readonly fieldAsyncValidation;
|
|
33
|
-
constructor(requestFactory: SyncRequestFactory, responseFactory: SyncResponseFactory, xpsApiService: XpsApiService, nextActionService: NextActionService, settingsService: SettingsService, xpsResponseErrorsMappingService: XpsResponseErrorsMappingService, encryptCreditCardService: EncryptCreditCardService, showErrorsActionCreator: ShowErrorsActionCreator, userBehaviourAnalyticsService: UserBehaviourAnalyticsService);
|
|
37
|
+
constructor(requestFactory: SyncRequestFactory, responseFactory: SyncResponseFactory, xpsApiService: XpsApiService, nextActionService: NextActionService, settingsService: SettingsService, xpsResponseErrorsMappingService: XpsResponseErrorsMappingService, encryptCreditCardService: EncryptCreditCardService, showErrorsActionCreator: ShowErrorsActionCreator, userBehaviourAnalyticsService: UserBehaviourAnalyticsService, paymentSettingsService: PaymentSettingsService);
|
|
34
38
|
get fieldAsyncValidation$(): Observable<FieldAsyncValidation>;
|
|
35
|
-
setup(form: UntypedFormGroup, fields: Field[]): void;
|
|
39
|
+
setup(form: UntypedFormGroup, fields: Field[], config: PaymentConfiguration): void;
|
|
36
40
|
reset(): void;
|
|
37
41
|
validate(field: Field, delay?: number): Promise<ValidationErrors | null>;
|
|
38
42
|
getSyncValidationErrors(field: Field): ValidationErrors | null;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
export declare abstract class XpsApiPartRequest {
|
|
2
|
-
[fieldName:
|
|
2
|
+
[fieldName: string]: unknown;
|
|
3
3
|
protected addXpsParameters(parameters: {
|
|
4
4
|
[key: string]: unknown;
|
|
5
5
|
}): void;
|
|
6
|
+
protected addParameters(parameters: {
|
|
7
|
+
[key: string]: unknown;
|
|
8
|
+
}): void;
|
|
6
9
|
}
|
|
@@ -17,6 +17,12 @@ export interface SavedMethodApi {
|
|
|
17
17
|
month: string;
|
|
18
18
|
year: string;
|
|
19
19
|
};
|
|
20
|
+
date_create: {
|
|
21
|
+
date: string;
|
|
22
|
+
timezone: string;
|
|
23
|
+
timezone_type: number;
|
|
24
|
+
};
|
|
25
|
+
date_last_charge: number;
|
|
20
26
|
switch_icon_name: string | null;
|
|
21
27
|
partner?: string | null;
|
|
22
28
|
}
|
|
@@ -7,7 +7,7 @@ import { SavedMethodsService } from './core/saved-methods/saved-methods.service'
|
|
|
7
7
|
import { SavedMethod } from './core/saved-methods/saved-method.interface';
|
|
8
8
|
import { UserBalanceResponse } from './core/user-balance/user-balance-response.class';
|
|
9
9
|
import { UserBalanceService } from './core/user-balance/user-balance.service';
|
|
10
|
-
import {
|
|
10
|
+
import { PaymentConfiguration } from './core/payment/payment-configuration.interface';
|
|
11
11
|
import { PaymentService } from './core/payment/payment.service';
|
|
12
12
|
import { Payment } from './core/payment/payment.interface';
|
|
13
13
|
import { DeviceFingerPrintService } from './core/device-finger-print/device-finger-print.service';
|
|
@@ -89,7 +89,7 @@ export declare class CoreLibraryService {
|
|
|
89
89
|
getCountries(): Promise<CountryResponse['countryList']>;
|
|
90
90
|
setCountry(country: string): void;
|
|
91
91
|
getCountry(): string;
|
|
92
|
-
createPayment(config:
|
|
92
|
+
createPayment(config: PaymentConfiguration): Payment;
|
|
93
93
|
getCreditCardService(): CreditCard;
|
|
94
94
|
get flowUpdates$(): Observable<NextAction>;
|
|
95
95
|
get financeDetailsUpdates$(): Observable<FinanceDetails>;
|
package/package.json
CHANGED
|
Binary file
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
export {};
|
|
2
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicGF5bWVudC1jb25maWcuaW50ZXJmYWNlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vcGFja2FnZXMvcGF5bWVudC1jbGllbnQtY29yZS9zcmMvbGliL2NvcmUvcGF5bWVudC9wYXltZW50LWNvbmZpZy5pbnRlcmZhY2UudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiIsInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCBpbnRlcmZhY2UgUGF5bWVudENvbmZpZyB7XG4gIHBheW1lbnRNZXRob2RJZDogbnVtYmVyO1xuICByZXR1cm5Vcmw6IHN0cmluZztcbiAgYWNjb3VudElkPzogbnVtYmVyO1xuICBwYXltZW50V2l0aFNhdmVkTWV0aG9kPzogYm9vbGVhbjtcbiAgc2F2ZWRNZXRob2RJZD86IG51bWJlcjtcbiAgc2F2ZVBheW1lbnRNZXRob2Q/OiBib29sZWFuO1xufVxuIl19
|
|
Binary file
|