@xsolla/payment-client-core 0.2.49 → 0.2.51
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/sdk-payment-systems/apple-pay/apple-pay.service.mjs +3 -4
- package/esm2022/lib/core/sdk-payment-systems/apple-pay/session-handlers/braintree.handler.mjs +5 -7
- package/esm2022/lib/core/sdk-payment-systems/apple-pay/session-handlers/checkout.handler.mjs +5 -7
- package/esm2022/lib/core/sdk-payment-systems/apple-pay/session-handlers/session-handler.abstract.mjs +1 -1
- package/esm2022/lib/core/sdk-payment-systems/apple-pay/session-handlers/start-session-params.interface.mjs +2 -0
- package/esm2022/lib/core/settings/configuration.interface.mjs +1 -1
- package/esm2022/lib/core/settings/settings.service.mjs +11 -1
- package/esm2022/lib/core-library.service.mjs +6 -3
- package/fesm2022/xsolla-payment-client-core.mjs +25 -17
- package/fesm2022/xsolla-payment-client-core.mjs.map +1 -1
- package/lib/core/sdk-payment-systems/apple-pay/apple-pay.service.d.ts +2 -1
- package/lib/core/sdk-payment-systems/apple-pay/session-handlers/braintree.handler.d.ts +2 -1
- package/lib/core/sdk-payment-systems/apple-pay/session-handlers/checkout.handler.d.ts +2 -1
- package/lib/core/sdk-payment-systems/apple-pay/session-handlers/session-handler.abstract.d.ts +2 -1
- package/lib/core/sdk-payment-systems/apple-pay/session-handlers/start-session-params.interface.d.ts +4 -0
- package/lib/core/settings/configuration.interface.d.ts +2 -0
- package/lib/core/settings/settings.service.d.ts +4 -0
- package/lib/core-library.service.d.ts +2 -3
- package/package.json +1 -1
- package/xsolla-payment-client-core-0.2.51.tgz +0 -0
- package/xsolla-payment-client-core-0.2.49.tgz +0 -0
|
@@ -129,6 +129,7 @@ class SettingsService {
|
|
|
129
129
|
this.secureApi = secureApi;
|
|
130
130
|
this.isInitialized = false;
|
|
131
131
|
this._token = '';
|
|
132
|
+
this._isApplePayInstantFlowEnabled = false;
|
|
132
133
|
this.sandboxMode = false;
|
|
133
134
|
}
|
|
134
135
|
async init(configuration) {
|
|
@@ -138,9 +139,18 @@ class SettingsService {
|
|
|
138
139
|
this._token = configuration.token;
|
|
139
140
|
this.sandboxMode = !!configuration.sandbox;
|
|
140
141
|
this._refer = configuration.refer;
|
|
142
|
+
this._topLevelDomain = configuration.topLevelDomain;
|
|
143
|
+
this._isApplePayInstantFlowEnabled =
|
|
144
|
+
!!configuration.isApplePayInstantFlowEnabled;
|
|
141
145
|
await this.sendRequest(this.token);
|
|
142
146
|
this.isInitialized = true;
|
|
143
147
|
}
|
|
148
|
+
get topLevelDomain() {
|
|
149
|
+
return this._topLevelDomain;
|
|
150
|
+
}
|
|
151
|
+
get isApplePayInstantFlowEnabled() {
|
|
152
|
+
return this._isApplePayInstantFlowEnabled;
|
|
153
|
+
}
|
|
144
154
|
isSandboxMode() {
|
|
145
155
|
return this.sandboxMode;
|
|
146
156
|
}
|
|
@@ -7900,8 +7910,11 @@ class CoreLibraryService {
|
|
|
7900
7910
|
get formResponseValue() {
|
|
7901
7911
|
return this.paymentService.formResponseValue;
|
|
7902
7912
|
}
|
|
7903
|
-
get
|
|
7904
|
-
return this.settingsService.
|
|
7913
|
+
get topLevelDomain() {
|
|
7914
|
+
return this.settingsService.topLevelDomain;
|
|
7915
|
+
}
|
|
7916
|
+
get isApplePayInstantFlowEnabled() {
|
|
7917
|
+
return this.settingsService.isApplePayInstantFlowEnabled;
|
|
7905
7918
|
}
|
|
7906
7919
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: CoreLibraryService, deps: [{ token: SettingsService }, { token: CountryService }, { token: PaymentMethodsService }, { token: SavedMethodsService }, { token: UserBalanceService }, { token: PaymentConfigService }, { token: PaymentService }, { token: DeviceFingerPrintService }, { token: FinanceDetailsService }, { token: LegalService }, { token: StatusService }, { token: NextActionService }, { token: CreditCardService }, { token: CreditCardStateService }, { token: FormMessagesService }, { token: EditSavedMethodsService }, { token: UserBehaviourAnalyticsService }, { token: PerformanceService }, { token: CombinedPaymentMethodsService }, { token: CountriesApiService }, { token: SendInstructionService }, { token: ScriptTrackerService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
7907
7920
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: CoreLibraryService, providedIn: 'root' }); }
|
|
@@ -8118,7 +8131,7 @@ class BraintreeHandler extends ApplePaySessionHandlerAbstract {
|
|
|
8118
8131
|
setClient(client) {
|
|
8119
8132
|
this.paymentClient = client;
|
|
8120
8133
|
}
|
|
8121
|
-
startSession(params,
|
|
8134
|
+
startSession(params, additionalParams) {
|
|
8122
8135
|
if (!this.paymentClient) {
|
|
8123
8136
|
console.error(ApplePayErrors.braintreeInitializeError);
|
|
8124
8137
|
this.elkLoggerService.log(ApplePayErrors.braintreeInitializeError, [
|
|
@@ -8129,15 +8142,15 @@ class BraintreeHandler extends ApplePaySessionHandlerAbstract {
|
|
|
8129
8142
|
const request = this.buildPaymentRequest(params);
|
|
8130
8143
|
const applePayRequest = this.paymentClient.createPaymentRequest(request);
|
|
8131
8144
|
const session = new this.window.ApplePaySession(applePayVersion, applePayRequest);
|
|
8145
|
+
const { isApplePayInstantFlowEnabled, topLevelDomain } = additionalParams;
|
|
8132
8146
|
session.onvalidatemerchant = (event) => {
|
|
8133
8147
|
const validationParams = {
|
|
8134
8148
|
validationURL: event.validationURL,
|
|
8135
8149
|
displayName: params.totalLabel,
|
|
8136
8150
|
};
|
|
8137
|
-
|
|
8138
|
-
if (iframeIntegrationEnabled && params.topLevelDomain) {
|
|
8151
|
+
if (isApplePayInstantFlowEnabled && topLevelDomain) {
|
|
8139
8152
|
// @ts-expect-error unknown property
|
|
8140
|
-
validationParams.domainName =
|
|
8153
|
+
validationParams.domainName = topLevelDomain;
|
|
8141
8154
|
}
|
|
8142
8155
|
this.paymentClient
|
|
8143
8156
|
?.performValidation(validationParams)
|
|
@@ -8153,7 +8166,6 @@ class BraintreeHandler extends ApplePaySessionHandlerAbstract {
|
|
|
8153
8166
|
this.paymentClient
|
|
8154
8167
|
?.tokenize({ token: event.payment.token })
|
|
8155
8168
|
.then((response) => {
|
|
8156
|
-
console.log('🟡[LOG] braintree response :>>', response);
|
|
8157
8169
|
this.payment.next(JSON.stringify({
|
|
8158
8170
|
token: response?.nonce ?? '',
|
|
8159
8171
|
email: event.payment.billingContact?.emailAddress ?? null,
|
|
@@ -8162,7 +8174,6 @@ class BraintreeHandler extends ApplePaySessionHandlerAbstract {
|
|
|
8162
8174
|
session.completePayment(this.window.ApplePaySession.STATUS_SUCCESS);
|
|
8163
8175
|
})
|
|
8164
8176
|
.catch((error) => {
|
|
8165
|
-
console.log('🟡[LOG] braintree error :>>', error);
|
|
8166
8177
|
console.error('Apple Pay: Tokenization error', error);
|
|
8167
8178
|
session.completePayment(this.window.ApplePaySession.STATUS_FAILURE);
|
|
8168
8179
|
});
|
|
@@ -8189,7 +8200,7 @@ class CheckoutHandler extends ApplePaySessionHandlerAbstract {
|
|
|
8189
8200
|
this.window = window;
|
|
8190
8201
|
this.http = http;
|
|
8191
8202
|
}
|
|
8192
|
-
startSession(params,
|
|
8203
|
+
startSession(params, additionalParams) {
|
|
8193
8204
|
const request = this.buildPaymentRequest(params);
|
|
8194
8205
|
const session = new this.window.ApplePaySession(applePayVersion, request);
|
|
8195
8206
|
session.onvalidatemerchant = (event) => {
|
|
@@ -8198,10 +8209,10 @@ class CheckoutHandler extends ApplePaySessionHandlerAbstract {
|
|
|
8198
8209
|
accountId: params.payInstanceAccountId,
|
|
8199
8210
|
isSandbox: params.isSandbox,
|
|
8200
8211
|
};
|
|
8201
|
-
|
|
8202
|
-
if (
|
|
8212
|
+
const { isApplePayInstantFlowEnabled, topLevelDomain } = additionalParams;
|
|
8213
|
+
if (isApplePayInstantFlowEnabled && topLevelDomain) {
|
|
8203
8214
|
// @ts-expect-error unknown property
|
|
8204
|
-
validationParams.domainName =
|
|
8215
|
+
validationParams.domainName = topLevelDomain;
|
|
8205
8216
|
}
|
|
8206
8217
|
this.http
|
|
8207
8218
|
.post(params.getApplePaySessionUrl, JSON.stringify(validationParams), {
|
|
@@ -8209,7 +8220,6 @@ class CheckoutHandler extends ApplePaySessionHandlerAbstract {
|
|
|
8209
8220
|
})
|
|
8210
8221
|
.subscribe({
|
|
8211
8222
|
next: (response) => {
|
|
8212
|
-
console.log('🟡[LOG] checkout http response :>>', response);
|
|
8213
8223
|
session.completeMerchantValidation(response.merchantSession);
|
|
8214
8224
|
},
|
|
8215
8225
|
error: (error) => {
|
|
@@ -8219,7 +8229,6 @@ class CheckoutHandler extends ApplePaySessionHandlerAbstract {
|
|
|
8219
8229
|
});
|
|
8220
8230
|
};
|
|
8221
8231
|
session.onpaymentauthorized = (event) => {
|
|
8222
|
-
console.log('🟡[LOG] checkout onpaymentauthorized :>>', event);
|
|
8223
8232
|
this.payment.next(JSON.stringify({
|
|
8224
8233
|
token: event.payment.token ?? '',
|
|
8225
8234
|
email: event.payment.billingContact?.emailAddress ?? null,
|
|
@@ -9016,13 +9025,13 @@ class ApplePayService {
|
|
|
9016
9025
|
}
|
|
9017
9026
|
this.applePayParams = this.appleParamsBuilder.updateParams(this.applePayParams, summary);
|
|
9018
9027
|
}
|
|
9019
|
-
proceedCheckout(parameters,
|
|
9028
|
+
proceedCheckout(parameters, additionalParams) {
|
|
9020
9029
|
const sessionHandler = this.getSessionHandler(parameters.acquirer);
|
|
9021
9030
|
if (!sessionHandler) {
|
|
9022
9031
|
console.error('Apple Pay: Unsupported acquirer:', parameters.acquirer);
|
|
9023
9032
|
return;
|
|
9024
9033
|
}
|
|
9025
|
-
sessionHandler.startSession(parameters,
|
|
9034
|
+
sessionHandler.startSession(parameters, additionalParams);
|
|
9026
9035
|
}
|
|
9027
9036
|
getSessionHandler(acquirer) {
|
|
9028
9037
|
switch (acquirer) {
|
|
@@ -9054,7 +9063,6 @@ class ApplePayService {
|
|
|
9054
9063
|
handlers.forEach((handler) => {
|
|
9055
9064
|
handler.error$.subscribe((error) => this.emitError(error));
|
|
9056
9065
|
handler.payment$.subscribe((token) => {
|
|
9057
|
-
console.log('🟡[LOG] payment token :>>', token);
|
|
9058
9066
|
this.payment.next(token);
|
|
9059
9067
|
});
|
|
9060
9068
|
});
|