@xsolla/payment-client-core 0.0.2 → 0.0.3-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/esm2020/lib/core/boolean-number.enum.mjs +5 -5
- package/esm2020/lib/core/country/country.service.mjs +26 -26
- package/esm2020/lib/core/deep-readonly.type.mjs +1 -1
- package/esm2020/lib/core/exceptions-handling/errors/api-error.interface.mjs +1 -1
- package/esm2020/lib/core/exceptions-handling/errors/app-error.class.mjs +5 -5
- package/esm2020/lib/core/exceptions-handling/errors/http-error.class.mjs +39 -39
- package/esm2020/lib/core/exceptions-handling/errors/response-error.class.mjs +6 -6
- package/esm2020/lib/core/exceptions-handling/http-interceptor/http-error-data.interface.mjs +1 -1
- package/esm2020/lib/core/exceptions-handling/http-interceptor/http-error-response-data.interface.mjs +1 -1
- package/esm2020/lib/core/exceptions-handling/http-interceptor/http-exceptions.interceptor.mjs +21 -21
- package/esm2020/lib/core/extended-window.interface.mjs +1 -1
- package/esm2020/lib/core/http/secure-api/api-url.const.mjs +2 -2
- package/esm2020/lib/core/http/secure-api/options.interface.mjs +1 -1
- package/esm2020/lib/core/http/secure-api/secure-api.service.mjs +54 -54
- package/esm2020/lib/core/legal/disclaimer.service.mjs +16 -0
- package/esm2020/lib/core/legal/legal.component.config.mjs +2 -0
- package/esm2020/lib/core/legal/legal.service.mjs +39 -0
- package/esm2020/lib/core/legal/refund-policy.service.mjs +30 -0
- package/esm2020/lib/core/legal/secure-connection.service.mjs +31 -0
- package/esm2020/lib/core/payment-methods/payment-method-api.interface.mjs +1 -1
- package/esm2020/lib/core/payment-methods/payment-method.interface.mjs +1 -1
- package/esm2020/lib/core/payment-methods/payment-methods-api.interface.mjs +1 -1
- package/esm2020/lib/core/payment-methods/payment-methods-request-params.interface.mjs +1 -1
- package/esm2020/lib/core/payment-methods/payment-methods-response.class.mjs +25 -25
- package/esm2020/lib/core/payment-methods/payment-methods-response.interface.mjs +1 -1
- package/esm2020/lib/core/payment-methods/payment-methods-response.token.mjs +7 -7
- package/esm2020/lib/core/payment-methods/payment-methods.service.mjs +57 -57
- package/esm2020/lib/core/saved-methods/saved-method-api.interface.mjs +2 -0
- package/esm2020/lib/core/saved-methods/saved-method.interface.mjs +2 -0
- package/esm2020/lib/core/saved-methods/saved-methods-request-params.interface.mjs +2 -0
- package/esm2020/lib/core/saved-methods/saved-methods-response.class.mjs +24 -0
- package/esm2020/lib/core/saved-methods/saved-methods-response.interface.mjs +2 -0
- package/esm2020/lib/core/saved-methods/saved-methods-response.token.mjs +8 -0
- package/esm2020/lib/core/saved-methods/saved-methods.service.mjs +53 -0
- package/esm2020/lib/core/settings/auto-redirect-on-status.mjs +13 -13
- package/esm2020/lib/core/settings/balance.interface.mjs +1 -1
- package/esm2020/lib/core/settings/bonus.interface.mjs +1 -1
- package/esm2020/lib/core/settings/configuration.interface.mjs +1 -1
- package/esm2020/lib/core/settings/empty-utils-response.error.mjs +6 -6
- package/esm2020/lib/core/settings/header-type.enum.mjs +5 -5
- package/esm2020/lib/core/settings/offer.interface.mjs +1 -1
- package/esm2020/lib/core/settings/project.interface.mjs +1 -1
- package/esm2020/lib/core/settings/purchase.interface.mjs +1 -1
- package/esm2020/lib/core/settings/settings-mode.enum.mjs +4 -4
- package/esm2020/lib/core/settings/settings.interface.mjs +1 -1
- package/esm2020/lib/core/settings/settings.service.mjs +84 -84
- package/esm2020/lib/core/settings/status-back-show.mjs +15 -15
- package/esm2020/lib/core/settings/tracking-info.interface.mjs +1 -1
- package/esm2020/lib/core/settings/user.interface.mjs +1 -1
- package/esm2020/lib/core/settings/utils-response.interface.mjs +1 -1
- package/esm2020/lib/core/user-balance/user-balance-api.interface.mjs +2 -0
- package/esm2020/lib/core/user-balance/user-balance-request-params.interface.mjs +2 -0
- package/esm2020/lib/core/user-balance/user-balance-response.class.mjs +8 -0
- package/esm2020/lib/core/user-balance/user-balance-response.token.mjs +8 -0
- package/esm2020/lib/core/user-balance/user-balance.service.mjs +50 -0
- package/esm2020/lib/core/window.token.mjs +2 -2
- package/esm2020/lib/core-library.module.mjs +41 -35
- package/esm2020/lib/core-library.service.mjs +42 -31
- package/esm2020/public-api.mjs +7 -6
- package/esm2020/xsolla-payment-client-core.mjs +4 -4
- package/fesm2015/xsolla-payment-client-core.mjs +618 -358
- package/fesm2015/xsolla-payment-client-core.mjs.map +1 -1
- package/fesm2020/xsolla-payment-client-core.mjs +589 -345
- 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 -4
- package/lib/core/country/country.service.d.ts +12 -12
- package/lib/core/deep-readonly.type.d.ts +3 -3
- package/lib/core/exceptions-handling/errors/api-error.interface.d.ts +4 -4
- package/lib/core/exceptions-handling/errors/app-error.class.d.ts +3 -3
- package/lib/core/exceptions-handling/errors/http-error.class.d.ts +10 -10
- package/lib/core/exceptions-handling/errors/response-error.class.d.ts +4 -4
- package/lib/core/exceptions-handling/http-interceptor/http-error-data.interface.d.ts +20 -20
- package/lib/core/exceptions-handling/http-interceptor/http-error-response-data.interface.d.ts +7 -7
- package/lib/core/exceptions-handling/http-interceptor/http-exceptions.interceptor.d.ts +11 -11
- package/lib/core/extended-window.interface.d.ts +1 -1
- package/lib/core/http/secure-api/api-url.const.d.ts +2 -2
- package/lib/core/http/secure-api/options.interface.d.ts +14 -14
- package/lib/core/http/secure-api/secure-api.service.d.ts +20 -20
- package/lib/core/legal/disclaimer.service.d.ts +6 -0
- package/lib/core/legal/legal.component.config.d.ts +10 -0
- package/lib/core/legal/legal.service.d.ts +18 -0
- package/lib/core/legal/refund-policy.service.d.ts +11 -0
- package/lib/core/legal/secure-connection.service.d.ts +13 -0
- package/lib/core/payment-methods/payment-method-api.interface.d.ts +11 -11
- package/lib/core/payment-methods/payment-method.interface.d.ts +11 -11
- package/lib/core/payment-methods/payment-methods-api.interface.d.ts +10 -10
- package/lib/core/payment-methods/payment-methods-request-params.interface.d.ts +4 -4
- package/lib/core/payment-methods/payment-methods-response.class.d.ts +13 -13
- package/lib/core/payment-methods/payment-methods-response.interface.d.ts +4 -4
- package/lib/core/payment-methods/payment-methods-response.token.d.ts +7 -7
- package/lib/core/payment-methods/payment-methods.service.d.ts +20 -20
- package/lib/core/saved-methods/saved-method-api.interface.d.ts +22 -0
- package/lib/core/saved-methods/saved-method.interface.d.ts +21 -0
- package/lib/core/saved-methods/saved-methods-request-params.interface.d.ts +3 -0
- package/lib/core/saved-methods/saved-methods-response.class.d.ts +7 -0
- package/lib/core/saved-methods/saved-methods-response.interface.d.ts +4 -0
- package/lib/core/saved-methods/saved-methods-response.token.d.ts +7 -0
- package/lib/core/saved-methods/saved-methods.service.d.ts +19 -0
- package/lib/core/settings/auto-redirect-on-status.d.ts +12 -12
- package/lib/core/settings/balance.interface.d.ts +4 -4
- package/lib/core/settings/bonus.interface.d.ts +10 -10
- package/lib/core/settings/configuration.interface.d.ts +5 -5
- package/lib/core/settings/empty-utils-response.error.d.ts +4 -4
- package/lib/core/settings/header-type.enum.d.ts +4 -4
- package/lib/core/settings/offer.interface.d.ts +6 -6
- package/lib/core/settings/project.interface.d.ts +32 -32
- package/lib/core/settings/purchase.interface.d.ts +47 -47
- package/lib/core/settings/settings-mode.enum.d.ts +3 -3
- package/lib/core/settings/settings.interface.d.ts +45 -45
- package/lib/core/settings/settings.service.d.ts +30 -30
- package/lib/core/settings/status-back-show.d.ts +14 -14
- package/lib/core/settings/tracking-info.interface.d.ts +5 -5
- package/lib/core/settings/user.interface.d.ts +23 -23
- package/lib/core/settings/utils-response.interface.d.ts +16 -16
- package/lib/core/user-balance/user-balance-api.interface.d.ts +4 -0
- package/lib/core/user-balance/user-balance-request-params.interface.d.ts +3 -0
- package/lib/core/user-balance/user-balance-response.class.d.ts +6 -0
- package/lib/core/user-balance/user-balance-response.token.d.ts +7 -0
- package/lib/core/user-balance/user-balance.service.d.ts +17 -0
- package/lib/core/window.token.d.ts +3 -3
- package/lib/core-library.module.d.ts +7 -7
- package/lib/core-library.service.d.ts +32 -20
- package/package.json +1 -1
- package/public-api.d.ts +3 -2
- package/xsolla-payment-client-core-0.0.3-2.tgz +0 -0
- package/xsolla-payment-client-core-0.0.2.tgz +0 -0
|
@@ -7,397 +7,657 @@ import { HttpParams, HttpHeaders, HttpClientModule, HTTP_INTERCEPTORS } from '@a
|
|
|
7
7
|
import { catchError } from 'rxjs/operators';
|
|
8
8
|
import * as i1$1 from '@angular/router';
|
|
9
9
|
|
|
10
|
-
class AppError extends Error {
|
|
11
|
-
constructor(message) {
|
|
12
|
-
super(message);
|
|
13
|
-
}
|
|
10
|
+
class AppError extends Error {
|
|
11
|
+
constructor(message) {
|
|
12
|
+
super(message);
|
|
13
|
+
}
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
class EmptyUtilsResponseError extends AppError {
|
|
17
|
-
constructor() {
|
|
18
|
-
super('Utils response is empty or not requested. Check your token.');
|
|
19
|
-
}
|
|
16
|
+
class EmptyUtilsResponseError extends AppError {
|
|
17
|
+
constructor() {
|
|
18
|
+
super('Utils response is empty or not requested. Check your token.');
|
|
19
|
+
}
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
const windowToken = new InjectionToken('window');
|
|
23
23
|
|
|
24
|
-
const defaultApiUrl = 'https://secure.xsolla.com/paystation2/api/';
|
|
24
|
+
const defaultApiUrl = 'https://secure.xsolla.com/paystation2/api/';
|
|
25
25
|
const sandboxApiUrl = 'https://sandbox-secure.xsolla.com/paystation2/api/';
|
|
26
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
|
-
}] }];
|
|
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
77
|
} });
|
|
78
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
|
-
}]
|
|
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
158
|
}], ctorParameters: function () { return [{ type: SecureApiClient }]; } });
|
|
159
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
|
-
}]
|
|
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
183
|
}], ctorParameters: function () { return [{ type: SettingsService }]; } });
|
|
184
184
|
|
|
185
|
-
class ResponseError extends AppError {
|
|
186
|
-
constructor(message) {
|
|
187
|
-
super('Response failed' + (message ? `: "${message}".` : '.'));
|
|
188
|
-
}
|
|
185
|
+
class ResponseError extends AppError {
|
|
186
|
+
constructor(message) {
|
|
187
|
+
super('Response failed' + (message ? `: "${message}".` : '.'));
|
|
188
|
+
}
|
|
189
189
|
}
|
|
190
190
|
|
|
191
|
-
var BooleanNumber;
|
|
192
|
-
(function (BooleanNumber) {
|
|
193
|
-
BooleanNumber[BooleanNumber["false"] = 0] = "false";
|
|
194
|
-
BooleanNumber[BooleanNumber["true"] = 1] = "true";
|
|
191
|
+
var BooleanNumber;
|
|
192
|
+
(function (BooleanNumber) {
|
|
193
|
+
BooleanNumber[BooleanNumber["false"] = 0] = "false";
|
|
194
|
+
BooleanNumber[BooleanNumber["true"] = 1] = "true";
|
|
195
195
|
})(BooleanNumber || (BooleanNumber = {}));
|
|
196
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
|
-
}
|
|
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 SavedMethodsResponse {
|
|
286
|
+
constructor(savedMethods) {
|
|
287
|
+
this.list = savedMethods.list.map((method) => this.mapSavedMethod(method));
|
|
288
|
+
}
|
|
289
|
+
mapSavedMethod(method) {
|
|
290
|
+
return {
|
|
291
|
+
currency: method.currency,
|
|
292
|
+
form: method.form,
|
|
293
|
+
id: method.id,
|
|
294
|
+
isSelected: method.isSelected,
|
|
295
|
+
isBabkaPay: method.is_babka_pay,
|
|
296
|
+
name: method.name,
|
|
297
|
+
pid: method.pid,
|
|
298
|
+
psName: method.psName,
|
|
299
|
+
recurrentType: method.recurrent_type,
|
|
300
|
+
replaced: method.replaced,
|
|
301
|
+
type: method.type,
|
|
302
|
+
cardExpiryDate: method.card_expiry_date,
|
|
303
|
+
iconName: method.switch_icon_name,
|
|
304
|
+
partner: method.partner,
|
|
305
|
+
};
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
const savedMethodsResponseFactoryToken = new InjectionToken('SavedMethodsResponse');
|
|
310
|
+
const savedMethodsResponseFactoryProvider = {
|
|
311
|
+
provide: savedMethodsResponseFactoryToken,
|
|
312
|
+
useValue: (...args) => new SavedMethodsResponse(...args),
|
|
313
|
+
};
|
|
314
|
+
|
|
315
|
+
class SavedMethodsService {
|
|
316
|
+
constructor(responseFactory, settingsService, countryService, secureApi) {
|
|
317
|
+
this.responseFactory = responseFactory;
|
|
318
|
+
this.settingsService = settingsService;
|
|
319
|
+
this.countryService = countryService;
|
|
320
|
+
this.secureApi = secureApi;
|
|
321
|
+
this.apiRoute = 'savedmethods';
|
|
322
|
+
this.cache = new Map();
|
|
323
|
+
}
|
|
324
|
+
getList() {
|
|
325
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
326
|
+
const response = yield this.request();
|
|
327
|
+
return response.list;
|
|
328
|
+
});
|
|
329
|
+
}
|
|
330
|
+
request() {
|
|
331
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
332
|
+
const requestParams = {
|
|
333
|
+
access_token: this.settingsService.token,
|
|
334
|
+
};
|
|
335
|
+
const cacheKey = JSON.stringify(requestParams);
|
|
336
|
+
if (!this.cache.has(cacheKey)) {
|
|
337
|
+
this.cache.set(cacheKey, lastValueFrom(this.secureApi
|
|
338
|
+
.post(this.apiRoute, new URLSearchParams(Object.assign({}, requestParams)), {
|
|
339
|
+
headers: new HttpHeaders().set('Content-Type', 'application/x-www-form-urlencoded; charset=utf-8'),
|
|
340
|
+
responseType: 'json',
|
|
341
|
+
})
|
|
342
|
+
.pipe(map((response) => this.responseFactory(response)))).catch((error) => {
|
|
343
|
+
throw new ResponseError(error.message);
|
|
344
|
+
}));
|
|
345
|
+
}
|
|
346
|
+
// @ts-expect-error the map already has the cache with key
|
|
347
|
+
return this.cache.get(cacheKey);
|
|
348
|
+
});
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
SavedMethodsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: SavedMethodsService, deps: [{ token: savedMethodsResponseFactoryToken }, { token: SettingsService }, { token: CountryService }, { token: SecureApiClient }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
352
|
+
SavedMethodsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: SavedMethodsService, providedIn: 'root' });
|
|
353
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: SavedMethodsService, decorators: [{
|
|
354
|
+
type: Injectable,
|
|
355
|
+
args: [{
|
|
356
|
+
providedIn: 'root',
|
|
357
|
+
}]
|
|
358
|
+
}], ctorParameters: function () {
|
|
359
|
+
return [{ type: undefined, decorators: [{
|
|
360
|
+
type: Inject,
|
|
361
|
+
args: [savedMethodsResponseFactoryToken]
|
|
362
|
+
}] }, { type: SettingsService }, { type: CountryService }, { type: SecureApiClient }];
|
|
363
|
+
} });
|
|
364
|
+
|
|
365
|
+
class UserBalanceResponse {
|
|
366
|
+
constructor(userBalance) {
|
|
367
|
+
var _a, _b;
|
|
368
|
+
this.isEnoughUserBalance = (_a = userBalance.is_enough_user_balance) !== null && _a !== void 0 ? _a : false;
|
|
369
|
+
this.isEnoughUserRecurrentBalance =
|
|
370
|
+
(_b = userBalance.is_enough_user_recurrent_balance) !== null && _b !== void 0 ? _b : false;
|
|
371
|
+
}
|
|
220
372
|
}
|
|
221
373
|
|
|
222
|
-
const
|
|
223
|
-
const
|
|
224
|
-
provide:
|
|
225
|
-
useValue: (...args) => new
|
|
374
|
+
const userBalanceResponseFactoryToken = new InjectionToken('UserBalanceResponse');
|
|
375
|
+
const userBalanceResponseFactoryProvider = {
|
|
376
|
+
provide: userBalanceResponseFactoryToken,
|
|
377
|
+
useValue: (...args) => new UserBalanceResponse(...args),
|
|
226
378
|
};
|
|
227
379
|
|
|
228
|
-
class
|
|
229
|
-
constructor(responseFactory, settingsService,
|
|
230
|
-
this.responseFactory = responseFactory;
|
|
231
|
-
this.settingsService = settingsService;
|
|
232
|
-
this.
|
|
233
|
-
this.
|
|
234
|
-
this.
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
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 }];
|
|
380
|
+
class UserBalanceService {
|
|
381
|
+
constructor(responseFactory, settingsService, secureApi) {
|
|
382
|
+
this.responseFactory = responseFactory;
|
|
383
|
+
this.settingsService = settingsService;
|
|
384
|
+
this.secureApi = secureApi;
|
|
385
|
+
this.apiRoute = 'balance/sufficiency';
|
|
386
|
+
this.cache = new Map();
|
|
387
|
+
}
|
|
388
|
+
getUserBalance() {
|
|
389
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
390
|
+
return this.request();
|
|
391
|
+
});
|
|
392
|
+
}
|
|
393
|
+
request() {
|
|
394
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
395
|
+
const requestParams = {
|
|
396
|
+
access_token: this.settingsService.token,
|
|
397
|
+
};
|
|
398
|
+
const cacheKey = JSON.stringify(requestParams);
|
|
399
|
+
if (!this.cache.has(cacheKey)) {
|
|
400
|
+
this.cache.set(cacheKey, lastValueFrom(this.secureApi
|
|
401
|
+
.post(this.apiRoute, new URLSearchParams(Object.assign({}, requestParams)), {
|
|
402
|
+
headers: new HttpHeaders().set('Content-Type', 'application/x-www-form-urlencoded; charset=utf-8'),
|
|
403
|
+
responseType: 'json',
|
|
404
|
+
})
|
|
405
|
+
.pipe(map((response) => this.responseFactory(response)))).catch((error) => {
|
|
406
|
+
throw new ResponseError(error.message);
|
|
407
|
+
}));
|
|
408
|
+
}
|
|
409
|
+
// @ts-expect-error the map already has the cache with key
|
|
410
|
+
return this.cache.get(cacheKey);
|
|
411
|
+
});
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
UserBalanceService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: UserBalanceService, deps: [{ token: userBalanceResponseFactoryToken }, { token: SettingsService }, { token: SecureApiClient }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
415
|
+
UserBalanceService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: UserBalanceService, providedIn: 'root' });
|
|
416
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: UserBalanceService, decorators: [{
|
|
417
|
+
type: Injectable,
|
|
418
|
+
args: [{
|
|
419
|
+
providedIn: 'root',
|
|
420
|
+
}]
|
|
421
|
+
}], ctorParameters: function () {
|
|
422
|
+
return [{ type: undefined, decorators: [{
|
|
423
|
+
type: Inject,
|
|
424
|
+
args: [userBalanceResponseFactoryToken]
|
|
425
|
+
}] }, { type: SettingsService }, { type: SecureApiClient }];
|
|
283
426
|
} });
|
|
284
427
|
|
|
285
|
-
class
|
|
286
|
-
constructor(settingsService
|
|
287
|
-
this.settingsService = settingsService;
|
|
288
|
-
this.
|
|
289
|
-
this.
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
428
|
+
class RefundPolicyService {
|
|
429
|
+
constructor(settingsService) {
|
|
430
|
+
this.settingsService = settingsService;
|
|
431
|
+
this.defaultVersionId = 2;
|
|
432
|
+
this.defaultUrl = 'https://xsolla.com/refund-policy-ps';
|
|
433
|
+
}
|
|
434
|
+
get url() {
|
|
435
|
+
var _a, _b, _c, _d;
|
|
436
|
+
if (!this.settingsService.token) {
|
|
437
|
+
return 'https://xsolla.com/refundpolicy/en-us';
|
|
438
|
+
}
|
|
439
|
+
const language = (_a = this.settingsService.user.local) !== null && _a !== void 0 ? _a : 'en';
|
|
440
|
+
const versionId = (_c = (_b = this.settingsService.project.refundPolicySettings) === null || _b === void 0 ? void 0 : _b.policy_version_id) !== null && _c !== void 0 ? _c : this.defaultVersionId;
|
|
441
|
+
const countryIso = (_d = this.settingsService.user.country.value) !== null && _d !== void 0 ? _d : '';
|
|
442
|
+
const projectId = this.settingsService.project.id;
|
|
443
|
+
return `${this.defaultUrl}?policy_version_id=${versionId}&language=${language}&country=${countryIso}&project_id=${projectId}`;
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
RefundPolicyService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: RefundPolicyService, deps: [{ token: SettingsService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
447
|
+
RefundPolicyService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: RefundPolicyService, providedIn: 'root' });
|
|
448
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: RefundPolicyService, decorators: [{
|
|
449
|
+
type: Injectable,
|
|
450
|
+
args: [{
|
|
451
|
+
providedIn: 'root',
|
|
452
|
+
}]
|
|
453
|
+
}], ctorParameters: function () { return [{ type: SettingsService }]; } });
|
|
454
|
+
|
|
455
|
+
class SecureConnectionService {
|
|
456
|
+
get isWhiteLabel() {
|
|
457
|
+
var _a;
|
|
458
|
+
return !!((_a = this.settingsService.settings) === null || _a === void 0 ? void 0 : _a.white_label);
|
|
459
|
+
}
|
|
460
|
+
get secureConnectionUrl() {
|
|
461
|
+
this.setSecureConnectionUrl();
|
|
462
|
+
return this._secureConnectionUrl;
|
|
463
|
+
}
|
|
464
|
+
constructor(settingsService) {
|
|
465
|
+
this.settingsService = settingsService;
|
|
466
|
+
this.secureConnectionApi = 'https://verify.xsolla.com/?url=';
|
|
467
|
+
}
|
|
468
|
+
setSecureConnectionUrl() {
|
|
469
|
+
var _a;
|
|
470
|
+
const projectUrl = (_a = this.settingsService.project) === null || _a === void 0 ? void 0 : _a.projectUrl;
|
|
471
|
+
if (projectUrl) {
|
|
472
|
+
this._secureConnectionUrl = `${this.secureConnectionApi}${encodeURIComponent(projectUrl)}`;
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
SecureConnectionService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: SecureConnectionService, deps: [{ token: SettingsService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
477
|
+
SecureConnectionService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: SecureConnectionService, providedIn: 'root' });
|
|
478
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: SecureConnectionService, decorators: [{
|
|
479
|
+
type: Injectable,
|
|
480
|
+
args: [{
|
|
481
|
+
providedIn: 'root'
|
|
482
|
+
}]
|
|
483
|
+
}], ctorParameters: function () { return [{ type: SettingsService }]; } });
|
|
484
|
+
|
|
485
|
+
class DisclaimerService {
|
|
486
|
+
get disclaimer() {
|
|
487
|
+
return 'disclaimer';
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
DisclaimerService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: DisclaimerService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
491
|
+
DisclaimerService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: DisclaimerService, providedIn: 'root' });
|
|
492
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: DisclaimerService, decorators: [{
|
|
493
|
+
type: Injectable,
|
|
494
|
+
args: [{
|
|
495
|
+
providedIn: 'root'
|
|
496
|
+
}]
|
|
497
|
+
}] });
|
|
498
|
+
|
|
499
|
+
class LegalService {
|
|
500
|
+
get isJapanUser() {
|
|
501
|
+
var _a;
|
|
502
|
+
return ((_a = this.settingsService.user) === null || _a === void 0 ? void 0 : _a.local) === 'ja';
|
|
503
|
+
}
|
|
504
|
+
constructor(settingsService, refundPolicyService, secureConnectionService, disclaimerService) {
|
|
505
|
+
this.settingsService = settingsService;
|
|
506
|
+
this.refundPolicyService = refundPolicyService;
|
|
507
|
+
this.secureConnectionService = secureConnectionService;
|
|
508
|
+
this.disclaimerService = disclaimerService;
|
|
509
|
+
this.sctlPolicyUrl = 'https://xsolla.com/sctl';
|
|
510
|
+
}
|
|
511
|
+
getLegalComponentConfig() {
|
|
512
|
+
return {
|
|
513
|
+
isJapanUser: this.isJapanUser,
|
|
514
|
+
refundPolicyUrl: this.refundPolicyService.url,
|
|
515
|
+
sctlPolicyUrl: this.sctlPolicyUrl,
|
|
516
|
+
secureConnection: {
|
|
517
|
+
secureConnectionUrl: this.secureConnectionService.secureConnectionUrl,
|
|
518
|
+
isWhiteLabel: this.secureConnectionService.isWhiteLabel,
|
|
519
|
+
},
|
|
520
|
+
disclaimer: this.disclaimerService.disclaimer
|
|
521
|
+
};
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
LegalService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: LegalService, deps: [{ token: SettingsService }, { token: RefundPolicyService }, { token: SecureConnectionService }, { token: DisclaimerService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
525
|
+
LegalService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: LegalService, providedIn: 'root' });
|
|
526
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: LegalService, decorators: [{
|
|
527
|
+
type: Injectable,
|
|
528
|
+
args: [{
|
|
529
|
+
providedIn: 'root',
|
|
530
|
+
}]
|
|
531
|
+
}], ctorParameters: function () { return [{ type: SettingsService }, { type: RefundPolicyService }, { type: SecureConnectionService }, { type: DisclaimerService }]; } });
|
|
312
532
|
|
|
313
|
-
class
|
|
314
|
-
constructor(
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
this.
|
|
318
|
-
this.
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
},
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
this.
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
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
|
-
}
|
|
533
|
+
class CoreLibraryService {
|
|
534
|
+
constructor(settingsService, countryService, paymentMethodsService, savedMethodsService, userBalanceService, legalService) {
|
|
535
|
+
this.settingsService = settingsService;
|
|
536
|
+
this.countryService = countryService;
|
|
537
|
+
this.paymentMethodsService = paymentMethodsService;
|
|
538
|
+
this.savedMethodsService = savedMethodsService;
|
|
539
|
+
this.userBalanceService = userBalanceService;
|
|
540
|
+
this.legalService = legalService;
|
|
541
|
+
this.paymentMethods = {
|
|
542
|
+
getList: () => __awaiter(this, void 0, void 0, function* () { return this.paymentMethodsService.getList(); }),
|
|
543
|
+
getQuickMethods: () => __awaiter(this, void 0, void 0, function* () { return this.paymentMethodsService.getQuickMethods(); }),
|
|
544
|
+
getSavedMethods: () => __awaiter(this, void 0, void 0, function* () { return this.savedMethodsService.getList(); }),
|
|
545
|
+
getUserBalance: () => __awaiter(this, void 0, void 0, function* () { return this.userBalanceService.getUserBalance(); }),
|
|
546
|
+
};
|
|
547
|
+
}
|
|
548
|
+
init(configuration) {
|
|
549
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
550
|
+
return this.settingsService.init(configuration);
|
|
551
|
+
});
|
|
552
|
+
}
|
|
553
|
+
setCountry(country) {
|
|
554
|
+
this.countryService.setCountry(country);
|
|
555
|
+
}
|
|
556
|
+
getLegalComponentConfig() {
|
|
557
|
+
return this.legalService.getLegalComponentConfig();
|
|
558
|
+
}
|
|
348
559
|
}
|
|
560
|
+
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: LegalService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
561
|
+
CoreLibraryService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: CoreLibraryService, providedIn: 'root' });
|
|
562
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: CoreLibraryService, decorators: [{
|
|
563
|
+
type: Injectable,
|
|
564
|
+
args: [{
|
|
565
|
+
providedIn: 'root',
|
|
566
|
+
}]
|
|
567
|
+
}], ctorParameters: function () { return [{ type: SettingsService }, { type: CountryService }, { type: PaymentMethodsService }, { type: SavedMethodsService }, { type: UserBalanceService }, { type: LegalService }]; } });
|
|
349
568
|
|
|
350
|
-
class
|
|
351
|
-
constructor(
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
569
|
+
class HttpError extends AppError {
|
|
570
|
+
constructor(error, req) {
|
|
571
|
+
var _a;
|
|
572
|
+
super(error.message);
|
|
573
|
+
this.RESTRICTED_KEYS_REGEXP = new RegExp('.*(card_number|number|cvv|cvn|month|year|cardholdername|client_data|dfp|password).*', 'i');
|
|
574
|
+
this.httpErrorData = {
|
|
575
|
+
request: {
|
|
576
|
+
url: req.url,
|
|
577
|
+
method: req.method,
|
|
578
|
+
headers: req.headers,
|
|
579
|
+
},
|
|
580
|
+
response: {
|
|
581
|
+
status: error.status,
|
|
582
|
+
headers: error.headers,
|
|
583
|
+
},
|
|
584
|
+
};
|
|
585
|
+
if (req.body) {
|
|
586
|
+
this.httpErrorData.request.data = this.cleanPersonalData(req.body);
|
|
587
|
+
}
|
|
588
|
+
if (error.statusText) {
|
|
589
|
+
const errorData = error.error;
|
|
590
|
+
this.httpErrorData.response.data = {
|
|
591
|
+
statusText: error.statusText,
|
|
592
|
+
errors: (_a = errorData === null || errorData === void 0 ? void 0 : errorData.errors) !== null && _a !== void 0 ? _a : [],
|
|
593
|
+
};
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
getHttpErrorData() {
|
|
597
|
+
return this.httpErrorData;
|
|
598
|
+
}
|
|
599
|
+
cleanPersonalData(data) {
|
|
600
|
+
return Object.entries(data).reduce((acc, [key, val]) => {
|
|
601
|
+
return Object.assign(Object.assign({}, acc), { [key]: this.RESTRICTED_KEYS_REGEXP.test(key) ? '***' : val });
|
|
602
|
+
}, {});
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
class HttpExceptionsInterceptor {
|
|
607
|
+
constructor(router) {
|
|
608
|
+
this.router = router;
|
|
609
|
+
}
|
|
610
|
+
intercept(req, next) {
|
|
611
|
+
return next.handle(req).pipe(catchError((error) => {
|
|
612
|
+
return throwError(() => new HttpError(error, req));
|
|
613
|
+
}));
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
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 });
|
|
617
|
+
HttpExceptionsInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: HttpExceptionsInterceptor });
|
|
618
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: HttpExceptionsInterceptor, decorators: [{
|
|
619
|
+
type: Injectable
|
|
364
620
|
}], ctorParameters: function () { return [{ type: i1$1.Router }]; } });
|
|
365
621
|
|
|
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
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
622
|
+
class CoreLibraryModule {
|
|
623
|
+
}
|
|
624
|
+
CoreLibraryModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: CoreLibraryModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
625
|
+
CoreLibraryModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.7", ngImport: i0, type: CoreLibraryModule, imports: [HttpClientModule] });
|
|
626
|
+
CoreLibraryModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: CoreLibraryModule, providers: [
|
|
627
|
+
{
|
|
628
|
+
provide: HTTP_INTERCEPTORS,
|
|
629
|
+
useClass: HttpExceptionsInterceptor,
|
|
630
|
+
multi: true,
|
|
631
|
+
},
|
|
632
|
+
{ provide: windowToken, useValue: window },
|
|
633
|
+
paymentMethodsResponseFactoryProvider,
|
|
634
|
+
savedMethodsResponseFactoryProvider,
|
|
635
|
+
userBalanceResponseFactoryProvider,
|
|
636
|
+
], imports: [HttpClientModule] });
|
|
637
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: CoreLibraryModule, decorators: [{
|
|
638
|
+
type: NgModule,
|
|
639
|
+
args: [{
|
|
640
|
+
imports: [HttpClientModule],
|
|
641
|
+
providers: [
|
|
642
|
+
{
|
|
643
|
+
provide: HTTP_INTERCEPTORS,
|
|
644
|
+
useClass: HttpExceptionsInterceptor,
|
|
645
|
+
multi: true,
|
|
646
|
+
},
|
|
647
|
+
{ provide: windowToken, useValue: window },
|
|
648
|
+
paymentMethodsResponseFactoryProvider,
|
|
649
|
+
savedMethodsResponseFactoryProvider,
|
|
650
|
+
userBalanceResponseFactoryProvider,
|
|
651
|
+
],
|
|
652
|
+
}]
|
|
393
653
|
}] });
|
|
394
654
|
|
|
395
|
-
/*
|
|
396
|
-
* Public API Surface of core-library
|
|
655
|
+
/*
|
|
656
|
+
* Public API Surface of core-library
|
|
397
657
|
*/
|
|
398
658
|
|
|
399
|
-
/**
|
|
400
|
-
* Generated bundle index. Do not edit.
|
|
659
|
+
/**
|
|
660
|
+
* Generated bundle index. Do not edit.
|
|
401
661
|
*/
|
|
402
662
|
|
|
403
663
|
export { CoreLibraryModule, CoreLibraryService };
|