@xsolla/payment-client-core 0.3.1 → 0.3.3

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.
Files changed (35) hide show
  1. package/esm2022/lib/core/agreements-group.const.mjs +2 -1
  2. package/esm2022/lib/core/capabilities/capabilities.service.mjs +25 -0
  3. package/esm2022/lib/core/capabilities/capability.const.mjs +8 -0
  4. package/esm2022/lib/core/legal/legal.service.mjs +2 -2
  5. package/esm2022/lib/core/payment/actions/next-action.interface.mjs +1 -1
  6. package/esm2022/lib/core/payment/actions/next-actions.mjs +3 -1
  7. package/esm2022/lib/core/payment/actions/show-init-form/show-init-form.action.class.mjs +56 -0
  8. package/esm2022/lib/core/payment/actions/show-init-form/show-init-form.action.type.mjs +2 -0
  9. package/esm2022/lib/core/payment/config/config.service.mjs +8 -1
  10. package/esm2022/lib/core/payment/field-names.enum.mjs +2 -1
  11. package/esm2022/lib/core/payment/finance-details/cart-summary.interface.mjs +1 -1
  12. package/esm2022/lib/core/payment/payment-configuration.interface.mjs +1 -1
  13. package/esm2022/lib/core/payment/payment.service.mjs +13 -10
  14. package/esm2022/lib/core/payment/status/status.service.mjs +2 -8
  15. package/esm2022/lib/core/payment/three-ds/dfp-collect/dfp-collect.service.mjs +12 -8
  16. package/esm2022/lib/core/settings/configuration.interface.mjs +1 -1
  17. package/esm2022/lib/core-library.service.mjs +9 -7
  18. package/fesm2022/xsolla-payment-client-core.mjs +121 -30
  19. package/fesm2022/xsolla-payment-client-core.mjs.map +1 -1
  20. package/lib/core/capabilities/capabilities.service.d.ts +9 -0
  21. package/lib/core/capabilities/capability.const.d.ts +6 -0
  22. package/lib/core/payment/actions/next-action.interface.d.ts +2 -1
  23. package/lib/core/payment/actions/show-init-form/show-init-form.action.class.d.ts +17 -0
  24. package/lib/core/payment/actions/show-init-form/show-init-form.action.type.d.ts +11 -0
  25. package/lib/core/payment/config/config.service.d.ts +3 -0
  26. package/lib/core/payment/field-names.enum.d.ts +1 -0
  27. package/lib/core/payment/finance-details/cart-summary.interface.d.ts +2 -0
  28. package/lib/core/payment/payment-configuration.interface.d.ts +1 -0
  29. package/lib/core/payment/payment.service.d.ts +3 -0
  30. package/lib/core/payment/status/status.service.d.ts +0 -2
  31. package/lib/core/settings/configuration.interface.d.ts +7 -0
  32. package/lib/core-library.service.d.ts +3 -2
  33. package/package.json +1 -1
  34. package/xsolla-payment-client-core-0.3.3.tgz +0 -0
  35. package/xsolla-payment-client-core-0.3.1.tgz +0 -0
@@ -0,0 +1,9 @@
1
+ import * as i0 from "@angular/core";
2
+ export declare class CapabilitiesService {
3
+ private capabilities;
4
+ set(list?: string[]): void;
5
+ has(capability: string): boolean;
6
+ clear(): void;
7
+ static ɵfac: i0.ɵɵFactoryDeclaration<CapabilitiesService, never>;
8
+ static ɵprov: i0.ɵɵInjectableDeclaration<CapabilitiesService>;
9
+ }
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Known capability identifiers. Values mirror the SDK-side
3
+ * {@link Capability} enum but are kept as plain strings because
4
+ * payment-client-core must not depend on pay-station-sdk.
5
+ */
6
+ export declare const SHOW_INIT_FORM_CAPABILITY = "show_init_form_action";
@@ -1,5 +1,6 @@
1
1
  import { CheckStatusAction } from './check-status/check-status.action.type';
2
2
  import { ShowFieldsAction } from './show-fields/show-fields.action.type';
3
+ import { ShowInitFormAction } from './show-init-form/show-init-form.action.type';
3
4
  import { StatusUpdatedAction } from './status-updated/status-updated.action.type';
4
5
  import { RedirectAction } from './redirect/redirect.action.type';
5
6
  import { ShowErrorsAction } from './show-errors/show-errors.action.type';
@@ -11,4 +12,4 @@ import { ShowXsollaNumberAction } from './show-xsolla-number/show-xsolla-number.
11
12
  import { ShowCashPaymentInstructionAction } from './show-cash-payment-instruction/show-cash-payment-instruction.action.type';
12
13
  import { ThreeDsRedirectAction } from './three-ds-redirect/three-ds-redirect.action.type';
13
14
  import { ServerErrorAction } from './server-error/server-error.action.type';
14
- export type NextAction = CheckStatusAction | ShowFieldsAction | StatusUpdatedAction | ShowErrorsAction | RedirectAction | ThreeDsAction | ThreeDsRedirectAction | SpecialButtonAction | ShowQrCodeAction | ShowMobilePaymentScreenAction | ShowXsollaNumberAction | ShowCashPaymentInstructionAction | ServerErrorAction;
15
+ export type NextAction = CheckStatusAction | ShowFieldsAction | ShowInitFormAction | StatusUpdatedAction | ShowErrorsAction | RedirectAction | ThreeDsAction | ThreeDsRedirectAction | SpecialButtonAction | ShowQrCodeAction | ShowMobilePaymentScreenAction | ShowXsollaNumberAction | ShowCashPaymentInstructionAction | ServerErrorAction;
@@ -0,0 +1,17 @@
1
+ import { ActionCreator } from '../action.interface';
2
+ import { ShowInitFormAction, ShowInitFormActionType } from './show-init-form.action.type';
3
+ import { SubmitResponse } from '../../requests/submit/response/submit-response.class';
4
+ import { PaymentConfigService } from '../../config/config.service';
5
+ import { CapabilitiesService } from '../../../capabilities/capabilities.service';
6
+ import * as i0 from "@angular/core";
7
+ export declare class ShowInitFormActionCreator implements ActionCreator {
8
+ private readonly paymentConfigService;
9
+ private readonly capabilitiesService;
10
+ type: ShowInitFormActionType;
11
+ constructor(paymentConfigService: PaymentConfigService, capabilitiesService: CapabilitiesService);
12
+ getActionData(submitResponse: SubmitResponse): ShowInitFormAction;
13
+ isSuitable(response: SubmitResponse): boolean;
14
+ private isExternalVaultActive;
15
+ static ɵfac: i0.ɵɵFactoryDeclaration<ShowInitFormActionCreator, never>;
16
+ static ɵprov: i0.ɵɵInjectableDeclaration<ShowInitFormActionCreator>;
17
+ }
@@ -0,0 +1,11 @@
1
+ import { Action } from '../action.interface';
2
+ import { Field } from '../../field.interface';
3
+ import { XpsError } from '../../xps-error.interface';
4
+ import { XpsMessage } from '../../xps-message.interface';
5
+ export type ShowInitFormActionType = 'show_init_form';
6
+ export interface ShowInitFormActionData {
7
+ fields: Field[];
8
+ errors: XpsError[] | null;
9
+ messages: XpsMessage[] | undefined;
10
+ }
11
+ export type ShowInitFormAction = Action<ShowInitFormActionType, ShowInitFormActionData>;
@@ -5,7 +5,10 @@ import * as i0 from "@angular/core";
5
5
  export declare class PaymentConfigService {
6
6
  private readonly urlService;
7
7
  private readonly settingsService;
8
+ private _activeConfig;
8
9
  constructor(urlService: UrlService, settingsService: SettingsService);
10
+ get activeConfig(): PaymentConfiguration | null;
11
+ setActiveConfig(config: PaymentConfiguration | null): void;
9
12
  enrich(config: PaymentConfiguration): PaymentConfiguration;
10
13
  updateReferByPaymentConfiguration(config: PaymentConfiguration): void;
11
14
  private enrichReturnUrl;
@@ -61,6 +61,7 @@ export declare enum FieldNames {
61
61
  psAccountCountry = "psAccountCountry",
62
62
  allowSave = "allowSave",
63
63
  koreaLimitsInstruction = "korea_limits_instruction",
64
+ koreaCashReceiptInstruction = "korea_cash_receipt_instruction",
64
65
  tokenApplePay = "token_applepay",
65
66
  fixInvoice = "fix_invoice",
66
67
  fixPid = "fix_pid",
@@ -7,4 +7,6 @@ export interface CartSummary {
7
7
  subtotalDetails?: CartLine[];
8
8
  total: CartLine;
9
9
  totalDetails?: CartLine[];
10
+ salesTax?: number | null;
11
+ currency?: string;
10
12
  }
@@ -10,6 +10,7 @@ export interface BasePaymentConfiguration {
10
10
  paymentMethodId: number;
11
11
  returnUrl: string;
12
12
  accountId?: number;
13
+ country?: string;
13
14
  paymentWithSavedMethod?: boolean;
14
15
  savedMethodId?: number;
15
16
  savePaymentMethod?: boolean;
@@ -113,6 +113,9 @@ export declare class PaymentService {
113
113
  private setupSyncService;
114
114
  private listenFinanceDetails;
115
115
  private listenFormStatusChanges;
116
+ /**
117
+ * In case the form pid changes despite the one passed during initialization
118
+ */
116
119
  private updatePidConfig;
117
120
  private emitFormResponse;
118
121
  private getInitializeMessages;
@@ -18,11 +18,9 @@ export declare class StatusService {
18
18
  private readonly nextActionService;
19
19
  private readonly savePaymentMethodStatusService;
20
20
  private readonly statusUpdatedActionCreator;
21
- private listenStatusSubscription;
22
21
  constructor(urlService: UrlService, statusRequestService: StatusRequestService, financeDetailsService: FinanceDetailsService, listenStatusService: ListenStatusService, nextActionService: NextActionService, savePaymentMethodStatusService: SavePaymentMethodStatusService, statusUpdatedActionCreator: StatusUpdatedActionCreator);
23
22
  getStatus(params: StatusRequestParams): Promise<Status>;
24
23
  getStatusWithUrlSearchParams(url?: string): Promise<Status>;
25
- stopListening(): void;
26
24
  listenFinalStatus(invoice: number): Observable<StatusSettings>;
27
25
  private getRequestParamsFromUrl;
28
26
  private startWaitingStatusUpdates;
@@ -15,4 +15,11 @@ export interface InitConfiguration {
15
15
  * Will be ignored in production.
16
16
  */
17
17
  apiUrl?: string;
18
+ /**
19
+ * Features the SDK declares it can handle. Used by the iframe to gate
20
+ * behaviour that would otherwise break partners on older SDK versions
21
+ * (e.g. new NextAction types). Internal handshake — not consumed by the
22
+ * server.
23
+ */
24
+ capabilities?: string[];
18
25
  }
@@ -54,6 +54,7 @@ import { CommonLogAttributes } from './core/exceptions-handling/common-log-attri
54
54
  import { LogHandler } from './core/exceptions-handling/logger/log-handler.interface';
55
55
  import { LoggerService } from './core/exceptions-handling/logger/logger.service';
56
56
  import { XpsError } from './core/payment/xps-error.interface';
57
+ import { CapabilitiesService } from './core/capabilities/capabilities.service';
57
58
  import * as i0 from "@angular/core";
58
59
  export declare class CoreLibraryService {
59
60
  private readonly settingsService;
@@ -81,6 +82,7 @@ export declare class CoreLibraryService {
81
82
  private readonly scriptTrackerService;
82
83
  private readonly translateService;
83
84
  private readonly commonLogAttributesService;
85
+ private readonly capabilitiesService;
84
86
  paymentMethods: {
85
87
  getList: (isSaveMethodMode?: boolean) => Promise<PaymentMethod[]>;
86
88
  getQuickMethods: () => Promise<PaymentMethod[]>;
@@ -93,10 +95,9 @@ export declare class CoreLibraryService {
93
95
  finance: {
94
96
  getDetailsFromSummary: (summary: XpsSummary) => FinanceDetails;
95
97
  };
96
- constructor(settingsService: SettingsService, loggerService: LoggerService, countryService: CountryService, paymentMethodsService: PaymentMethodsService, savedMethodsService: SavedMethodsService, userBalanceService: UserBalanceService, paymentConfigService: PaymentConfigService, paymentService: PaymentService, deviceFingerPrintService: DeviceFingerPrintService, financeDetailsService: FinanceDetailsService, legalService: LegalService, statusService: StatusService, nextActionService: NextActionService, creditCardService: CreditCardService, creditCardStateService: CreditCardStateService, formMessagesService: FormMessagesService, editSavedMethodsService: EditSavedMethodsService, userBehaviourAnalyticsService: UserBehaviourAnalyticsService, performanceService: PerformanceService, combinedPaymentMethodsService: CombinedPaymentMethodsService, countriesApiService: CountriesApiService, sendInstructionService: SendInstructionService, scriptTrackerService: ScriptTrackerService, translateService: TranslateService, commonLogAttributesService: CommonLogAttributesService);
98
+ constructor(settingsService: SettingsService, loggerService: LoggerService, countryService: CountryService, paymentMethodsService: PaymentMethodsService, savedMethodsService: SavedMethodsService, userBalanceService: UserBalanceService, paymentConfigService: PaymentConfigService, paymentService: PaymentService, deviceFingerPrintService: DeviceFingerPrintService, financeDetailsService: FinanceDetailsService, legalService: LegalService, statusService: StatusService, nextActionService: NextActionService, creditCardService: CreditCardService, creditCardStateService: CreditCardStateService, formMessagesService: FormMessagesService, editSavedMethodsService: EditSavedMethodsService, userBehaviourAnalyticsService: UserBehaviourAnalyticsService, performanceService: PerformanceService, combinedPaymentMethodsService: CombinedPaymentMethodsService, countriesApiService: CountriesApiService, sendInstructionService: SendInstructionService, scriptTrackerService: ScriptTrackerService, translateService: TranslateService, commonLogAttributesService: CommonLogAttributesService, capabilitiesService: CapabilitiesService);
97
99
  init(configuration: InitConfiguration): Promise<void>;
98
100
  getStatus(url?: string): Promise<Status>;
99
- stopStatusListening(): void;
100
101
  calculateField(changedField: Field, fields: Field[]): Promise<SyncResponse>;
101
102
  submit(fields: Field[]): Promise<{
102
103
  response: SubmitResponse;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xsolla/payment-client-core",
3
- "version": "0.3.1",
3
+ "version": "0.3.3",
4
4
  "engines": {
5
5
  "node": ">=16.10.0",
6
6
  "npm": ">=8.11.0"