@xsolla/payment-client-core 0.2.10 → 0.2.11

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.
@@ -5726,7 +5726,12 @@ class PaymentService {
5726
5726
  else {
5727
5727
  type = 'sync';
5728
5728
  }
5729
- this._formResponse$.next({ type, data, token: this.settingsService.token });
5729
+ this._formResponse$.next({
5730
+ type,
5731
+ data,
5732
+ token: this.settingsService.token,
5733
+ isSandbox: this.settingsService.isSandboxMode(),
5734
+ });
5730
5735
  }
5731
5736
  }
5732
5737
  PaymentService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: PaymentService, deps: [{ token: InitializeService }, { token: SubmitService }, { token: SyncService }, { token: FormService }, { token: StatusService }, { token: FinanceDetailsService }, { token: CreditCardStateService }, { token: NextActionService }, { token: ControlConfigService }, { token: ThreeDsService }, { token: FormMessagesService }, { token: SettingsService }, { token: CountryService }, { token: CheckStatusActionCreator }], target: i0.ɵɵFactoryTarget.Injectable });
@@ -6479,6 +6484,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImpor
6479
6484
  }] });
6480
6485
 
6481
6486
  const applePayVersion = 3;
6487
+ const safariVersionForIframeIntegration = 17;
6482
6488
 
6483
6489
  const agreementsGroup = [
6484
6490
  FieldNames.termsAndConditions,
@@ -6840,6 +6846,17 @@ class UserAgentService {
6840
6846
  get isSafari() {
6841
6847
  return this._browserName === 'Apple Safari';
6842
6848
  }
6849
+ get safariVersion() {
6850
+ if (!this.isSafari) {
6851
+ return null;
6852
+ }
6853
+ const versionRegExp = new RegExp('(Version)\\/(.+)\\s');
6854
+ const version = versionRegExp.exec(this.userAgent);
6855
+ if (!version) {
6856
+ return null;
6857
+ }
6858
+ return Number(version[2].split('.')[0]);
6859
+ }
6843
6860
  get iOsVersion() {
6844
6861
  if (this.osType !== 'ios') {
6845
6862
  return null;
@@ -7073,7 +7090,7 @@ class ApplePayService {
7073
7090
  this.emitError(ApplePayErrors.deviceIsNotCapableError);
7074
7091
  }
7075
7092
  }
7076
- redirectToPaymentPage(parameters, token) {
7093
+ redirectToPaymentPage(parameters, token, isSandbox) {
7077
7094
  const route = pagesRoutes.get(applePayId);
7078
7095
  if (!route) {
7079
7096
  return;
@@ -7088,8 +7105,8 @@ class ApplePayService {
7088
7105
  if (this.order) {
7089
7106
  query.append('order', this.order);
7090
7107
  }
7091
- const url = `${route}?${query.toString()}`;
7092
- return url;
7108
+ const payStationUrl = isSandbox ? sandboxPayStationUrl : payStation4Url;
7109
+ return `${payStationUrl}/en${route}?${query.toString()}`;
7093
7110
  }
7094
7111
  setOrder(data) {
7095
7112
  const summary = data?.paymentForm?.summary;
@@ -7140,6 +7157,7 @@ class ApplePayService {
7140
7157
  })
7141
7158
  .catch((error) => {
7142
7159
  console.error('apple pay: merchant validation error', error);
7160
+ this.emitError(ApplePayErrors.paymentError);
7143
7161
  session.abort();
7144
7162
  });
7145
7163
  };
@@ -7155,6 +7173,7 @@ class ApplePayService {
7155
7173
  })
7156
7174
  .catch((error) => {
7157
7175
  console.error('apple pay: payment authorization error', error);
7176
+ this.emitError(ApplePayErrors.paymentError);
7158
7177
  session.completePayment(this.window.ApplePaySession.STATUS_FAILURE);
7159
7178
  });
7160
7179
  };
@@ -7227,7 +7246,7 @@ class ApplePayService {
7227
7246
  }
7228
7247
  emitIntegrationType() {
7229
7248
  let integrationType;
7230
- if (this.paymentClient && this.isDeviceCapable()) {
7249
+ if (this.paymentClient && this.isDeviceCapable() && this.canUseSdk()) {
7231
7250
  integrationType = 'sdk';
7232
7251
  }
7233
7252
  else if (this.userAgentService.isSafari) {
@@ -7238,6 +7257,10 @@ class ApplePayService {
7238
7257
  }
7239
7258
  this.integrationType.next(integrationType);
7240
7259
  }
7260
+ canUseSdk() {
7261
+ return !!(this.userAgentService.safariVersion &&
7262
+ this.userAgentService.safariVersion >= safariVersionForIframeIntegration);
7263
+ }
7241
7264
  }
7242
7265
  ApplePayService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: ApplePayService, deps: [{ token: windowToken }, { token: UserAgentService }, { token: SummaryFinanceDetailsAdapterService }], target: i0.ɵɵFactoryTarget.Injectable });
7243
7266
  ApplePayService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: ApplePayService, providedIn: 'root' });