@xsolla/payment-client-core 0.2.15 → 0.2.17

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 (25) hide show
  1. package/esm2020/lib/core/countries-api/countries-api.service.mjs +38 -0
  2. package/esm2020/lib/core/countries-api/country-response.interface.mjs +2 -0
  3. package/esm2020/lib/core/countries-api/country.interface.mjs +2 -0
  4. package/esm2020/lib/core/payment/status/status-request/response/status-response.class.mjs +3 -1
  5. package/esm2020/lib/core/payment/status/status-request/status-request.service.mjs +2 -1
  6. package/esm2020/lib/core/payment/status/status.interface.mjs +1 -1
  7. package/esm2020/lib/core/payment/xps-response.interface.mjs +1 -1
  8. package/esm2020/lib/core/sdk-payment-systems/apple-pay/apple-pay.service.mjs +3 -7
  9. package/esm2020/lib/core-library.service.mjs +9 -4
  10. package/esm2020/public-api.mjs +2 -1
  11. package/fesm2015/xsolla-payment-client-core.mjs +48 -10
  12. package/fesm2015/xsolla-payment-client-core.mjs.map +1 -1
  13. package/fesm2020/xsolla-payment-client-core.mjs +43 -9
  14. package/fesm2020/xsolla-payment-client-core.mjs.map +1 -1
  15. package/lib/core/countries-api/countries-api.service.d.ts +15 -0
  16. package/lib/core/countries-api/country-response.interface.d.ts +4 -0
  17. package/lib/core/countries-api/country.interface.d.ts +5 -0
  18. package/lib/core/payment/status/status-request/response/status-response.class.d.ts +1 -0
  19. package/lib/core/payment/status/status.interface.d.ts +1 -0
  20. package/lib/core/payment/xps-response.interface.d.ts +3 -0
  21. package/lib/core-library.service.d.ts +5 -1
  22. package/package.json +1 -1
  23. package/public-api.d.ts +1 -0
  24. package/xsolla-payment-client-core-0.2.17.tgz +0 -0
  25. package/xsolla-payment-client-core-0.2.15.tgz +0 -0
@@ -1491,6 +1491,8 @@ class StatusResponse {
1491
1491
  paymentCountryIso: parameters.status.statusData.payment_country_iso,
1492
1492
  order: parameters.status.text.order,
1493
1493
  };
1494
+ this.status.autoCancellation =
1495
+ parameters.payment_method?.auto_cancellation !== false;
1494
1496
  if (parameters.form) {
1495
1497
  this.status.userReturnStatus = this.getUserReturnStatus(parameters.form);
1496
1498
  }
@@ -4178,6 +4180,7 @@ class StatusRequestService extends XpsApiPart {
4178
4180
  status: response.status,
4179
4181
  errors: response.errors,
4180
4182
  form: response.form,
4183
+ payment_method: response.payment_method,
4181
4184
  });
4182
4185
  this.emitResponse(statusResponse);
4183
4186
  })
@@ -7002,8 +7005,39 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImpor
7002
7005
  }]
7003
7006
  }], ctorParameters: function () { return [{ type: PaymentMethodsService }, { type: SavedMethodsService }]; } });
7004
7007
 
7008
+ class CountriesApiService {
7009
+ constructor(secureApi, settingsService) {
7010
+ this.secureApi = secureApi;
7011
+ this.settingsService = settingsService;
7012
+ this.countries$ = new BehaviorSubject(null);
7013
+ this.apiRoute = 'country';
7014
+ }
7015
+ async request() {
7016
+ const token = this.settingsService.token;
7017
+ return lastValueFrom(this.secureApi
7018
+ .post(this.apiRoute, { access_token: token }, {
7019
+ headers: new HttpHeaders().set('Content-Type', 'application/x-www-form-urlencoded; charset=utf-8'),
7020
+ responseType: 'json',
7021
+ })
7022
+ .pipe(map$1((response) => {
7023
+ return response.countryList;
7024
+ }), tap((value) => {
7025
+ this.countries$.next(value);
7026
+ return value;
7027
+ })));
7028
+ }
7029
+ }
7030
+ CountriesApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: CountriesApiService, deps: [{ token: SecureApiClient }, { token: SettingsService }], target: i0.ɵɵFactoryTarget.Injectable });
7031
+ CountriesApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: CountriesApiService, providedIn: 'root' });
7032
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: CountriesApiService, decorators: [{
7033
+ type: Injectable,
7034
+ args: [{
7035
+ providedIn: 'root',
7036
+ }]
7037
+ }], ctorParameters: function () { return [{ type: SecureApiClient }, { type: SettingsService }]; } });
7038
+
7005
7039
  class CoreLibraryService {
7006
- constructor(settingsService, countryService, paymentMethodsService, savedMethodsService, userBalanceService, paymentConfigService, paymentService, deviceFingerPrintService, financeDetailsService, legalService, statusService, nextActionService, creditCardService, creditCardStateService, formMessagesService, editSavedMethodsService, userBehaviourAnalyticsService, performanceService, combinedPaymentMethodsService) {
7040
+ constructor(settingsService, countryService, paymentMethodsService, savedMethodsService, userBalanceService, paymentConfigService, paymentService, deviceFingerPrintService, financeDetailsService, legalService, statusService, nextActionService, creditCardService, creditCardStateService, formMessagesService, editSavedMethodsService, userBehaviourAnalyticsService, performanceService, combinedPaymentMethodsService, countriesApiService) {
7007
7041
  this.settingsService = settingsService;
7008
7042
  this.countryService = countryService;
7009
7043
  this.paymentMethodsService = paymentMethodsService;
@@ -7023,6 +7057,7 @@ class CoreLibraryService {
7023
7057
  this.userBehaviourAnalyticsService = userBehaviourAnalyticsService;
7024
7058
  this.performanceService = performanceService;
7025
7059
  this.combinedPaymentMethodsService = combinedPaymentMethodsService;
7060
+ this.countriesApiService = countriesApiService;
7026
7061
  this.paymentMethods = {
7027
7062
  getList: async (isSaveMethodMode) => this.paymentMethodsService.getList(isSaveMethodMode),
7028
7063
  getQuickMethods: async () => this.paymentMethodsService.getQuickMethods(),
@@ -7053,6 +7088,9 @@ class CoreLibraryService {
7053
7088
  pid: this.paymentService.getPid(),
7054
7089
  };
7055
7090
  }
7091
+ async getCountries() {
7092
+ return this.countriesApiService.request();
7093
+ }
7056
7094
  setCountry(country) {
7057
7095
  this.countryService.setCountry(country);
7058
7096
  }
@@ -7118,14 +7156,14 @@ class CoreLibraryService {
7118
7156
  return this.paymentService.formResponseValue;
7119
7157
  }
7120
7158
  }
7121
- CoreLibraryService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", 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 }], target: i0.ɵɵFactoryTarget.Injectable });
7159
+ CoreLibraryService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", 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 }], target: i0.ɵɵFactoryTarget.Injectable });
7122
7160
  CoreLibraryService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: CoreLibraryService, providedIn: 'root' });
7123
7161
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: CoreLibraryService, decorators: [{
7124
7162
  type: Injectable,
7125
7163
  args: [{
7126
7164
  providedIn: 'root',
7127
7165
  }]
7128
- }], ctorParameters: function () { return [{ type: SettingsService }, { type: CountryService }, { type: PaymentMethodsService }, { type: SavedMethodsService }, { type: UserBalanceService }, { type: PaymentConfigService }, { type: PaymentService }, { type: DeviceFingerPrintService }, { type: FinanceDetailsService }, { type: LegalService }, { type: StatusService }, { type: NextActionService }, { type: CreditCardService }, { type: CreditCardStateService }, { type: FormMessagesService }, { type: EditSavedMethodsService }, { type: UserBehaviourAnalyticsService }, { type: PerformanceService }, { type: CombinedPaymentMethodsService }]; } });
7166
+ }], ctorParameters: function () { return [{ type: SettingsService }, { type: CountryService }, { type: PaymentMethodsService }, { type: SavedMethodsService }, { type: UserBalanceService }, { type: PaymentConfigService }, { type: PaymentService }, { type: DeviceFingerPrintService }, { type: FinanceDetailsService }, { type: LegalService }, { type: StatusService }, { type: NextActionService }, { type: CreditCardService }, { type: CreditCardStateService }, { type: FormMessagesService }, { type: EditSavedMethodsService }, { type: UserBehaviourAnalyticsService }, { type: PerformanceService }, { type: CombinedPaymentMethodsService }, { type: CountriesApiService }]; } });
7129
7167
 
7130
7168
  class HttpError extends AppError {
7131
7169
  constructor(error, req) {
@@ -7688,8 +7726,7 @@ class ApplePayService {
7688
7726
  console.error('apple pay: initialize failed', error);
7689
7727
  }
7690
7728
  this.emitIntegrationType();
7691
- if (!this.paymentClient ||
7692
- (!this.isDeviceCapable() && !this.userAgentService.isSafari)) {
7729
+ if (!this.paymentClient || !this.isDeviceCapable()) {
7693
7730
  this.emitError(ApplePayErrors.deviceIsNotCapableError);
7694
7731
  }
7695
7732
  }
@@ -7849,10 +7886,7 @@ class ApplePayService {
7849
7886
  }
7850
7887
  emitIntegrationType() {
7851
7888
  let integrationType;
7852
- if (this.paymentClient && this.isDeviceCapable() && this.canUseSdk()) {
7853
- integrationType = 'sdk';
7854
- }
7855
- else if (this.userAgentService.isSafari) {
7889
+ if (this.paymentClient && this.isDeviceCapable()) {
7856
7890
  integrationType = 'redirect';
7857
7891
  }
7858
7892
  else {