@xsolla/payment-client-core 0.2.44 → 0.2.46
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2022/lib/core/agreements-group.const.mjs +17 -0
- package/esm2022/lib/core/extended-window.interface.mjs +1 -1
- package/esm2022/lib/core/payment/actions/action.interface.mjs +1 -1
- package/esm2022/lib/core/payment/actions/next-action.service.mjs +1 -1
- package/esm2022/lib/core/payment/field-names.enum.mjs +4 -1
- package/esm2022/lib/core/payment/field.interface.mjs +1 -1
- package/esm2022/lib/core/payment/finance-details/finance-details.service.mjs +4 -1
- package/esm2022/lib/core/payment/initialize-actions/action.interface.mjs +2 -0
- package/esm2022/lib/core/payment/initialize-actions/initialize-next-action.service.mjs +40 -0
- package/esm2022/lib/core/payment/initialize-actions/initialize-next-actions.mjs +7 -0
- package/esm2022/lib/core/payment/initialize-actions/next-action.interface.mjs +2 -0
- package/esm2022/lib/core/payment/initialize-actions/special-button/special-button.action.class.mjs +46 -0
- package/esm2022/lib/core/payment/initialize-actions/special-button/special-button.action.type.mjs +2 -0
- package/esm2022/lib/core/payment/initialized-form.inteface.mjs +1 -1
- package/esm2022/lib/core/payment/payment.service.mjs +72 -24
- package/esm2022/lib/core/payment/sync/request/sync-request.class.mjs +3 -1
- package/esm2022/lib/core/payment/sync/sync.service.mjs +4 -4
- package/esm2022/lib/core/payment/xps-error.interface.mjs +1 -1
- package/esm2022/lib/core/sdk-payment-systems/apple-pay/apple-pay-integration.type.mjs +6 -2
- package/esm2022/lib/core/sdk-payment-systems/apple-pay/apple-pay-params-builder.service.mjs +90 -0
- package/esm2022/lib/core/sdk-payment-systems/apple-pay/apple-pay-session.interface.mjs +2 -0
- package/esm2022/lib/core/sdk-payment-systems/apple-pay/apple-pay.errors.enum.mjs +6 -3
- package/esm2022/lib/core/sdk-payment-systems/apple-pay/apple-pay.service.mjs +64 -87
- package/esm2022/lib/core/sdk-payment-systems/apple-pay/checkout-params.interface.mjs +1 -1
- package/esm2022/lib/core/sdk-payment-systems/apple-pay/session-handlers/braintree.handler.mjs +80 -0
- package/esm2022/lib/core/sdk-payment-systems/apple-pay/session-handlers/checkout.handler.mjs +65 -0
- package/esm2022/lib/core/sdk-payment-systems/apple-pay/session-handlers/session-handler.abstract.mjs +31 -0
- package/esm2022/lib/core/sdk-payment-systems/apple-pay/session-handlers/session-handler.type.mjs +2 -0
- package/esm2022/lib/core/sdk-payment-systems/google-pay/check-payment-device-data.interface.mjs +2 -0
- package/esm2022/lib/core/sdk-payment-systems/google-pay/google-pay-init-params.interface.mjs +1 -1
- package/esm2022/lib/core/sdk-payment-systems/google-pay/google-pay-library.interface.mjs +1 -1
- package/esm2022/lib/core/sdk-payment-systems/google-pay/google-pay.service.mjs +70 -59
- package/esm2022/lib/core/sdk-payment-systems/google-pay/payment/google-pay-checkout-payment.service.mjs +75 -0
- package/esm2022/lib/core/sdk-payment-systems/google-pay/payment/google-pay-instant-payment.service.mjs +121 -0
- package/esm2022/lib/core/sdk-payment-systems/google-pay/payment/google-pay-payment-service.interface.mjs +2 -0
- package/esm2022/lib/core/sdk-payment-systems/google-pay/updated-price.interface.mjs +2 -0
- package/esm2022/lib/core/sdk-payment-systems/sdk-payment-systems-initial-data.interface.mjs +1 -1
- package/esm2022/lib/core/sdk-payment-systems/sdk-payment-systems.interface.mjs +1 -1
- package/esm2022/lib/core/settings/project.interface.mjs +1 -1
- package/esm2022/lib/core-library.module.mjs +18 -1
- package/esm2022/lib/core-library.service.mjs +16 -2
- package/fesm2022/xsolla-payment-client-core.mjs +920 -336
- package/fesm2022/xsolla-payment-client-core.mjs.map +1 -1
- package/lib/core/extended-window.interface.d.ts +1 -1
- package/lib/core/payment/actions/action.interface.d.ts +2 -2
- package/lib/core/payment/actions/next-action.service.d.ts +1 -1
- package/lib/core/payment/actions/next-actions.d.ts +1 -1
- package/lib/core/payment/field-names.enum.d.ts +4 -1
- package/lib/core/payment/field.interface.d.ts +1 -1
- package/lib/core/payment/finance-details/finance-details.service.d.ts +1 -0
- package/lib/core/payment/initialize-actions/action.interface.d.ts +11 -0
- package/lib/core/payment/initialize-actions/initialize-next-action.service.d.ts +16 -0
- package/lib/core/payment/initialize-actions/initialize-next-actions.d.ts +5 -0
- package/lib/core/payment/initialize-actions/next-action.interface.d.ts +2 -0
- package/lib/core/payment/initialize-actions/special-button/special-button.action.class.d.ts +17 -0
- package/lib/core/payment/initialize-actions/special-button/special-button.action.type.d.ts +6 -0
- package/lib/core/payment/initialized-form.inteface.d.ts +2 -0
- package/lib/core/payment/payment.service.d.ts +11 -2
- package/lib/core/payment/sync/sync.service.d.ts +1 -1
- package/lib/core/payment/xps-error.interface.d.ts +1 -0
- package/lib/core/sdk-payment-systems/apple-pay/apple-pay-integration.type.d.ts +5 -1
- package/lib/core/sdk-payment-systems/apple-pay/apple-pay-params-builder.service.d.ts +15 -0
- package/lib/core/sdk-payment-systems/apple-pay/apple-pay-session.interface.d.ts +135 -0
- package/lib/core/sdk-payment-systems/apple-pay/apple-pay.errors.enum.d.ts +5 -2
- package/lib/core/sdk-payment-systems/apple-pay/apple-pay.service.d.ts +24 -13
- package/lib/core/sdk-payment-systems/apple-pay/checkout-params.interface.d.ts +1 -0
- package/lib/core/sdk-payment-systems/apple-pay/session-handlers/braintree.handler.d.ts +16 -0
- package/lib/core/sdk-payment-systems/apple-pay/session-handlers/checkout.handler.d.ts +13 -0
- package/lib/core/sdk-payment-systems/apple-pay/session-handlers/session-handler.abstract.d.ts +13 -0
- package/lib/core/sdk-payment-systems/apple-pay/session-handlers/session-handler.type.d.ts +3 -0
- package/lib/core/sdk-payment-systems/google-pay/check-payment-device-data.interface.d.ts +9 -0
- package/lib/core/sdk-payment-systems/google-pay/google-pay-init-params.interface.d.ts +6 -0
- package/lib/core/sdk-payment-systems/google-pay/google-pay-library.interface.d.ts +170 -52
- package/lib/core/sdk-payment-systems/google-pay/google-pay.service.d.ts +18 -10
- package/lib/core/sdk-payment-systems/google-pay/payment/google-pay-checkout-payment.service.d.ts +18 -0
- package/lib/core/sdk-payment-systems/google-pay/payment/google-pay-instant-payment.service.d.ts +18 -0
- package/lib/core/sdk-payment-systems/google-pay/payment/google-pay-payment-service.interface.d.ts +14 -0
- package/lib/core/sdk-payment-systems/google-pay/updated-price.interface.d.ts +7 -0
- package/lib/core/sdk-payment-systems/sdk-payment-systems-initial-data.interface.d.ts +7 -1
- package/lib/core/sdk-payment-systems/sdk-payment-systems.interface.d.ts +1 -1
- package/lib/core/settings/project.interface.d.ts +1 -0
- package/lib/core-library.service.d.ts +12 -0
- package/package.json +1 -1
- package/xsolla-payment-client-core-0.2.46.tgz +0 -0
- package/esm2022/lib/core/agreementsGroup.const.mjs +0 -17
- package/xsolla-payment-client-core-0.2.44.tgz +0 -0
- /package/lib/core/{agreementsGroup.const.d.ts → agreements-group.const.d.ts} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ApplePaySession } from '
|
|
1
|
+
import { ApplePaySession } from './sdk-payment-systems/apple-pay/apple-pay-session.interface';
|
|
2
2
|
import { GooglePayLibrary } from './sdk-payment-systems/google-pay/google-pay-library.interface';
|
|
3
3
|
export interface ExtendedWindow extends Window {
|
|
4
4
|
PerformanceObserver?: typeof PerformanceObserver;
|
|
@@ -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?:
|
|
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,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,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,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
|
-
|
|
43
|
+
request(field: Field, fields?: Field[], form?: UntypedFormGroup): Promise<SyncResponse>;
|
|
44
44
|
private isReadyField;
|
|
45
45
|
private getPrevFieldSyncState;
|
|
46
46
|
private setPrevFieldSyncState;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { PaymentForm } from '../../payment/payment-form.interface';
|
|
2
|
+
import { XpsSummary } from '../../payment/xps-summary.interface';
|
|
3
|
+
import { ApplePayParams } from './apple-pay-params.interface';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
export declare class ApplePayParamsBuilderService {
|
|
6
|
+
private readonly agreementFieldsNames;
|
|
7
|
+
buildParams(paymentForm: PaymentForm): ApplePayParams | null;
|
|
8
|
+
updateParams(params: ApplePayParams, summary: XpsSummary): ApplePayParams;
|
|
9
|
+
private getJsonValueFromField;
|
|
10
|
+
private getAppleToken;
|
|
11
|
+
private getTotalAmount;
|
|
12
|
+
private getTotalCurrency;
|
|
13
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ApplePayParamsBuilderService, never>;
|
|
14
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<ApplePayParamsBuilderService>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
export declare class ApplePaySession {
|
|
2
|
+
static STATUS_SUCCESS: number;
|
|
3
|
+
static STATUS_FAILURE: number;
|
|
4
|
+
onvalidatemerchant: (this: ApplePaySession, event: ApplePayValidEvent) => void;
|
|
5
|
+
onpaymentauthorized: (this: ApplePaySession, event: ApplePayPaymentAuthorizedEvent) => void;
|
|
6
|
+
onshippingcontactselected: (this: ApplePaySession, event: ApplePayOnShippingContactSelectedEvent) => void;
|
|
7
|
+
onshippingmethodselected: (this: ApplePaySession, event: ApplePayOnShippingMethodSelectedEvent) => void;
|
|
8
|
+
completeShippingContactSelection: (this: ApplePaySession, shippingContactUpdate: ApplePayShippingContactUpdate) => void;
|
|
9
|
+
oncancel: (this: ApplePaySession, event?: ApplePayOnCancelEvent) => void;
|
|
10
|
+
constructor(version: number, paymentRequest: ApplePayPaymentRequest);
|
|
11
|
+
static supportsVersion(version: number): boolean;
|
|
12
|
+
static canMakePayments(): boolean;
|
|
13
|
+
completeMerchantValidation(merchantSession: ApplePayMerchantSession): void;
|
|
14
|
+
completePayment(status: number): void;
|
|
15
|
+
abort(): void;
|
|
16
|
+
begin(): void;
|
|
17
|
+
}
|
|
18
|
+
export interface ApplePayValidEvent {
|
|
19
|
+
validationURL: string;
|
|
20
|
+
}
|
|
21
|
+
export interface ApplePayPaymentAuthorizedEvent {
|
|
22
|
+
payment: ApplePayPayment;
|
|
23
|
+
}
|
|
24
|
+
export interface ApplePayOnShippingContactSelectedEvent {
|
|
25
|
+
shippingContact: {
|
|
26
|
+
locality: string;
|
|
27
|
+
country: string;
|
|
28
|
+
postalCode: string;
|
|
29
|
+
administrativeArea: string;
|
|
30
|
+
countryCode: string;
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
export interface ApplePayOnShippingMethodSelectedEvent {
|
|
34
|
+
shippingMethod: {
|
|
35
|
+
label: string;
|
|
36
|
+
detail: string;
|
|
37
|
+
amount: string;
|
|
38
|
+
identifier: string;
|
|
39
|
+
dateComponentsRange: {
|
|
40
|
+
startDateComponents: {
|
|
41
|
+
years: number;
|
|
42
|
+
months: number;
|
|
43
|
+
days: number;
|
|
44
|
+
hours: number;
|
|
45
|
+
};
|
|
46
|
+
endDateComponents: {
|
|
47
|
+
years: number;
|
|
48
|
+
months: number;
|
|
49
|
+
days: number;
|
|
50
|
+
hours: number;
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
export interface ApplePayShippingContactUpdate {
|
|
56
|
+
status: 'STATUS_SUCCESS' | 'STATUS_FAILURE';
|
|
57
|
+
newTotal: ApplePayLineItem;
|
|
58
|
+
newLineItems?: ApplePayLineItem[];
|
|
59
|
+
}
|
|
60
|
+
export interface ApplePayOnCancelEvent {
|
|
61
|
+
type: string;
|
|
62
|
+
sessionError: {
|
|
63
|
+
code: string;
|
|
64
|
+
info?: {
|
|
65
|
+
[key: string]: unknown;
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
export interface ApplePayPayment {
|
|
70
|
+
token: ApplePayPaymentToken;
|
|
71
|
+
billingContact?: ApplePayPaymentContact;
|
|
72
|
+
shippingContact?: ApplePayPaymentContact;
|
|
73
|
+
}
|
|
74
|
+
export interface ApplePayPaymentToken {
|
|
75
|
+
paymentMethod: {
|
|
76
|
+
displayName: string;
|
|
77
|
+
network: string;
|
|
78
|
+
type: string;
|
|
79
|
+
};
|
|
80
|
+
transactionIdentifier: string;
|
|
81
|
+
}
|
|
82
|
+
export interface ApplePayPaymentRequest {
|
|
83
|
+
countryCode: string;
|
|
84
|
+
currencyCode: string;
|
|
85
|
+
supportedNetworks: string[] | undefined;
|
|
86
|
+
merchantCapabilities: string[] | undefined;
|
|
87
|
+
total: ApplePayLineItem;
|
|
88
|
+
lineItems?: ApplePayLineItem[];
|
|
89
|
+
requiredShippingContactFields?: string[];
|
|
90
|
+
requiredBillingContactFields?: string[];
|
|
91
|
+
shippingMethods?: ApplePayShippingMethod[];
|
|
92
|
+
shippingType?: string;
|
|
93
|
+
}
|
|
94
|
+
export interface ApplePayLineItem {
|
|
95
|
+
amount: string;
|
|
96
|
+
label: string;
|
|
97
|
+
type?: 'final' | 'pending';
|
|
98
|
+
paymentTiming?: 'immediate' | 'recurring' | 'deferred' | 'automaticReload';
|
|
99
|
+
recurringPaymentStartDate?: Date;
|
|
100
|
+
recurringPaymentIntervalUnit?: 'year' | 'month' | 'day' | 'hour' | 'minute';
|
|
101
|
+
recurringPaymentIntervalCount?: number;
|
|
102
|
+
recurringPaymentEndDate?: Date;
|
|
103
|
+
deferredPaymentDate?: Date;
|
|
104
|
+
automaticReloadPaymentThresholdAmount?: string;
|
|
105
|
+
}
|
|
106
|
+
export interface ApplePayShippingMethod {
|
|
107
|
+
identifier: string;
|
|
108
|
+
label: string;
|
|
109
|
+
detail: string;
|
|
110
|
+
amount: string;
|
|
111
|
+
}
|
|
112
|
+
export interface ApplePayMerchantSession {
|
|
113
|
+
merchantIdentifier: string;
|
|
114
|
+
displayName: string;
|
|
115
|
+
signature: string;
|
|
116
|
+
nonce: string;
|
|
117
|
+
epochTimestamp: number;
|
|
118
|
+
}
|
|
119
|
+
export interface GetMerchantSessionResponse {
|
|
120
|
+
merchantSession: ApplePayMerchantSession;
|
|
121
|
+
}
|
|
122
|
+
export interface ApplePayPaymentContact {
|
|
123
|
+
emailAddress?: string;
|
|
124
|
+
phoneNumber?: string;
|
|
125
|
+
givenName?: string;
|
|
126
|
+
familyName?: string;
|
|
127
|
+
addressLines?: string[];
|
|
128
|
+
locality?: string;
|
|
129
|
+
subLocality?: string;
|
|
130
|
+
administrativeArea?: string;
|
|
131
|
+
subAdministrativeArea?: string;
|
|
132
|
+
postalCode?: string;
|
|
133
|
+
country?: string;
|
|
134
|
+
countryCode?: string;
|
|
135
|
+
}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
export declare enum ApplePayErrors {
|
|
2
|
-
paymentError = "
|
|
3
|
-
deviceIsNotCapableError = "
|
|
2
|
+
paymentError = "Apple Pay: payment error",
|
|
3
|
+
deviceIsNotCapableError = "Apple Pay: device is not capable",
|
|
4
|
+
cancelled = "Apple Pay: payment cancelled",
|
|
5
|
+
merchantValidationError = "Apple Pay: merchant validation error",
|
|
6
|
+
braintreeInitializeError = "Apple Pay: Braintree library is not initialized"
|
|
4
7
|
}
|
|
@@ -1,16 +1,24 @@
|
|
|
1
1
|
import { Observable } from 'rxjs';
|
|
2
|
-
import { ApplePayParams } from './apple-pay-params.interface';
|
|
3
2
|
import { ExtendedWindow } from '../../extended-window.interface';
|
|
4
|
-
import {
|
|
3
|
+
import { SummaryFinanceDetailsAdapterService } from '../../payment/finance-details/summary/summary-finance-details-adapter.service';
|
|
5
4
|
import { UserAgentService } from '../../user-agent/user-agent.service';
|
|
6
5
|
import { ApplePayIntegration } from './apple-pay-integration.type';
|
|
7
|
-
import {
|
|
6
|
+
import { ApplePayParams } from './apple-pay-params.interface';
|
|
7
|
+
import { ApplePayErrors } from './apple-pay.errors.enum';
|
|
8
|
+
import { BraintreeHandler } from './session-handlers/braintree.handler';
|
|
9
|
+
import { CheckoutHandler } from './session-handlers/checkout.handler';
|
|
10
|
+
import { PaymentForm } from '../../payment/payment-form.interface';
|
|
11
|
+
import { ApplePayParamsBuilderService } from './apple-pay-params-builder.service';
|
|
12
|
+
import { ElkLoggerService } from '../../exceptions-handling/elk/elk-logger.service';
|
|
8
13
|
import * as i0 from "@angular/core";
|
|
9
14
|
export declare class ApplePayService {
|
|
10
15
|
private readonly window;
|
|
11
16
|
private readonly userAgentService;
|
|
12
17
|
private readonly summaryFinanceDetailsAdapterService;
|
|
13
|
-
private readonly
|
|
18
|
+
private readonly braintreeHandler;
|
|
19
|
+
private readonly checkoutHandler;
|
|
20
|
+
private readonly appleParamsBuilder;
|
|
21
|
+
private readonly elkLoggerService;
|
|
14
22
|
private readonly payment;
|
|
15
23
|
private readonly error;
|
|
16
24
|
private readonly integrationType;
|
|
@@ -22,24 +30,27 @@ export declare class ApplePayService {
|
|
|
22
30
|
get payment$(): Observable<string>;
|
|
23
31
|
get error$(): Observable<ApplePayErrors>;
|
|
24
32
|
get integrationType$(): Observable<ApplePayIntegration>;
|
|
25
|
-
constructor(window: ExtendedWindow, userAgentService: UserAgentService, summaryFinanceDetailsAdapterService: SummaryFinanceDetailsAdapterService);
|
|
26
|
-
setApplePayParams(data:
|
|
27
|
-
|
|
33
|
+
constructor(window: ExtendedWindow, userAgentService: UserAgentService, summaryFinanceDetailsAdapterService: SummaryFinanceDetailsAdapterService, braintreeHandler: BraintreeHandler, checkoutHandler: CheckoutHandler, appleParamsBuilder: ApplePayParamsBuilderService, elkLoggerService: ElkLoggerService);
|
|
34
|
+
setApplePayParams(data: {
|
|
35
|
+
paymentForm: PaymentForm;
|
|
36
|
+
}): void;
|
|
37
|
+
initBraintreeLibrary(tokenKey: string): Promise<void>;
|
|
28
38
|
redirectToPaymentPage(parameters: ApplePayParams, token: string, isSandbox?: boolean): string | undefined;
|
|
29
|
-
setOrder(data:
|
|
30
|
-
|
|
39
|
+
setOrder(data: {
|
|
40
|
+
paymentForm: PaymentForm;
|
|
41
|
+
}): void;
|
|
42
|
+
get isDeviceCapable(): boolean;
|
|
31
43
|
getTokenNonceFieldData(tokenNonce: string): {
|
|
32
44
|
name: string;
|
|
33
45
|
value: string;
|
|
34
46
|
};
|
|
35
47
|
updateApplePayParams(data: unknown): void;
|
|
48
|
+
proceedCheckout(parameters: ApplePayParams, iframeIntegrationEnabled?: boolean): void;
|
|
49
|
+
private getSessionHandler;
|
|
36
50
|
private loadBraintree;
|
|
37
|
-
private getAppleToken;
|
|
38
|
-
private getTotalAmount;
|
|
39
|
-
private getTotalCurrency;
|
|
40
|
-
private getJsonValueFromField;
|
|
41
51
|
private emitError;
|
|
42
52
|
private emitIntegrationType;
|
|
53
|
+
private subscribeToHandlers;
|
|
43
54
|
static ɵfac: i0.ɵɵFactoryDeclaration<ApplePayService, never>;
|
|
44
55
|
static ɵprov: i0.ɵɵInjectableDeclaration<ApplePayService>;
|
|
45
56
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ApplePay } from 'braintree-web';
|
|
2
|
+
import { ElkLoggerService } from '../../../exceptions-handling/elk/elk-logger.service';
|
|
3
|
+
import { ExtendedWindow } from '../../../extended-window.interface';
|
|
4
|
+
import { ApplePayParams } from '../apple-pay-params.interface';
|
|
5
|
+
import { ApplePaySessionHandlerAbstract } from './session-handler.abstract';
|
|
6
|
+
import * as i0 from "@angular/core";
|
|
7
|
+
export declare class BraintreeHandler extends ApplePaySessionHandlerAbstract {
|
|
8
|
+
private readonly window;
|
|
9
|
+
private readonly elkLoggerService;
|
|
10
|
+
private paymentClient;
|
|
11
|
+
constructor(window: ExtendedWindow, elkLoggerService: ElkLoggerService);
|
|
12
|
+
setClient(client: ApplePay): void;
|
|
13
|
+
startSession(params: ApplePayParams, iframeIntegrationEnabled: boolean): void;
|
|
14
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<BraintreeHandler, never>;
|
|
15
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<BraintreeHandler>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { HttpClient } from '@angular/common/http';
|
|
2
|
+
import { ExtendedWindow } from '../../../extended-window.interface';
|
|
3
|
+
import { ApplePayParams } from '../apple-pay-params.interface';
|
|
4
|
+
import { ApplePaySessionHandlerAbstract } from './session-handler.abstract';
|
|
5
|
+
import * as i0 from "@angular/core";
|
|
6
|
+
export declare class CheckoutHandler extends ApplePaySessionHandlerAbstract {
|
|
7
|
+
private readonly window;
|
|
8
|
+
private readonly http;
|
|
9
|
+
constructor(window: ExtendedWindow, http: HttpClient);
|
|
10
|
+
startSession(params: ApplePayParams, iframeIntegrationEnabled: boolean): void;
|
|
11
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CheckoutHandler, never>;
|
|
12
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<CheckoutHandler>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Observable, Subject } from 'rxjs';
|
|
2
|
+
import { ApplePayParams } from '../apple-pay-params.interface';
|
|
3
|
+
import { ApplePayErrors } from '../apple-pay.errors.enum';
|
|
4
|
+
import { ApplePayPaymentRequest } from '../apple-pay-session.interface';
|
|
5
|
+
export declare abstract class ApplePaySessionHandlerAbstract {
|
|
6
|
+
protected readonly payment: Subject<string>;
|
|
7
|
+
private readonly _errorSubject;
|
|
8
|
+
get error$(): Observable<ApplePayErrors>;
|
|
9
|
+
get payment$(): Observable<string>;
|
|
10
|
+
abstract startSession(params: ApplePayParams, iframe: boolean): void;
|
|
11
|
+
protected emitError(error: ApplePayErrors): void;
|
|
12
|
+
protected buildPaymentRequest(params: ApplePayParams): ApplePayPaymentRequest;
|
|
13
|
+
}
|
|
@@ -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
|
}
|