@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
@@ -1482,7 +1482,7 @@ var StatusEnum;
1482
1482
 
1483
1483
  class StatusResponse {
1484
1484
  constructor(parameters) {
1485
- var _a, _b, _c, _d, _e, _f, _g;
1485
+ var _a, _b, _c, _d, _e, _f, _g, _h;
1486
1486
  if ((_a = parameters.errors) === null || _a === void 0 ? void 0 : _a[0]) {
1487
1487
  this.error = {
1488
1488
  code: parameters.errors[0].code.toString(),
@@ -1526,6 +1526,8 @@ class StatusResponse {
1526
1526
  paymentCountryIso: parameters.status.statusData.payment_country_iso,
1527
1527
  order: parameters.status.text.order,
1528
1528
  };
1529
+ this.status.autoCancellation =
1530
+ ((_h = parameters.payment_method) === null || _h === void 0 ? void 0 : _h.auto_cancellation) !== false;
1529
1531
  if (parameters.form) {
1530
1532
  this.status.userReturnStatus = this.getUserReturnStatus(parameters.form);
1531
1533
  }
@@ -4246,6 +4248,7 @@ class StatusRequestService extends XpsApiPart {
4246
4248
  status: response.status,
4247
4249
  errors: response.errors,
4248
4250
  form: response.form,
4251
+ payment_method: response.payment_method,
4249
4252
  });
4250
4253
  this.emitResponse(statusResponse);
4251
4254
  })
@@ -7180,8 +7183,41 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImpor
7180
7183
  }]
7181
7184
  }], ctorParameters: function () { return [{ type: PaymentMethodsService }, { type: SavedMethodsService }]; } });
7182
7185
 
7186
+ class CountriesApiService {
7187
+ constructor(secureApi, settingsService) {
7188
+ this.secureApi = secureApi;
7189
+ this.settingsService = settingsService;
7190
+ this.countries$ = new BehaviorSubject(null);
7191
+ this.apiRoute = 'country';
7192
+ }
7193
+ request() {
7194
+ return __awaiter(this, void 0, void 0, function* () {
7195
+ const token = this.settingsService.token;
7196
+ return lastValueFrom(this.secureApi
7197
+ .post(this.apiRoute, { access_token: token }, {
7198
+ headers: new HttpHeaders().set('Content-Type', 'application/x-www-form-urlencoded; charset=utf-8'),
7199
+ responseType: 'json',
7200
+ })
7201
+ .pipe(map$1((response) => {
7202
+ return response.countryList;
7203
+ }), tap((value) => {
7204
+ this.countries$.next(value);
7205
+ return value;
7206
+ })));
7207
+ });
7208
+ }
7209
+ }
7210
+ 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 });
7211
+ CountriesApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: CountriesApiService, providedIn: 'root' });
7212
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: CountriesApiService, decorators: [{
7213
+ type: Injectable,
7214
+ args: [{
7215
+ providedIn: 'root',
7216
+ }]
7217
+ }], ctorParameters: function () { return [{ type: SecureApiClient }, { type: SettingsService }]; } });
7218
+
7183
7219
  class CoreLibraryService {
7184
- constructor(settingsService, countryService, paymentMethodsService, savedMethodsService, userBalanceService, paymentConfigService, paymentService, deviceFingerPrintService, financeDetailsService, legalService, statusService, nextActionService, creditCardService, creditCardStateService, formMessagesService, editSavedMethodsService, userBehaviourAnalyticsService, performanceService, combinedPaymentMethodsService) {
7220
+ constructor(settingsService, countryService, paymentMethodsService, savedMethodsService, userBalanceService, paymentConfigService, paymentService, deviceFingerPrintService, financeDetailsService, legalService, statusService, nextActionService, creditCardService, creditCardStateService, formMessagesService, editSavedMethodsService, userBehaviourAnalyticsService, performanceService, combinedPaymentMethodsService, countriesApiService) {
7185
7221
  this.settingsService = settingsService;
7186
7222
  this.countryService = countryService;
7187
7223
  this.paymentMethodsService = paymentMethodsService;
@@ -7201,6 +7237,7 @@ class CoreLibraryService {
7201
7237
  this.userBehaviourAnalyticsService = userBehaviourAnalyticsService;
7202
7238
  this.performanceService = performanceService;
7203
7239
  this.combinedPaymentMethodsService = combinedPaymentMethodsService;
7240
+ this.countriesApiService = countriesApiService;
7204
7241
  this.paymentMethods = {
7205
7242
  getList: (isSaveMethodMode) => __awaiter(this, void 0, void 0, function* () { return this.paymentMethodsService.getList(isSaveMethodMode); }),
7206
7243
  getQuickMethods: () => __awaiter(this, void 0, void 0, function* () { return this.paymentMethodsService.getQuickMethods(); }),
@@ -7235,6 +7272,11 @@ class CoreLibraryService {
7235
7272
  pid: this.paymentService.getPid(),
7236
7273
  };
7237
7274
  }
7275
+ getCountries() {
7276
+ return __awaiter(this, void 0, void 0, function* () {
7277
+ return this.countriesApiService.request();
7278
+ });
7279
+ }
7238
7280
  setCountry(country) {
7239
7281
  this.countryService.setCountry(country);
7240
7282
  }
@@ -7300,14 +7342,14 @@ class CoreLibraryService {
7300
7342
  return this.paymentService.formResponseValue;
7301
7343
  }
7302
7344
  }
7303
- 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 });
7345
+ 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 });
7304
7346
  CoreLibraryService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: CoreLibraryService, providedIn: 'root' });
7305
7347
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: CoreLibraryService, decorators: [{
7306
7348
  type: Injectable,
7307
7349
  args: [{
7308
7350
  providedIn: 'root',
7309
7351
  }]
7310
- }], 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 }]; } });
7352
+ }], 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 }]; } });
7311
7353
 
7312
7354
  class HttpError extends AppError {
7313
7355
  constructor(error, req) {
@@ -7877,8 +7919,7 @@ class ApplePayService {
7877
7919
  console.error('apple pay: initialize failed', error);
7878
7920
  }
7879
7921
  this.emitIntegrationType();
7880
- if (!this.paymentClient ||
7881
- (!this.isDeviceCapable() && !this.userAgentService.isSafari)) {
7922
+ if (!this.paymentClient || !this.isDeviceCapable()) {
7882
7923
  this.emitError(ApplePayErrors.deviceIsNotCapableError);
7883
7924
  }
7884
7925
  });
@@ -8036,10 +8077,7 @@ class ApplePayService {
8036
8077
  }
8037
8078
  emitIntegrationType() {
8038
8079
  let integrationType;
8039
- if (this.paymentClient && this.isDeviceCapable() && this.canUseSdk()) {
8040
- integrationType = 'sdk';
8041
- }
8042
- else if (this.userAgentService.isSafari) {
8080
+ if (this.paymentClient && this.isDeviceCapable()) {
8043
8081
  integrationType = 'redirect';
8044
8082
  }
8045
8083
  else {