@xsolla/payment-client-core 0.2.97 → 0.2.99

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.
Files changed (22) hide show
  1. package/esm2022/lib/core/payment/actions/redirect/redirect.action.class.mjs +12 -4
  2. package/esm2022/lib/core/payment/actions/show-mobile-payment-screen/show-mobile-payment-screen.action.class.mjs +5 -2
  3. package/esm2022/lib/core/payment/actions/three-ds/three-ds.action.class.mjs +20 -5
  4. package/esm2022/lib/core/payment/payment.service.mjs +2 -1
  5. package/esm2022/lib/core/payment/three-ds/api/status-three-ds/three-ds-checkout-form.interface.mjs +1 -1
  6. package/esm2022/lib/core/payment/three-ds/reinsurance-check/reinsurance-check.service.mjs +2 -2
  7. package/esm2022/lib/core/payment/three-ds/reinsurance-check/timer.interface.mjs +1 -1
  8. package/esm2022/lib/core/sdk-payment-systems/sdk-payment-systems-initial-data.interface.mjs +1 -1
  9. package/esm2022/lib/core/settings/settings.interface.mjs +1 -1
  10. package/esm2022/lib/shared/payment-methods-id.variable.mjs +3 -1
  11. package/fesm2022/xsolla-payment-client-core.mjs +43 -17
  12. package/fesm2022/xsolla-payment-client-core.mjs.map +1 -1
  13. package/lib/core/payment/actions/show-mobile-payment-screen/show-mobile-payment-screen.action.class.d.ts +1 -0
  14. package/lib/core/payment/actions/three-ds/three-ds.action.class.d.ts +4 -0
  15. package/lib/core/payment/three-ds/api/status-three-ds/three-ds-checkout-form.interface.d.ts +4 -0
  16. package/lib/core/payment/three-ds/reinsurance-check/timer.interface.d.ts +1 -1
  17. package/lib/core/sdk-payment-systems/sdk-payment-systems-initial-data.interface.d.ts +1 -0
  18. package/lib/core/settings/settings.interface.d.ts +1 -0
  19. package/lib/shared/payment-methods-id.variable.d.ts +2 -0
  20. package/package.json +1 -1
  21. package/xsolla-payment-client-core-0.2.99.tgz +0 -0
  22. package/xsolla-payment-client-core-0.2.97.tgz +0 -0
@@ -1778,21 +1778,28 @@ class RedirectActionCreator {
1778
1778
  };
1779
1779
  }
1780
1780
  getIsNewWindowRequired(submitResponse) {
1781
- if (!cardsWith3ds.has(submitResponse?.parameters?.pid)) {
1781
+ const pid = submitResponse?.parameters?.pid;
1782
+ if (!cardsWith3ds.has(pid) && pid !== googlePayPid) {
1782
1783
  return false;
1783
1784
  }
1784
1785
  const acquirer = submitResponse?.userSession?.payment_method_contr_id ?? null;
1785
1786
  const isAcquirerWithRedirectInNewWindow = acquirer && acquirersWithRedirectInNewWindow.has(acquirer);
1786
1787
  const cardBinCountry = submitResponse.parameters.cardBinCountry;
1787
1788
  const isJapanCard = cardBinCountry === 'JP';
1788
- return isAcquirerWithRedirectInNewWindow || isJapanCard;
1789
+ const isThreeDsIndependentWindow = this.settingsService.settings.is_three_ds_independent_windows ?? false;
1790
+ return (isAcquirerWithRedirectInNewWindow ||
1791
+ isJapanCard ||
1792
+ isThreeDsIndependentWindow);
1789
1793
  }
1790
1794
  getIsSameWindowRequired(submitResponse) {
1791
1795
  if (this.getIsNewWindowRequired(submitResponse)) {
1792
1796
  return false;
1793
1797
  }
1798
+ const pid = submitResponse?.parameters?.pid;
1799
+ const isCorrectPids = cardsWith3ds.has(pid) || googlePayPid === pid;
1794
1800
  // 3DS with redirect case
1795
- return cardsWith3ds.has(submitResponse?.parameters?.pid);
1801
+ return (isCorrectPids &&
1802
+ !this.settingsService.settings.is_three_ds_independent_windows);
1796
1803
  }
1797
1804
  preparePagesUrl(pagesPath) {
1798
1805
  const isSandbox = this.settingsService.isSandboxMode();
@@ -2039,24 +2046,38 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImpor
2039
2046
  }] });
2040
2047
 
2041
2048
  class ThreeDsActionCreator {
2042
- constructor() {
2049
+ constructor(settingsService) {
2050
+ this.settingsService = settingsService;
2043
2051
  this.type = '3DS';
2044
2052
  }
2045
2053
  getActionData(actionData) {
2046
2054
  return {
2047
2055
  type: this.type,
2048
- data: actionData,
2056
+ data: this.enrichWithRedirectParams(actionData),
2049
2057
  };
2050
2058
  }
2051
2059
  isSuitable() {
2052
2060
  return false;
2053
2061
  }
2054
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: ThreeDsActionCreator, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
2062
+ enrichWithRedirectParams(actionData) {
2063
+ return {
2064
+ ...actionData,
2065
+ data: {
2066
+ ...actionData.data,
2067
+ redirect: {
2068
+ isNewWindowRequired: this.settingsService.settings.is_three_ds_independent_windows ??
2069
+ false,
2070
+ isSameWindowRequired: !this.settingsService.settings.is_three_ds_independent_windows,
2071
+ },
2072
+ },
2073
+ };
2074
+ }
2075
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: ThreeDsActionCreator, deps: [{ token: SettingsService }], target: i0.ɵɵFactoryTarget.Injectable }); }
2055
2076
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: ThreeDsActionCreator }); }
2056
2077
  }
2057
2078
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: ThreeDsActionCreator, decorators: [{
2058
2079
  type: Injectable
2059
- }] });
2080
+ }], ctorParameters: () => [{ type: SettingsService }] });
2060
2081
 
2061
2082
  class SpecialButtonActionCreator {
2062
2083
  constructor() {
@@ -2120,9 +2141,20 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImpor
2120
2141
  type: Injectable
2121
2142
  }] });
2122
2143
 
2144
+ const payPayId = 3669;
2145
+ const linePayId = 3677;
2146
+ const auPayId = 3686;
2147
+ const docomoId = 3692;
2148
+ const softbankId = 3693;
2149
+ const auEasyPaymentId = 3694;
2150
+ const yMobileId = 3697;
2151
+ const mobilePaymentMethodId = 1738;
2152
+ const mobilePaymentMethodId2 = 2015;
2153
+
2123
2154
  class ShowMobilePaymentScreenActionCreator {
2124
2155
  constructor() {
2125
2156
  this.type = 'show_mobile_payment_screen';
2157
+ this.pids = [mobilePaymentMethodId, mobilePaymentMethodId2];
2126
2158
  }
2127
2159
  getActionData(response) {
2128
2160
  const submitButtonText = response.parameters.buyData.value;
@@ -2134,7 +2166,8 @@ class ShowMobilePaymentScreenActionCreator {
2134
2166
  };
2135
2167
  }
2136
2168
  isSuitable(response) {
2137
- return response.currentCommand === XpsCommand.create;
2169
+ return (response.currentCommand === XpsCommand.create &&
2170
+ this.pids.includes(response.pid));
2138
2171
  }
2139
2172
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: ShowMobilePaymentScreenActionCreator, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
2140
2173
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: ShowMobilePaymentScreenActionCreator }); }
@@ -7030,7 +7063,7 @@ class ReinsuranceCheckService {
7030
7063
  this.removeTimer(timer.id);
7031
7064
  this.timers[timer.id] = timer;
7032
7065
  const timerInStorage = this.timers[timer.id];
7033
- this.window.setTimeout(() => {
7066
+ timerInStorage.timeoutRef = this.window.setTimeout(() => {
7034
7067
  timerInStorage.callback();
7035
7068
  this.timers[timer.id] = null;
7036
7069
  }, timerInStorage.timeoutMs);
@@ -7621,6 +7654,7 @@ class PaymentService {
7621
7654
  summary: sdkPaymentData.summary,
7622
7655
  locale: this.translateService.getCurrentLang(),
7623
7656
  shouldHandleUserBackRedirectOnSdkSide,
7657
+ isThreeDsIndependentWindows: this.settingsService.settings.is_three_ds_independent_windows ?? false,
7624
7658
  });
7625
7659
  }
7626
7660
  getQrCode() {
@@ -7987,14 +8021,6 @@ const euCountries = new Set([
7987
8021
  'SE',
7988
8022
  ]);
7989
8023
 
7990
- const payPayId = 3669;
7991
- const linePayId = 3677;
7992
- const auPayId = 3686;
7993
- const docomoId = 3692;
7994
- const softbankId = 3693;
7995
- const auEasyPaymentId = 3694;
7996
- const yMobileId = 3697;
7997
-
7998
8024
  const sctlLinkUsa = 'https://xsolla.com/ja/sctl/xsolla-usa';
7999
8025
  const sctlLinkJapan = 'https://xsolla.com/ja/sctl/xsolla-japan';
8000
8026
  const sctlLinkMap = new Map([