@xsolla/payment-client-core 0.2.32 → 0.2.34
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/agreementsGroup.const.mjs +4 -1
- package/esm2022/lib/core/payment/actions/show-cash-payment-instruction/show-cash-payment-instruction.action.class.mjs +2 -3
- package/esm2022/lib/core/payment/field-names.enum.mjs +13 -1
- package/esm2022/lib/core/payment/payment.service.mjs +2 -3
- package/esm2022/lib/core/sdk-payment-systems/apple-pay/apple-pay-integration.type.mjs +1 -1
- package/esm2022/lib/core/sdk-payment-systems/apple-pay/apple-pay.const.mjs +1 -2
- package/esm2022/lib/core/sdk-payment-systems/apple-pay/apple-pay.service.mjs +25 -82
- package/esm2022/lib/core/sdk-payment-systems/apple-pay/checkout-params.interface.mjs +1 -1
- package/fesm2022/xsolla-payment-client-core.mjs +40 -85
- package/fesm2022/xsolla-payment-client-core.mjs.map +1 -1
- package/lib/core/payment/field-names.enum.d.ts +13 -1
- package/lib/core/sdk-payment-systems/apple-pay/apple-pay-integration.type.d.ts +1 -1
- package/lib/core/sdk-payment-systems/apple-pay/apple-pay.const.d.ts +0 -1
- package/lib/core/sdk-payment-systems/apple-pay/apple-pay.service.d.ts +0 -2
- package/lib/core/sdk-payment-systems/apple-pay/checkout-params.interface.d.ts +3 -1
- package/package.json +1 -1
- package/xsolla-payment-client-core-0.2.34.tgz +0 -0
- package/xsolla-payment-client-core-0.2.32.tgz +0 -0
|
@@ -560,6 +560,7 @@ var FieldNames;
|
|
|
560
560
|
FieldNames["termsAndConditionsRolandEula"] = "termsAndConditionsRolandEula";
|
|
561
561
|
FieldNames["termsAndConditionsDeusLoVultEula"] = "termsAndConditionsDeusLoVultEula";
|
|
562
562
|
FieldNames["termsAndConditionsOnzenga"] = "termsAndConditionsOnzenga";
|
|
563
|
+
FieldNames["licenseDisclaimer"] = "licenseDisclaimer";
|
|
563
564
|
FieldNames["xsollaTipsAmount"] = "xsollaTipsAmount";
|
|
564
565
|
FieldNames["zip"] = "zip";
|
|
565
566
|
FieldNames["allowSave"] = "allowSave";
|
|
@@ -575,6 +576,17 @@ var FieldNames;
|
|
|
575
576
|
FieldNames["ppEmail"] = "pp_email";
|
|
576
577
|
FieldNames["redeemPoints"] = "redeemPoints";
|
|
577
578
|
FieldNames["omnibusDirective"] = "omnibus_directive";
|
|
579
|
+
FieldNames["labelApplePay"] = "label_applePay";
|
|
580
|
+
FieldNames["countryCode"] = "countryCode";
|
|
581
|
+
FieldNames["merchantCapabilities"] = "merchantCapabilities";
|
|
582
|
+
FieldNames["requiredBillingContactFields"] = "requiredBillingContactFields";
|
|
583
|
+
FieldNames["requiredShippingContactFields"] = "requiredShippingContactFields";
|
|
584
|
+
FieldNames["supportedNetworks"] = "supportedNetworks";
|
|
585
|
+
FieldNames["acquirer"] = "acquirer";
|
|
586
|
+
FieldNames["isSandbox"] = "isSandbox";
|
|
587
|
+
FieldNames["payInstanceAccountId"] = "payInstanceAccountId";
|
|
588
|
+
FieldNames["getApplePaySessionUrl"] = "getApplePaySessionUrl";
|
|
589
|
+
FieldNames["payViaCheckoutUrl"] = "payViaCheckoutUrl";
|
|
578
590
|
})(FieldNames || (FieldNames = {}));
|
|
579
591
|
|
|
580
592
|
class SubmitResponse {
|
|
@@ -1738,8 +1750,7 @@ class ShowCashPaymentInstructionActionCreator {
|
|
|
1738
1750
|
};
|
|
1739
1751
|
}
|
|
1740
1752
|
isSuitable(response) {
|
|
1741
|
-
|
|
1742
|
-
return (response.fields || []).some((field) => field.name === 'payment_instruction' || field.name === 'email_info');
|
|
1753
|
+
return (response.fields || []).some((field) => field.name === 'payment_instruction');
|
|
1743
1754
|
}
|
|
1744
1755
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: ShowCashPaymentInstructionActionCreator, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1745
1756
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: ShowCashPaymentInstructionActionCreator }); }
|
|
@@ -6557,8 +6568,7 @@ class PaymentService {
|
|
|
6557
6568
|
if (!isSubmitResponse(this.data)) {
|
|
6558
6569
|
throw new Error('Should submit form first');
|
|
6559
6570
|
}
|
|
6560
|
-
|
|
6561
|
-
const cashInstructionField = this.data.fields.find((field) => field.name === 'payment_instruction' || field.name === 'email_info');
|
|
6571
|
+
const cashInstructionField = this.data.fields.find((field) => field.name === 'payment_instruction');
|
|
6562
6572
|
const params = {
|
|
6563
6573
|
isCashPaymentMethod: !!cashInstructionField,
|
|
6564
6574
|
xsollaNumber: this.data.xsollaNumber.accountXsolla,
|
|
@@ -7951,19 +7961,21 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImpor
|
|
|
7951
7961
|
}] }, { type: PaymentSystemProcessingService }, { type: i0.Injector }] });
|
|
7952
7962
|
|
|
7953
7963
|
const applePayVersion = 3;
|
|
7954
|
-
const safariVersionForIframeIntegration = 17;
|
|
7955
7964
|
|
|
7956
7965
|
const agreementsGroup = [
|
|
7966
|
+
FieldNames.licenseDisclaimer,
|
|
7957
7967
|
FieldNames.termsAndConditions,
|
|
7958
7968
|
FieldNames.termsAndConditionsHtcEula,
|
|
7959
7969
|
FieldNames.termsAndConditionsAtariTc,
|
|
7960
7970
|
FieldNames.termsAndConditionsAtariPp,
|
|
7961
7971
|
FieldNames.termsAndConditionsRolandEula,
|
|
7962
7972
|
FieldNames.termsAndConditionsRobloxEula,
|
|
7973
|
+
FieldNames.termsAndConditionsDeusLoVultEula,
|
|
7963
7974
|
FieldNames.termsAndConditionsOnzenga,
|
|
7964
7975
|
FieldNames.take2Taxes,
|
|
7965
7976
|
FieldNames.rockstarTaxes,
|
|
7966
7977
|
FieldNames.omnibusDirective,
|
|
7978
|
+
FieldNames.koreaLimitsInstruction,
|
|
7967
7979
|
];
|
|
7968
7980
|
|
|
7969
7981
|
var ApplePayErrors;
|
|
@@ -8015,22 +8027,27 @@ class ApplePayService {
|
|
|
8015
8027
|
return acc;
|
|
8016
8028
|
}, {});
|
|
8017
8029
|
const agreements = this.agreementFieldsNames
|
|
8018
|
-
.map((fieldName) => fields[fieldName])
|
|
8019
|
-
.filter(
|
|
8030
|
+
.map((fieldName) => [fieldName, fields[fieldName]])
|
|
8031
|
+
.filter((fieldEntry) => {
|
|
8032
|
+
const [, value] = fieldEntry;
|
|
8033
|
+
return !!value;
|
|
8034
|
+
});
|
|
8020
8035
|
this.applePayParams = {
|
|
8021
8036
|
tokenKey: this.getAppleToken(formFields),
|
|
8022
|
-
totalLabel: fields[
|
|
8037
|
+
totalLabel: fields[FieldNames.labelApplePay] ?? '',
|
|
8023
8038
|
totalAmount: this.getTotalAmount(summary),
|
|
8024
8039
|
currencyCode: this.getTotalCurrency(summary),
|
|
8025
|
-
countryCode: fields[
|
|
8026
|
-
merchantCapabilities: this.getJsonValueFromField(fields,
|
|
8027
|
-
|
|
8040
|
+
countryCode: fields[FieldNames.countryCode] ?? '',
|
|
8041
|
+
merchantCapabilities: this.getJsonValueFromField(fields, FieldNames.merchantCapabilities),
|
|
8042
|
+
requiredBillingContactFields: this.getJsonValueFromField(fields, FieldNames.requiredBillingContactFields),
|
|
8043
|
+
requiredShippingContactFields: this.getJsonValueFromField(fields, FieldNames.requiredShippingContactFields),
|
|
8044
|
+
supportedNetworks: this.getJsonValueFromField(fields, FieldNames.supportedNetworks),
|
|
8028
8045
|
agreements: agreements,
|
|
8029
|
-
acquirer: fields[
|
|
8030
|
-
isSandbox: fields[
|
|
8031
|
-
payInstanceAccountId: fields[
|
|
8032
|
-
getApplePaySessionUrl: fields[
|
|
8033
|
-
payViaCheckoutUrl: fields[
|
|
8046
|
+
acquirer: fields[FieldNames.acquirer] ?? '',
|
|
8047
|
+
isSandbox: fields[FieldNames.isSandbox] ?? '',
|
|
8048
|
+
payInstanceAccountId: fields[FieldNames.payInstanceAccountId] ?? '',
|
|
8049
|
+
getApplePaySessionUrl: fields[FieldNames.getApplePaySessionUrl] ?? '',
|
|
8050
|
+
payViaCheckoutUrl: fields[FieldNames.payViaCheckoutUrl] ?? '',
|
|
8034
8051
|
};
|
|
8035
8052
|
}
|
|
8036
8053
|
async initLibrary(tokenKey) {
|
|
@@ -8060,8 +8077,10 @@ class ApplePayService {
|
|
|
8060
8077
|
...parameters,
|
|
8061
8078
|
merchantCapabilities: JSON.stringify(parameters.merchantCapabilities),
|
|
8062
8079
|
supportedNetworks: JSON.stringify(parameters.supportedNetworks),
|
|
8063
|
-
|
|
8080
|
+
requiredBillingContactFields: JSON.stringify(parameters?.requiredBillingContactFields),
|
|
8081
|
+
requiredShippingContactFields: JSON.stringify(parameters?.requiredShippingContactFields),
|
|
8064
8082
|
agreements: JSON.stringify(parameters.agreements),
|
|
8083
|
+
token,
|
|
8065
8084
|
});
|
|
8066
8085
|
if (this.order) {
|
|
8067
8086
|
query.append('order', this.order);
|
|
@@ -8085,71 +8104,11 @@ class ApplePayService {
|
|
|
8085
8104
|
}, '');
|
|
8086
8105
|
}
|
|
8087
8106
|
}
|
|
8088
|
-
proceedCheckout(parameters) {
|
|
8089
|
-
if (!parameters) {
|
|
8090
|
-
return;
|
|
8091
|
-
}
|
|
8092
|
-
if (!this.paymentClient || !this.isDeviceCapable()) {
|
|
8093
|
-
console.warn('apple pay: device is not capable', this.paymentClient);
|
|
8094
|
-
this.emitError(ApplePayErrors.deviceIsNotCapableError);
|
|
8095
|
-
return;
|
|
8096
|
-
}
|
|
8097
|
-
try {
|
|
8098
|
-
const paymentRequest = this.paymentClient.createPaymentRequest({
|
|
8099
|
-
total: {
|
|
8100
|
-
label: parameters.totalLabel,
|
|
8101
|
-
amount: parameters.totalAmount,
|
|
8102
|
-
},
|
|
8103
|
-
currencyCode: parameters.currencyCode,
|
|
8104
|
-
countryCode: parameters.countryCode,
|
|
8105
|
-
merchantCapabilities: parameters.merchantCapabilities,
|
|
8106
|
-
supportedNetworks: parameters.supportedNetworks,
|
|
8107
|
-
});
|
|
8108
|
-
const session = new this.window.ApplePaySession(applePayVersion, paymentRequest);
|
|
8109
|
-
session.onvalidatemerchant = (event) => {
|
|
8110
|
-
console.info('apple pay: merchant validation', event);
|
|
8111
|
-
this.paymentClient
|
|
8112
|
-
?.performValidation({
|
|
8113
|
-
validationURL: event.validationURL,
|
|
8114
|
-
displayName: parameters?.totalLabel,
|
|
8115
|
-
})
|
|
8116
|
-
.then((merchantSession) => {
|
|
8117
|
-
session.completeMerchantValidation(merchantSession);
|
|
8118
|
-
})
|
|
8119
|
-
.catch((error) => {
|
|
8120
|
-
console.error('apple pay: merchant validation error', error);
|
|
8121
|
-
this.emitError(ApplePayErrors.paymentError);
|
|
8122
|
-
session.abort();
|
|
8123
|
-
});
|
|
8124
|
-
};
|
|
8125
|
-
session.onpaymentauthorized = (event) => {
|
|
8126
|
-
console.info('apple pay: payment authorization', event);
|
|
8127
|
-
this.paymentClient
|
|
8128
|
-
?.tokenize({
|
|
8129
|
-
token: event.payment.token,
|
|
8130
|
-
})
|
|
8131
|
-
.then((authorizationResponse) => {
|
|
8132
|
-
this.payment.next(authorizationResponse?.nonce ?? '');
|
|
8133
|
-
session.completePayment(this.window.ApplePaySession.STATUS_SUCCESS);
|
|
8134
|
-
})
|
|
8135
|
-
.catch((error) => {
|
|
8136
|
-
console.error('apple pay: payment authorization error', error);
|
|
8137
|
-
this.emitError(ApplePayErrors.paymentError);
|
|
8138
|
-
session.completePayment(this.window.ApplePaySession.STATUS_FAILURE);
|
|
8139
|
-
});
|
|
8140
|
-
};
|
|
8141
|
-
session.oncancel = (event) => {
|
|
8142
|
-
this.emitError(ApplePayErrors.paymentError);
|
|
8143
|
-
console.error('apple pay: user cancel payment', event);
|
|
8144
|
-
};
|
|
8145
|
-
session.begin();
|
|
8146
|
-
}
|
|
8147
|
-
catch (error) {
|
|
8148
|
-
console.error('apple pay: checkout error', error);
|
|
8149
|
-
this.emitError(ApplePayErrors.paymentError);
|
|
8150
|
-
}
|
|
8151
|
-
}
|
|
8152
8107
|
isDeviceCapable() {
|
|
8108
|
+
// Apple SDK is used on non-Safari devices.
|
|
8109
|
+
// Support of ApplePay payments will be defined on the external PS4 page
|
|
8110
|
+
if (!this.userAgentService.isSafari)
|
|
8111
|
+
return true;
|
|
8153
8112
|
try {
|
|
8154
8113
|
return Boolean(this.window.ApplePaySession?.supportsVersion(applePayVersion) &&
|
|
8155
8114
|
this.window.ApplePaySession?.canMakePayments());
|
|
@@ -8215,10 +8174,6 @@ class ApplePayService {
|
|
|
8215
8174
|
}
|
|
8216
8175
|
this.integrationType.next(integrationType);
|
|
8217
8176
|
}
|
|
8218
|
-
canUseSdk() {
|
|
8219
|
-
return !!(this.userAgentService.safariVersion &&
|
|
8220
|
-
this.userAgentService.safariVersion >= safariVersionForIframeIntegration);
|
|
8221
|
-
}
|
|
8222
8177
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: ApplePayService, deps: [{ token: windowToken }, { token: UserAgentService }, { token: SummaryFinanceDetailsAdapterService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
8223
8178
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: ApplePayService, providedIn: 'root' }); }
|
|
8224
8179
|
}
|