@xsolla/payment-client-core 0.1.14 → 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.
- package/esm2020/lib/core/edit-saved-methods/delete-method-response.interface.mjs +2 -0
- package/esm2020/lib/core/edit-saved-methods/edit-saved-methods.service.mjs +43 -0
- package/esm2020/lib/core/payment/initialize/initialize-request-params.interface.mjs +1 -1
- package/esm2020/lib/core/payment/initialize/initialize.service.mjs +5 -1
- package/esm2020/lib/core/payment/payment-config.interface.mjs +1 -1
- package/esm2020/lib/core/saved-methods/saved-methods.service.mjs +5 -2
- package/esm2020/lib/core-library.service.mjs +7 -4
- package/fesm2015/xsolla-payment-client-core.mjs +51 -4
- package/fesm2015/xsolla-payment-client-core.mjs.map +1 -1
- package/fesm2020/xsolla-payment-client-core.mjs +49 -4
- package/fesm2020/xsolla-payment-client-core.mjs.map +1 -1
- package/lib/core/edit-saved-methods/delete-method-response.interface.d.ts +5 -0
- package/lib/core/edit-saved-methods/edit-saved-methods.service.d.ts +14 -0
- package/lib/core/payment/initialize/initialize-request-params.interface.d.ts +3 -0
- package/lib/core/payment/payment-config.interface.d.ts +2 -0
- package/lib/core/saved-methods/saved-methods.service.d.ts +1 -1
- package/lib/core-library.service.d.ts +4 -1
- package/package.json +1 -1
- package/xsolla-payment-client-core-0.1.16.tgz +0 -0
- package/xsolla-payment-client-core-0.1.14.tgz +0 -0
|
@@ -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
|
}
|
|
@@ -1431,6 +1434,10 @@ class InitializeService {
|
|
|
1431
1434
|
refer: this.ps4ReferId,
|
|
1432
1435
|
country: this.countryService.getCountry(),
|
|
1433
1436
|
returnUrl: config.returnUrl,
|
|
1437
|
+
paymentWithSavedMethod: config.paymentWithSavedMethod === true
|
|
1438
|
+
? "1" /* XpsBoolean.true */
|
|
1439
|
+
: "0" /* XpsBoolean.false */,
|
|
1440
|
+
saved_method_id: config.savedMethodId,
|
|
1434
1441
|
};
|
|
1435
1442
|
return this.xpsApiService
|
|
1436
1443
|
.directPaymentRequest(requestParams)
|
|
@@ -5345,8 +5352,44 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImpor
|
|
|
5345
5352
|
}]
|
|
5346
5353
|
}], ctorParameters: function () { return [{ type: SettingsService }, { type: RefundPolicyService }, { type: SecureConnectionService }, { type: DisclaimerService }]; } });
|
|
5347
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
|
+
|
|
5348
5391
|
class CoreLibraryService {
|
|
5349
|
-
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) {
|
|
5350
5393
|
this.settingsService = settingsService;
|
|
5351
5394
|
this.countryService = countryService;
|
|
5352
5395
|
this.paymentMethodsService = paymentMethodsService;
|
|
@@ -5362,11 +5405,13 @@ class CoreLibraryService {
|
|
|
5362
5405
|
this.creditCardService = creditCardService;
|
|
5363
5406
|
this.creditCardStateService = creditCardStateService;
|
|
5364
5407
|
this.formMessagesService = formMessagesService;
|
|
5408
|
+
this.editSavedMethodsService = editSavedMethodsService;
|
|
5365
5409
|
this.paymentMethods = {
|
|
5366
5410
|
getList: async () => this.paymentMethodsService.getList(),
|
|
5367
5411
|
getQuickMethods: async () => this.paymentMethodsService.getQuickMethods(),
|
|
5368
5412
|
getSavedMethods: async () => this.savedMethodsService.getList(),
|
|
5369
5413
|
getUserBalance: async () => this.userBalanceService.getUserBalance(),
|
|
5414
|
+
deleteSavedMethod: async (id, type) => this.editSavedMethodsService.deleteSavedMethodRequest(id, type),
|
|
5370
5415
|
};
|
|
5371
5416
|
}
|
|
5372
5417
|
async init(configuration) {
|
|
@@ -5430,14 +5475,14 @@ class CoreLibraryService {
|
|
|
5430
5475
|
return this.userBalanceService.getUserBalanceValue();
|
|
5431
5476
|
}
|
|
5432
5477
|
}
|
|
5433
|
-
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 });
|
|
5434
5479
|
CoreLibraryService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: CoreLibraryService, providedIn: 'root' });
|
|
5435
5480
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: CoreLibraryService, decorators: [{
|
|
5436
5481
|
type: Injectable,
|
|
5437
5482
|
args: [{
|
|
5438
5483
|
providedIn: 'root',
|
|
5439
5484
|
}]
|
|
5440
|
-
}], 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 }]; } });
|
|
5441
5486
|
|
|
5442
5487
|
class HttpError extends AppError {
|
|
5443
5488
|
constructor(error, req) {
|