@xsolla/payment-client-core 0.3.2 → 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.
@@ -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;
@@ -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,7 +95,7 @@ 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
101
  calculateField(changedField: Field, fields: Field[]): Promise<SyncResponse>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xsolla/payment-client-core",
3
- "version": "0.3.2",
3
+ "version": "0.3.3",
4
4
  "engines": {
5
5
  "node": ">=16.10.0",
6
6
  "npm": ">=8.11.0"