@xsolla/payment-client-core 0.1.15 → 0.1.16

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.
@@ -316,7 +316,10 @@ class SavedMethodsService {
316
316
  this.apiRoute = 'savedmethods';
317
317
  this.cache = new Map();
318
318
  }
319
- async getList() {
319
+ async getList(needResetCache = false) {
320
+ if (needResetCache) {
321
+ this.cache.clear();
322
+ }
320
323
  const response = await this.request();
321
324
  return response.list;
322
325
  }
@@ -5349,8 +5352,44 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImpor
5349
5352
  }]
5350
5353
  }], ctorParameters: function () { return [{ type: SettingsService }, { type: RefundPolicyService }, { type: SecureConnectionService }, { type: DisclaimerService }]; } });
5351
5354
 
5355
+ class EditSavedMethodsService {
5356
+ constructor(savedMethodsService, settingsService, secureApi) {
5357
+ this.savedMethodsService = savedMethodsService;
5358
+ this.settingsService = settingsService;
5359
+ this.secureApi = secureApi;
5360
+ this.deleteRoute = 'savedmethods/delete';
5361
+ }
5362
+ async deleteSavedMethodRequest(id, type) {
5363
+ const token = this.settingsService.token;
5364
+ const parameters = {
5365
+ access_token: token,
5366
+ id,
5367
+ type,
5368
+ };
5369
+ return lastValueFrom(this.secureApi.post(this.deleteRoute, new URLSearchParams(parameters), {
5370
+ headers: new HttpHeaders().set('Content-Type', 'application/x-www-form-urlencoded; charset=utf-8'),
5371
+ responseType: 'json',
5372
+ }))
5373
+ .then(async () => {
5374
+ await this.savedMethodsService.getList(true);
5375
+ return true;
5376
+ })
5377
+ .catch(() => {
5378
+ return false;
5379
+ });
5380
+ }
5381
+ }
5382
+ EditSavedMethodsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: EditSavedMethodsService, deps: [{ token: SavedMethodsService }, { token: SettingsService }, { token: SecureApiClient }], target: i0.ɵɵFactoryTarget.Injectable });
5383
+ EditSavedMethodsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: EditSavedMethodsService, providedIn: 'root' });
5384
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: EditSavedMethodsService, decorators: [{
5385
+ type: Injectable,
5386
+ args: [{
5387
+ providedIn: 'root',
5388
+ }]
5389
+ }], ctorParameters: function () { return [{ type: SavedMethodsService }, { type: SettingsService }, { type: SecureApiClient }]; } });
5390
+
5352
5391
  class CoreLibraryService {
5353
- constructor(settingsService, countryService, paymentMethodsService, savedMethodsService, userBalanceService, paymentConfigService, paymentService, deviceFingerPrintService, financeDetailsService, legalService, statusService, nextActionService, creditCardService, creditCardStateService, formMessagesService) {
5392
+ constructor(settingsService, countryService, paymentMethodsService, savedMethodsService, userBalanceService, paymentConfigService, paymentService, deviceFingerPrintService, financeDetailsService, legalService, statusService, nextActionService, creditCardService, creditCardStateService, formMessagesService, editSavedMethodsService) {
5354
5393
  this.settingsService = settingsService;
5355
5394
  this.countryService = countryService;
5356
5395
  this.paymentMethodsService = paymentMethodsService;
@@ -5366,11 +5405,13 @@ class CoreLibraryService {
5366
5405
  this.creditCardService = creditCardService;
5367
5406
  this.creditCardStateService = creditCardStateService;
5368
5407
  this.formMessagesService = formMessagesService;
5408
+ this.editSavedMethodsService = editSavedMethodsService;
5369
5409
  this.paymentMethods = {
5370
5410
  getList: async () => this.paymentMethodsService.getList(),
5371
5411
  getQuickMethods: async () => this.paymentMethodsService.getQuickMethods(),
5372
5412
  getSavedMethods: async () => this.savedMethodsService.getList(),
5373
5413
  getUserBalance: async () => this.userBalanceService.getUserBalance(),
5414
+ deleteSavedMethod: async (id, type) => this.editSavedMethodsService.deleteSavedMethodRequest(id, type),
5374
5415
  };
5375
5416
  }
5376
5417
  async init(configuration) {
@@ -5434,14 +5475,14 @@ class CoreLibraryService {
5434
5475
  return this.userBalanceService.getUserBalanceValue();
5435
5476
  }
5436
5477
  }
5437
- 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 }], target: i0.ɵɵFactoryTarget.Injectable });
5478
+ 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 }], target: i0.ɵɵFactoryTarget.Injectable });
5438
5479
  CoreLibraryService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: CoreLibraryService, providedIn: 'root' });
5439
5480
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: CoreLibraryService, decorators: [{
5440
5481
  type: Injectable,
5441
5482
  args: [{
5442
5483
  providedIn: 'root',
5443
5484
  }]
5444
- }], 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 }]; } });
5485
+ }], 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 }]; } });
5445
5486
 
5446
5487
  class HttpError extends AppError {
5447
5488
  constructor(error, req) {