@xsolla/payment-client-core 0.0.1 → 0.0.2
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/README.md +8 -11
- package/esm2020/lib/core/boolean-number.enum.mjs +6 -0
- package/esm2020/lib/core/country/country.service.mjs +27 -0
- package/esm2020/lib/core/deep-readonly.type.mjs +2 -0
- package/esm2020/lib/core/exceptions-handling/errors/api-error.interface.mjs +2 -0
- package/esm2020/lib/core/exceptions-handling/errors/app-error.class.mjs +6 -0
- package/esm2020/lib/core/exceptions-handling/errors/http-error.class.mjs +40 -0
- package/esm2020/lib/core/exceptions-handling/errors/response-error.class.mjs +7 -0
- package/esm2020/lib/core/exceptions-handling/http-interceptor/http-error-data.interface.mjs +2 -0
- package/esm2020/lib/core/exceptions-handling/http-interceptor/http-error-response-data.interface.mjs +2 -0
- package/esm2020/lib/core/exceptions-handling/http-interceptor/http-exceptions.interceptor.mjs +22 -0
- package/esm2020/lib/core/extended-window.interface.mjs +2 -0
- package/esm2020/lib/core/http/secure-api/api-url.const.mjs +3 -0
- package/esm2020/lib/core/http/secure-api/options.interface.mjs +2 -0
- package/esm2020/lib/core/http/secure-api/secure-api.service.mjs +55 -0
- package/esm2020/lib/core/payment-methods/payment-method-api.interface.mjs +2 -0
- package/esm2020/lib/core/payment-methods/payment-method.interface.mjs +2 -0
- package/esm2020/lib/core/payment-methods/payment-methods-api.interface.mjs +2 -0
- package/esm2020/lib/core/payment-methods/payment-methods-request-params.interface.mjs +2 -0
- package/esm2020/lib/core/payment-methods/payment-methods-response.class.mjs +26 -0
- package/esm2020/lib/core/payment-methods/payment-methods-response.interface.mjs +2 -0
- package/esm2020/lib/core/payment-methods/payment-methods-response.token.mjs +8 -0
- package/esm2020/lib/core/payment-methods/payment-methods.service.mjs +58 -0
- package/esm2020/lib/core/settings/auto-redirect-on-status.mjs +14 -0
- package/esm2020/lib/core/settings/balance.interface.mjs +2 -0
- package/esm2020/lib/core/settings/bonus.interface.mjs +2 -0
- package/esm2020/lib/core/settings/configuration.interface.mjs +2 -0
- package/esm2020/lib/core/settings/empty-utils-response.error.mjs +7 -0
- package/esm2020/lib/core/settings/header-type.enum.mjs +6 -0
- package/esm2020/lib/core/settings/offer.interface.mjs +2 -0
- package/esm2020/lib/core/settings/project.interface.mjs +2 -0
- package/esm2020/lib/core/settings/purchase.interface.mjs +2 -0
- package/esm2020/lib/core/settings/settings-mode.enum.mjs +5 -0
- package/esm2020/lib/core/settings/settings.interface.mjs +2 -0
- package/esm2020/lib/core/settings/settings.service.mjs +85 -0
- package/esm2020/lib/core/settings/status-back-show.mjs +16 -0
- package/esm2020/lib/core/settings/tracking-info.interface.mjs +2 -0
- package/esm2020/lib/core/settings/user.interface.mjs +2 -0
- package/esm2020/lib/core/settings/utils-response.interface.mjs +2 -0
- package/esm2020/lib/core/window.token.mjs +3 -0
- package/esm2020/lib/core-library.module.mjs +35 -17
- package/esm2020/lib/core-library.service.mjs +31 -13
- package/esm2020/public-api.mjs +6 -7
- package/esm2020/xsolla-payment-client-core.mjs +4 -4
- package/fesm2015/xsolla-payment-client-core.mjs +390 -33
- package/fesm2015/xsolla-payment-client-core.mjs.map +1 -1
- package/fesm2020/xsolla-payment-client-core.mjs +376 -33
- package/fesm2020/xsolla-payment-client-core.mjs.map +1 -1
- package/index.d.ts +5 -5
- package/lib/core/boolean-number.enum.d.ts +4 -0
- package/lib/core/country/country.service.d.ts +12 -0
- package/lib/core/deep-readonly.type.d.ts +3 -0
- package/lib/core/exceptions-handling/errors/api-error.interface.d.ts +4 -0
- package/lib/core/exceptions-handling/errors/app-error.class.d.ts +3 -0
- package/lib/core/exceptions-handling/errors/http-error.class.d.ts +10 -0
- package/lib/core/exceptions-handling/errors/response-error.class.d.ts +4 -0
- package/lib/core/exceptions-handling/http-interceptor/http-error-data.interface.d.ts +20 -0
- package/lib/core/exceptions-handling/http-interceptor/http-error-response-data.interface.d.ts +7 -0
- package/lib/core/exceptions-handling/http-interceptor/http-exceptions.interceptor.d.ts +11 -0
- package/lib/core/extended-window.interface.d.ts +1 -0
- package/lib/core/http/secure-api/api-url.const.d.ts +2 -0
- package/lib/core/http/secure-api/options.interface.d.ts +14 -0
- package/lib/core/http/secure-api/secure-api.service.d.ts +20 -0
- package/lib/core/payment-methods/payment-method-api.interface.d.ts +11 -0
- package/lib/core/payment-methods/payment-method.interface.d.ts +11 -0
- package/lib/core/payment-methods/payment-methods-api.interface.d.ts +10 -0
- package/lib/core/payment-methods/payment-methods-request-params.interface.d.ts +4 -0
- package/lib/core/payment-methods/payment-methods-response.class.d.ts +13 -0
- package/lib/core/payment-methods/payment-methods-response.interface.d.ts +4 -0
- package/lib/core/payment-methods/payment-methods-response.token.d.ts +7 -0
- package/lib/core/payment-methods/payment-methods.service.d.ts +20 -0
- package/lib/core/settings/auto-redirect-on-status.d.ts +12 -0
- package/lib/core/settings/balance.interface.d.ts +4 -0
- package/lib/core/settings/bonus.interface.d.ts +10 -0
- package/lib/core/settings/configuration.interface.d.ts +5 -0
- package/lib/core/settings/empty-utils-response.error.d.ts +4 -0
- package/lib/core/settings/header-type.enum.d.ts +4 -0
- package/lib/core/settings/offer.interface.d.ts +6 -0
- package/lib/core/settings/project.interface.d.ts +32 -0
- package/lib/core/settings/purchase.interface.d.ts +47 -0
- package/lib/core/settings/settings-mode.enum.d.ts +3 -0
- package/lib/core/settings/settings.interface.d.ts +45 -0
- package/lib/core/settings/settings.service.d.ts +30 -0
- package/lib/core/settings/status-back-show.d.ts +14 -0
- package/lib/core/settings/tracking-info.interface.d.ts +5 -0
- package/lib/core/settings/user.interface.d.ts +23 -0
- package/lib/core/settings/utils-response.interface.d.ts +16 -0
- package/lib/core/window.token.d.ts +3 -0
- package/lib/core-library.module.d.ts +7 -7
- package/lib/core-library.service.d.ts +20 -5
- package/package.json +4 -3
- package/public-api.d.ts +2 -3
- package/xsolla-payment-client-core-0.0.2.tgz +0 -0
- package/esm2020/lib/core-library.component.mjs +0 -11
- package/lib/core-library.component.d.ts +0 -5
- package/xsolla-payment-client-core-0.0.1.tgz +0 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* none (ни один из статусов),
|
|
3
|
+
* done (статус done),
|
|
4
|
+
* final (статусы done, cancel),
|
|
5
|
+
* virtual_operation (статус оплаты виртуальной валютой)
|
|
6
|
+
* all (все статусы)
|
|
7
|
+
*/
|
|
8
|
+
export var StatusBackShow;
|
|
9
|
+
(function (StatusBackShow) {
|
|
10
|
+
StatusBackShow["none"] = "none";
|
|
11
|
+
StatusBackShow["done"] = "done";
|
|
12
|
+
StatusBackShow["final"] = "final";
|
|
13
|
+
StatusBackShow["virtual_operation"] = "virtual_operation";
|
|
14
|
+
StatusBackShow["all"] = "all";
|
|
15
|
+
})(StatusBackShow || (StatusBackShow = {}));
|
|
16
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3RhdHVzLWJhY2stc2hvdy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL3BhY2thZ2VzL3BheW1lbnQtY2xpZW50LWNvcmUvc3JjL2xpYi9jb3JlL3NldHRpbmdzL3N0YXR1cy1iYWNrLXNob3cudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7OztHQU1HO0FBQ0gsTUFBTSxDQUFOLElBQVksY0FNWDtBQU5ELFdBQVksY0FBYztJQUN4QiwrQkFBYSxDQUFBO0lBQ2IsK0JBQWEsQ0FBQTtJQUNiLGlDQUFlLENBQUE7SUFDZix5REFBdUMsQ0FBQTtJQUN2Qyw2QkFBVyxDQUFBO0FBQ2IsQ0FBQyxFQU5XLGNBQWMsS0FBZCxjQUFjLFFBTXpCIiwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBub25lICjQvdC4INC+0LTQuNC9INC40Lcg0YHRgtCw0YLRg9GB0L7QsiksXG4gKiBkb25lICjRgdGC0LDRgtGD0YEgZG9uZSksXG4gKiBmaW5hbCAo0YHRgtCw0YLRg9GB0YsgZG9uZSwgY2FuY2VsKSxcbiAqIHZpcnR1YWxfb3BlcmF0aW9uICjRgdGC0LDRgtGD0YEg0L7Qv9C70LDRgtGLINCy0LjRgNGC0YPQsNC70YzQvdC+0Lkg0LLQsNC70Y7RgtC+0LkpXG4gKiBhbGwgKNCy0YHQtSDRgdGC0LDRgtGD0YHRiylcbiAqL1xuZXhwb3J0IGVudW0gU3RhdHVzQmFja1Nob3cge1xuICBub25lID0gJ25vbmUnLFxuICBkb25lID0gJ2RvbmUnLFxuICBmaW5hbCA9ICdmaW5hbCcsXG4gIHZpcnR1YWxfb3BlcmF0aW9uID0gJ3ZpcnR1YWxfb3BlcmF0aW9uJyxcbiAgYWxsID0gJ2FsbCcsXG59XG4iXX0=
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export {};
|
|
2
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHJhY2tpbmctaW5mby5pbnRlcmZhY2UuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9wYWNrYWdlcy9wYXltZW50LWNsaWVudC1jb3JlL3NyYy9saWIvY29yZS9zZXR0aW5ncy90cmFja2luZy1pbmZvLmludGVyZmFjZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiIiwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0IGludGVyZmFjZSBUcmFja2luZ0luZm8ge1xuICBwcm9qZWN0SWQ6IG51bWJlcjtcbiAgYW5hbHl0aWNzU3lzdGVtTmFtZTogc3RyaW5nO1xuICB0cmFja2luZ0lkOiBzdHJpbmc7XG59XG4iXX0=
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export {};
|
|
2
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXNlci5pbnRlcm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llbnQtY29yZS9zcmMvbGliL2NvcmUvc2V0dGluZ3MvdXRpbHMtcmVzcG9uc2UuaW50ZXJmYWNlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiIiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBCb251cyB9IGZyb20gJy4vYm9udXMuaW50ZXJmYWNlJztcbmltcG9ydCB7IFByb2plY3QgfSBmcm9tICcuL3Byb2plY3QuaW50ZXJmYWNlJztcbmltcG9ydCB7IFB1cmNoYXNlIH0gZnJvbSAnLi9wdXJjaGFzZS5pbnRlcmZhY2UnO1xuaW1wb3J0IHsgU2V0dGluZ3MgfSBmcm9tICcuL3NldHRpbmdzLmludGVyZmFjZSc7XG5pbXBvcnQgeyBVc2VyIH0gZnJvbSAnLi91c2VyLmludGVyZmFjZSc7XG5cbmV4cG9ydCBpbnRlcmZhY2UgVXRpbHNSZXNwb25zZSB7XG4gIHByb2plY3Q6IFByb2plY3Q7XG4gIHB1cmNoYXNlOiBQdXJjaGFzZTtcbiAgc2V0dGluZ3M6IFNldHRpbmdzO1xuICB1c2VyOiBVc2VyO1xuICBwdXJjaGFzZV9leHRlcm5hbF9pZDogc3RyaW5nIHwgbnVsbDtcbiAgeHNvbGxhX3Byb2R1Y3RfdGFnOiBzdHJpbmcgfCBudWxsO1xuICBleHBlcmltZW50R3JvdXA6IHN0cmluZyB8IG51bGw7XG4gIHNhdmVfcGF5bWVudF9hY2NvdW50OiBib29sZWFuIHwgbnVsbDtcbiAgYm9udXM6IEJvbnVzIHwgbnVsbDtcbn1cbiJdfQ==
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { InjectionToken } from '@angular/core';
|
|
2
|
+
export const windowToken = new InjectionToken('window');
|
|
3
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoid2luZG93LnRva2VuLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vcGFja2FnZXMvcGF5bWVudC1jbGllbnQtY29yZS9zcmMvbGliL2NvcmUvd2luZG93LnRva2VuLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxjQUFjLEVBQUUsTUFBTSxlQUFlLENBQUM7QUFHL0MsTUFBTSxDQUFDLE1BQU0sV0FBVyxHQUFtQyxJQUFJLGNBQWMsQ0FDM0UsUUFBUSxDQUNULENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBJbmplY3Rpb25Ub2tlbiB9IGZyb20gJ0Bhbmd1bGFyL2NvcmUnO1xuaW1wb3J0IHsgRXh0ZW5kZWRXaW5kb3cgfSBmcm9tICcuL2V4dGVuZGVkLXdpbmRvdy5pbnRlcmZhY2UnO1xuXG5leHBvcnQgY29uc3Qgd2luZG93VG9rZW46IEluamVjdGlvblRva2VuPEV4dGVuZGVkV2luZG93PiA9IG5ldyBJbmplY3Rpb25Ub2tlbihcbiAgJ3dpbmRvdydcbik7XG4iXX0=
|
|
@@ -1,17 +1,35 @@
|
|
|
1
|
-
import { NgModule } from '@angular/core';
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
i0.ɵɵ
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
|
|
1
|
+
import { NgModule } from '@angular/core';
|
|
2
|
+
import { HTTP_INTERCEPTORS, HttpClientModule } from '@angular/common/http';
|
|
3
|
+
import { HttpExceptionsInterceptor } from './core/exceptions-handling/http-interceptor/http-exceptions.interceptor';
|
|
4
|
+
import { windowToken } from './core/window.token';
|
|
5
|
+
import { paymentMethodsResponseFactoryProvider } from './core/payment-methods/payment-methods-response.token';
|
|
6
|
+
import * as i0 from "@angular/core";
|
|
7
|
+
export class CoreLibraryModule {
|
|
8
|
+
}
|
|
9
|
+
CoreLibraryModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: CoreLibraryModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
10
|
+
CoreLibraryModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.7", ngImport: i0, type: CoreLibraryModule, imports: [HttpClientModule] });
|
|
11
|
+
CoreLibraryModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: CoreLibraryModule, providers: [
|
|
12
|
+
{
|
|
13
|
+
provide: HTTP_INTERCEPTORS,
|
|
14
|
+
useClass: HttpExceptionsInterceptor,
|
|
15
|
+
multi: true,
|
|
16
|
+
},
|
|
17
|
+
{ provide: windowToken, useValue: window },
|
|
18
|
+
paymentMethodsResponseFactoryProvider,
|
|
19
|
+
], imports: [HttpClientModule] });
|
|
20
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: CoreLibraryModule, decorators: [{
|
|
21
|
+
type: NgModule,
|
|
22
|
+
args: [{
|
|
23
|
+
imports: [HttpClientModule],
|
|
24
|
+
providers: [
|
|
25
|
+
{
|
|
26
|
+
provide: HTTP_INTERCEPTORS,
|
|
27
|
+
useClass: HttpExceptionsInterceptor,
|
|
28
|
+
multi: true,
|
|
29
|
+
},
|
|
30
|
+
{ provide: windowToken, useValue: window },
|
|
31
|
+
paymentMethodsResponseFactoryProvider,
|
|
32
|
+
],
|
|
33
|
+
}]
|
|
34
|
+
}] });
|
|
35
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29yZS1saWJyYXJ5Lm1vZHVsZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3BhY2thZ2VzL3BheW1lbnQtY2xpZW50LWNvcmUvc3JjL2xpYi9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
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
import { Injectable } from '@angular/core';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
import * as i1 from "./core/settings/settings.service";
|
|
4
|
+
import * as i2 from "./core/country/country.service";
|
|
5
|
+
import * as i3 from "./core/payment-methods/payment-methods.service";
|
|
6
|
+
export class CoreLibraryService {
|
|
7
|
+
constructor(settingsService, countryService, paymentMethodsService) {
|
|
8
|
+
this.settingsService = settingsService;
|
|
9
|
+
this.countryService = countryService;
|
|
10
|
+
this.paymentMethodsService = paymentMethodsService;
|
|
11
|
+
this.paymentMethods = {
|
|
12
|
+
getList: async () => this.paymentMethodsService.getList(),
|
|
13
|
+
getQuickMethods: async () => this.paymentMethodsService.getQuickMethods(),
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
async init(configuration) {
|
|
17
|
+
return this.settingsService.init(configuration);
|
|
18
|
+
}
|
|
19
|
+
setCountry(country) {
|
|
20
|
+
this.countryService.setCountry(country);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
CoreLibraryService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: CoreLibraryService, deps: [{ token: i1.SettingsService }, { token: i2.CountryService }, { token: i3.PaymentMethodsService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
24
|
+
CoreLibraryService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: CoreLibraryService, providedIn: 'root' });
|
|
25
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: CoreLibraryService, decorators: [{
|
|
26
|
+
type: Injectable,
|
|
27
|
+
args: [{
|
|
28
|
+
providedIn: 'root',
|
|
29
|
+
}]
|
|
30
|
+
}], ctorParameters: function () { return [{ type: i1.SettingsService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mdldFF1aWNrTWV0aG9kcygpLFxuICB9O1xuXG4gIHB1YmxpYyBjb25zdHJ1Y3RvcihcbiAgICBwcml2YXRlIHJlYWRvbmx5IHNldHRpbmdzU2VydmljZTogU2V0dGluZ3NTZXJ2aWNlLFxuICAgIHByaXZhdGUgcmVhZG9ubHkgY291bnRyeVNlcnZpY2U6IENvdW50cnlTZXJ2aWNlLFxuICAgIHByaXZhdGUgcmVhZG9ubHkgcGF5bWVudE1ldGhvZHNTZXJ2aWNlOiBQYXltZW50TWV0aG9kc1NlcnZpY2VcbiAgKSB7fVxuXG4gIHB1YmxpYyBhc3luYyBpbml0KGNvbmZpZ3VyYXRpb246IEluaXRDb25maWd1cmF0aW9uKTogUHJvbWlzZTx2b2lkPiB7XG4gICAgcmV0dXJuIHRoaXMuc2V0dGluZ3NTZXJ2aWNlLmluaXQoY29uZmlndXJhdGlvbik7XG4gIH1cblxuICBwdWJsaWMgc2V0Q291bnRyeShjb3VudHJ5OiBzdHJpbmcpOiB2b2lkIHtcbiAgICB0aGlzLmNvdW50cnlTZXJ2aWNlLnNldENvdW50cnkoY291bnRyeSk7XG4gIH1cbn1cbiJdfQ==
|
package/esm2020/public-api.mjs
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Public API Surface of core-library
|
|
3
|
-
*/
|
|
4
|
-
export * from './lib/core-library.service';
|
|
5
|
-
export * from './lib/core-library.
|
|
6
|
-
|
|
7
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHVibGljLWFwaS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3BhY2thZ2VzL3BheW1lbnQtY2xpZW50LWNvcmUvc3JjL3B1YmxpYy1hcGkudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7O0dBRUc7QUFFSCxjQUFjLDRCQUE0QixDQUFDO0FBQzNDLGNBQWMsOEJBQThCLENBQUM7QUFDN0MsY0FBYywyQkFBMkIsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbIi8qXG4gKiBQdWJsaWMgQVBJIFN1cmZhY2Ugb2YgY29yZS1saWJyYXJ5XG4gKi9cblxuZXhwb3J0ICogZnJvbSAnLi9saWIvY29yZS1saWJyYXJ5LnNlcnZpY2UnO1xuZXhwb3J0ICogZnJvbSAnLi9saWIvY29yZS1saWJyYXJ5LmNvbXBvbmVudCc7XG5leHBvcnQgKiBmcm9tICcuL2xpYi9jb3JlLWxpYnJhcnkubW9kdWxlJztcbiJdfQ==
|
|
1
|
+
/*
|
|
2
|
+
* Public API Surface of core-library
|
|
3
|
+
*/
|
|
4
|
+
export * from './lib/core-library.service';
|
|
5
|
+
export * from './lib/core-library.module';
|
|
6
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHVibGljLWFwaS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3BhY2thZ2VzL3BheW1lbnQtY2xpZW50LWNvcmUvc3JjL3B1YmxpYy1hcGkudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7O0dBRUc7QUFFSCxjQUFjLDRCQUE0QixDQUFDO0FBQzNDLGNBQWMsMkJBQTJCLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyIvKlxuICogUHVibGljIEFQSSBTdXJmYWNlIG9mIGNvcmUtbGlicmFyeVxuICovXG5cbmV4cG9ydCAqIGZyb20gJy4vbGliL2NvcmUtbGlicmFyeS5zZXJ2aWNlJztcbmV4cG9ydCAqIGZyb20gJy4vbGliL2NvcmUtbGlicmFyeS5tb2R1bGUnO1xuIl19
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Generated bundle index. Do not edit.
|
|
3
|
-
*/
|
|
4
|
-
export * from './public-api';
|
|
1
|
+
/**
|
|
2
|
+
* Generated bundle index. Do not edit.
|
|
3
|
+
*/
|
|
4
|
+
export * from './public-api';
|
|
5
5
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoieHNvbGxhLXBheW1lbnQtY2xpZW50LWNvcmUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9wYWNrYWdlcy9wYXltZW50LWNsaWVudC1jb3JlL3NyYy94c29sbGEtcGF5bWVudC1jbGllbnQtY29yZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7R0FFRztBQUVILGNBQWMsY0FBYyxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBHZW5lcmF0ZWQgYnVuZGxlIGluZGV4LiBEbyBub3QgZWRpdC5cbiAqL1xuXG5leHBvcnQgKiBmcm9tICcuL3B1YmxpYy1hcGknO1xuIl19
|
|
@@ -1,47 +1,404 @@
|
|
|
1
|
+
import { __awaiter } from 'tslib';
|
|
1
2
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { Injectable,
|
|
3
|
+
import { InjectionToken, Injectable, Inject, NgModule } from '@angular/core';
|
|
4
|
+
import { firstValueFrom, lastValueFrom, map, throwError } from 'rxjs';
|
|
5
|
+
import * as i1 from '@angular/common/http';
|
|
6
|
+
import { HttpParams, HttpHeaders, HttpClientModule, HTTP_INTERCEPTORS } from '@angular/common/http';
|
|
7
|
+
import { catchError } from 'rxjs/operators';
|
|
8
|
+
import * as i1$1 from '@angular/router';
|
|
3
9
|
|
|
4
|
-
class
|
|
10
|
+
class AppError extends Error {
|
|
11
|
+
constructor(message) {
|
|
12
|
+
super(message);
|
|
13
|
+
}
|
|
5
14
|
}
|
|
6
|
-
CoreLibraryService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: CoreLibraryService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
7
|
-
CoreLibraryService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: CoreLibraryService, providedIn: 'root' });
|
|
8
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: CoreLibraryService, decorators: [{
|
|
9
|
-
type: Injectable,
|
|
10
|
-
args: [{
|
|
11
|
-
providedIn: 'root',
|
|
12
|
-
}]
|
|
13
|
-
}] });
|
|
14
15
|
|
|
15
|
-
class
|
|
16
|
+
class EmptyUtilsResponseError extends AppError {
|
|
17
|
+
constructor() {
|
|
18
|
+
super('Utils response is empty or not requested. Check your token.');
|
|
19
|
+
}
|
|
16
20
|
}
|
|
17
|
-
CoreLibraryComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: CoreLibraryComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
18
|
-
CoreLibraryComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.7", type: CoreLibraryComponent, selector: "x-payment-client-core", ngImport: i0, template: ` <p>core-library works!</p> `, isInline: true });
|
|
19
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: CoreLibraryComponent, decorators: [{
|
|
20
|
-
type: Component,
|
|
21
|
-
args: [{ selector: 'x-payment-client-core', template: ` <p>core-library works!</p> ` }]
|
|
22
|
-
}] });
|
|
23
21
|
|
|
24
|
-
|
|
22
|
+
const windowToken = new InjectionToken('window');
|
|
23
|
+
|
|
24
|
+
const defaultApiUrl = 'https://secure.xsolla.com/paystation2/api/';
|
|
25
|
+
const sandboxApiUrl = 'https://sandbox-secure.xsolla.com/paystation2/api/';
|
|
26
|
+
|
|
27
|
+
class SecureApiClient {
|
|
28
|
+
constructor(httpClient, window) {
|
|
29
|
+
this.httpClient = httpClient;
|
|
30
|
+
this.window = window;
|
|
31
|
+
this.isSandboxMode = false;
|
|
32
|
+
}
|
|
33
|
+
setSandboxMode(isSandboxMode) {
|
|
34
|
+
this.isSandboxMode = isSandboxMode;
|
|
35
|
+
}
|
|
36
|
+
get(url, options) {
|
|
37
|
+
return this.httpClient.get(`${this.baseUrl}${url}`, options);
|
|
38
|
+
}
|
|
39
|
+
post(url, body, options) {
|
|
40
|
+
return this.httpClient.post(`${this.baseUrl}${url}`, body, options);
|
|
41
|
+
}
|
|
42
|
+
patch(url, body, options) {
|
|
43
|
+
return this.httpClient.patch(`${this.baseUrl}${url}`, body, options);
|
|
44
|
+
}
|
|
45
|
+
put(url, body, options) {
|
|
46
|
+
return this.httpClient.put(`${this.baseUrl}${url}`, body, options);
|
|
47
|
+
}
|
|
48
|
+
delete(url, options) {
|
|
49
|
+
return this.httpClient.delete(`${this.baseUrl}${url}`, options);
|
|
50
|
+
}
|
|
51
|
+
get baseUrl() {
|
|
52
|
+
let predefinedBaseUrl = null;
|
|
53
|
+
try {
|
|
54
|
+
predefinedBaseUrl = this.window.localStorage.getItem('devApiUrl');
|
|
55
|
+
}
|
|
56
|
+
catch (e) {
|
|
57
|
+
console.warn('localStorage is not available');
|
|
58
|
+
}
|
|
59
|
+
if (predefinedBaseUrl) {
|
|
60
|
+
return predefinedBaseUrl;
|
|
61
|
+
}
|
|
62
|
+
return this.isSandboxMode ? sandboxApiUrl : defaultApiUrl;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
SecureApiClient.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: SecureApiClient, deps: [{ token: i1.HttpClient }, { token: windowToken }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
66
|
+
SecureApiClient.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: SecureApiClient, providedIn: 'root' });
|
|
67
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: SecureApiClient, decorators: [{
|
|
68
|
+
type: Injectable,
|
|
69
|
+
args: [{
|
|
70
|
+
providedIn: 'root',
|
|
71
|
+
}]
|
|
72
|
+
}], ctorParameters: function () {
|
|
73
|
+
return [{ type: i1.HttpClient }, { type: undefined, decorators: [{
|
|
74
|
+
type: Inject,
|
|
75
|
+
args: [windowToken]
|
|
76
|
+
}] }];
|
|
77
|
+
} });
|
|
78
|
+
|
|
79
|
+
class SettingsService {
|
|
80
|
+
get project() {
|
|
81
|
+
if (!this.response) {
|
|
82
|
+
throw new EmptyUtilsResponseError();
|
|
83
|
+
}
|
|
84
|
+
return this.response.project;
|
|
85
|
+
}
|
|
86
|
+
get purchase() {
|
|
87
|
+
if (!this.response) {
|
|
88
|
+
throw new EmptyUtilsResponseError();
|
|
89
|
+
}
|
|
90
|
+
return this.response.purchase;
|
|
91
|
+
}
|
|
92
|
+
get settings() {
|
|
93
|
+
var _a, _b;
|
|
94
|
+
if (!this.response) {
|
|
95
|
+
throw new EmptyUtilsResponseError();
|
|
96
|
+
}
|
|
97
|
+
if ((_a = this.response) === null || _a === void 0 ? void 0 : _a.purchase_external_id) {
|
|
98
|
+
return Object.assign(Object.assign({}, this.response.settings), { purchase_external_id: this.response.purchase_external_id });
|
|
99
|
+
}
|
|
100
|
+
return (_b = this.response) === null || _b === void 0 ? void 0 : _b.settings;
|
|
101
|
+
}
|
|
102
|
+
get user() {
|
|
103
|
+
if (!this.response) {
|
|
104
|
+
throw new EmptyUtilsResponseError();
|
|
105
|
+
}
|
|
106
|
+
return this.response.user;
|
|
107
|
+
}
|
|
108
|
+
get utilsResponse() {
|
|
109
|
+
if (!this.response) {
|
|
110
|
+
throw new EmptyUtilsResponseError();
|
|
111
|
+
}
|
|
112
|
+
return this.response;
|
|
113
|
+
}
|
|
114
|
+
get isEmpty() {
|
|
115
|
+
return !this.response;
|
|
116
|
+
}
|
|
117
|
+
get token() {
|
|
118
|
+
return this._token;
|
|
119
|
+
}
|
|
120
|
+
get hasResponse() {
|
|
121
|
+
return !!this.response;
|
|
122
|
+
}
|
|
123
|
+
constructor(secureApi) {
|
|
124
|
+
this.secureApi = secureApi;
|
|
125
|
+
this.isInitialized = false;
|
|
126
|
+
this._token = '';
|
|
127
|
+
this.sandboxMode = false;
|
|
128
|
+
}
|
|
129
|
+
init(configuration) {
|
|
130
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
131
|
+
if (!configuration.token) {
|
|
132
|
+
return Promise.reject('token is missing');
|
|
133
|
+
}
|
|
134
|
+
this._token = configuration.token;
|
|
135
|
+
this.sandboxMode = !!configuration.sandbox;
|
|
136
|
+
yield this.sendRequest(this.token);
|
|
137
|
+
this.isInitialized = true;
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
isSandboxMode() {
|
|
141
|
+
return this.sandboxMode;
|
|
142
|
+
}
|
|
143
|
+
sendRequest(token) {
|
|
144
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
145
|
+
const params = new HttpParams().set('access_token', token);
|
|
146
|
+
this.secureApi.setSandboxMode(this.isSandboxMode());
|
|
147
|
+
this.response = yield firstValueFrom(this.secureApi.get('utils', { params }));
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
SettingsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: SettingsService, deps: [{ token: SecureApiClient }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
152
|
+
SettingsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: SettingsService, providedIn: 'root' });
|
|
153
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: SettingsService, decorators: [{
|
|
154
|
+
type: Injectable,
|
|
155
|
+
args: [{
|
|
156
|
+
providedIn: 'root',
|
|
157
|
+
}]
|
|
158
|
+
}], ctorParameters: function () { return [{ type: SecureApiClient }]; } });
|
|
159
|
+
|
|
160
|
+
class CountryService {
|
|
161
|
+
constructor(settingsService) {
|
|
162
|
+
this.settingsService = settingsService;
|
|
163
|
+
this.userDefinedCountry = null;
|
|
164
|
+
}
|
|
165
|
+
setCountry(country) {
|
|
166
|
+
this.userDefinedCountry = country;
|
|
167
|
+
}
|
|
168
|
+
getCountry() {
|
|
169
|
+
var _a;
|
|
170
|
+
return (_a = this.userDefinedCountry) !== null && _a !== void 0 ? _a : this.getTokenCountry();
|
|
171
|
+
}
|
|
172
|
+
getTokenCountry() {
|
|
173
|
+
return this.settingsService.user.country.value;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
CountryService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: CountryService, deps: [{ token: SettingsService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
177
|
+
CountryService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: CountryService, providedIn: 'root' });
|
|
178
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: CountryService, decorators: [{
|
|
179
|
+
type: Injectable,
|
|
180
|
+
args: [{
|
|
181
|
+
providedIn: 'root',
|
|
182
|
+
}]
|
|
183
|
+
}], ctorParameters: function () { return [{ type: SettingsService }]; } });
|
|
184
|
+
|
|
185
|
+
class ResponseError extends AppError {
|
|
186
|
+
constructor(message) {
|
|
187
|
+
super('Response failed' + (message ? `: "${message}".` : '.'));
|
|
188
|
+
}
|
|
25
189
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
190
|
+
|
|
191
|
+
var BooleanNumber;
|
|
192
|
+
(function (BooleanNumber) {
|
|
193
|
+
BooleanNumber[BooleanNumber["false"] = 0] = "false";
|
|
194
|
+
BooleanNumber[BooleanNumber["true"] = 1] = "true";
|
|
195
|
+
})(BooleanNumber || (BooleanNumber = {}));
|
|
196
|
+
|
|
197
|
+
class PaymentMethodsResponse {
|
|
198
|
+
constructor(paymentMethods) {
|
|
199
|
+
this.especial = paymentMethods.especial.map((method) => this.mapPaymentMethod(method));
|
|
200
|
+
this.top = paymentMethods.top.map((method) => this.mapPaymentMethod(method));
|
|
201
|
+
this.remained = paymentMethods.remained.map((method) => this.mapPaymentMethod(method));
|
|
202
|
+
this.remainedCount = {
|
|
203
|
+
total: paymentMethods.remained_count.total,
|
|
204
|
+
visible: paymentMethods.remained_count.visible,
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
mapPaymentMethod(method) {
|
|
208
|
+
return {
|
|
209
|
+
id: method.id,
|
|
210
|
+
rank: method.rank,
|
|
211
|
+
name: method.name,
|
|
212
|
+
aliases: method.aliases,
|
|
213
|
+
categories: method.cat,
|
|
214
|
+
isVisible: method.is_visible,
|
|
215
|
+
recommended: method.recommended === BooleanNumber.true,
|
|
216
|
+
enabledSaveAccount: method.enabled_save_account,
|
|
217
|
+
iconName: method.switch_icon_name,
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
const paymentMethodsResponseFactoryToken = new InjectionToken('PaymentMethodsResponse');
|
|
223
|
+
const paymentMethodsResponseFactoryProvider = {
|
|
224
|
+
provide: paymentMethodsResponseFactoryToken,
|
|
225
|
+
useValue: (...args) => new PaymentMethodsResponse(...args),
|
|
226
|
+
};
|
|
227
|
+
|
|
228
|
+
class PaymentMethodsService {
|
|
229
|
+
constructor(responseFactory, settingsService, countryService, secureApi) {
|
|
230
|
+
this.responseFactory = responseFactory;
|
|
231
|
+
this.settingsService = settingsService;
|
|
232
|
+
this.countryService = countryService;
|
|
233
|
+
this.secureApi = secureApi;
|
|
234
|
+
this.apiRoute = 'remained_payment_methods';
|
|
235
|
+
this.cache = new Map();
|
|
236
|
+
}
|
|
237
|
+
getList() {
|
|
238
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
239
|
+
const response = yield this.request();
|
|
240
|
+
return response.remained;
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
getQuickMethods() {
|
|
244
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
245
|
+
const response = yield this.request();
|
|
246
|
+
return response.especial;
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
request() {
|
|
250
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
251
|
+
const requestParams = {
|
|
252
|
+
access_token: this.settingsService.token,
|
|
253
|
+
country: this.countryService.getCountry(),
|
|
254
|
+
};
|
|
255
|
+
const cacheKey = JSON.stringify(requestParams);
|
|
256
|
+
if (!this.cache.has(cacheKey)) {
|
|
257
|
+
this.cache.set(cacheKey, lastValueFrom(this.secureApi
|
|
258
|
+
.post(this.apiRoute, new URLSearchParams(Object.assign({}, requestParams)), {
|
|
259
|
+
headers: new HttpHeaders().set('Content-Type', 'application/x-www-form-urlencoded; charset=utf-8'),
|
|
260
|
+
responseType: 'json',
|
|
261
|
+
})
|
|
262
|
+
.pipe(map((response) => this.responseFactory(response.payment_methods)))).catch((error) => {
|
|
263
|
+
throw new ResponseError(error.message);
|
|
264
|
+
}));
|
|
265
|
+
}
|
|
266
|
+
// @ts-expect-error the map already has the cache with key
|
|
267
|
+
return this.cache.get(cacheKey);
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
PaymentMethodsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: PaymentMethodsService, deps: [{ token: paymentMethodsResponseFactoryToken }, { token: SettingsService }, { token: CountryService }, { token: SecureApiClient }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
272
|
+
PaymentMethodsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: PaymentMethodsService, providedIn: 'root' });
|
|
273
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: PaymentMethodsService, decorators: [{
|
|
274
|
+
type: Injectable,
|
|
275
|
+
args: [{
|
|
276
|
+
providedIn: 'root',
|
|
277
|
+
}]
|
|
278
|
+
}], ctorParameters: function () {
|
|
279
|
+
return [{ type: undefined, decorators: [{
|
|
280
|
+
type: Inject,
|
|
281
|
+
args: [paymentMethodsResponseFactoryToken]
|
|
282
|
+
}] }, { type: SettingsService }, { type: CountryService }, { type: SecureApiClient }];
|
|
283
|
+
} });
|
|
284
|
+
|
|
285
|
+
class CoreLibraryService {
|
|
286
|
+
constructor(settingsService, countryService, paymentMethodsService) {
|
|
287
|
+
this.settingsService = settingsService;
|
|
288
|
+
this.countryService = countryService;
|
|
289
|
+
this.paymentMethodsService = paymentMethodsService;
|
|
290
|
+
this.paymentMethods = {
|
|
291
|
+
getList: () => __awaiter(this, void 0, void 0, function* () { return this.paymentMethodsService.getList(); }),
|
|
292
|
+
getQuickMethods: () => __awaiter(this, void 0, void 0, function* () { return this.paymentMethodsService.getQuickMethods(); }),
|
|
293
|
+
};
|
|
294
|
+
}
|
|
295
|
+
init(configuration) {
|
|
296
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
297
|
+
return this.settingsService.init(configuration);
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
setCountry(country) {
|
|
301
|
+
this.countryService.setCountry(country);
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
CoreLibraryService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: CoreLibraryService, deps: [{ token: SettingsService }, { token: CountryService }, { token: PaymentMethodsService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
305
|
+
CoreLibraryService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: CoreLibraryService, providedIn: 'root' });
|
|
306
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: CoreLibraryService, decorators: [{
|
|
307
|
+
type: Injectable,
|
|
308
|
+
args: [{
|
|
309
|
+
providedIn: 'root',
|
|
310
|
+
}]
|
|
311
|
+
}], ctorParameters: function () { return [{ type: SettingsService }, { type: CountryService }, { type: PaymentMethodsService }]; } });
|
|
312
|
+
|
|
313
|
+
class HttpError extends AppError {
|
|
314
|
+
constructor(error, req) {
|
|
315
|
+
var _a;
|
|
316
|
+
super(error.message);
|
|
317
|
+
this.RESTRICTED_KEYS_REGEXP = new RegExp('.*(card_number|number|cvv|cvn|month|year|cardholdername|client_data|dfp|password).*', 'i');
|
|
318
|
+
this.httpErrorData = {
|
|
319
|
+
request: {
|
|
320
|
+
url: req.url,
|
|
321
|
+
method: req.method,
|
|
322
|
+
headers: req.headers,
|
|
323
|
+
},
|
|
324
|
+
response: {
|
|
325
|
+
status: error.status,
|
|
326
|
+
headers: error.headers,
|
|
327
|
+
},
|
|
328
|
+
};
|
|
329
|
+
if (req.body) {
|
|
330
|
+
this.httpErrorData.request.data = this.cleanPersonalData(req.body);
|
|
331
|
+
}
|
|
332
|
+
if (error.statusText) {
|
|
333
|
+
const errorData = error.error;
|
|
334
|
+
this.httpErrorData.response.data = {
|
|
335
|
+
statusText: error.statusText,
|
|
336
|
+
errors: (_a = errorData === null || errorData === void 0 ? void 0 : errorData.errors) !== null && _a !== void 0 ? _a : [],
|
|
337
|
+
};
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
getHttpErrorData() {
|
|
341
|
+
return this.httpErrorData;
|
|
342
|
+
}
|
|
343
|
+
cleanPersonalData(data) {
|
|
344
|
+
return Object.entries(data).reduce((acc, [key, val]) => {
|
|
345
|
+
return Object.assign(Object.assign({}, acc), { [key]: this.RESTRICTED_KEYS_REGEXP.test(key) ? '***' : val });
|
|
346
|
+
}, {});
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
class HttpExceptionsInterceptor {
|
|
351
|
+
constructor(router) {
|
|
352
|
+
this.router = router;
|
|
353
|
+
}
|
|
354
|
+
intercept(req, next) {
|
|
355
|
+
return next.handle(req).pipe(catchError((error) => {
|
|
356
|
+
return throwError(() => new HttpError(error, req));
|
|
357
|
+
}));
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
HttpExceptionsInterceptor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: HttpExceptionsInterceptor, deps: [{ token: i1$1.Router }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
361
|
+
HttpExceptionsInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: HttpExceptionsInterceptor });
|
|
362
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: HttpExceptionsInterceptor, decorators: [{
|
|
363
|
+
type: Injectable
|
|
364
|
+
}], ctorParameters: function () { return [{ type: i1$1.Router }]; } });
|
|
365
|
+
|
|
366
|
+
class CoreLibraryModule {
|
|
367
|
+
}
|
|
368
|
+
CoreLibraryModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: CoreLibraryModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
369
|
+
CoreLibraryModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.7", ngImport: i0, type: CoreLibraryModule, imports: [HttpClientModule] });
|
|
370
|
+
CoreLibraryModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: CoreLibraryModule, providers: [
|
|
371
|
+
{
|
|
372
|
+
provide: HTTP_INTERCEPTORS,
|
|
373
|
+
useClass: HttpExceptionsInterceptor,
|
|
374
|
+
multi: true,
|
|
375
|
+
},
|
|
376
|
+
{ provide: windowToken, useValue: window },
|
|
377
|
+
paymentMethodsResponseFactoryProvider,
|
|
378
|
+
], imports: [HttpClientModule] });
|
|
379
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: CoreLibraryModule, decorators: [{
|
|
380
|
+
type: NgModule,
|
|
381
|
+
args: [{
|
|
382
|
+
imports: [HttpClientModule],
|
|
383
|
+
providers: [
|
|
384
|
+
{
|
|
385
|
+
provide: HTTP_INTERCEPTORS,
|
|
386
|
+
useClass: HttpExceptionsInterceptor,
|
|
387
|
+
multi: true,
|
|
388
|
+
},
|
|
389
|
+
{ provide: windowToken, useValue: window },
|
|
390
|
+
paymentMethodsResponseFactoryProvider,
|
|
391
|
+
],
|
|
392
|
+
}]
|
|
36
393
|
}] });
|
|
37
394
|
|
|
38
|
-
/*
|
|
39
|
-
* Public API Surface of core-library
|
|
395
|
+
/*
|
|
396
|
+
* Public API Surface of core-library
|
|
40
397
|
*/
|
|
41
398
|
|
|
42
|
-
/**
|
|
43
|
-
* Generated bundle index. Do not edit.
|
|
399
|
+
/**
|
|
400
|
+
* Generated bundle index. Do not edit.
|
|
44
401
|
*/
|
|
45
402
|
|
|
46
|
-
export {
|
|
403
|
+
export { CoreLibraryModule, CoreLibraryService };
|
|
47
404
|
//# sourceMappingURL=xsolla-payment-client-core.mjs.map
|