@xsolla/payment-client-core 0.2.49 → 0.2.50
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 +12 -1
- package/esm2022/lib/core-library.service.mjs +6 -3
- package/fesm2022/xsolla-payment-client-core.mjs +26 -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.50.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,19 @@ 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
|
+
!!this.project.isApplePayIframeIntegrationTurnedOn);
|
|
154
|
+
}
|
|
144
155
|
isSandboxMode() {
|
|
145
156
|
return this.sandboxMode;
|
|
146
157
|
}
|
|
@@ -7900,8 +7911,11 @@ class CoreLibraryService {
|
|
|
7900
7911
|
get formResponseValue() {
|
|
7901
7912
|
return this.paymentService.formResponseValue;
|
|
7902
7913
|
}
|
|
7903
|
-
get
|
|
7904
|
-
return this.settingsService.
|
|
7914
|
+
get topLevelDomain() {
|
|
7915
|
+
return this.settingsService.topLevelDomain;
|
|
7916
|
+
}
|
|
7917
|
+
get isApplePayInstantFlowEnabled() {
|
|
7918
|
+
return this.settingsService.isApplePayInstantFlowEnabled;
|
|
7905
7919
|
}
|
|
7906
7920
|
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
7921
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: CoreLibraryService, providedIn: 'root' }); }
|
|
@@ -8118,7 +8132,7 @@ class BraintreeHandler extends ApplePaySessionHandlerAbstract {
|
|
|
8118
8132
|
setClient(client) {
|
|
8119
8133
|
this.paymentClient = client;
|
|
8120
8134
|
}
|
|
8121
|
-
startSession(params,
|
|
8135
|
+
startSession(params, additionalParams) {
|
|
8122
8136
|
if (!this.paymentClient) {
|
|
8123
8137
|
console.error(ApplePayErrors.braintreeInitializeError);
|
|
8124
8138
|
this.elkLoggerService.log(ApplePayErrors.braintreeInitializeError, [
|
|
@@ -8129,15 +8143,15 @@ class BraintreeHandler extends ApplePaySessionHandlerAbstract {
|
|
|
8129
8143
|
const request = this.buildPaymentRequest(params);
|
|
8130
8144
|
const applePayRequest = this.paymentClient.createPaymentRequest(request);
|
|
8131
8145
|
const session = new this.window.ApplePaySession(applePayVersion, applePayRequest);
|
|
8146
|
+
const { isApplePayInstantFlowEnabled, topLevelDomain } = additionalParams;
|
|
8132
8147
|
session.onvalidatemerchant = (event) => {
|
|
8133
8148
|
const validationParams = {
|
|
8134
8149
|
validationURL: event.validationURL,
|
|
8135
8150
|
displayName: params.totalLabel,
|
|
8136
8151
|
};
|
|
8137
|
-
|
|
8138
|
-
if (iframeIntegrationEnabled && params.topLevelDomain) {
|
|
8152
|
+
if (isApplePayInstantFlowEnabled && topLevelDomain) {
|
|
8139
8153
|
// @ts-expect-error unknown property
|
|
8140
|
-
validationParams.domainName =
|
|
8154
|
+
validationParams.domainName = topLevelDomain;
|
|
8141
8155
|
}
|
|
8142
8156
|
this.paymentClient
|
|
8143
8157
|
?.performValidation(validationParams)
|
|
@@ -8153,7 +8167,6 @@ class BraintreeHandler extends ApplePaySessionHandlerAbstract {
|
|
|
8153
8167
|
this.paymentClient
|
|
8154
8168
|
?.tokenize({ token: event.payment.token })
|
|
8155
8169
|
.then((response) => {
|
|
8156
|
-
console.log('🟡[LOG] braintree response :>>', response);
|
|
8157
8170
|
this.payment.next(JSON.stringify({
|
|
8158
8171
|
token: response?.nonce ?? '',
|
|
8159
8172
|
email: event.payment.billingContact?.emailAddress ?? null,
|
|
@@ -8162,7 +8175,6 @@ class BraintreeHandler extends ApplePaySessionHandlerAbstract {
|
|
|
8162
8175
|
session.completePayment(this.window.ApplePaySession.STATUS_SUCCESS);
|
|
8163
8176
|
})
|
|
8164
8177
|
.catch((error) => {
|
|
8165
|
-
console.log('🟡[LOG] braintree error :>>', error);
|
|
8166
8178
|
console.error('Apple Pay: Tokenization error', error);
|
|
8167
8179
|
session.completePayment(this.window.ApplePaySession.STATUS_FAILURE);
|
|
8168
8180
|
});
|
|
@@ -8189,7 +8201,7 @@ class CheckoutHandler extends ApplePaySessionHandlerAbstract {
|
|
|
8189
8201
|
this.window = window;
|
|
8190
8202
|
this.http = http;
|
|
8191
8203
|
}
|
|
8192
|
-
startSession(params,
|
|
8204
|
+
startSession(params, additionalParams) {
|
|
8193
8205
|
const request = this.buildPaymentRequest(params);
|
|
8194
8206
|
const session = new this.window.ApplePaySession(applePayVersion, request);
|
|
8195
8207
|
session.onvalidatemerchant = (event) => {
|
|
@@ -8198,10 +8210,10 @@ class CheckoutHandler extends ApplePaySessionHandlerAbstract {
|
|
|
8198
8210
|
accountId: params.payInstanceAccountId,
|
|
8199
8211
|
isSandbox: params.isSandbox,
|
|
8200
8212
|
};
|
|
8201
|
-
|
|
8202
|
-
if (
|
|
8213
|
+
const { isApplePayInstantFlowEnabled, topLevelDomain } = additionalParams;
|
|
8214
|
+
if (isApplePayInstantFlowEnabled && topLevelDomain) {
|
|
8203
8215
|
// @ts-expect-error unknown property
|
|
8204
|
-
validationParams.domainName =
|
|
8216
|
+
validationParams.domainName = topLevelDomain;
|
|
8205
8217
|
}
|
|
8206
8218
|
this.http
|
|
8207
8219
|
.post(params.getApplePaySessionUrl, JSON.stringify(validationParams), {
|
|
@@ -8209,7 +8221,6 @@ class CheckoutHandler extends ApplePaySessionHandlerAbstract {
|
|
|
8209
8221
|
})
|
|
8210
8222
|
.subscribe({
|
|
8211
8223
|
next: (response) => {
|
|
8212
|
-
console.log('🟡[LOG] checkout http response :>>', response);
|
|
8213
8224
|
session.completeMerchantValidation(response.merchantSession);
|
|
8214
8225
|
},
|
|
8215
8226
|
error: (error) => {
|
|
@@ -8219,7 +8230,6 @@ class CheckoutHandler extends ApplePaySessionHandlerAbstract {
|
|
|
8219
8230
|
});
|
|
8220
8231
|
};
|
|
8221
8232
|
session.onpaymentauthorized = (event) => {
|
|
8222
|
-
console.log('🟡[LOG] checkout onpaymentauthorized :>>', event);
|
|
8223
8233
|
this.payment.next(JSON.stringify({
|
|
8224
8234
|
token: event.payment.token ?? '',
|
|
8225
8235
|
email: event.payment.billingContact?.emailAddress ?? null,
|
|
@@ -9016,13 +9026,13 @@ class ApplePayService {
|
|
|
9016
9026
|
}
|
|
9017
9027
|
this.applePayParams = this.appleParamsBuilder.updateParams(this.applePayParams, summary);
|
|
9018
9028
|
}
|
|
9019
|
-
proceedCheckout(parameters,
|
|
9029
|
+
proceedCheckout(parameters, additionalParams) {
|
|
9020
9030
|
const sessionHandler = this.getSessionHandler(parameters.acquirer);
|
|
9021
9031
|
if (!sessionHandler) {
|
|
9022
9032
|
console.error('Apple Pay: Unsupported acquirer:', parameters.acquirer);
|
|
9023
9033
|
return;
|
|
9024
9034
|
}
|
|
9025
|
-
sessionHandler.startSession(parameters,
|
|
9035
|
+
sessionHandler.startSession(parameters, additionalParams);
|
|
9026
9036
|
}
|
|
9027
9037
|
getSessionHandler(acquirer) {
|
|
9028
9038
|
switch (acquirer) {
|
|
@@ -9054,7 +9064,6 @@ class ApplePayService {
|
|
|
9054
9064
|
handlers.forEach((handler) => {
|
|
9055
9065
|
handler.error$.subscribe((error) => this.emitError(error));
|
|
9056
9066
|
handler.payment$.subscribe((token) => {
|
|
9057
|
-
console.log('🟡[LOG] payment token :>>', token);
|
|
9058
9067
|
this.payment.next(token);
|
|
9059
9068
|
});
|
|
9060
9069
|
});
|