@xsolla/payment-client-core 0.1.21 → 0.1.22
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/esm2020/lib/core/payment/actions/next-action.service.mjs +7 -5
- package/esm2020/lib/core/payment/actions/redirect/pay-station4-url.const.mjs +3 -0
- package/esm2020/lib/core/payment/actions/redirect/ps4-pages/pages-payment-methods-id.const.mjs +7 -0
- package/esm2020/lib/core/payment/actions/redirect/ps4-pages/pages-routes.const.mjs +9 -0
- package/esm2020/lib/core/payment/actions/redirect/redirect.action.class.mjs +23 -5
- package/fesm2015/xsolla-payment-client-core.mjs +44 -8
- package/fesm2015/xsolla-payment-client-core.mjs.map +1 -1
- package/fesm2020/xsolla-payment-client-core.mjs +43 -8
- package/fesm2020/xsolla-payment-client-core.mjs.map +1 -1
- package/lib/core/payment/actions/next-action.service.d.ts +3 -1
- package/lib/core/payment/actions/redirect/pay-station4-url.const.d.ts +2 -0
- package/lib/core/payment/actions/redirect/ps4-pages/pages-payment-methods-id.const.d.ts +6 -0
- package/lib/core/payment/actions/redirect/ps4-pages/pages-routes.const.d.ts +1 -0
- package/lib/core/payment/actions/redirect/redirect.action.class.d.ts +3 -1
- package/package.json +1 -1
- package/xsolla-payment-client-core-0.1.22.tgz +0 -0
- package/xsolla-payment-client-core-0.1.21.tgz +0 -0
|
@@ -952,8 +952,26 @@ const statusUpdatedActionFactoryProvider = {
|
|
|
952
952
|
},
|
|
953
953
|
};
|
|
954
954
|
|
|
955
|
+
const vkPay = 3496;
|
|
956
|
+
const googlePay = 3431;
|
|
957
|
+
const applePay = 3175;
|
|
958
|
+
const barzahlenPay = 1679;
|
|
959
|
+
const naverPay = 3563;
|
|
960
|
+
const venmoPay = 3636;
|
|
961
|
+
|
|
962
|
+
const pagesRoutes = new Map([
|
|
963
|
+
[vkPay, '/payment/external-pages/vk-pay'],
|
|
964
|
+
[applePay, '/payment/external-pages/apple-pay'],
|
|
965
|
+
[barzahlenPay, '/payment/external-pages/barzahlen-pay'],
|
|
966
|
+
[naverPay, '/payment/external-pages/naver-pay'],
|
|
967
|
+
[venmoPay, '/payment/external-pages/venmo-pay'],
|
|
968
|
+
]);
|
|
969
|
+
|
|
970
|
+
const payStation4Url = 'https://secure.xsolla.com/paystation4';
|
|
971
|
+
const sandboxPayStationUrl = 'https://sandbox-secure.xsolla.com/paystation4';
|
|
972
|
+
|
|
955
973
|
class RedirectAction {
|
|
956
|
-
constructor(submitResponse) {
|
|
974
|
+
constructor(submitResponse, token, isSandbox) {
|
|
957
975
|
this.type = 'redirect';
|
|
958
976
|
this.data = {
|
|
959
977
|
fields: submitResponse.fields,
|
|
@@ -961,15 +979,31 @@ class RedirectAction {
|
|
|
961
979
|
messages: submitResponse.messages,
|
|
962
980
|
order: submitResponse.summary,
|
|
963
981
|
invoiceId: submitResponse.fixInvoice,
|
|
964
|
-
redirect: this.getRedirect(submitResponse),
|
|
982
|
+
redirect: this.getRedirect(submitResponse, token, isSandbox),
|
|
965
983
|
};
|
|
966
984
|
}
|
|
967
|
-
getRedirect(submitResponse) {
|
|
985
|
+
getRedirect(submitResponse, token, isSandbox) {
|
|
968
986
|
return {
|
|
969
|
-
redirectUrl: submitResponse
|
|
987
|
+
redirectUrl: this.getRedirectUrl(submitResponse, token, isSandbox),
|
|
970
988
|
data: submitResponse.parameters.checkout.data,
|
|
971
989
|
};
|
|
972
990
|
}
|
|
991
|
+
getRedirectUrl(submitResponse, token, isSandbox) {
|
|
992
|
+
const responseRedirectUrl = submitResponse.parameters.checkout.action;
|
|
993
|
+
const pid = submitResponse?.fields?.find(({ name }) => name === 'fix_pid')?.value;
|
|
994
|
+
if (!pid) {
|
|
995
|
+
return responseRedirectUrl;
|
|
996
|
+
}
|
|
997
|
+
const pagesPath = pagesRoutes.get(Number(pid));
|
|
998
|
+
if (!pagesPath) {
|
|
999
|
+
return responseRedirectUrl;
|
|
1000
|
+
}
|
|
1001
|
+
return this.preparePagesUrl(pagesPath, token, isSandbox);
|
|
1002
|
+
}
|
|
1003
|
+
preparePagesUrl(pagesPath, token, isSandbox) {
|
|
1004
|
+
const payStationUrl = isSandbox ? sandboxPayStationUrl : payStation4Url;
|
|
1005
|
+
return `${payStationUrl}/en${pagesPath}?token=${token}`;
|
|
1006
|
+
}
|
|
973
1007
|
}
|
|
974
1008
|
|
|
975
1009
|
const redirectActionFactoryToken = new InjectionToken('RedirectAction');
|
|
@@ -1028,9 +1062,10 @@ class NextActionService {
|
|
|
1028
1062
|
get flowUpdates$() {
|
|
1029
1063
|
return this.flowUpdatesSubject.asObservable();
|
|
1030
1064
|
}
|
|
1031
|
-
constructor(nextActionTokens, injector) {
|
|
1065
|
+
constructor(nextActionTokens, injector, settingsService) {
|
|
1032
1066
|
this.nextActionTokens = nextActionTokens;
|
|
1033
1067
|
this.injector = injector;
|
|
1068
|
+
this.settingsService = settingsService;
|
|
1034
1069
|
this.flowUpdatesSubject = new Subject();
|
|
1035
1070
|
this.nextActionsList = [];
|
|
1036
1071
|
this.fillNextActionsList();
|
|
@@ -1044,7 +1079,7 @@ class NextActionService {
|
|
|
1044
1079
|
}
|
|
1045
1080
|
const nextActionFactory = this.findNextAction(submitResponse);
|
|
1046
1081
|
if (nextActionFactory) {
|
|
1047
|
-
return nextActionFactory(submitResponse);
|
|
1082
|
+
return nextActionFactory(submitResponse, this.settingsService.token, this.settingsService.isSandboxMode());
|
|
1048
1083
|
}
|
|
1049
1084
|
throw new Error('Next action is undefined.');
|
|
1050
1085
|
}
|
|
@@ -1067,7 +1102,7 @@ class NextActionService {
|
|
|
1067
1102
|
return actionType.factory;
|
|
1068
1103
|
}
|
|
1069
1104
|
}
|
|
1070
|
-
NextActionService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: NextActionService, deps: [{ token: nextActionsToken }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1105
|
+
NextActionService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: NextActionService, deps: [{ token: nextActionsToken }, { token: i0.Injector }, { token: SettingsService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1071
1106
|
NextActionService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: NextActionService, providedIn: 'root' });
|
|
1072
1107
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: NextActionService, decorators: [{
|
|
1073
1108
|
type: Injectable,
|
|
@@ -1077,7 +1112,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImpor
|
|
|
1077
1112
|
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
1078
1113
|
type: Inject,
|
|
1079
1114
|
args: [nextActionsToken]
|
|
1080
|
-
}] }, { type: i0.Injector }]; } });
|
|
1115
|
+
}] }, { type: i0.Injector }, { type: SettingsService }]; } });
|
|
1081
1116
|
|
|
1082
1117
|
/* eslint-disable @typescript-eslint/no-magic-numbers */
|
|
1083
1118
|
const cardNumberSanctionErrorCodes = [
|