@xsolla/payment-client-core 0.1.22 → 0.2.1

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 (82) hide show
  1. package/esm2020/lib/core/extended-window.interface.mjs +1 -1
  2. package/esm2020/lib/core/payment/actions/action.interface.mjs +1 -1
  3. package/esm2020/lib/core/payment/actions/check-status/check-status.action.class.mjs +19 -11
  4. package/esm2020/lib/core/payment/actions/check-status/check-status.action.type.mjs +1 -1
  5. package/esm2020/lib/core/payment/actions/next-action.interface.mjs +1 -1
  6. package/esm2020/lib/core/payment/actions/next-action.service.mjs +12 -13
  7. package/esm2020/lib/core/payment/actions/next-actions.mjs +15 -13
  8. package/esm2020/lib/core/payment/actions/redirect/redirect.action.class.mjs +37 -15
  9. package/esm2020/lib/core/payment/actions/show-errors/show-errors.action.class.mjs +18 -5
  10. package/esm2020/lib/core/payment/actions/show-fields/show-fields.action.class.mjs +26 -8
  11. package/esm2020/lib/core/payment/actions/special-button/special-button.action.class.mjs +41 -0
  12. package/esm2020/lib/core/payment/actions/special-button/special-button.action.type.mjs +2 -0
  13. package/esm2020/lib/core/payment/actions/status-updated/status-updated.action.class.mjs +26 -11
  14. package/esm2020/lib/core/payment/actions/three-ds/three-ds.action.class.mjs +19 -4
  15. package/esm2020/lib/core/payment/initialize/initialize.service.mjs +7 -6
  16. package/esm2020/lib/core/payment/payment.service.mjs +20 -4
  17. package/esm2020/lib/core/payment/status/save-payment-method-status/save-payment-method-status.service.mjs +11 -6
  18. package/esm2020/lib/core/payment/status/status.service.mjs +7 -6
  19. package/esm2020/lib/core/payment/sync/sync.service.mjs +7 -6
  20. package/esm2020/lib/core/payment/three-ds/three-ds.service.mjs +10 -8
  21. package/esm2020/lib/core/payment/xps-checkout.mjs +2 -0
  22. package/esm2020/lib/core/sdk-payment-systems/google-pay/google-pay-checkout.interface.mjs +2 -0
  23. package/esm2020/lib/core/sdk-payment-systems/google-pay/google-pay-init-params.interface.mjs +2 -0
  24. package/esm2020/lib/core/sdk-payment-systems/google-pay/google-pay-library.interface.mjs +2 -0
  25. package/esm2020/lib/core/sdk-payment-systems/google-pay/google-pay.service.mjs +185 -0
  26. package/esm2020/lib/core/sdk-payment-systems/payment-systems/payment-system-processing.service.mjs +84 -0
  27. package/esm2020/lib/core/sdk-payment-systems/sdk-payment-methods.const.mjs +2 -0
  28. package/esm2020/lib/core/sdk-payment-systems/sdk-payment-systems-initial-data.interface.mjs +2 -0
  29. package/esm2020/lib/core/sdk-payment-systems/sdk-payment-systems.interface.mjs +2 -0
  30. package/esm2020/lib/core-library.module.mjs +1 -1
  31. package/esm2020/lib/core-library.service.mjs +25 -4
  32. package/fesm2015/xsolla-payment-client-core.mjs +559 -205
  33. package/fesm2015/xsolla-payment-client-core.mjs.map +1 -1
  34. package/fesm2020/xsolla-payment-client-core.mjs +550 -202
  35. package/fesm2020/xsolla-payment-client-core.mjs.map +1 -1
  36. package/lib/core/extended-window.interface.d.ts +4 -1
  37. package/lib/core/payment/actions/action.interface.d.ts +7 -0
  38. package/lib/core/payment/actions/check-status/check-status.action.class.d.ts +8 -5
  39. package/lib/core/payment/actions/check-status/check-status.action.type.d.ts +1 -10
  40. package/lib/core/payment/actions/next-action.interface.d.ts +2 -1
  41. package/lib/core/payment/actions/next-action.service.d.ts +3 -3
  42. package/lib/core/payment/actions/next-actions.d.ts +4 -4
  43. package/lib/core/payment/actions/redirect/redirect.action.class.d.ts +12 -6
  44. package/lib/core/payment/actions/show-errors/show-errors.action.class.d.ts +9 -4
  45. package/lib/core/payment/actions/show-fields/show-fields.action.class.d.ts +8 -5
  46. package/lib/core/payment/actions/special-button/special-button.action.class.d.ts +14 -0
  47. package/lib/core/payment/actions/special-button/special-button.action.type.d.ts +10 -0
  48. package/lib/core/payment/actions/status-updated/status-updated.action.class.d.ts +12 -5
  49. package/lib/core/payment/actions/three-ds/three-ds.action.class.d.ts +8 -5
  50. package/lib/core/payment/initialize/initialize.service.d.ts +3 -1
  51. package/lib/core/payment/payment.service.d.ts +7 -1
  52. package/lib/core/payment/status/save-payment-method-status/save-payment-method-status.service.d.ts +3 -1
  53. package/lib/core/payment/status/status.service.d.ts +3 -1
  54. package/lib/core/payment/sync/sync.service.d.ts +3 -1
  55. package/lib/core/payment/three-ds/three-ds.service.d.ts +5 -1
  56. package/lib/core/payment/xps-checkout.d.ts +17 -0
  57. package/lib/core/sdk-payment-systems/google-pay/google-pay-checkout.interface.d.ts +17 -0
  58. package/lib/core/sdk-payment-systems/google-pay/google-pay-init-params.interface.d.ts +4 -0
  59. package/lib/core/sdk-payment-systems/google-pay/google-pay-library.interface.d.ts +83 -0
  60. package/lib/core/sdk-payment-systems/google-pay/google-pay.service.d.ts +35 -0
  61. package/lib/core/sdk-payment-systems/payment-systems/payment-system-processing.service.d.ts +20 -0
  62. package/lib/core/sdk-payment-systems/sdk-payment-methods.const.d.ts +1 -0
  63. package/lib/core/sdk-payment-systems/sdk-payment-systems-initial-data.interface.d.ts +6 -0
  64. package/lib/core/sdk-payment-systems/sdk-payment-systems.interface.d.ts +21 -0
  65. package/lib/core-library.service.d.ts +7 -1
  66. package/package.json +1 -1
  67. package/xsolla-payment-client-core-0.2.1.tgz +0 -0
  68. package/esm2020/lib/core/payment/actions/action-factory-value.interface.mjs +0 -2
  69. package/esm2020/lib/core/payment/actions/check-status/check-status.action.token.mjs +0 -14
  70. package/esm2020/lib/core/payment/actions/redirect/redirect.action.token.mjs +0 -16
  71. package/esm2020/lib/core/payment/actions/show-errors/show-errors.action.token.mjs +0 -13
  72. package/esm2020/lib/core/payment/actions/show-fields/show-fields.action.token.mjs +0 -15
  73. package/esm2020/lib/core/payment/actions/status-updated/status-updated.action.token.mjs +0 -11
  74. package/esm2020/lib/core/payment/actions/three-ds/three-ds.action.token.mjs +0 -11
  75. package/lib/core/payment/actions/action-factory-value.interface.d.ts +0 -6
  76. package/lib/core/payment/actions/check-status/check-status.action.token.d.ts +0 -4
  77. package/lib/core/payment/actions/redirect/redirect.action.token.d.ts +0 -4
  78. package/lib/core/payment/actions/show-errors/show-errors.action.token.d.ts +0 -4
  79. package/lib/core/payment/actions/show-fields/show-fields.action.token.d.ts +0 -4
  80. package/lib/core/payment/actions/status-updated/status-updated.action.token.d.ts +0 -4
  81. package/lib/core/payment/actions/three-ds/three-ds.action.token.d.ts +0 -4
  82. package/xsolla-payment-client-core-0.1.22.tgz +0 -0
@@ -1 +1,4 @@
1
- export type ExtendedWindow = Window;
1
+ import { GooglePayLibrary } from './sdk-payment-systems/google-pay/google-pay-library.interface';
2
+ export interface ExtendedWindow extends Window {
3
+ google?: GooglePayLibrary;
4
+ }
@@ -1,4 +1,11 @@
1
+ import { SubmitResponse } from '../submit/response/submit-response.class';
2
+ import { NextAction } from './next-action.interface';
1
3
  export interface Action<T = string, D = object> {
2
4
  type: T;
3
5
  data: D;
4
6
  }
7
+ export interface ActionCreator<T = string, D = unknown> {
8
+ type: T;
9
+ isSuitable(response?: SubmitResponse): boolean;
10
+ getActionData(actionData?: D): NextAction;
11
+ }
@@ -1,8 +1,11 @@
1
1
  import { SubmitResponse } from '../../submit/response/submit-response.class';
2
- import { Action } from '../action.interface';
3
- import { CheckStatusActionData, CheckStatusActionType } from './check-status.action.type';
4
- export declare class CheckStatusAction implements Action {
2
+ import { ActionCreator } from '../action.interface';
3
+ import { CheckStatusAction, CheckStatusActionType } from './check-status.action.type';
4
+ import * as i0 from "@angular/core";
5
+ export declare class CheckStatusActionCreator implements ActionCreator {
5
6
  type: CheckStatusActionType;
6
- data: CheckStatusActionData;
7
- constructor(submitResponse: SubmitResponse);
7
+ getActionData(): CheckStatusAction;
8
+ isSuitable(response: SubmitResponse): boolean;
9
+ static ɵfac: i0.ɵɵFactoryDeclaration<CheckStatusActionCreator, never>;
10
+ static ɵprov: i0.ɵɵInjectableDeclaration<CheckStatusActionCreator>;
8
11
  }
@@ -1,12 +1,3 @@
1
1
  import { Action } from '../action.interface';
2
2
  export type CheckStatusActionType = 'check_status';
3
- export interface CheckStatusActionData {
4
- invoice: number;
5
- signature: string;
6
- locale: string;
7
- testProject?: string;
8
- testPs?: string;
9
- testXsolla?: string;
10
- userReturnStatus?: string;
11
- }
12
- export type CheckStatusAction = Action<CheckStatusActionType, CheckStatusActionData>;
3
+ export type CheckStatusAction = Action<CheckStatusActionType, null>;
@@ -4,4 +4,5 @@ import { StatusUpdatedAction } from './status-updated/status-updated.action.type
4
4
  import { RedirectAction } from './redirect/redirect.action.type';
5
5
  import { ShowErrorsAction } from './show-errors/show-errors.action.type';
6
6
  import { ThreeDsAction } from './three-ds/three-ds.action.type';
7
- export type NextAction = CheckStatusAction | ShowFieldsAction | StatusUpdatedAction | ShowErrorsAction | RedirectAction | ThreeDsAction;
7
+ import { SpecialButtonAction } from './special-button/special-button.action.type';
8
+ export type NextAction = CheckStatusAction | ShowFieldsAction | StatusUpdatedAction | ShowErrorsAction | RedirectAction | ThreeDsAction | SpecialButtonAction;
@@ -3,16 +3,16 @@ import { Observable } from 'rxjs';
3
3
  import { NextAction } from './next-action.interface';
4
4
  import { SubmitResponse } from '../submit/response/submit-response.class';
5
5
  import { NextActionTokens } from './next-actions';
6
- import { SettingsService } from '../../settings/settings.service';
6
+ import { ShowErrorsActionCreator } from './show-errors/show-errors.action.class';
7
7
  import * as i0 from "@angular/core";
8
8
  export declare class NextActionService {
9
9
  private readonly nextActionTokens;
10
10
  private readonly injector;
11
- private readonly settingsService;
11
+ private readonly showErrorsActionCreator;
12
12
  private readonly flowUpdatesSubject;
13
13
  private readonly nextActionsList;
14
14
  get flowUpdates$(): Observable<NextAction>;
15
- constructor(nextActionTokens: NextActionTokens, injector: Injector, settingsService: SettingsService);
15
+ constructor(nextActionTokens: NextActionTokens, injector: Injector, showErrorsActionCreator: ShowErrorsActionCreator);
16
16
  getNextAction(submitResponse: SubmitResponse): NextAction | null;
17
17
  emitFlowUpdates(action: NextAction): void;
18
18
  private fillNextActionsList;
@@ -1,6 +1,6 @@
1
- import { InjectionToken, ValueProvider } from '@angular/core';
2
- import { Action } from './action.interface';
3
- export type NextActionTokens = ValueProvider[];
4
- export declare const nextActionsToken: InjectionToken<Action<string, object>>;
1
+ import { InjectionToken, ProviderToken } from '@angular/core';
2
+ import { ActionCreator } from './action.interface';
3
+ export type NextActionTokens = Array<ProviderToken<ActionCreator>>;
4
+ export declare const nextActionsToken: InjectionToken<ActionCreator<string, unknown>>;
5
5
  export declare const nextActions: NextActionTokens;
6
6
  export declare const flowUpdateNextActions: NextActionTokens;
@@ -1,11 +1,17 @@
1
1
  import { SubmitResponse } from '../../submit/response/submit-response.class';
2
- import { Action } from '../action.interface';
3
- import { RedirectActionData, RedirectActionType } from './redirect.action.type';
4
- export declare class RedirectAction implements Action {
5
- type: RedirectActionType;
6
- data: RedirectActionData;
7
- constructor(submitResponse: SubmitResponse, token: string, isSandbox: boolean);
2
+ import { ActionCreator } from '../action.interface';
3
+ import { RedirectAction, RedirectActionType } from './redirect.action.type';
4
+ import { SettingsService } from '../../../settings/settings.service';
5
+ import * as i0 from "@angular/core";
6
+ export declare class RedirectActionCreator implements ActionCreator {
7
+ private readonly settingsService;
8
+ readonly type: RedirectActionType;
9
+ constructor(settingsService: SettingsService);
10
+ getActionData(submitResponse: SubmitResponse): RedirectAction;
11
+ isSuitable(response: SubmitResponse): boolean;
8
12
  private getRedirect;
9
13
  private getRedirectUrl;
10
14
  private preparePagesUrl;
15
+ static ɵfac: i0.ɵɵFactoryDeclaration<RedirectActionCreator, never>;
16
+ static ɵprov: i0.ɵɵInjectableDeclaration<RedirectActionCreator>;
11
17
  }
@@ -1,8 +1,13 @@
1
+ import { ActionCreator } from '../action.interface';
2
+ import { ShowErrorsAction, ShowErrorsActionData, ShowErrorsActionType } from './show-errors.action.type';
3
+ import { SubmitResponse } from '../../submit/response/submit-response.class';
1
4
  import { XpsError } from '../../xps-error.interface';
2
- import { Action } from '../action.interface';
3
- import { ShowErrorsActionData, ShowErrorsActionType } from './show-errors.action.type';
4
- export declare class ShowErrorsAction implements Action {
5
+ import * as i0 from "@angular/core";
6
+ export declare class ShowErrorsActionCreator implements ActionCreator {
5
7
  type: ShowErrorsActionType;
6
8
  data: ShowErrorsActionData;
7
- constructor(errors: XpsError[]);
9
+ getActionData(errors: XpsError[]): ShowErrorsAction;
10
+ isSuitable(response: SubmitResponse): boolean;
11
+ static ɵfac: i0.ɵɵFactoryDeclaration<ShowErrorsActionCreator, never>;
12
+ static ɵprov: i0.ɵɵInjectableDeclaration<ShowErrorsActionCreator>;
8
13
  }
@@ -1,8 +1,11 @@
1
- import { Action } from '../action.interface';
2
- import { ShowFieldsActionData, ShowFieldsActionType } from './show-fields.action.type';
1
+ import { ActionCreator } from '../action.interface';
2
+ import { ShowFieldsAction, ShowFieldsActionType } from './show-fields.action.type';
3
3
  import { SubmitResponse } from '../../submit/response/submit-response.class';
4
- export declare class ShowFieldsAction implements Action {
4
+ import * as i0 from "@angular/core";
5
+ export declare class ShowFieldsActionCreator implements ActionCreator {
5
6
  type: ShowFieldsActionType;
6
- data: ShowFieldsActionData;
7
- constructor(submitResponse: SubmitResponse);
7
+ getActionData(submitResponse: SubmitResponse): ShowFieldsAction;
8
+ isSuitable(response: SubmitResponse): boolean;
9
+ static ɵfac: i0.ɵɵFactoryDeclaration<ShowFieldsActionCreator, never>;
10
+ static ɵprov: i0.ɵɵInjectableDeclaration<ShowFieldsActionCreator>;
8
11
  }
@@ -0,0 +1,14 @@
1
+ import { SubmitResponse } from '../../submit/response/submit-response.class';
2
+ import { ActionCreator } from '../action.interface';
3
+ import { SpecialButtonAction, SpecialButtonActionType } from './special-button.action.type';
4
+ import * as i0 from "@angular/core";
5
+ export declare class SpecialButtonActionCreator implements ActionCreator {
6
+ type: SpecialButtonActionType;
7
+ private readonly pids;
8
+ private readonly sdkPaymentMethodsName;
9
+ getActionData(submitResponse: SubmitResponse): SpecialButtonAction;
10
+ isSuitable(response: SubmitResponse): boolean;
11
+ private getPaymentMethodName;
12
+ static ɵfac: i0.ɵɵFactoryDeclaration<SpecialButtonActionCreator, never>;
13
+ static ɵprov: i0.ɵɵInjectableDeclaration<SpecialButtonActionCreator>;
14
+ }
@@ -0,0 +1,10 @@
1
+ import { Action } from '../action.interface';
2
+ import { XpsError } from '../../xps-error.interface';
3
+ import { XpsMessage } from '../../xps-message.interface';
4
+ export type SpecialButtonActionType = 'special_button';
5
+ export interface SpecialButtonActionData {
6
+ errors: XpsError[] | null;
7
+ messages: XpsMessage[] | undefined;
8
+ buttonName: string;
9
+ }
10
+ export type SpecialButtonAction = Action<SpecialButtonActionType, SpecialButtonActionData>;
@@ -1,10 +1,17 @@
1
- import { Action } from '../action.interface';
2
- import { StatusUpdatedActionData, StatusUpdatedActionType } from './status-updated.action.type';
1
+ import { ActionCreator } from '../action.interface';
2
+ import { StatusUpdatedAction, StatusUpdatedActionType } from './status-updated.action.type';
3
3
  import { StatusResponse } from '../../status/status-request/response/status-response.class';
4
4
  import { Status } from '../../status/status.interface';
5
5
  import { SavePaymentMethodStatus } from '../../status/save-payment-method-status/save-payment-method-status.enum';
6
- export declare class StatusUpdatedAction implements Action {
6
+ import * as i0 from "@angular/core";
7
+ export declare class StatusUpdatedActionCreator implements ActionCreator {
7
8
  type: StatusUpdatedActionType;
8
- data: StatusUpdatedActionData;
9
- constructor(statusResponse: StatusResponse | Status, isSavePaymentMethodMode?: boolean, savePaymentMethodStatus?: SavePaymentMethodStatus);
9
+ getActionData({ statusResponse, isSavePaymentMethodMode, savePaymentMethodStatus, }: {
10
+ statusResponse: StatusResponse | Status;
11
+ isSavePaymentMethodMode?: boolean;
12
+ savePaymentMethodStatus?: SavePaymentMethodStatus;
13
+ }): StatusUpdatedAction;
14
+ isSuitable(): boolean;
15
+ static ɵfac: i0.ɵɵFactoryDeclaration<StatusUpdatedActionCreator, never>;
16
+ static ɵprov: i0.ɵɵInjectableDeclaration<StatusUpdatedActionCreator>;
10
17
  }
@@ -1,8 +1,11 @@
1
- import { Action } from '../action.interface';
2
- import { ThreeDsActionData, ThreeDsActionType } from './three-ds.action.type';
1
+ import { ActionCreator } from '../action.interface';
2
+ import { ThreeDsAction, ThreeDsActionType } from './three-ds.action.type';
3
3
  import { StatusChallenge } from '../../three-ds/three-ds-20/status-update.interface';
4
- export declare class ThreeDsAction implements Action {
4
+ import * as i0 from "@angular/core";
5
+ export declare class ThreeDsActionCreator implements ActionCreator {
5
6
  type: ThreeDsActionType;
6
- data: ThreeDsActionData;
7
- constructor(statusUpdate: StatusChallenge);
7
+ getActionData(actionData: StatusChallenge): ThreeDsAction;
8
+ isSuitable(): boolean;
9
+ static ɵfac: i0.ɵɵFactoryDeclaration<ThreeDsActionCreator, never>;
10
+ static ɵprov: i0.ɵɵInjectableDeclaration<ThreeDsActionCreator>;
8
11
  }
@@ -3,6 +3,7 @@ import { EncryptCreditCardService } from '../../encrypt-credit-card/encrypt-cred
3
3
  import { SettingsService } from '../../settings/settings.service';
4
4
  import { PaymentConfig } from '../payment-config.interface';
5
5
  import { NextActionService } from '../actions/next-action.service';
6
+ import { ShowErrorsActionCreator } from '../actions/show-errors/show-errors.action.class';
6
7
  import { XpsApiService } from '../xps-api/xps-api.service';
7
8
  import { InitializeResponseFactory } from './response/initialize-response.token';
8
9
  import { InitializeResponse } from './response/initialize-response.class';
@@ -16,8 +17,9 @@ export declare class InitializeService {
16
17
  private readonly nextActionService;
17
18
  private readonly xpsResponseErrorsMappingService;
18
19
  private readonly encryptCreditCardService;
20
+ private readonly showErrorsActionCreator;
19
21
  private readonly ps4ReferId;
20
- constructor(responseFactory: InitializeResponseFactory, xpsApiService: XpsApiService, settingsService: SettingsService, countryService: CountryService, nextActionService: NextActionService, xpsResponseErrorsMappingService: XpsResponseErrorsMappingService, encryptCreditCardService: EncryptCreditCardService);
22
+ constructor(responseFactory: InitializeResponseFactory, xpsApiService: XpsApiService, settingsService: SettingsService, countryService: CountryService, nextActionService: NextActionService, xpsResponseErrorsMappingService: XpsResponseErrorsMappingService, encryptCreditCardService: EncryptCreditCardService, showErrorsActionCreator: ShowErrorsActionCreator);
21
23
  request(config: PaymentConfig): Promise<InitializeResponse>;
22
24
  private setCreditCardEncryptKey;
23
25
  static ɵfac: i0.ɵɵFactoryDeclaration<InitializeService, never>;
@@ -21,6 +21,9 @@ import { ThreeDsService } from './three-ds/three-ds.service';
21
21
  import { CreditCardStateService } from './credit-card-state/credit-card-state.service';
22
22
  import { FormState } from './form/form-state.interface';
23
23
  import { FormMessagesService } from './form-messages/form-messages.service';
24
+ import { SettingsService } from '../settings/settings.service';
25
+ import { CountryService } from '../country/country.service';
26
+ import { SdkPaymentSystemsInitialData } from '../sdk-payment-systems/sdk-payment-systems-initial-data.interface';
24
27
  import * as i0 from "@angular/core";
25
28
  export declare class PaymentService {
26
29
  private readonly initializeService;
@@ -34,6 +37,8 @@ export declare class PaymentService {
34
37
  private readonly controlConfigService;
35
38
  private readonly threeDsService;
36
39
  private readonly formMessagesService;
40
+ private readonly settingsService;
41
+ private readonly countryService;
37
42
  form: UntypedFormGroup | null;
38
43
  get formFieldsStatus$(): Observable<FormFieldsStatus>;
39
44
  private data;
@@ -45,10 +50,11 @@ export declare class PaymentService {
45
50
  private formDestroy$;
46
51
  private readonly formFieldsStatusSubject;
47
52
  private isSavingMethodMode;
48
- constructor(initializeService: InitializeService, submitService: SubmitService, syncService: SyncService, formService: FormService, statusService: StatusService, financeDetailsService: FinanceDetailsService, creditCardStateService: CreditCardStateService, nextActionService: NextActionService, controlConfigService: ControlConfigService, threeDsService: ThreeDsService, formMessagesService: FormMessagesService);
53
+ 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);
49
54
  initialize(config: PaymentConfig): Promise<Field[]>;
50
55
  submit(): Promise<NextAction | null | void>;
51
56
  getFields(): Field[];
57
+ getInitialDataForSdkPaymentSystems(): SdkPaymentSystemsInitialData;
52
58
  getPid(): number | null;
53
59
  validate(field: Field): Promise<ValidationErrors | null>;
54
60
  runThreeDs(): void;
@@ -1,6 +1,7 @@
1
1
  import { StatusRequestParams } from '../status-request/status-request-params.interface';
2
2
  import { Status } from '../status.interface';
3
3
  import { StatusRequestService } from '../status-request/status-request.service';
4
+ import { StatusUpdatedActionCreator } from '../../actions/status-updated/status-updated.action.class';
4
5
  import { ListenStatusService } from '../listen-status/listen-status.service';
5
6
  import { SavedPaymentAccountChangesService } from './api/saved-payment-account-changes.service';
6
7
  import { NextActionService } from '../../actions/next-action.service';
@@ -12,12 +13,13 @@ export declare class SavePaymentMethodStatusService {
12
13
  private readonly savedPaymentAccountChangesService;
13
14
  private readonly nextActionService;
14
15
  private readonly checkStatusService;
16
+ private readonly statusUpdatedActionCreator;
15
17
  private savePaymentMethodStatus?;
16
18
  private listenStatusSubscription;
17
19
  private statusChecked;
18
20
  private accountData?;
19
21
  private status?;
20
- constructor(statusRequestService: StatusRequestService, listenStatusService: ListenStatusService, savedPaymentAccountChangesService: SavedPaymentAccountChangesService, nextActionService: NextActionService, checkStatusService: CheckStatusService);
22
+ constructor(statusRequestService: StatusRequestService, listenStatusService: ListenStatusService, savedPaymentAccountChangesService: SavedPaymentAccountChangesService, nextActionService: NextActionService, checkStatusService: CheckStatusService, statusUpdatedActionCreator: StatusUpdatedActionCreator);
21
23
  getStatus(params: StatusRequestParams): Promise<Status>;
22
24
  private checkStatus;
23
25
  private savingFailedOrCancel;
@@ -3,6 +3,7 @@ import { StatusRequestParams } from './status-request/status-request-params.inte
3
3
  import { ListenStatusService } from './listen-status/listen-status.service';
4
4
  import { Status } from './status.interface';
5
5
  import { NextActionService } from '../actions/next-action.service';
6
+ import { StatusUpdatedActionCreator } from '../actions/status-updated/status-updated.action.class';
6
7
  import { UrlService } from '../../url/url.service';
7
8
  import { FinanceDetailsService } from '../finance-details/finance-details.service';
8
9
  import { SavePaymentMethodStatusService } from './save-payment-method-status/save-payment-method-status.service';
@@ -14,7 +15,8 @@ export declare class StatusService {
14
15
  private readonly listenStatusService;
15
16
  private readonly nextActionService;
16
17
  private readonly savePaymentMethodStatusService;
17
- constructor(urlService: UrlService, statusRequestService: StatusRequestService, financeDetailsService: FinanceDetailsService, listenStatusService: ListenStatusService, nextActionService: NextActionService, savePaymentMethodStatusService: SavePaymentMethodStatusService);
18
+ private readonly statusUpdatedActionCreator;
19
+ constructor(urlService: UrlService, statusRequestService: StatusRequestService, financeDetailsService: FinanceDetailsService, listenStatusService: ListenStatusService, nextActionService: NextActionService, savePaymentMethodStatusService: SavePaymentMethodStatusService, statusUpdatedActionCreator: StatusUpdatedActionCreator);
18
20
  getStatus(params: StatusRequestParams): Promise<Status>;
19
21
  getStatusWithUrlSearchParams(url?: string): Promise<Status>;
20
22
  private getRequestParamsFromUrl;
@@ -8,6 +8,7 @@ import { SyncRequestFactory } from './request/sync-request.token';
8
8
  import { SyncResponse } from './response/sync-response.class';
9
9
  import { SyncResponseFactory } from './response/sync-response.token';
10
10
  import { NextActionService } from '../actions/next-action.service';
11
+ import { ShowErrorsActionCreator } from '../actions/show-errors/show-errors.action.class';
11
12
  import { XpsApiService } from '../xps-api/xps-api.service';
12
13
  import { FieldAsyncValidation } from './field-async-validation.interface';
13
14
  import { EncryptCreditCardService } from '../../encrypt-credit-card/encrypt-credit-card.service';
@@ -21,12 +22,13 @@ export declare class SyncService extends EmitDataService<XpsResponse> {
21
22
  private readonly settingsService;
22
23
  private readonly xpsResponseErrorsMappingService;
23
24
  private readonly encryptCreditCardService;
25
+ private readonly showErrorsActionCreator;
24
26
  private prevFieldSyncStates;
25
27
  private form;
26
28
  private fields;
27
29
  private fieldSyncTimers;
28
30
  private readonly fieldAsyncValidation;
29
- constructor(requestFactory: SyncRequestFactory, responseFactory: SyncResponseFactory, xpsApiService: XpsApiService, nextActionService: NextActionService, settingsService: SettingsService, xpsResponseErrorsMappingService: XpsResponseErrorsMappingService, encryptCreditCardService: EncryptCreditCardService);
31
+ constructor(requestFactory: SyncRequestFactory, responseFactory: SyncResponseFactory, xpsApiService: XpsApiService, nextActionService: NextActionService, settingsService: SettingsService, xpsResponseErrorsMappingService: XpsResponseErrorsMappingService, encryptCreditCardService: EncryptCreditCardService, showErrorsActionCreator: ShowErrorsActionCreator);
30
32
  get fieldAsyncValidation$(): Observable<FieldAsyncValidation>;
31
33
  setup(form: UntypedFormGroup, fields: Field[]): void;
32
34
  reset(): void;
@@ -1,12 +1,16 @@
1
1
  import { NextActionService } from '../actions/next-action.service';
2
2
  import { ThreeDs20Service } from './three-ds-20/three-ds20.service';
3
+ import { ThreeDsActionCreator } from '../actions/three-ds/three-ds.action.class';
4
+ import { CheckStatusActionCreator } from '../actions/check-status/check-status.action.class';
3
5
  import { SubmitResponse } from '../submit/response/submit-response.class';
4
6
  import * as i0 from "@angular/core";
5
7
  export declare class ThreeDsService {
6
8
  private readonly threeDs20Service;
7
9
  private readonly nextActionService;
10
+ private readonly checkStatusActionCreator;
11
+ private readonly threeDsActionCreator;
8
12
  private statusSubscription;
9
- constructor(threeDs20Service: ThreeDs20Service, nextActionService: NextActionService);
13
+ constructor(threeDs20Service: ThreeDs20Service, nextActionService: NextActionService, checkStatusActionCreator: CheckStatusActionCreator, threeDsActionCreator: ThreeDsActionCreator);
10
14
  checkThreeDs(params: SubmitResponse): void;
11
15
  stopChecking(): void;
12
16
  static ɵfac: i0.ɵɵFactoryDeclaration<ThreeDsService, never>;
@@ -0,0 +1,17 @@
1
+ export interface XpsCheckout<Fields = {
2
+ [key: string]: unknown;
3
+ }> {
4
+ request: {
5
+ form: {
6
+ attributes: {
7
+ action: string;
8
+ method: 'GET' | 'POST';
9
+ encoding: string;
10
+ };
11
+ fields: Fields;
12
+ };
13
+ include: unknown;
14
+ cookies: unknown;
15
+ };
16
+ signature: string;
17
+ }
@@ -0,0 +1,17 @@
1
+ import { XpsCheckout } from '../../payment/xps-checkout';
2
+ export type GooglePayCheckout = XpsCheckout<{
3
+ amexCardNotification: string;
4
+ currency: string;
5
+ descriptor: string;
6
+ environment: string;
7
+ invoice: number;
8
+ isReadyToPayRequest: string;
9
+ itemDescription: string;
10
+ locale: string;
11
+ paymentDataRequest: string;
12
+ returnFailUrl: string;
13
+ returnSuccessUrl: string;
14
+ sum: string;
15
+ cpf_number: number;
16
+ agreements: string[];
17
+ }>;
@@ -0,0 +1,4 @@
1
+ export interface GooglePayInitParams {
2
+ isSandbox: boolean;
3
+ country: string;
4
+ }
@@ -0,0 +1,83 @@
1
+ export declare class GooglePayClient {
2
+ constructor(options: {
3
+ environment: string;
4
+ });
5
+ isReadyToPay(isReadyToPayRequest: string): Promise<{
6
+ result: boolean;
7
+ }>;
8
+ createButton(options: ButtonOptions): HTMLButtonElement;
9
+ loadPaymentData(paymentDataRequest: GooglePayPaymentRequest): Promise<PaymentDataResponse>;
10
+ prefetchPaymentData(paymentDataRequest: GooglePayPaymentRequest): void;
11
+ }
12
+ export interface GooglePayClientInit {
13
+ new (options: {
14
+ environment: string;
15
+ }): GooglePayClient;
16
+ }
17
+ export interface PaymentDataRequest {
18
+ transactionInfo: {
19
+ currencyCode: string;
20
+ totalPriceStatus: string;
21
+ totalPrice: string;
22
+ };
23
+ }
24
+ export interface PaymentDataResponse {
25
+ paymentMethodData: {
26
+ tokenizationData: {
27
+ token: string;
28
+ };
29
+ };
30
+ }
31
+ export interface ButtonOptions {
32
+ onClick(): void;
33
+ allowedPaymentMethods: GooglePayPaymentMethod[];
34
+ buttonColor?: 'default' | 'black' | 'white';
35
+ buttonType?: 'plain' | 'buy';
36
+ buttonSizeMode?: 'static' | 'fill';
37
+ }
38
+ export interface GooglePayLibrary {
39
+ payments: {
40
+ api: {
41
+ PaymentsClient: GooglePayClientInit;
42
+ };
43
+ };
44
+ }
45
+ export interface GooglePayPaymentMethod {
46
+ type: string;
47
+ parameters: {
48
+ allowedAuthMethods: string[];
49
+ allowedCardNetworks: string[];
50
+ allowPrepaidCards: boolean;
51
+ billingAddressRequired: boolean;
52
+ billingAddressParameters: {
53
+ format: string;
54
+ phoneNumberRequired: boolean;
55
+ };
56
+ };
57
+ tokenizationSpecification: {
58
+ type: string;
59
+ parameters: {
60
+ gateway: 'vantiv';
61
+ 'vantiv:merchantPayPageId': string;
62
+ 'vantiv:merchantOrderId': string;
63
+ 'vantiv:merchantTransactionId': string;
64
+ 'vantiv:merchantReportGroup': string;
65
+ };
66
+ };
67
+ }
68
+ export interface GooglePayPaymentRequest {
69
+ apiVersion: number;
70
+ apiVersionMinor: number;
71
+ merchantInfo: {
72
+ merchantId: string;
73
+ };
74
+ allowedPaymentMethods: GooglePayPaymentMethod[];
75
+ transactionInfo: {
76
+ currencyCode: string;
77
+ totalPriceStatus: string;
78
+ totalPrice: string;
79
+ countryCode: string;
80
+ };
81
+ emailRequired: boolean;
82
+ shippingAddressRequired: boolean;
83
+ }
@@ -0,0 +1,35 @@
1
+ import { Injector } from '@angular/core';
2
+ import { Observable } from 'rxjs';
3
+ import { PaymentSystemProcessingService } from '../payment-systems/payment-system-processing.service';
4
+ import { ExtendedWindow } from '../../extended-window.interface';
5
+ import { GooglePayInitParams } from './google-pay-init-params.interface';
6
+ import { HttpClient } from '@angular/common/http';
7
+ import { CheckStatusAction } from '../../payment/actions/check-status/check-status.action.type';
8
+ import * as i0 from "@angular/core";
9
+ export declare class GooglePayService {
10
+ private readonly window;
11
+ readonly commonPayProcessingService: PaymentSystemProcessingService;
12
+ readonly httpClient: HttpClient;
13
+ readonly injector: Injector;
14
+ private readonly googlePayScriptUrl;
15
+ private readonly readyToPay;
16
+ private checkout;
17
+ private googlePaymentClient;
18
+ private isSandbox;
19
+ private country;
20
+ private get libraryWasInitialized();
21
+ private get googlePaymentClientWasInitialized();
22
+ constructor(window: ExtendedWindow, commonPayProcessingService: PaymentSystemProcessingService, httpClient: HttpClient, injector: Injector);
23
+ get readyToPay$(): Observable<boolean | null>;
24
+ isReadyToPay(): boolean | null;
25
+ sendUserBack(path: string): void;
26
+ initGooglePayLibrary(data: GooglePayInitParams): void;
27
+ checkPaymentDevice(base64checkoutData: string): void;
28
+ proceedCheckout(): Promise<CheckStatusAction | null>;
29
+ createButton(onClickHandler: () => void): HTMLButtonElement | null;
30
+ private setupGooglePayClient;
31
+ private onLoadScript;
32
+ private isCancelledStatus;
33
+ static ɵfac: i0.ɵɵFactoryDeclaration<GooglePayService, never>;
34
+ static ɵprov: i0.ɵɵInjectableDeclaration<GooglePayService>;
35
+ }
@@ -0,0 +1,20 @@
1
+ import { Observable } from 'rxjs';
2
+ import { GooglePayCheckout } from '../google-pay/google-pay-checkout.interface';
3
+ import { ExtendedWindow } from '../../extended-window.interface';
4
+ import * as i0 from "@angular/core";
5
+ export type CommonCheckout = GooglePayCheckout;
6
+ export declare class PaymentSystemProcessingService {
7
+ private readonly window;
8
+ private readonly statusUrl;
9
+ private readonly initialize;
10
+ constructor(window: ExtendedWindow);
11
+ get initialize$(): Observable<boolean>;
12
+ get status$(): Observable<string>;
13
+ emitPayment(payment: string): void;
14
+ emitInitialize(isInitialized: boolean): void;
15
+ getDecodedCheckout<T extends CommonCheckout>(base64checkoutData: string): T;
16
+ loadScript(url: string, onLoad: () => void, addScriptCustomAttributes?: (script: HTMLScriptElement) => HTMLScriptElement): void;
17
+ isInitialized(): boolean;
18
+ static ɵfac: i0.ɵɵFactoryDeclaration<PaymentSystemProcessingService, never>;
19
+ static ɵprov: i0.ɵɵInjectableDeclaration<PaymentSystemProcessingService>;
20
+ }
@@ -0,0 +1 @@
1
+ export declare const googlePayPid = 3431;
@@ -0,0 +1,6 @@
1
+ import { XpsBoolean } from '../xps-boolean.enum';
2
+ export interface SdkPaymentSystemsInitialData {
3
+ data: string;
4
+ sandbox: XpsBoolean;
5
+ country: string;
6
+ }
@@ -0,0 +1,21 @@
1
+ import { Observable } from 'rxjs';
2
+ import { GooglePayInitParams } from './google-pay/google-pay-init-params.interface';
3
+ import { SdkPaymentSystemsInitialData } from './sdk-payment-systems-initial-data.interface';
4
+ import { CheckStatusAction } from '../payment/actions/check-status/check-status.action.type';
5
+ export interface SdkPaymentSystems {
6
+ googlePay: {
7
+ readyToPay$: Observable<boolean | null>;
8
+ isReadyToPay(): boolean | null;
9
+ initGooglePayLibrary(params: GooglePayInitParams): void;
10
+ checkPaymentDevice(base64checkoutData: string): void;
11
+ proceedCheckout(): Promise<CheckStatusAction | null>;
12
+ createButton(onClickHandler: () => void): HTMLButtonElement | null;
13
+ sendUserBack(path: string): void;
14
+ };
15
+ commonPayProcessingService: {
16
+ initialize$: Observable<boolean>;
17
+ isInitialized(): boolean;
18
+ status$: Observable<string>;
19
+ };
20
+ getInitialData(): SdkPaymentSystemsInitialData;
21
+ }
@@ -29,6 +29,9 @@ import { NextAction } from './core/payment/actions/next-action.interface';
29
29
  import { Balance } from './core/settings/balance.interface';
30
30
  import { FormMessagesService } from './core/payment/form-messages/form-messages.service';
31
31
  import { EditSavedMethodsService } from './core/edit-saved-methods/edit-saved-methods.service';
32
+ import { GooglePayService } from './core/sdk-payment-systems/google-pay/google-pay.service';
33
+ import { PaymentSystemProcessingService } from './core/sdk-payment-systems/payment-systems/payment-system-processing.service';
34
+ import { SdkPaymentSystems } from './core/sdk-payment-systems/sdk-payment-systems.interface';
32
35
  import * as i0 from "@angular/core";
33
36
  export declare class CoreLibraryService {
34
37
  private readonly settingsService;
@@ -47,6 +50,8 @@ export declare class CoreLibraryService {
47
50
  private readonly creditCardStateService;
48
51
  private readonly formMessagesService;
49
52
  private readonly editSavedMethodsService;
53
+ private readonly googlePayService;
54
+ private readonly commonPayProcessingService;
50
55
  paymentMethods: {
51
56
  getList: (isSaveMethodMode?: boolean) => Promise<PaymentMethod[]>;
52
57
  getQuickMethods: () => Promise<PaymentMethod[]>;
@@ -54,7 +59,8 @@ export declare class CoreLibraryService {
54
59
  getUserBalance: () => Promise<UserBalanceResponse>;
55
60
  deleteSavedMethod: (id: number, type: string) => Promise<boolean>;
56
61
  };
57
- constructor(settingsService: SettingsService, 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);
62
+ sdkPaymentSystems: SdkPaymentSystems;
63
+ constructor(settingsService: SettingsService, 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, googlePayService: GooglePayService, commonPayProcessingService: PaymentSystemProcessingService);
58
64
  init(configuration: InitConfiguration): Promise<void>;
59
65
  getStatus(url?: string): Promise<Status>;
60
66
  setCountry(country: string): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xsolla/payment-client-core",
3
- "version": "0.1.22",
3
+ "version": "0.2.1",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^15.2.0",
6
6
  "@angular/core": "^15.2.0",