@xsolla/payment-client-core 0.2.43 → 0.2.45

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 (73) hide show
  1. package/esm2022/lib/core/environment.interface.mjs +2 -0
  2. package/esm2022/lib/core/payment/actions/action.interface.mjs +1 -1
  3. package/esm2022/lib/core/payment/actions/next-action.service.mjs +1 -1
  4. package/esm2022/lib/core/payment/field-names.enum.mjs +4 -1
  5. package/esm2022/lib/core/payment/field.interface.mjs +1 -1
  6. package/esm2022/lib/core/payment/finance-details/finance-details.service.mjs +4 -1
  7. package/esm2022/lib/core/payment/initialize-actions/action.interface.mjs +2 -0
  8. package/esm2022/lib/core/payment/initialize-actions/initialize-next-action.service.mjs +40 -0
  9. package/esm2022/lib/core/payment/initialize-actions/initialize-next-actions.mjs +7 -0
  10. package/esm2022/lib/core/payment/initialize-actions/next-action.interface.mjs +2 -0
  11. package/esm2022/lib/core/payment/initialize-actions/special-button/special-button.action.class.mjs +46 -0
  12. package/esm2022/lib/core/payment/initialize-actions/special-button/special-button.action.type.mjs +2 -0
  13. package/esm2022/lib/core/payment/initialized-form.inteface.mjs +1 -1
  14. package/esm2022/lib/core/payment/payment.service.mjs +72 -24
  15. package/esm2022/lib/core/payment/sync/request/sync-request.class.mjs +3 -1
  16. package/esm2022/lib/core/payment/sync/sync.service.mjs +4 -4
  17. package/esm2022/lib/core/payment/xps-error.interface.mjs +1 -1
  18. package/esm2022/lib/core/script-tracker/script-tracker.service.mjs +88 -0
  19. package/esm2022/lib/core/sdk-payment-systems/google-pay/check-payment-device-data.interface.mjs +2 -0
  20. package/esm2022/lib/core/sdk-payment-systems/google-pay/google-pay-init-params.interface.mjs +1 -1
  21. package/esm2022/lib/core/sdk-payment-systems/google-pay/google-pay-library.interface.mjs +1 -1
  22. package/esm2022/lib/core/sdk-payment-systems/google-pay/google-pay.service.mjs +70 -59
  23. package/esm2022/lib/core/sdk-payment-systems/google-pay/payment/google-pay-checkout-payment.service.mjs +75 -0
  24. package/esm2022/lib/core/sdk-payment-systems/google-pay/payment/google-pay-instant-payment.service.mjs +121 -0
  25. package/esm2022/lib/core/sdk-payment-systems/google-pay/payment/google-pay-payment-service.interface.mjs +2 -0
  26. package/esm2022/lib/core/sdk-payment-systems/google-pay/updated-price.interface.mjs +2 -0
  27. package/esm2022/lib/core/sdk-payment-systems/sdk-payment-systems-initial-data.interface.mjs +1 -1
  28. package/esm2022/lib/core/sdk-payment-systems/sdk-payment-systems.interface.mjs +1 -1
  29. package/esm2022/lib/core/settings/configuration.interface.mjs +1 -1
  30. package/esm2022/lib/core/user-behaviour-analytics/event-builder/event-builder.service.mjs +2 -1
  31. package/esm2022/lib/core/user-behaviour-analytics/event-builder/event-parameter-types.mjs +2 -1
  32. package/esm2022/lib/core/user-behaviour-analytics/user-behaviour-analytics.interface.mjs +1 -1
  33. package/esm2022/lib/core/user-behaviour-analytics/user-behaviour-event-name.enum.mjs +2 -1
  34. package/esm2022/lib/core-library.module.mjs +12 -1
  35. package/esm2022/lib/core-library.service.mjs +19 -5
  36. package/fesm2022/xsolla-payment-client-core.mjs +649 -213
  37. package/fesm2022/xsolla-payment-client-core.mjs.map +1 -1
  38. package/lib/core/environment.interface.d.ts +1 -0
  39. package/lib/core/payment/actions/action.interface.d.ts +2 -2
  40. package/lib/core/payment/actions/next-action.service.d.ts +1 -1
  41. package/lib/core/payment/actions/next-actions.d.ts +1 -1
  42. package/lib/core/payment/field-names.enum.d.ts +4 -1
  43. package/lib/core/payment/field.interface.d.ts +1 -1
  44. package/lib/core/payment/finance-details/finance-details.service.d.ts +1 -0
  45. package/lib/core/payment/initialize-actions/action.interface.d.ts +11 -0
  46. package/lib/core/payment/initialize-actions/initialize-next-action.service.d.ts +16 -0
  47. package/lib/core/payment/initialize-actions/initialize-next-actions.d.ts +5 -0
  48. package/lib/core/payment/initialize-actions/next-action.interface.d.ts +2 -0
  49. package/lib/core/payment/initialize-actions/special-button/special-button.action.class.d.ts +17 -0
  50. package/lib/core/payment/initialize-actions/special-button/special-button.action.type.d.ts +6 -0
  51. package/lib/core/payment/initialized-form.inteface.d.ts +2 -0
  52. package/lib/core/payment/payment.service.d.ts +11 -2
  53. package/lib/core/payment/sync/sync.service.d.ts +1 -1
  54. package/lib/core/payment/xps-error.interface.d.ts +1 -0
  55. package/lib/core/script-tracker/script-tracker.service.d.ts +19 -0
  56. package/lib/core/sdk-payment-systems/google-pay/check-payment-device-data.interface.d.ts +9 -0
  57. package/lib/core/sdk-payment-systems/google-pay/google-pay-init-params.interface.d.ts +6 -0
  58. package/lib/core/sdk-payment-systems/google-pay/google-pay-library.interface.d.ts +170 -52
  59. package/lib/core/sdk-payment-systems/google-pay/google-pay.service.d.ts +18 -10
  60. package/lib/core/sdk-payment-systems/google-pay/payment/google-pay-checkout-payment.service.d.ts +18 -0
  61. package/lib/core/sdk-payment-systems/google-pay/payment/google-pay-instant-payment.service.d.ts +18 -0
  62. package/lib/core/sdk-payment-systems/google-pay/payment/google-pay-payment-service.interface.d.ts +14 -0
  63. package/lib/core/sdk-payment-systems/google-pay/updated-price.interface.d.ts +7 -0
  64. package/lib/core/sdk-payment-systems/sdk-payment-systems-initial-data.interface.d.ts +7 -1
  65. package/lib/core/sdk-payment-systems/sdk-payment-systems.interface.d.ts +1 -1
  66. package/lib/core/settings/configuration.interface.d.ts +2 -0
  67. package/lib/core/user-behaviour-analytics/event-builder/event-parameter-types.d.ts +2 -1
  68. package/lib/core/user-behaviour-analytics/user-behaviour-analytics.interface.d.ts +2 -2
  69. package/lib/core/user-behaviour-analytics/user-behaviour-event-name.enum.d.ts +2 -1
  70. package/lib/core-library.service.d.ts +12 -1
  71. package/package.json +1 -1
  72. package/xsolla-payment-client-core-0.2.45.tgz +0 -0
  73. package/xsolla-payment-client-core-0.2.43.tgz +0 -0
@@ -0,0 +1 @@
1
+ export type Environment = 'production' | 'staging' | 'development';
@@ -4,8 +4,8 @@ export interface Action<T = string, D = object> {
4
4
  type: T;
5
5
  data: D;
6
6
  }
7
- export interface ActionCreator<T = string, D = unknown> {
7
+ export interface ActionCreator<R = SubmitResponse, T = string, D = unknown> {
8
8
  type: T;
9
- isSuitable(response?: SubmitResponse): boolean;
9
+ isSuitable(response?: R): boolean;
10
10
  getActionData(actionData?: D): NextAction;
11
11
  }
@@ -1,7 +1,7 @@
1
1
  import { Injector } from '@angular/core';
2
2
  import { Observable } from 'rxjs';
3
- import { NextAction } from './next-action.interface';
4
3
  import { SubmitResponse } from '../submit/response/submit-response.class';
4
+ import { NextAction } from './next-action.interface';
5
5
  import { NextActionTokens } from './next-actions';
6
6
  import { ShowErrorsActionCreator } from './show-errors/show-errors.action.class';
7
7
  import * as i0 from "@angular/core";
@@ -1,6 +1,6 @@
1
1
  import { InjectionToken, ProviderToken } from '@angular/core';
2
2
  import { ActionCreator } from './action.interface';
3
3
  export type NextActionTokens = Array<ProviderToken<ActionCreator>>;
4
- export declare const nextActionsToken: InjectionToken<ActionCreator<string, unknown>>;
4
+ export declare const nextActionsToken: InjectionToken<ActionCreator<import("../submit/response/submit-response.class").SubmitResponse, string, unknown>>;
5
5
  export declare const nextActions: NextActionTokens;
6
6
  export declare const flowUpdateNextActions: NextActionTokens;
@@ -21,6 +21,7 @@ export declare enum FieldNames {
21
21
  description = "description",
22
22
  email = "email",
23
23
  psEmail = "psEmail",
24
+ psAccountCountry = "psAccountCountry",
24
25
  bazitemail = "bazitemail",
25
26
  euCheck = "eu_check",
26
27
  extraCvv = "extra_cvv",
@@ -75,5 +76,7 @@ export declare enum FieldNames {
75
76
  isSandbox = "isSandbox",
76
77
  payInstanceAccountId = "payInstanceAccountId",
77
78
  getApplePaySessionUrl = "getApplePaySessionUrl",
78
- payViaCheckoutUrl = "payViaCheckoutUrl"
79
+ payViaCheckoutUrl = "payViaCheckoutUrl",
80
+ googlePayInitData = "googlePayInitData",
81
+ googlePayPaymentData = "googlePayPaymentData"
79
82
  }
@@ -14,7 +14,7 @@ export interface Field {
14
14
  regex?: string;
15
15
  validation_error_msg?: string;
16
16
  label_hint?: string;
17
- javascript: {
17
+ javascript?: {
18
18
  change: {
19
19
  mutableFields: string[];
20
20
  staticParams: {
@@ -14,6 +14,7 @@ export declare class FinanceDetailsService extends EmitDataService<FinanceDetail
14
14
  constructor(sessionService: SessionService, summaryFinanceDetailsAdapterService: SummaryFinanceDetailsAdapterService, statusFinanceDetailsAdapterService: StatusFinanceDetailsAdapterService);
15
15
  emitWithSummary(summary?: XpsSummary): void;
16
16
  emitWithStatus(status?: Status): void;
17
+ getDetailsFromSummary(summary: XpsSummary): FinanceDetails;
17
18
  static ɵfac: i0.ɵɵFactoryDeclaration<FinanceDetailsService, never>;
18
19
  static ɵprov: i0.ɵɵInjectableDeclaration<FinanceDetailsService>;
19
20
  }
@@ -0,0 +1,11 @@
1
+ import { InitializeNextAction } from '../initialize-actions/next-action.interface';
2
+ import { InitializeResponse } from '../initialize/response/initialize-response.class';
3
+ export interface InitializeAction<T = string, D = object> {
4
+ type: T;
5
+ data: D;
6
+ }
7
+ export interface InitializeActionCreator<R = InitializeResponse, T = string, D = unknown> {
8
+ type: T;
9
+ isSuitable(response?: R): boolean;
10
+ getActionData(actionData?: D): InitializeNextAction;
11
+ }
@@ -0,0 +1,16 @@
1
+ import { Injector } from '@angular/core';
2
+ import { InitializeResponse } from '../initialize/response/initialize-response.class';
3
+ import { InitializeNextActionTokens } from './initialize-next-actions';
4
+ import { InitializeNextAction } from './next-action.interface';
5
+ import * as i0 from "@angular/core";
6
+ export declare class InitializeNextActionService {
7
+ private readonly initializeNextActionTokens;
8
+ private readonly injector;
9
+ private readonly initializeNextActionsList;
10
+ constructor(initializeNextActionTokens: InitializeNextActionTokens, injector: Injector);
11
+ getNextAction(response: InitializeResponse): InitializeNextAction | null;
12
+ private fillNextActionsList;
13
+ private findNextAction;
14
+ static ɵfac: i0.ɵɵFactoryDeclaration<InitializeNextActionService, never>;
15
+ static ɵprov: i0.ɵɵInjectableDeclaration<InitializeNextActionService>;
16
+ }
@@ -0,0 +1,5 @@
1
+ import { InjectionToken, ProviderToken } from '@angular/core';
2
+ import { InitializeActionCreator } from './action.interface';
3
+ export type InitializeNextActionTokens = Array<ProviderToken<InitializeActionCreator>>;
4
+ export declare const initializeNextActionsToken: InjectionToken<InitializeActionCreator<import("../initialize/response/initialize-response.class").InitializeResponse, string, unknown>>;
5
+ export declare const initializeNextActions: InitializeNextActionTokens;
@@ -0,0 +1,2 @@
1
+ import { InitializeSpecialButtonAction } from './special-button/special-button.action.type';
2
+ export type InitializeNextAction = InitializeSpecialButtonAction;
@@ -0,0 +1,17 @@
1
+ import { ElkLoggerService } from '../../../exceptions-handling/elk/elk-logger.service';
2
+ import { InitializeResponse } from '../../initialize/response/initialize-response.class';
3
+ import { InitializeActionCreator } from '../action.interface';
4
+ import { InitializeSpecialButtonAction, SpecialButtonActionType } from './special-button.action.type';
5
+ import * as i0 from "@angular/core";
6
+ export declare class InitializeSpecialButtonActionCreator implements InitializeActionCreator {
7
+ private readonly elkLoggerService;
8
+ type: SpecialButtonActionType;
9
+ private readonly pids;
10
+ private readonly sdkPaymentMethodsName;
11
+ constructor(elkLoggerService: ElkLoggerService);
12
+ getActionData(response: InitializeResponse): InitializeSpecialButtonAction;
13
+ isSuitable(response: InitializeResponse): boolean;
14
+ private getPaymentMethodName;
15
+ static ɵfac: i0.ɵɵFactoryDeclaration<InitializeSpecialButtonActionCreator, never>;
16
+ static ɵprov: i0.ɵɵInjectableDeclaration<InitializeSpecialButtonActionCreator>;
17
+ }
@@ -0,0 +1,6 @@
1
+ import { InitializeAction } from '../action.interface';
2
+ export type SpecialButtonActionType = 'special_button';
3
+ export interface SpecialButtonActionData {
4
+ buttonName: string;
5
+ }
6
+ export type InitializeSpecialButtonAction = InitializeAction<SpecialButtonActionType, SpecialButtonActionData>;
@@ -1,5 +1,7 @@
1
1
  import { Field } from './field.interface';
2
+ import { InitializeNextAction } from './initialize-actions/next-action.interface';
2
3
  export interface InitializedForm {
3
4
  fields: Field[];
4
5
  isFormAutoSubmitted: boolean;
6
+ nextAction: InitializeNextAction | null;
5
7
  }
@@ -1,5 +1,6 @@
1
1
  import { Observable } from 'rxjs';
2
2
  import { FormControlStatus, UntypedFormGroup } from '@angular/forms';
3
+ import { SubmitResponse } from './submit/response/submit-response.class';
3
4
  import { FormService } from './form/form.service';
4
5
  import { InitializeService } from './initialize/initialize.service';
5
6
  import { Status } from './status/status.interface';
@@ -7,6 +8,7 @@ import { SubmitService } from './submit/submit.service';
7
8
  import { SyncService } from './sync/sync.service';
8
9
  import { StatusService } from './status/status.service';
9
10
  import { NextActionService } from './actions/next-action.service';
11
+ import { InitializeNextActionService } from './initialize-actions/initialize-next-action.service';
10
12
  import { ControlConfig } from './form/controls/control-config';
11
13
  import { ControlConfigService } from './form/controls/control-config.service';
12
14
  import { FinanceDetails } from './finance-details/finance-details.interface';
@@ -31,8 +33,11 @@ import { ControlStatus } from './form/control-status.interface';
31
33
  import { InitializedForm } from './initialized-form.inteface';
32
34
  import { CashPaymentData } from './cash-payment-data.interface';
33
35
  import { PrintInstructionService } from '../xsolla-number/api/print-instruction/print-instruction.service';
36
+ import { SyncResponse } from './sync/response/sync-response.class';
37
+ import { ElkLoggerService } from '../exceptions-handling/elk/elk-logger.service';
34
38
  import * as i0 from "@angular/core";
35
39
  export declare class PaymentService {
40
+ private readonly elkLoggerService;
36
41
  private readonly initializeService;
37
42
  private readonly submitService;
38
43
  private readonly syncService;
@@ -41,6 +46,7 @@ export declare class PaymentService {
41
46
  private readonly financeDetailsService;
42
47
  private readonly creditCardStateService;
43
48
  private readonly nextActionService;
49
+ private readonly initializeNextActionService;
44
50
  private readonly controlConfigService;
45
51
  private readonly threeDsService;
46
52
  private readonly formMessagesService;
@@ -64,17 +70,19 @@ export declare class PaymentService {
64
70
  private readonly formFieldsStatusSubject;
65
71
  private readonly _formResponse$;
66
72
  private isSavingMethodMode;
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);
73
+ constructor(elkLoggerService: ElkLoggerService, initializeService: InitializeService, submitService: SubmitService, syncService: SyncService, formService: FormService, statusService: StatusService, financeDetailsService: FinanceDetailsService, creditCardStateService: CreditCardStateService, nextActionService: NextActionService, initializeNextActionService: InitializeNextActionService, controlConfigService: ControlConfigService, threeDsService: ThreeDsService, formMessagesService: FormMessagesService, settingsService: SettingsService, countryService: CountryService, checkStatusActionCreator: CheckStatusActionCreator, printInstructionService: PrintInstructionService);
68
74
  initialize(config: PaymentConfiguration): Promise<InitializedForm>;
69
75
  submit(): Promise<NextAction | null | void>;
76
+ submitWithFields(fields?: Field[]): Promise<SubmitResponse>;
70
77
  getFields(): Field[];
71
78
  getControlStatus(name: FieldNames): ControlStatus | null;
72
- getInitialDataForSdkPaymentSystems(): SdkPaymentSystemsInitialData;
79
+ getInitialDataForSdkPaymentSystems(): Promise<SdkPaymentSystemsInitialData>;
73
80
  getQrCode(): string;
74
81
  getCashPaymentData(): CashPaymentData;
75
82
  getPid(): number | null;
76
83
  getSubmitButtonText(): string | null;
77
84
  validate(field: Field): Promise<ValidationErrors | null>;
85
+ calculateField(changedField: Field, fields: Field[]): Promise<SyncResponse>;
78
86
  runThreeDs(): void;
79
87
  getFinanceDetails(): FinanceDetails | null;
80
88
  updateFieldFormState(fieldName: string, formState: FormState): void;
@@ -97,6 +105,7 @@ export declare class PaymentService {
97
105
  private emitFormResponse;
98
106
  private getInitializeMessages;
99
107
  private canAutoSubmit;
108
+ private getSdkPaymentDataFromResponse;
100
109
  static ɵfac: i0.ɵɵFactoryDeclaration<PaymentService, never>;
101
110
  static ɵprov: i0.ɵɵInjectableDeclaration<PaymentService>;
102
111
  }
@@ -40,7 +40,7 @@ export declare class SyncService extends EmitDataService<XpsResponse> {
40
40
  reset(): void;
41
41
  validate(field: Field, delay?: number): Promise<ValidationErrors | null>;
42
42
  getSyncValidationErrors(field: Field): ValidationErrors | null;
43
- protected request(field: Field): Promise<SyncResponse>;
43
+ request(field: Field, fields?: Field[], form?: UntypedFormGroup): Promise<SyncResponse>;
44
44
  private isReadyField;
45
45
  private getPrevFieldSyncState;
46
46
  private setPrevFieldSyncState;
@@ -3,5 +3,6 @@ export interface XpsError {
3
3
  code: number;
4
4
  message: string;
5
5
  element_name?: string;
6
+ title?: string;
6
7
  alternative_instances?: PaymentMethodApi[];
7
8
  }
@@ -0,0 +1,19 @@
1
+ import { UserBehaviourAnalyticsService } from '../user-behaviour-analytics/user-behaviour-analytics.service';
2
+ import { Environment } from '../environment.interface';
3
+ import * as i0 from "@angular/core";
4
+ export declare class ScriptTrackerService {
5
+ private readonly userBehaviourAnalyticsService;
6
+ private readonly currentScripts;
7
+ private readonly scriptHostBlacklist;
8
+ private readonly SCRIPT_DEBOUNCE_TIME_MS;
9
+ private readonly scriptTracked$;
10
+ constructor(userBehaviourAnalyticsService: UserBehaviourAnalyticsService);
11
+ initScriptTracking(environment: Environment): void;
12
+ private handleScriptData;
13
+ private getTrackedScripts;
14
+ private checkCurrentScripts;
15
+ private setupScriptObserver;
16
+ private trackScript;
17
+ static ɵfac: i0.ɵɵFactoryDeclaration<ScriptTrackerService, never>;
18
+ static ɵprov: i0.ɵɵInjectableDeclaration<ScriptTrackerService>;
19
+ }
@@ -0,0 +1,9 @@
1
+ import { Field } from '../../payment/field.interface';
2
+ import { SubmitResponse } from '../../payment/submit/response/submit-response.class';
3
+ import { XpsSummary } from '../../payment/xps-summary.interface';
4
+ export interface CheckPaymentDeviceData {
5
+ base64checkoutData: string | null;
6
+ submitResponse: SubmitResponse | null;
7
+ fields: Field[];
8
+ summary: XpsSummary | null;
9
+ }
@@ -1,4 +1,10 @@
1
+ import { Field } from '../../payment/field.interface';
2
+ import { PaymentAuthorizedHandler, PaymentDataChangedHandler } from './google-pay-library.interface';
1
3
  export interface GooglePayInitParams {
2
4
  isSandbox: boolean;
5
+ isInstantPayFlow: boolean;
3
6
  country: string;
7
+ fields: Field[];
8
+ onPaymentDataChanged: PaymentDataChangedHandler;
9
+ onPaymentAuthorized: PaymentAuthorizedHandler;
4
10
  }
@@ -1,18 +1,163 @@
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;
1
+ type ApiVersion = number;
2
+ type ApiVersionMinor = number;
3
+ interface Address {
4
+ name: string;
5
+ address1: string;
6
+ address2: string;
7
+ address3: string;
8
+ locality: string;
9
+ administrativeArea: string;
10
+ countryCode: string;
11
+ postalCode: string;
12
+ sortingCode: string;
13
+ }
14
+ export type DisplayItems = Array<{
15
+ label: string;
16
+ type: string;
17
+ price: string;
18
+ }>;
19
+ export interface TransactionInfo {
20
+ currencyCode?: string;
21
+ totalPriceStatus: string;
22
+ totalPrice?: number | string;
23
+ countryCode?: string;
24
+ totalPriceLabel?: string;
25
+ displayItems?: DisplayItems;
26
+ }
27
+ export interface AllowedPaymentMethod {
28
+ type: string;
29
+ parameters: {
30
+ allowedAuthMethods: string[];
31
+ allowedCardNetworks: string[];
32
+ allowPrepaidCards: boolean;
33
+ billingAddressRequired: boolean;
34
+ billingAddressParameters: {
35
+ format: string;
36
+ phoneNumberRequired: boolean;
37
+ };
38
+ };
39
+ tokenizationSpecification: {
40
+ type: string;
41
+ parameters: {
42
+ gateway: string;
43
+ 'vantiv:merchantPayPageId'?: string;
44
+ 'vantiv:merchantOrderId'?: string;
45
+ 'vantiv:merchantTransactionId'?: string;
46
+ 'vantiv:merchantReportGroup'?: string;
47
+ };
48
+ };
49
+ }
50
+ export interface IsReadyToPayRequest {
51
+ apiVersion: ApiVersion;
52
+ apiVersionMinor: ApiVersionMinor;
53
+ allowedPaymentMethods: AllowedPaymentMethod[];
54
+ }
55
+ export interface GooglePayPaymentRequest {
56
+ apiVersion: ApiVersion;
57
+ apiVersionMinor: ApiVersionMinor;
58
+ merchantInfo: {
59
+ merchantId: string;
60
+ };
61
+ allowedPaymentMethods: AllowedPaymentMethod[];
62
+ transactionInfo: TransactionInfo;
63
+ emailRequired: boolean;
64
+ shippingAddressRequired: boolean;
65
+ callbackIntents: string[];
66
+ }
67
+ export interface PaymentAuthorizationResult {
68
+ transactionState: 'SUCCESS' | 'ERROR';
69
+ error?: {
70
+ reason: string;
71
+ message: string;
72
+ intent: string;
73
+ };
74
+ }
75
+ export interface PaymentData {
76
+ apiVersion: number;
77
+ apiVersionMinor: number;
78
+ paymentMethodData: {
79
+ type: string;
80
+ description: string;
81
+ info: {
82
+ cardDetails: string;
83
+ assuranceDetails: {
84
+ accountVerified: boolean;
85
+ cardHolderAuthenticated: boolean;
86
+ };
87
+ cardNetwork: string;
88
+ billingAddress?: Address;
89
+ };
90
+ tokenizationData: {
91
+ type: string;
92
+ token?: string;
93
+ };
94
+ };
95
+ email?: string;
96
+ shippingAddress?: Address;
97
+ }
98
+ export interface PaymentDataRequestUpdate {
99
+ newTransactionInfo?: {
100
+ displayItems?: Array<{
101
+ label: string;
102
+ type: string;
103
+ price: string;
104
+ }>;
105
+ currencyCode: string;
106
+ countryCode?: string;
107
+ transactionId?: string;
108
+ totalPriceStatus: string;
109
+ totalPrice: string;
110
+ totalPriceLabel?: string;
111
+ checkoutOption?: string;
112
+ };
113
+ newShippingOptionParameters?: {
114
+ defaultSelectedOptionId: string;
115
+ shippingOptions?: Array<{
116
+ id: string;
117
+ label: string;
118
+ description?: string;
119
+ }>;
120
+ };
121
+ newOfferInfo?: {
122
+ offers: Array<{
123
+ redemptionCode: string;
124
+ description: string;
125
+ }>;
126
+ };
127
+ error?: {
128
+ reason: string;
129
+ message: string;
130
+ intent: string;
131
+ };
132
+ }
133
+ export interface GoogleInitData {
134
+ isReadyToPayRequest: IsReadyToPayRequest;
135
+ paymentDataRequest: GooglePayPaymentRequest;
136
+ amexCardNotification?: string;
137
+ }
138
+ export interface IntermediatePaymentData {
139
+ callbackTrigger?: 'INITIALIZE' | 'SHIPPING_ADDRESS' | 'SHIPPING_OPTION';
140
+ shippingAddress?: {
141
+ administrativeArea: string;
142
+ countryCode: string;
143
+ locality: string;
144
+ postalCode: string;
145
+ };
146
+ shippingOptionData?: {
147
+ id: string;
148
+ };
149
+ }
150
+ export type PaymentDataChangedHandler = (intermediatePaymentData: IntermediatePaymentData) => Promise<PaymentDataRequestUpdate>;
151
+ export type PaymentAuthorizedHandler = (paymentData: PaymentData) => Promise<PaymentAuthorizationResult>;
152
+ export interface GooglePayClientInitData {
153
+ environment: string;
154
+ paymentDataCallbacks?: {
155
+ onPaymentDataChanged: PaymentDataChangedHandler;
156
+ onPaymentAuthorized: PaymentAuthorizedHandler;
157
+ };
11
158
  }
12
159
  export interface GooglePayClientInit {
13
- new (options: {
14
- environment: string;
15
- }): GooglePayClient;
160
+ new (options: GooglePayClientInitData): GooglePayClient;
16
161
  }
17
162
  export interface PaymentDataRequest {
18
163
  transactionInfo: {
@@ -30,7 +175,7 @@ export interface PaymentDataResponse {
30
175
  }
31
176
  export interface ButtonOptions {
32
177
  onClick(): void;
33
- allowedPaymentMethods: GooglePayPaymentMethod[];
178
+ allowedPaymentMethods: AllowedPaymentMethod[];
34
179
  buttonColor?: 'default' | 'black' | 'white';
35
180
  buttonType?: 'plain' | 'buy';
36
181
  buttonSizeMode?: 'static' | 'fill';
@@ -42,42 +187,15 @@ export interface GooglePayLibrary {
42
187
  };
43
188
  };
44
189
  }
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;
190
+ export declare class GooglePayClient {
191
+ constructor(options: {
192
+ environment: string;
193
+ });
194
+ isReadyToPay(isReadyToPayRequest: IsReadyToPayRequest): Promise<{
195
+ result: boolean;
196
+ }>;
197
+ createButton(options: ButtonOptions): HTMLButtonElement;
198
+ loadPaymentData(paymentDataRequest: GooglePayPaymentRequest): Promise<PaymentDataResponse>;
199
+ prefetchPaymentData(paymentDataRequest: GooglePayPaymentRequest): void;
83
200
  }
201
+ export {};
@@ -1,33 +1,41 @@
1
1
  import { Injector } from '@angular/core';
2
2
  import { Observable } from 'rxjs';
3
- import { PaymentSystemProcessingService } from '../payment-systems/payment-system-processing.service';
3
+ import { ElkLoggerService } from '../../exceptions-handling/elk/elk-logger.service';
4
4
  import { ExtendedWindow } from '../../extended-window.interface';
5
- import { GooglePayInitParams } from './google-pay-init-params.interface';
6
5
  import { CheckStatusAction } from '../../payment/actions/check-status/check-status.action.type';
6
+ import { PaymentSystemProcessingService } from '../payment-systems/payment-system-processing.service';
7
+ import { CheckPaymentDeviceData } from './check-payment-device-data.interface';
7
8
  import { GooglePayButtonColorType } from './google-pay-button-color.type';
9
+ import { GooglePayInitParams } from './google-pay-init-params.interface';
10
+ import { GooglePayCheckoutPaymentService } from './payment/google-pay-checkout-payment.service';
11
+ import { GooglePayInstantPaymentService } from './payment/google-pay-instant-payment.service';
8
12
  import * as i0 from "@angular/core";
9
13
  export declare class GooglePayService {
10
14
  private readonly window;
11
- readonly paymentSystemProcessingService: PaymentSystemProcessingService;
12
- readonly injector: Injector;
15
+ private readonly elkLoggerService;
16
+ private readonly paymentSystemProcessingService;
17
+ private readonly googlePayCheckoutPaymentService;
18
+ private readonly googlePayInstantPaymentService;
19
+ private readonly injector;
13
20
  private readonly googlePayScriptUrl;
14
21
  private readonly readyToPay;
15
- private checkout;
16
22
  private googlePaymentClient;
17
- private isSandbox;
18
- private country;
23
+ private initParams;
24
+ private paymentService;
25
+ private onPaymentDataChanged;
26
+ private onPaymentAuthorized;
19
27
  private get libraryWasInitialized();
20
28
  private get googlePaymentClientWasInitialized();
21
- constructor(window: ExtendedWindow, paymentSystemProcessingService: PaymentSystemProcessingService, injector: Injector);
29
+ constructor(window: ExtendedWindow, elkLoggerService: ElkLoggerService, paymentSystemProcessingService: PaymentSystemProcessingService, googlePayCheckoutPaymentService: GooglePayCheckoutPaymentService, googlePayInstantPaymentService: GooglePayInstantPaymentService, injector: Injector);
22
30
  get readyToPay$(): Observable<boolean | null>;
23
31
  isReadyToPay(): boolean | null;
24
32
  initGooglePayLibrary(data: GooglePayInitParams): void;
25
- checkPaymentDevice(base64checkoutData: string): void;
33
+ checkPaymentDevice(data: CheckPaymentDeviceData): void;
26
34
  proceedCheckout(): Promise<CheckStatusAction | null>;
27
35
  createButton(onClickHandler: () => void, buttonColor?: GooglePayButtonColorType): HTMLButtonElement | null;
28
36
  private setupGooglePayClient;
29
37
  private onLoadScript;
30
- private isCancelledStatus;
38
+ private getPaymentService;
31
39
  static ɵfac: i0.ɵɵFactoryDeclaration<GooglePayService, never>;
32
40
  static ɵprov: i0.ɵɵInjectableDeclaration<GooglePayService>;
33
41
  }
@@ -0,0 +1,18 @@
1
+ import { PaymentSystemProcessingService } from '../../payment-systems/payment-system-processing.service';
2
+ import { AllowedPaymentMethod, GoogleInitData, GooglePayPaymentRequest, PaymentDataResponse } from '../google-pay-library.interface';
3
+ import { GooglePayPaymentService, PreparePaymentParams } from './google-pay-payment-service.interface';
4
+ import * as i0 from "@angular/core";
5
+ export declare class GooglePayCheckoutPaymentService implements GooglePayPaymentService {
6
+ readonly paymentSystemProcessingService: PaymentSystemProcessingService;
7
+ private initParams;
8
+ private checkout;
9
+ constructor(paymentSystemProcessingService: PaymentSystemProcessingService);
10
+ preparePayment({ initParams, checkDeviceData, }: PreparePaymentParams): GoogleInitData | null;
11
+ getPaymentRequest(): GooglePayPaymentRequest | null;
12
+ getAllowedPaymentMethods(): AllowedPaymentMethod[];
13
+ handleSuccessfulPayment(response: PaymentDataResponse): void;
14
+ handleFailedPayment(error: unknown): void;
15
+ private isCancelledStatus;
16
+ static ɵfac: i0.ɵɵFactoryDeclaration<GooglePayCheckoutPaymentService, never>;
17
+ static ɵprov: i0.ɵɵInjectableDeclaration<GooglePayCheckoutPaymentService>;
18
+ }
@@ -0,0 +1,18 @@
1
+ import { SummaryFinanceDetailsAdapterService } from '../../../payment/finance-details/summary/summary-finance-details-adapter.service';
2
+ import { AllowedPaymentMethod, GoogleInitData, GooglePayPaymentRequest } from '../google-pay-library.interface';
3
+ import { GooglePayPaymentService, PreparePaymentParams } from './google-pay-payment-service.interface';
4
+ import * as i0 from "@angular/core";
5
+ export declare class GooglePayInstantPaymentService implements GooglePayPaymentService {
6
+ private readonly summaryFinanceDetailsAdapterService;
7
+ private initParams;
8
+ private googleInitData;
9
+ constructor(summaryFinanceDetailsAdapterService: SummaryFinanceDetailsAdapterService);
10
+ preparePayment({ initParams, checkDeviceData, }: PreparePaymentParams): GoogleInitData | null;
11
+ getPaymentRequest(): GooglePayPaymentRequest | null;
12
+ getAllowedPaymentMethods(): AllowedPaymentMethod[];
13
+ private extractGoogleInitData;
14
+ private getItemsTaxes;
15
+ private getTotalAmount;
16
+ static ɵfac: i0.ɵɵFactoryDeclaration<GooglePayInstantPaymentService, never>;
17
+ static ɵprov: i0.ɵɵInjectableDeclaration<GooglePayInstantPaymentService>;
18
+ }
@@ -0,0 +1,14 @@
1
+ import { CheckPaymentDeviceData } from '../check-payment-device-data.interface';
2
+ import { GooglePayInitParams } from '../google-pay-init-params.interface';
3
+ import { AllowedPaymentMethod, GoogleInitData, GooglePayPaymentRequest, PaymentDataResponse } from '../google-pay-library.interface';
4
+ export interface PreparePaymentParams {
5
+ initParams: GooglePayInitParams;
6
+ checkDeviceData: CheckPaymentDeviceData;
7
+ }
8
+ export interface GooglePayPaymentService {
9
+ preparePayment(params: PreparePaymentParams): GoogleInitData | null;
10
+ getPaymentRequest(): GooglePayPaymentRequest | null;
11
+ getAllowedPaymentMethods(): AllowedPaymentMethod[];
12
+ handleSuccessfulPayment?(response: PaymentDataResponse): void;
13
+ handleFailedPayment?(error: unknown): void;
14
+ }
@@ -0,0 +1,7 @@
1
+ import { CartLine } from '../../payment/finance-details/cart-line.interface';
2
+ export interface UpdatedPrice {
3
+ total: number;
4
+ subtotalPayment?: CartLine | null;
5
+ subtotalDetails?: CartLine[];
6
+ totalDetails?: CartLine[];
7
+ }
@@ -1,6 +1,12 @@
1
+ import { Field } from '../payment/field.interface';
2
+ import { SubmitResponse } from '../payment/submit/response/submit-response.class';
3
+ import { XpsSummary } from '../payment/xps-summary.interface';
1
4
  import { XpsBoolean } from '../xps-boolean.enum';
2
5
  export interface SdkPaymentSystemsInitialData {
3
- data: string;
4
6
  sandbox: XpsBoolean;
5
7
  country: string;
8
+ fields: Field[];
9
+ summary: XpsSummary | null;
10
+ submitResponse: SubmitResponse | null;
11
+ data: string | null;
6
12
  }