@xsolla/payment-client-core 0.2.74 → 0.2.75
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/esm2022/lib/core/exceptions-handling/common-log-attributes/common-log-attributes.interface.mjs +2 -0
- package/esm2022/lib/core/exceptions-handling/common-log-attributes/common-log-attributes.service.mjs +50 -0
- package/esm2022/lib/core/exceptions-handling/elk/additional-info.interface.mjs +1 -1
- package/esm2022/lib/core/exceptions-handling/elk/elk-logger.service.mjs +17 -23
- package/esm2022/lib/core/exceptions-handling/elk/log-message.interface.mjs +1 -1
- package/esm2022/lib/core/exceptions-handling/errors/index.mjs +3 -0
- package/esm2022/lib/core/exceptions-handling/errors/tagged-error.class.mjs +3 -2
- package/esm2022/lib/core/exceptions-handling/logger/index.mjs +2 -0
- package/esm2022/lib/core/exceptions-handling/logger/log-handler.interface.mjs +2 -0
- package/esm2022/lib/core/exceptions-handling/logger/logger.service.mjs +25 -0
- package/esm2022/lib/core/payment/initialize-actions/special-button/special-button.action.class.mjs +9 -8
- package/esm2022/lib/core/payment/payment-behaviour/behaviour-strategies.mjs +5 -1
- package/esm2022/lib/core/payment/payment-behaviour/strategies/behaviour-strategy.abstract.mjs +5 -1
- package/esm2022/lib/core/payment/payment-behaviour/strategies/google-pay-instant-flow/google-pay-instant-flow.strategy.mjs +41 -0
- package/esm2022/lib/core/payment/payment-behaviour/strategies/google-pay-regular-flow/google-pay-regular-flow.strategy.mjs +36 -0
- package/esm2022/lib/core/payment/payment.service.mjs +18 -15
- package/esm2022/lib/core/sdk-payment-systems/apple-pay/apple-pay-sdk.service.mjs +7 -6
- package/esm2022/lib/core/sdk-payment-systems/apple-pay/apple-pay.service.mjs +9 -8
- package/esm2022/lib/core/sdk-payment-systems/apple-pay/session-handlers/braintree.handler.mjs +9 -8
- package/esm2022/lib/core/sdk-payment-systems/google-pay/google-pay.service.mjs +16 -15
- package/esm2022/lib/core/settings/settings.service.mjs +10 -1
- package/esm2022/lib/core/web-socket/centrifugo-web-socket.service.mjs +19 -18
- package/esm2022/lib/core-library.service.mjs +36 -26
- package/esm2022/public-api.mjs +3 -1
- package/fesm2022/xsolla-payment-client-core.mjs +1164 -1010
- package/fesm2022/xsolla-payment-client-core.mjs.map +1 -1
- package/lib/core/exceptions-handling/common-log-attributes/common-log-attributes.interface.d.ts +16 -0
- package/lib/core/exceptions-handling/common-log-attributes/common-log-attributes.service.d.ts +15 -0
- package/lib/core/exceptions-handling/elk/additional-info.interface.d.ts +2 -1
- package/lib/core/exceptions-handling/elk/elk-logger.service.d.ts +4 -8
- package/lib/core/exceptions-handling/elk/log-message.interface.d.ts +1 -3
- package/lib/core/exceptions-handling/errors/index.d.ts +2 -0
- package/lib/core/exceptions-handling/errors/tagged-error.class.d.ts +2 -1
- package/lib/core/exceptions-handling/logger/index.d.ts +1 -0
- package/lib/core/exceptions-handling/logger/log-handler.interface.d.ts +4 -0
- package/lib/core/exceptions-handling/logger/logger.service.d.ts +13 -0
- package/lib/core/payment/initialize-actions/special-button/special-button.action.class.d.ts +3 -3
- package/lib/core/payment/payment-behaviour/strategies/behaviour-strategy.abstract.d.ts +2 -1
- package/lib/core/payment/payment-behaviour/strategies/google-pay-instant-flow/google-pay-instant-flow.strategy.d.ts +10 -0
- package/lib/core/payment/payment-behaviour/strategies/google-pay-regular-flow/google-pay-regular-flow.strategy.d.ts +10 -0
- package/lib/core/payment/payment.service.d.ts +4 -3
- package/lib/core/sdk-payment-systems/apple-pay/apple-pay-sdk.service.d.ts +2 -2
- package/lib/core/sdk-payment-systems/apple-pay/apple-pay.service.d.ts +3 -3
- package/lib/core/sdk-payment-systems/apple-pay/session-handlers/braintree.handler.d.ts +3 -3
- package/lib/core/sdk-payment-systems/google-pay/google-pay.service.d.ts +3 -3
- package/lib/core/settings/settings.service.d.ts +3 -0
- package/lib/core/web-socket/centrifugo-web-socket.service.d.ts +3 -3
- package/lib/core-library.service.d.ts +9 -1
- package/package.json +1 -1
- package/public-api.d.ts +2 -0
- package/xsolla-payment-client-core-0.2.75.tgz +0 -0
- package/xsolla-payment-client-core-0.2.74.tgz +0 -0
|
@@ -6,7 +6,7 @@ import { HttpParams, HttpHeaders, HttpClientModule, HTTP_INTERCEPTORS, provideHt
|
|
|
6
6
|
import { UntypedFormGroup, Validators, UntypedFormControl, FormGroup, ReactiveFormsModule } from '@angular/forms';
|
|
7
7
|
import JSEncrypt from 'jsencrypt';
|
|
8
8
|
import { filter, map as map$1, tap, debounce, debounceTime, catchError } from 'rxjs/operators';
|
|
9
|
-
import * as
|
|
9
|
+
import * as i24 from '@ngx-translate/core';
|
|
10
10
|
import { provideTranslateService, MissingTranslationHandler } from '@ngx-translate/core';
|
|
11
11
|
import * as i1$1 from '@angular/router';
|
|
12
12
|
import { CommonModule } from '@angular/common';
|
|
@@ -141,6 +141,15 @@ class SettingsService {
|
|
|
141
141
|
get unsafeUtilsResponse() {
|
|
142
142
|
return this.response ?? null;
|
|
143
143
|
}
|
|
144
|
+
get unsafeUser() {
|
|
145
|
+
return this.response?.user ?? null;
|
|
146
|
+
}
|
|
147
|
+
get unsafeProject() {
|
|
148
|
+
return this.response?.project ?? null;
|
|
149
|
+
}
|
|
150
|
+
get unsafeSettings() {
|
|
151
|
+
return this.response?.settings ?? null;
|
|
152
|
+
}
|
|
144
153
|
get isEmpty() {
|
|
145
154
|
return !this.response;
|
|
146
155
|
}
|
|
@@ -197,782 +206,84 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImpor
|
|
|
197
206
|
}]
|
|
198
207
|
}], ctorParameters: () => [{ type: SecureApiClient }] });
|
|
199
208
|
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
getCountry() {
|
|
213
|
-
return this.userDefinedCountry ?? this.getTokenCountry();
|
|
214
|
-
}
|
|
215
|
-
getTokenCountry() {
|
|
216
|
-
return this.settingsService.user.country.value;
|
|
217
|
-
}
|
|
218
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: CountryService, deps: [{ token: SettingsService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
219
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: CountryService, providedIn: 'root' }); }
|
|
220
|
-
}
|
|
221
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: CountryService, decorators: [{
|
|
222
|
-
type: Injectable,
|
|
223
|
-
args: [{
|
|
224
|
-
providedIn: 'root',
|
|
225
|
-
}]
|
|
226
|
-
}], ctorParameters: () => [{ type: SettingsService }] });
|
|
227
|
-
|
|
228
|
-
class ResponseError extends AppError {
|
|
229
|
-
constructor(message) {
|
|
230
|
-
super('Response failed' + (message ? `: "${message}".` : '.'));
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
var BooleanNumber;
|
|
235
|
-
(function (BooleanNumber) {
|
|
236
|
-
BooleanNumber[BooleanNumber["false"] = 0] = "false";
|
|
237
|
-
BooleanNumber[BooleanNumber["true"] = 1] = "true";
|
|
238
|
-
})(BooleanNumber || (BooleanNumber = {}));
|
|
239
|
-
|
|
240
|
-
class PaymentMethodsResponse {
|
|
241
|
-
constructor(paymentMethods) {
|
|
242
|
-
this.especial = paymentMethods.especial.map((method) => this.mapPaymentMethod(method));
|
|
243
|
-
this.top = paymentMethods.top.map((method) => this.mapPaymentMethod(method));
|
|
244
|
-
this.remained = paymentMethods.remained.map((method) => this.mapPaymentMethod(method));
|
|
245
|
-
this.remainedCount = {
|
|
246
|
-
total: paymentMethods.remained_count.total,
|
|
247
|
-
visible: paymentMethods.remained_count.visible,
|
|
248
|
-
};
|
|
249
|
-
}
|
|
250
|
-
mapPaymentMethod(method) {
|
|
251
|
-
return {
|
|
252
|
-
id: method.id,
|
|
253
|
-
rank: method.rank,
|
|
254
|
-
name: method.name,
|
|
255
|
-
aliases: method.aliases,
|
|
256
|
-
categories: method.cat,
|
|
257
|
-
recommended: method.recommended === BooleanNumber.true,
|
|
258
|
-
enabledSaveAccount: method.enabled_save_account,
|
|
259
|
-
iconName: method.switch_icon_name,
|
|
260
|
-
};
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
const paymentMethodsResponseFactoryToken = new InjectionToken('PaymentMethodsResponse');
|
|
265
|
-
const paymentMethodsResponseFactoryProvider = {
|
|
266
|
-
provide: paymentMethodsResponseFactoryToken,
|
|
267
|
-
useValue: (...args) => new PaymentMethodsResponse(...args),
|
|
268
|
-
};
|
|
209
|
+
var ErrorTags;
|
|
210
|
+
(function (ErrorTags) {
|
|
211
|
+
ErrorTags["APP"] = "appError";
|
|
212
|
+
ErrorTags["HTTP"] = "httpError";
|
|
213
|
+
ErrorTags["JS"] = "jsError";
|
|
214
|
+
ErrorTags["WS"] = "webSocket";
|
|
215
|
+
ErrorTags["ENCRYPT"] = "encrypt";
|
|
216
|
+
ErrorTags["APPLEPAY"] = "applepay";
|
|
217
|
+
ErrorTags["HEADLESS_UI"] = "headlessUi";
|
|
218
|
+
ErrorTags["GOOGLEPAY"] = "googlepay";
|
|
219
|
+
ErrorTags["PAYTM"] = "paytm";
|
|
220
|
+
})(ErrorTags || (ErrorTags = {}));
|
|
269
221
|
|
|
270
|
-
class
|
|
271
|
-
constructor(
|
|
272
|
-
|
|
273
|
-
this.
|
|
274
|
-
this.
|
|
275
|
-
this.
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
}
|
|
282
|
-
async getList(isSaveMethodMode) {
|
|
283
|
-
const response = await this.request(isSaveMethodMode);
|
|
284
|
-
if (this.isFixedPaymentMethod) {
|
|
285
|
-
return this.filterMethodsByFixedPaymentMethod(response.remained);
|
|
286
|
-
}
|
|
287
|
-
return response.remained;
|
|
288
|
-
}
|
|
289
|
-
async getQuickMethods() {
|
|
290
|
-
const response = await this.request();
|
|
291
|
-
return response.especial;
|
|
292
|
-
}
|
|
293
|
-
async request(isSaveMethodMode) {
|
|
294
|
-
const requestParams = {
|
|
295
|
-
access_token: this.settingsService.token,
|
|
296
|
-
country: this.countryService.getCountry(),
|
|
297
|
-
save_payment_account_only: isSaveMethodMode
|
|
298
|
-
? "1" /* XpsBoolean.true */
|
|
299
|
-
: "0" /* XpsBoolean.false */,
|
|
300
|
-
refer: this.settingsService.refer,
|
|
301
|
-
};
|
|
302
|
-
const cacheKey = JSON.stringify(requestParams);
|
|
303
|
-
if (!this.cache.has(cacheKey)) {
|
|
304
|
-
this.cache.set(cacheKey, lastValueFrom(this.secureApi
|
|
305
|
-
.post(this.apiRoute, new URLSearchParams({
|
|
306
|
-
...requestParams,
|
|
307
|
-
refer: String(requestParams.refer),
|
|
308
|
-
}), {
|
|
309
|
-
headers: new HttpHeaders().set('Content-Type', 'application/x-www-form-urlencoded; charset=utf-8'),
|
|
310
|
-
responseType: 'json',
|
|
311
|
-
})
|
|
312
|
-
.pipe(map((response) => this.responseFactory(response.payment_methods)))).catch((error) => {
|
|
313
|
-
throw new ResponseError(error.message);
|
|
314
|
-
}));
|
|
222
|
+
class TaggedError extends Error {
|
|
223
|
+
constructor(message, tags, extra) {
|
|
224
|
+
super(message);
|
|
225
|
+
this.tags = [];
|
|
226
|
+
this.parentTag = ErrorTags.HEADLESS_UI;
|
|
227
|
+
this.tags = this.childTag
|
|
228
|
+
? [this.parentTag, this.childTag]
|
|
229
|
+
: [this.parentTag];
|
|
230
|
+
if (tags) {
|
|
231
|
+
const newTags = tags.filter((t, i, arr) => !this.tags.includes(t) && arr.indexOf(t) == i);
|
|
232
|
+
this.tags = [...this.tags, ...newTags];
|
|
315
233
|
}
|
|
316
|
-
|
|
317
|
-
return this.cache.get(cacheKey);
|
|
318
|
-
}
|
|
319
|
-
filterMethodsByFixedPaymentMethod(methods) {
|
|
320
|
-
const fixedPid = this.settingsService.purchase?.payment_system?.id;
|
|
321
|
-
const paymentMethod = methods.find((method) => method.id === fixedPid);
|
|
322
|
-
return paymentMethod ? [paymentMethod] : [];
|
|
323
|
-
}
|
|
324
|
-
get isFixedPaymentMethod() {
|
|
325
|
-
return !!this.settingsService.purchase?.payment_system?.id;
|
|
234
|
+
this.extra = extra || {};
|
|
326
235
|
}
|
|
327
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: PaymentMethodsService, deps: [{ token: paymentMethodsResponseFactoryToken }, { token: SettingsService }, { token: CountryService }, { token: SecureApiClient }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
328
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: PaymentMethodsService, providedIn: 'root' }); }
|
|
329
236
|
}
|
|
330
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: PaymentMethodsService, decorators: [{
|
|
331
|
-
type: Injectable,
|
|
332
|
-
args: [{
|
|
333
|
-
providedIn: 'root',
|
|
334
|
-
}]
|
|
335
|
-
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
336
|
-
type: Inject,
|
|
337
|
-
args: [paymentMethodsResponseFactoryToken]
|
|
338
|
-
}] }, { type: SettingsService }, { type: CountryService }, { type: SecureApiClient }] });
|
|
339
237
|
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
238
|
+
const unknownValue = 'unknown';
|
|
239
|
+
const browsers = [
|
|
240
|
+
{
|
|
241
|
+
sentName: 'Mozilla Firefox',
|
|
242
|
+
shortName: 'Firefox',
|
|
243
|
+
regexpBrowserNameWithVersion: '(Firefox)\\/(.+)',
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
sentName: 'Samsung Internet',
|
|
247
|
+
shortName: 'SamsungBrowser',
|
|
248
|
+
regexpBrowserNameWithVersion: '(SamsungBrowser)\\/(.+)\\s',
|
|
249
|
+
},
|
|
250
|
+
{
|
|
251
|
+
sentName: 'Opera',
|
|
252
|
+
shortName: 'Opera',
|
|
253
|
+
regexpBrowserNameWithVersion: '(Opera)\\/(.+)',
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
sentName: 'Opera',
|
|
257
|
+
shortName: 'Opera',
|
|
258
|
+
regexpBrowserNameWithVersion: '(OPR)\\/(.+)',
|
|
259
|
+
},
|
|
260
|
+
{
|
|
261
|
+
sentName: 'Microsoft Edge (Legacy)',
|
|
262
|
+
shortName: 'MSEdge-legacy',
|
|
263
|
+
regexpBrowserNameWithVersion: '(Edge)\\/(.+)',
|
|
264
|
+
},
|
|
265
|
+
{
|
|
266
|
+
sentName: 'Microsoft Edge (Chromium)',
|
|
267
|
+
shortName: 'MSEdge',
|
|
268
|
+
regexpBrowserNameWithVersion: '(Edg)\\/(.+)',
|
|
269
|
+
},
|
|
270
|
+
{
|
|
271
|
+
sentName: 'Google Chrome or Chromium',
|
|
272
|
+
shortName: 'Chrome',
|
|
273
|
+
regexpBrowserNameWithVersion: '(Chrome)\\/(.+)\\s',
|
|
274
|
+
},
|
|
275
|
+
{
|
|
276
|
+
sentName: 'Apple Safari',
|
|
277
|
+
shortName: 'Safari',
|
|
278
|
+
regexpBrowserNameWithVersion: '(Safari)\\/(.+)',
|
|
279
|
+
},
|
|
280
|
+
];
|
|
366
281
|
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
};
|
|
372
|
-
|
|
373
|
-
class SavedMethodsService {
|
|
374
|
-
constructor(responseFactory, settingsService, secureApi) {
|
|
375
|
-
this.responseFactory = responseFactory;
|
|
376
|
-
this.settingsService = settingsService;
|
|
377
|
-
this.secureApi = secureApi;
|
|
378
|
-
this.apiRoute = 'savedmethods';
|
|
379
|
-
this.cache = new Map();
|
|
380
|
-
}
|
|
381
|
-
async getList(needResetCache = false) {
|
|
382
|
-
if (needResetCache) {
|
|
383
|
-
this.cache.clear();
|
|
384
|
-
}
|
|
385
|
-
const response = await this.request();
|
|
386
|
-
return response.list;
|
|
387
|
-
}
|
|
388
|
-
async request() {
|
|
389
|
-
const requestParams = {
|
|
390
|
-
access_token: this.settingsService.token,
|
|
391
|
-
};
|
|
392
|
-
const cacheKey = JSON.stringify(requestParams);
|
|
393
|
-
if (!this.cache.has(cacheKey)) {
|
|
394
|
-
this.cache.set(cacheKey, lastValueFrom(this.secureApi
|
|
395
|
-
.post(this.apiRoute, new URLSearchParams({ ...requestParams }), {
|
|
396
|
-
headers: new HttpHeaders().set('Content-Type', 'application/x-www-form-urlencoded; charset=utf-8'),
|
|
397
|
-
responseType: 'json',
|
|
398
|
-
})
|
|
399
|
-
.pipe(map((response) => this.responseFactory(response)))).catch((error) => {
|
|
400
|
-
throw new ResponseError(error.message);
|
|
401
|
-
}));
|
|
402
|
-
}
|
|
403
|
-
// @ts-expect-error the map already has the cache with key
|
|
404
|
-
return this.cache.get(cacheKey);
|
|
405
|
-
}
|
|
406
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: SavedMethodsService, deps: [{ token: savedMethodsResponseFactoryToken }, { token: SettingsService }, { token: SecureApiClient }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
407
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: SavedMethodsService, providedIn: 'root' }); }
|
|
408
|
-
}
|
|
409
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: SavedMethodsService, decorators: [{
|
|
410
|
-
type: Injectable,
|
|
411
|
-
args: [{
|
|
412
|
-
providedIn: 'root',
|
|
413
|
-
}]
|
|
414
|
-
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
415
|
-
type: Inject,
|
|
416
|
-
args: [savedMethodsResponseFactoryToken]
|
|
417
|
-
}] }, { type: SettingsService }, { type: SecureApiClient }] });
|
|
418
|
-
|
|
419
|
-
class UserBalanceResponse {
|
|
420
|
-
constructor(userBalance) {
|
|
421
|
-
this.isEnoughUserBalance = userBalance.is_enough_user_balance ?? false;
|
|
422
|
-
this.isEnoughUserRecurrentBalance =
|
|
423
|
-
userBalance.is_enough_user_recurrent_balance ?? false;
|
|
424
|
-
}
|
|
425
|
-
}
|
|
426
|
-
|
|
427
|
-
const userBalanceResponseFactoryToken = new InjectionToken('UserBalanceResponse');
|
|
428
|
-
const userBalanceResponseFactoryProvider = {
|
|
429
|
-
provide: userBalanceResponseFactoryToken,
|
|
430
|
-
useValue: (...args) => new UserBalanceResponse(...args),
|
|
431
|
-
};
|
|
432
|
-
|
|
433
|
-
class UserBalanceService {
|
|
434
|
-
constructor(responseFactory, settingsService, secureApi) {
|
|
435
|
-
this.responseFactory = responseFactory;
|
|
436
|
-
this.settingsService = settingsService;
|
|
437
|
-
this.secureApi = secureApi;
|
|
438
|
-
this.apiRoute = 'balance/sufficiency';
|
|
439
|
-
this.cache = new Map();
|
|
440
|
-
}
|
|
441
|
-
async getUserBalance() {
|
|
442
|
-
return this.request();
|
|
443
|
-
}
|
|
444
|
-
getUserBalanceValue() {
|
|
445
|
-
return this.settingsService.user.user_balance;
|
|
446
|
-
}
|
|
447
|
-
async request() {
|
|
448
|
-
const requestParams = {
|
|
449
|
-
access_token: this.settingsService.token,
|
|
450
|
-
};
|
|
451
|
-
const cacheKey = JSON.stringify(requestParams);
|
|
452
|
-
if (!this.cache.has(cacheKey)) {
|
|
453
|
-
this.cache.set(cacheKey, lastValueFrom(this.secureApi
|
|
454
|
-
.post(this.apiRoute, new URLSearchParams({ ...requestParams }), {
|
|
455
|
-
headers: new HttpHeaders().set('Content-Type', 'application/x-www-form-urlencoded; charset=utf-8'),
|
|
456
|
-
responseType: 'json',
|
|
457
|
-
})
|
|
458
|
-
.pipe(map((response) => this.responseFactory(response)))).catch((error) => {
|
|
459
|
-
throw new ResponseError(error.message);
|
|
460
|
-
}));
|
|
461
|
-
}
|
|
462
|
-
// @ts-expect-error the map already has the cache with key
|
|
463
|
-
return this.cache.get(cacheKey);
|
|
464
|
-
}
|
|
465
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: UserBalanceService, deps: [{ token: userBalanceResponseFactoryToken }, { token: SettingsService }, { token: SecureApiClient }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
466
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: UserBalanceService, providedIn: 'root' }); }
|
|
467
|
-
}
|
|
468
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: UserBalanceService, decorators: [{
|
|
469
|
-
type: Injectable,
|
|
470
|
-
args: [{
|
|
471
|
-
providedIn: 'root',
|
|
472
|
-
}]
|
|
473
|
-
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
474
|
-
type: Inject,
|
|
475
|
-
args: [userBalanceResponseFactoryToken]
|
|
476
|
-
}] }, { type: SettingsService }, { type: SecureApiClient }] });
|
|
477
|
-
|
|
478
|
-
class UrlService {
|
|
479
|
-
addSearchParams(url, params = {}) {
|
|
480
|
-
if (!url) {
|
|
481
|
-
return '';
|
|
482
|
-
}
|
|
483
|
-
const urlObject = new URL(url);
|
|
484
|
-
for (const [key, value] of Object.entries(params)) {
|
|
485
|
-
urlObject.searchParams.set(key, value);
|
|
486
|
-
}
|
|
487
|
-
return urlObject.toString();
|
|
488
|
-
}
|
|
489
|
-
getSearchParams(url) {
|
|
490
|
-
if (!url) {
|
|
491
|
-
return {};
|
|
492
|
-
}
|
|
493
|
-
const urlObject = new URL(url);
|
|
494
|
-
const searchParams = {};
|
|
495
|
-
for (const [key, value] of urlObject.searchParams) {
|
|
496
|
-
searchParams[key] = value;
|
|
497
|
-
}
|
|
498
|
-
return searchParams;
|
|
499
|
-
}
|
|
500
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: UrlService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
501
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: UrlService, providedIn: 'root' }); }
|
|
502
|
-
}
|
|
503
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: UrlService, decorators: [{
|
|
504
|
-
type: Injectable,
|
|
505
|
-
args: [{
|
|
506
|
-
providedIn: 'root',
|
|
507
|
-
}]
|
|
508
|
-
}] });
|
|
509
|
-
|
|
510
|
-
class PaymentConfigService {
|
|
511
|
-
constructor(urlService, settingsService) {
|
|
512
|
-
this.urlService = urlService;
|
|
513
|
-
this.settingsService = settingsService;
|
|
514
|
-
}
|
|
515
|
-
enrich(config) {
|
|
516
|
-
if (!config.returnUrl) {
|
|
517
|
-
throw new Error('URL is not provided in payment config');
|
|
518
|
-
}
|
|
519
|
-
return {
|
|
520
|
-
...config,
|
|
521
|
-
returnUrl: this.enrichReturnUrl(config.returnUrl, !!config.savePaymentMethod),
|
|
522
|
-
};
|
|
523
|
-
}
|
|
524
|
-
enrichReturnUrl(returnUrl, savePaymentMethod) {
|
|
525
|
-
const enrichedUrl = this.urlService.addSearchParams(returnUrl, {
|
|
526
|
-
token: this.settingsService.token,
|
|
527
|
-
isSavePaymentAccount: savePaymentMethod
|
|
528
|
-
? "1" /* XpsBoolean.true */
|
|
529
|
-
: "0" /* XpsBoolean.false */,
|
|
530
|
-
});
|
|
531
|
-
return enrichedUrl;
|
|
532
|
-
}
|
|
533
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: PaymentConfigService, deps: [{ token: UrlService }, { token: SettingsService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
534
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: PaymentConfigService, providedIn: 'root' }); }
|
|
535
|
-
}
|
|
536
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: PaymentConfigService, decorators: [{
|
|
537
|
-
type: Injectable,
|
|
538
|
-
args: [{
|
|
539
|
-
providedIn: 'root',
|
|
540
|
-
}]
|
|
541
|
-
}], ctorParameters: () => [{ type: UrlService }, { type: SettingsService }] });
|
|
542
|
-
|
|
543
|
-
var XpsCommand;
|
|
544
|
-
(function (XpsCommand) {
|
|
545
|
-
XpsCommand["form"] = "form";
|
|
546
|
-
XpsCommand["check"] = "check";
|
|
547
|
-
XpsCommand["status"] = "status";
|
|
548
|
-
XpsCommand["checkout"] = "checkout";
|
|
549
|
-
XpsCommand["account"] = "account";
|
|
550
|
-
XpsCommand["create"] = "create";
|
|
551
|
-
})(XpsCommand || (XpsCommand = {}));
|
|
552
|
-
|
|
553
|
-
var FieldNames;
|
|
554
|
-
(function (FieldNames) {
|
|
555
|
-
FieldNames["address1"] = "address1";
|
|
556
|
-
FieldNames["address2"] = "address2";
|
|
557
|
-
FieldNames["address"] = "address";
|
|
558
|
-
FieldNames["allowRecurrentSubscription"] = "allowRecurrentSubscription";
|
|
559
|
-
FieldNames["allowSubscription"] = "allowSubscription";
|
|
560
|
-
FieldNames["apt"] = "apt";
|
|
561
|
-
FieldNames["availableCardTypes"] = "available_card_types";
|
|
562
|
-
FieldNames["bank"] = "bank";
|
|
563
|
-
FieldNames["birthDate"] = "birth_date";
|
|
564
|
-
FieldNames["cardMonth"] = "card_month";
|
|
565
|
-
FieldNames["cardYear"] = "card_year";
|
|
566
|
-
FieldNames["cardExpire"] = "card_expire";
|
|
567
|
-
FieldNames["cardNumber"] = "card_number";
|
|
568
|
-
FieldNames["cardholdername"] = "cardholdername";
|
|
569
|
-
FieldNames["city"] = "city";
|
|
570
|
-
FieldNames["couponCode"] = "couponCode";
|
|
571
|
-
FieldNames["cpfName"] = "cpf_name";
|
|
572
|
-
FieldNames["cpfNumber"] = "cpf_number";
|
|
573
|
-
FieldNames["cvv"] = "cvv";
|
|
574
|
-
FieldNames["description"] = "description";
|
|
575
|
-
FieldNames["email"] = "email";
|
|
576
|
-
FieldNames["psEmail"] = "psEmail";
|
|
577
|
-
FieldNames["psAccountCountry"] = "psAccountCountry";
|
|
578
|
-
FieldNames["bazitemail"] = "bazitemail";
|
|
579
|
-
FieldNames["euCheck"] = "eu_check";
|
|
580
|
-
FieldNames["extraCvv"] = "extra_cvv";
|
|
581
|
-
FieldNames["extraCardNumber"] = "extra_card_number";
|
|
582
|
-
FieldNames["extraCardType"] = "extra_card_type";
|
|
583
|
-
FieldNames["fName"] = "f_name";
|
|
584
|
-
FieldNames["installments"] = "installments";
|
|
585
|
-
FieldNames["lName"] = "l_name";
|
|
586
|
-
FieldNames["needInstallments"] = "needInstallments";
|
|
587
|
-
FieldNames["personId"] = "person_id";
|
|
588
|
-
FieldNames["personIdAr"] = "person_id_ar";
|
|
589
|
-
FieldNames["personIdCo"] = "person_id_co";
|
|
590
|
-
FieldNames["phone"] = "phone";
|
|
591
|
-
FieldNames["purchaseDescription"] = "purchaseDescription";
|
|
592
|
-
FieldNames["recurrentType"] = "recurrent_type";
|
|
593
|
-
FieldNames["rockstarTaxes"] = "rockstar_taxes";
|
|
594
|
-
FieldNames["state"] = "state";
|
|
595
|
-
FieldNames["street"] = "street";
|
|
596
|
-
FieldNames["streetNumber"] = "street_number";
|
|
597
|
-
FieldNames["take2Taxes"] = "take2_taxes";
|
|
598
|
-
FieldNames["termsAndConditions"] = "termsAndConditions";
|
|
599
|
-
FieldNames["termsAndConditionsAtariPp"] = "termsAndConditionsAtariPP";
|
|
600
|
-
FieldNames["termsAndConditionsAtariTc"] = "termsAndConditionsAtariTC";
|
|
601
|
-
FieldNames["termsAndConditionsHtcEula"] = "termsAndConditionsHtcEula";
|
|
602
|
-
FieldNames["termsAndConditionsRobloxEula"] = "termsAndConditionsRobloxEula";
|
|
603
|
-
FieldNames["termsAndConditionsRolandEula"] = "termsAndConditionsRolandEula";
|
|
604
|
-
FieldNames["termsAndConditionsDeusLoVultEula"] = "termsAndConditionsDeusLoVultEula";
|
|
605
|
-
FieldNames["termsAndConditionsOnzenga"] = "termsAndConditionsOnzenga";
|
|
606
|
-
FieldNames["licenseDisclaimer"] = "licenseDisclaimer";
|
|
607
|
-
FieldNames["xsollaTipsAmount"] = "xsollaTipsAmount";
|
|
608
|
-
FieldNames["zip"] = "zip";
|
|
609
|
-
FieldNames["allowSave"] = "allowSave";
|
|
610
|
-
FieldNames["koreaLimitsInstruction"] = "korea_limits_instruction";
|
|
611
|
-
FieldNames["tokenApplePay"] = "token_applepay";
|
|
612
|
-
FieldNames["fixInvoice"] = "fix_invoice";
|
|
613
|
-
FieldNames["fixPid"] = "fix_pid";
|
|
614
|
-
FieldNames["signature"] = "signature";
|
|
615
|
-
FieldNames["qr"] = "qr";
|
|
616
|
-
FieldNames["sum"] = "sum";
|
|
617
|
-
FieldNames["out"] = "out";
|
|
618
|
-
FieldNames["tinkoffDisclaimer"] = "ps.tinkoff.disclaimer";
|
|
619
|
-
FieldNames["ppEmail"] = "pp_email";
|
|
620
|
-
FieldNames["redeemPoints"] = "redeemPoints";
|
|
621
|
-
FieldNames["omnibusDirective"] = "omnibus_directive";
|
|
622
|
-
FieldNames["labelApplePay"] = "label_applePay";
|
|
623
|
-
FieldNames["countryCode"] = "countryCode";
|
|
624
|
-
FieldNames["merchantCapabilities"] = "merchantCapabilities";
|
|
625
|
-
FieldNames["requiredBillingContactFields"] = "requiredBillingContactFields";
|
|
626
|
-
FieldNames["requiredShippingContactFields"] = "requiredShippingContactFields";
|
|
627
|
-
FieldNames["supportedNetworks"] = "supportedNetworks";
|
|
628
|
-
FieldNames["acquirer"] = "acquirer";
|
|
629
|
-
FieldNames["isSandbox"] = "isSandbox";
|
|
630
|
-
FieldNames["payInstanceAccountId"] = "payInstanceAccountId";
|
|
631
|
-
FieldNames["getApplePaySessionUrl"] = "getApplePaySessionUrl";
|
|
632
|
-
FieldNames["payViaCheckoutUrl"] = "payViaCheckoutUrl";
|
|
633
|
-
FieldNames["googlePayInitData"] = "googlePayInitData";
|
|
634
|
-
FieldNames["googlePayPaymentData"] = "googlePayPaymentData";
|
|
635
|
-
})(FieldNames || (FieldNames = {}));
|
|
636
|
-
|
|
637
|
-
class SubmitResponse {
|
|
638
|
-
constructor(parameters, responseNumber = 0) {
|
|
639
|
-
this.responseNumber = responseNumber;
|
|
640
|
-
/* Todo split into properties */
|
|
641
|
-
this.parameters = parameters;
|
|
642
|
-
this.fields = Object.keys(parameters.form).map((key) => parameters.form[key]);
|
|
643
|
-
if (parameters.onlineBanking) {
|
|
644
|
-
this.onlineBanking = {
|
|
645
|
-
url: parameters.onlineBanking.value,
|
|
646
|
-
};
|
|
647
|
-
}
|
|
648
|
-
this.isNeedRedirect =
|
|
649
|
-
parameters.currentCommand === XpsCommand.account ||
|
|
650
|
-
(parameters.currentCommand === XpsCommand.checkout &&
|
|
651
|
-
Boolean(parameters.checkout));
|
|
652
|
-
this.buyData = parameters.buyData;
|
|
653
|
-
this.fixInvoice = this.fields.find((field) => field.name === FieldNames.fixInvoice)?.value;
|
|
654
|
-
this.signature = this.fields.find((field) => field.name === FieldNames.signature)?.value;
|
|
655
|
-
this.hasFatalErrors = parameters.textAll?.fatal;
|
|
656
|
-
this.userSession = parameters.userSession;
|
|
657
|
-
this.pid = parameters.pid;
|
|
658
|
-
this.errors = parameters.errors;
|
|
659
|
-
this.summary = parameters.summary;
|
|
660
|
-
this.title = parameters.title;
|
|
661
|
-
this.currentCommand = parameters.currentCommand;
|
|
662
|
-
this.messages = parameters.messages;
|
|
663
|
-
this.xsollaNumber = {
|
|
664
|
-
accountXsolla: parameters.accountXsolla,
|
|
665
|
-
isMap: parameters.isMap,
|
|
666
|
-
};
|
|
667
|
-
}
|
|
668
|
-
}
|
|
669
|
-
|
|
670
|
-
class InitializeResponse {
|
|
671
|
-
constructor(response) {
|
|
672
|
-
this.paymentForm = null;
|
|
673
|
-
this.paymentForm = this.extractPaymentForm(response);
|
|
674
|
-
}
|
|
675
|
-
extractPaymentForm(response) {
|
|
676
|
-
if (!response) {
|
|
677
|
-
return null;
|
|
678
|
-
}
|
|
679
|
-
return {
|
|
680
|
-
totalAmount: response.buyData.sum,
|
|
681
|
-
currency: response.buyData.currency,
|
|
682
|
-
fields: Object.keys(response.form).map((key) => response.form[key]),
|
|
683
|
-
taxDisclaimer: response.taxDisclaimer,
|
|
684
|
-
number: response.number,
|
|
685
|
-
barcode: response.barcode,
|
|
686
|
-
instruction: response.instruction,
|
|
687
|
-
offers: response.offers,
|
|
688
|
-
error: response.error,
|
|
689
|
-
errors: response.errors,
|
|
690
|
-
restrictions: response.restrictions,
|
|
691
|
-
info: response.info,
|
|
692
|
-
buyData: response.buyData,
|
|
693
|
-
pid: response.pid,
|
|
694
|
-
messages: response.messages ?? [],
|
|
695
|
-
title: response.title,
|
|
696
|
-
summary: response.summary,
|
|
697
|
-
skipForm: response.skipForm,
|
|
698
|
-
isSavedMethodPayment: !!response.form?.saved_method_id,
|
|
699
|
-
couponCode: response.form?.couponCode?.value || '',
|
|
700
|
-
publicId: response.public_id,
|
|
701
|
-
skipCheckout: response.skipCheckout,
|
|
702
|
-
koreaNotification: response.form.korea_limits_instruction,
|
|
703
|
-
isCheckout: response.isCheckout,
|
|
704
|
-
categories: response.categories,
|
|
705
|
-
hasFatalErrors: response.textAll?.fatal,
|
|
706
|
-
userSession: response.userSession,
|
|
707
|
-
statusText: response.status?.statusData?.stateText ?? null,
|
|
708
|
-
country: response.country ? response.country.iso : null,
|
|
709
|
-
};
|
|
710
|
-
}
|
|
711
|
-
}
|
|
712
|
-
|
|
713
|
-
const isSubmitResponse = (value) => {
|
|
714
|
-
return value instanceof SubmitResponse;
|
|
715
|
-
};
|
|
716
|
-
|
|
717
|
-
var InputEventName;
|
|
718
|
-
(function (InputEventName) {
|
|
719
|
-
InputEventName["blur"] = "blur";
|
|
720
|
-
InputEventName["focus"] = "focus";
|
|
721
|
-
})(InputEventName || (InputEventName = {}));
|
|
722
|
-
|
|
723
|
-
const googlePayPid = 3431;
|
|
724
|
-
|
|
725
|
-
var ErrorTags;
|
|
726
|
-
(function (ErrorTags) {
|
|
727
|
-
ErrorTags["APP"] = "appError";
|
|
728
|
-
ErrorTags["HTTP"] = "httpError";
|
|
729
|
-
ErrorTags["JS"] = "jsError";
|
|
730
|
-
ErrorTags["WS"] = "webSocket";
|
|
731
|
-
ErrorTags["ENCRYPT"] = "encrypt";
|
|
732
|
-
ErrorTags["APPLEPAY"] = "applepay";
|
|
733
|
-
ErrorTags["HEADLESS_UI"] = "headlessUi";
|
|
734
|
-
ErrorTags["GOOGLEPAY"] = "googlepay";
|
|
735
|
-
ErrorTags["PAYTM"] = "paytm";
|
|
736
|
-
})(ErrorTags || (ErrorTags = {}));
|
|
737
|
-
|
|
738
|
-
const fieldsAllowedToOverride = new Set([
|
|
739
|
-
FieldNames.allowSubscription,
|
|
740
|
-
FieldNames.allowSave,
|
|
741
|
-
]);
|
|
742
|
-
|
|
743
|
-
function isXpsBoolean(value) {
|
|
744
|
-
return value === "1" /* XpsBoolean.true */ || value === "0" /* XpsBoolean.false */;
|
|
745
|
-
}
|
|
746
|
-
|
|
747
|
-
/**
|
|
748
|
-
* Configuration for fields that can be overridden by partner.
|
|
749
|
-
* We can extend this configuration with additional fields in the future.
|
|
750
|
-
*/
|
|
751
|
-
const overrideFieldConfigs = {
|
|
752
|
-
[FieldNames.allowSubscription]: {
|
|
753
|
-
validator: isXpsBoolean,
|
|
754
|
-
defaultValue: "0" /* XpsBoolean.false */,
|
|
755
|
-
},
|
|
756
|
-
[FieldNames.allowSave]: {
|
|
757
|
-
validator: isXpsBoolean,
|
|
758
|
-
defaultValue: "0" /* XpsBoolean.false */,
|
|
759
|
-
},
|
|
760
|
-
};
|
|
761
|
-
|
|
762
|
-
class TaggedError extends Error {
|
|
763
|
-
constructor(message, tags) {
|
|
764
|
-
super(message);
|
|
765
|
-
this.tags = [];
|
|
766
|
-
this.parentTag = ErrorTags.HEADLESS_UI;
|
|
767
|
-
this.tags = this.childTag
|
|
768
|
-
? [this.parentTag, this.childTag]
|
|
769
|
-
: [this.parentTag];
|
|
770
|
-
if (tags) {
|
|
771
|
-
const newTags = tags.filter((t, i, arr) => !this.tags.includes(t) && arr.indexOf(t) == i);
|
|
772
|
-
this.tags = [...this.tags, ...newTags];
|
|
773
|
-
}
|
|
774
|
-
}
|
|
775
|
-
}
|
|
776
|
-
|
|
777
|
-
class ElkLoggerService {
|
|
778
|
-
constructor(window, settingsService, http, ngZone) {
|
|
779
|
-
this.window = window;
|
|
780
|
-
this.settingsService = settingsService;
|
|
781
|
-
this.http = http;
|
|
782
|
-
this.ngZone = ngZone;
|
|
783
|
-
this.vendors = new RegExp('node_modules\\/(@angular|zone).*.js$');
|
|
784
|
-
this.stackTrace = this.loadStackTrace();
|
|
785
|
-
}
|
|
786
|
-
handleError(error) {
|
|
787
|
-
this.ngZone.runOutsideAngular(() => {
|
|
788
|
-
if (isDevMode()) {
|
|
789
|
-
console.error(error);
|
|
790
|
-
return;
|
|
791
|
-
}
|
|
792
|
-
this.parseError(error).catch(console.log);
|
|
793
|
-
});
|
|
794
|
-
}
|
|
795
|
-
log(message, tags, extra) {
|
|
796
|
-
const logTags = [ErrorTags.HEADLESS_UI, ...tags];
|
|
797
|
-
if (isDevMode()) {
|
|
798
|
-
console.log(message, tags);
|
|
799
|
-
return;
|
|
800
|
-
}
|
|
801
|
-
const logMessage = {
|
|
802
|
-
additionalInfo: this.getAdditionalInfo(),
|
|
803
|
-
extra,
|
|
804
|
-
message,
|
|
805
|
-
};
|
|
806
|
-
this.sendLog(logMessage, logTags);
|
|
807
|
-
}
|
|
808
|
-
async parseError(error) {
|
|
809
|
-
const errorObj = error instanceof TaggedError
|
|
810
|
-
? error
|
|
811
|
-
: new TaggedError(error.message || error.toString());
|
|
812
|
-
errorObj.trace = await this.getErrorTrace(errorObj);
|
|
813
|
-
errorObj.additionalInfo = this.getAdditionalInfo();
|
|
814
|
-
const { tags } = errorObj;
|
|
815
|
-
const cleanError = this.removeErrorMetaFields(errorObj);
|
|
816
|
-
this.sendLog(cleanError, tags);
|
|
817
|
-
return errorObj;
|
|
818
|
-
}
|
|
819
|
-
async loadStackTrace() {
|
|
820
|
-
const library = await import('stacktrace-js');
|
|
821
|
-
return library.default;
|
|
822
|
-
}
|
|
823
|
-
async getErrorTrace(error) {
|
|
824
|
-
const stackTrace = await this.stackTrace;
|
|
825
|
-
const stackFramesArr = await stackTrace.fromError(error);
|
|
826
|
-
const filteredFramesArr = stackFramesArr.filter(({ fileName }) => fileName && !this.vendors.test(fileName));
|
|
827
|
-
return filteredFramesArr
|
|
828
|
-
.map((stackFrame) => stackFrame.toString())
|
|
829
|
-
.join('\n');
|
|
830
|
-
}
|
|
831
|
-
getAdditionalInfo() {
|
|
832
|
-
const extractUrlHost = (url) => url.replace(/^https?:\/\/([^/?#]+).*$/i, '$1');
|
|
833
|
-
return {
|
|
834
|
-
location: {
|
|
835
|
-
url: this.window.location.href,
|
|
836
|
-
},
|
|
837
|
-
project: {
|
|
838
|
-
id: this.settingsService.project.id,
|
|
839
|
-
},
|
|
840
|
-
referrer: {
|
|
841
|
-
url: this.window.document.referrer,
|
|
842
|
-
},
|
|
843
|
-
viewport: {
|
|
844
|
-
width: this.window.document.documentElement.clientWidth,
|
|
845
|
-
height: this.window.document.documentElement.clientHeight,
|
|
846
|
-
},
|
|
847
|
-
cdn_address: this.settingsService.settings.cdnUrl
|
|
848
|
-
? extractUrlHost(this.settingsService.settings.cdnUrl)
|
|
849
|
-
: 'none',
|
|
850
|
-
country: this.settingsService.user.country.value,
|
|
851
|
-
local: this.settingsService.user.country.localized_name,
|
|
852
|
-
};
|
|
853
|
-
}
|
|
854
|
-
removeErrorMetaFields(error) {
|
|
855
|
-
const metaPropList = [
|
|
856
|
-
'parentTag',
|
|
857
|
-
'childTag',
|
|
858
|
-
'RESTRICTED_KEYS_REGEXP',
|
|
859
|
-
'tags',
|
|
860
|
-
];
|
|
861
|
-
Object.keys(error).forEach((key) => {
|
|
862
|
-
if (metaPropList.includes(key))
|
|
863
|
-
delete error[key];
|
|
864
|
-
});
|
|
865
|
-
// implementing own 'message' property from prototype
|
|
866
|
-
return { ...error, message: error.message };
|
|
867
|
-
}
|
|
868
|
-
sendLog(message, tags) {
|
|
869
|
-
const url = `https://logs-01.xsolla.com/tag/${tags.join(',')}`;
|
|
870
|
-
firstValueFrom(this.http.post(url, message, {
|
|
871
|
-
headers: new HttpHeaders().set('Content-Type', 'text/plain'),
|
|
872
|
-
responseType: 'text',
|
|
873
|
-
})).catch((err) => console.error('Elk Logger: request error', err));
|
|
874
|
-
}
|
|
875
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: ElkLoggerService, deps: [{ token: windowToken }, { token: SettingsService }, { token: i1.HttpClient }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
876
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: ElkLoggerService, providedIn: 'root' }); }
|
|
877
|
-
}
|
|
878
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: ElkLoggerService, decorators: [{
|
|
879
|
-
type: Injectable,
|
|
880
|
-
args: [{
|
|
881
|
-
providedIn: 'root',
|
|
882
|
-
}]
|
|
883
|
-
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
884
|
-
type: Inject,
|
|
885
|
-
args: [windowToken]
|
|
886
|
-
}] }, { type: SettingsService }, { type: i1.HttpClient }, { type: i0.NgZone }] });
|
|
887
|
-
|
|
888
|
-
const initializeResponseFactoryToken = new InjectionToken('InitializeResponse');
|
|
889
|
-
const initializeResponseFactoryProvider = {
|
|
890
|
-
provide: initializeResponseFactoryToken,
|
|
891
|
-
useValue: (...args) => new InitializeResponse(...args),
|
|
892
|
-
};
|
|
893
|
-
|
|
894
|
-
var UserBehaviourEventName;
|
|
895
|
-
(function (UserBehaviourEventName) {
|
|
896
|
-
UserBehaviourEventName["openPaystation"] = "open-paystation";
|
|
897
|
-
UserBehaviourEventName["showMethodHeader"] = "show-method-header";
|
|
898
|
-
UserBehaviourEventName["showErrorMessage"] = "show-error-message";
|
|
899
|
-
UserBehaviourEventName["openStatusError"] = "open-status-error";
|
|
900
|
-
UserBehaviourEventName["sysTrackedScripts"] = "sys-tracked_scripts";
|
|
901
|
-
})(UserBehaviourEventName || (UserBehaviourEventName = {}));
|
|
902
|
-
|
|
903
|
-
const userBehaviourEventTypes = {
|
|
904
|
-
open: 'open',
|
|
905
|
-
show: 'show',
|
|
906
|
-
click: 'click',
|
|
907
|
-
manual: 'manual',
|
|
908
|
-
store: 'store',
|
|
909
|
-
};
|
|
910
|
-
|
|
911
|
-
const masterCardAndVisaPaymentMethodId = 26;
|
|
912
|
-
const maestroPaymentMethodId = 490;
|
|
913
|
-
// eslint-disable-next-line @typescript-eslint/no-magic-numbers
|
|
914
|
-
const creditCardPaymentMethodId = 1380;
|
|
915
|
-
const americanExpressMethodId = 714;
|
|
916
|
-
const specialCards = [
|
|
917
|
-
maestroPaymentMethodId,
|
|
918
|
-
masterCardAndVisaPaymentMethodId,
|
|
919
|
-
americanExpressMethodId,
|
|
920
|
-
];
|
|
921
|
-
const cardsWith3ds = [
|
|
922
|
-
masterCardAndVisaPaymentMethodId,
|
|
923
|
-
maestroPaymentMethodId,
|
|
924
|
-
creditCardPaymentMethodId,
|
|
925
|
-
];
|
|
926
|
-
|
|
927
|
-
const unknownValue = 'unknown';
|
|
928
|
-
const browsers = [
|
|
929
|
-
{
|
|
930
|
-
sentName: 'Mozilla Firefox',
|
|
931
|
-
shortName: 'Firefox',
|
|
932
|
-
regexpBrowserNameWithVersion: '(Firefox)\\/(.+)',
|
|
933
|
-
},
|
|
934
|
-
{
|
|
935
|
-
sentName: 'Samsung Internet',
|
|
936
|
-
shortName: 'SamsungBrowser',
|
|
937
|
-
regexpBrowserNameWithVersion: '(SamsungBrowser)\\/(.+)\\s',
|
|
938
|
-
},
|
|
939
|
-
{
|
|
940
|
-
sentName: 'Opera',
|
|
941
|
-
shortName: 'Opera',
|
|
942
|
-
regexpBrowserNameWithVersion: '(Opera)\\/(.+)',
|
|
943
|
-
},
|
|
944
|
-
{
|
|
945
|
-
sentName: 'Opera',
|
|
946
|
-
shortName: 'Opera',
|
|
947
|
-
regexpBrowserNameWithVersion: '(OPR)\\/(.+)',
|
|
948
|
-
},
|
|
949
|
-
{
|
|
950
|
-
sentName: 'Microsoft Edge (Legacy)',
|
|
951
|
-
shortName: 'MSEdge-legacy',
|
|
952
|
-
regexpBrowserNameWithVersion: '(Edge)\\/(.+)',
|
|
953
|
-
},
|
|
954
|
-
{
|
|
955
|
-
sentName: 'Microsoft Edge (Chromium)',
|
|
956
|
-
shortName: 'MSEdge',
|
|
957
|
-
regexpBrowserNameWithVersion: '(Edg)\\/(.+)',
|
|
958
|
-
},
|
|
959
|
-
{
|
|
960
|
-
sentName: 'Google Chrome or Chromium',
|
|
961
|
-
shortName: 'Chrome',
|
|
962
|
-
regexpBrowserNameWithVersion: '(Chrome)\\/(.+)\\s',
|
|
963
|
-
},
|
|
964
|
-
{
|
|
965
|
-
sentName: 'Apple Safari',
|
|
966
|
-
shortName: 'Safari',
|
|
967
|
-
regexpBrowserNameWithVersion: '(Safari)\\/(.+)',
|
|
968
|
-
},
|
|
969
|
-
];
|
|
970
|
-
|
|
971
|
-
var Device;
|
|
972
|
-
(function (Device) {
|
|
973
|
-
Device["mobile"] = "mobile";
|
|
974
|
-
Device["desktop"] = "desktop";
|
|
975
|
-
})(Device || (Device = {}));
|
|
282
|
+
var Device;
|
|
283
|
+
(function (Device) {
|
|
284
|
+
Device["mobile"] = "mobile";
|
|
285
|
+
Device["desktop"] = "desktop";
|
|
286
|
+
})(Device || (Device = {}));
|
|
976
287
|
|
|
977
288
|
const osList = [
|
|
978
289
|
{
|
|
@@ -1229,210 +540,969 @@ const osList = [
|
|
|
1229
540
|
},
|
|
1230
541
|
];
|
|
1231
542
|
|
|
1232
|
-
class UserAgentService {
|
|
1233
|
-
constructor(window) {
|
|
543
|
+
class UserAgentService {
|
|
544
|
+
constructor(window) {
|
|
545
|
+
this.window = window;
|
|
546
|
+
this._browserName = null;
|
|
547
|
+
this._browserVersion = null;
|
|
548
|
+
this._browserApp = null;
|
|
549
|
+
this._platform = null;
|
|
550
|
+
this._os = null;
|
|
551
|
+
this.getUserPlatform();
|
|
552
|
+
this.getBrowserInformation();
|
|
553
|
+
this.getOsInformation();
|
|
554
|
+
}
|
|
555
|
+
get browserVersion() {
|
|
556
|
+
return this._browserVersion;
|
|
557
|
+
}
|
|
558
|
+
get browserApp() {
|
|
559
|
+
return this._browserApp;
|
|
560
|
+
}
|
|
561
|
+
get platform() {
|
|
562
|
+
if (this._platform === unknownValue) {
|
|
563
|
+
return this.osType;
|
|
564
|
+
}
|
|
565
|
+
return this._platform;
|
|
566
|
+
}
|
|
567
|
+
get userAgent() {
|
|
568
|
+
return this.window.navigator.userAgent;
|
|
569
|
+
}
|
|
570
|
+
get browserDescription() {
|
|
571
|
+
if (this.browserName === unknownValue || this.browserName === null) {
|
|
572
|
+
return this.userAgent;
|
|
573
|
+
}
|
|
574
|
+
return this.browserName;
|
|
575
|
+
}
|
|
576
|
+
get isSafari() {
|
|
577
|
+
return this._browserName === 'Apple Safari';
|
|
578
|
+
}
|
|
579
|
+
get safariVersion() {
|
|
580
|
+
if (!this.isSafari) {
|
|
581
|
+
return null;
|
|
582
|
+
}
|
|
583
|
+
const versionRegExp = new RegExp('(Version)\\/(.+)\\s');
|
|
584
|
+
const version = versionRegExp.exec(this.userAgent);
|
|
585
|
+
if (!version) {
|
|
586
|
+
return null;
|
|
587
|
+
}
|
|
588
|
+
return Number(version[2].split('.')[0]);
|
|
589
|
+
}
|
|
590
|
+
get iOsVersion() {
|
|
591
|
+
if (this.osType !== 'ios') {
|
|
592
|
+
return null;
|
|
593
|
+
}
|
|
594
|
+
const version = /OS (\d+)_(\d+)_?(\d+)?/.exec(this.window.navigator.appVersion);
|
|
595
|
+
return version ? `${version[1]}.${version[2]}.${version[3] ?? 0}` : null;
|
|
596
|
+
}
|
|
597
|
+
get browserInfo() {
|
|
598
|
+
const browserInfo = {
|
|
599
|
+
name: this.browserDescription,
|
|
600
|
+
[this.browserApp?.toLowerCase() ?? unknownValue]: true,
|
|
601
|
+
version: this.browserVersion,
|
|
602
|
+
[this.browserEngine.toLowerCase()]: true,
|
|
603
|
+
ui_version: this.isMobileDevice ? Device.mobile : Device.desktop,
|
|
604
|
+
os: this.os,
|
|
605
|
+
};
|
|
606
|
+
if (this.isMobileDevice) {
|
|
607
|
+
browserInfo.mobile = true;
|
|
608
|
+
}
|
|
609
|
+
if (this.osType) {
|
|
610
|
+
// @ts-expect-error index is string
|
|
611
|
+
browserInfo[this.osType.toLowerCase()] = true;
|
|
612
|
+
}
|
|
613
|
+
if (this.window.navigator.platform?.includes('iPhone')) {
|
|
614
|
+
browserInfo.iphone = true;
|
|
615
|
+
}
|
|
616
|
+
if (this.window.navigator.platform?.includes('iPod')) {
|
|
617
|
+
browserInfo.ipod = true;
|
|
618
|
+
}
|
|
619
|
+
if (this.window.navigator.platform?.includes('iPad')) {
|
|
620
|
+
browserInfo.ipad = true;
|
|
621
|
+
browserInfo.tablet = true;
|
|
622
|
+
}
|
|
623
|
+
if (this.isAndroid) {
|
|
624
|
+
browserInfo.android = true;
|
|
625
|
+
}
|
|
626
|
+
return browserInfo;
|
|
627
|
+
}
|
|
628
|
+
get isMobileDevice() {
|
|
629
|
+
const deviceAgents = [
|
|
630
|
+
'Android',
|
|
631
|
+
'webOS',
|
|
632
|
+
'iPhone',
|
|
633
|
+
'iPad',
|
|
634
|
+
'iPod',
|
|
635
|
+
'BlackBerry',
|
|
636
|
+
'IEMobile',
|
|
637
|
+
'Opera Mini',
|
|
638
|
+
'Mobile',
|
|
639
|
+
'Tablet',
|
|
640
|
+
'Kindle',
|
|
641
|
+
'Playbook',
|
|
642
|
+
'Silk',
|
|
643
|
+
'Puffin',
|
|
644
|
+
'CriOS',
|
|
645
|
+
];
|
|
646
|
+
return new RegExp(deviceAgents.join('|'), 'i').test(this.userAgent);
|
|
647
|
+
}
|
|
648
|
+
get isIosAndNotIpad() {
|
|
649
|
+
return ['iPhone', 'iPod'].includes(this.window.navigator.platform);
|
|
650
|
+
}
|
|
651
|
+
getUserPlatform() {
|
|
652
|
+
const experimentalPlatformApi = this.window.navigator?.userAgentData;
|
|
653
|
+
const platform = experimentalPlatformApi?.platform ??
|
|
654
|
+
this.window?.navigator?.platform ??
|
|
655
|
+
unknownValue;
|
|
656
|
+
this._platform = platform.toLowerCase();
|
|
657
|
+
}
|
|
658
|
+
getBrowserInformation() {
|
|
659
|
+
for (const browser of browsers) {
|
|
660
|
+
const browserRegExp = new RegExp(browser.regexpBrowserNameWithVersion);
|
|
661
|
+
const browserNameWithVersion = browserRegExp.exec(this.userAgent);
|
|
662
|
+
if (browserNameWithVersion !== null) {
|
|
663
|
+
this._browserName = browser.sentName;
|
|
664
|
+
this._browserApp = browser.shortName;
|
|
665
|
+
this._browserVersion = browserNameWithVersion[2];
|
|
666
|
+
break;
|
|
667
|
+
}
|
|
668
|
+
this._browserName = unknownValue;
|
|
669
|
+
this._browserApp = unknownValue;
|
|
670
|
+
this._browserVersion = unknownValue;
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
getOsInformation() {
|
|
674
|
+
for (const os of osList) {
|
|
675
|
+
const osRegExp = new RegExp(os.regExp);
|
|
676
|
+
const osName = osRegExp.exec(this.userAgent);
|
|
677
|
+
if (osName !== null) {
|
|
678
|
+
this._os = os.name;
|
|
679
|
+
break;
|
|
680
|
+
}
|
|
681
|
+
this._os = unknownValue;
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
get browserName() {
|
|
685
|
+
return this._browserName;
|
|
686
|
+
}
|
|
687
|
+
get isAndroid() {
|
|
688
|
+
return /Android\s+([\d.]+)/.test(this.userAgent);
|
|
689
|
+
}
|
|
690
|
+
get isXbox() {
|
|
691
|
+
return /xbox/i.test(this.userAgent);
|
|
692
|
+
}
|
|
693
|
+
get isLinux() {
|
|
694
|
+
return /linux/i.test(this.userAgent);
|
|
695
|
+
}
|
|
696
|
+
get isWindows() {
|
|
697
|
+
return /windows/i.test(this.userAgent);
|
|
698
|
+
}
|
|
699
|
+
get browserEngine() {
|
|
700
|
+
const engines = new Map([
|
|
701
|
+
['Firefox', 'Gecko'],
|
|
702
|
+
['Safari', 'Webkit'],
|
|
703
|
+
['MSEdge-legacy', 'EdgeHTML'],
|
|
704
|
+
['Chrome', 'Blink'],
|
|
705
|
+
['Opera', 'Blink'],
|
|
706
|
+
['MSEdge', 'Blink'],
|
|
707
|
+
['SamsungBrowser', 'Blink'],
|
|
708
|
+
]);
|
|
709
|
+
return engines.get(this.browserApp) ?? unknownValue;
|
|
710
|
+
}
|
|
711
|
+
get os() {
|
|
712
|
+
return this._os;
|
|
713
|
+
}
|
|
714
|
+
get osType() {
|
|
715
|
+
if (['iPhone', 'iPod', 'iPad'].includes(this.window.navigator.platform)) {
|
|
716
|
+
return 'ios';
|
|
717
|
+
}
|
|
718
|
+
if (this.window.navigator.platform?.includes('MacIntel')) {
|
|
719
|
+
return 'mac';
|
|
720
|
+
}
|
|
721
|
+
if (this.isXbox) {
|
|
722
|
+
return 'xbox';
|
|
723
|
+
}
|
|
724
|
+
if (this.isWindows) {
|
|
725
|
+
return 'windows';
|
|
726
|
+
}
|
|
727
|
+
if (this.isAndroid) {
|
|
728
|
+
return 'android';
|
|
729
|
+
}
|
|
730
|
+
if (this.isLinux) {
|
|
731
|
+
return 'linux';
|
|
732
|
+
}
|
|
733
|
+
return null;
|
|
734
|
+
}
|
|
735
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: UserAgentService, deps: [{ token: windowToken }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
736
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: UserAgentService, providedIn: 'root' }); }
|
|
737
|
+
}
|
|
738
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: UserAgentService, decorators: [{
|
|
739
|
+
type: Injectable,
|
|
740
|
+
args: [{
|
|
741
|
+
providedIn: 'root',
|
|
742
|
+
}]
|
|
743
|
+
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
744
|
+
type: Inject,
|
|
745
|
+
args: [windowToken]
|
|
746
|
+
}] }] });
|
|
747
|
+
|
|
748
|
+
class CommonLogAttributesService {
|
|
749
|
+
constructor(window, settingsService, userAgentService) {
|
|
1234
750
|
this.window = window;
|
|
1235
|
-
this.
|
|
1236
|
-
this.
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
this.
|
|
1241
|
-
this.
|
|
1242
|
-
|
|
751
|
+
this.settingsService = settingsService;
|
|
752
|
+
this.userAgentService = userAgentService;
|
|
753
|
+
}
|
|
754
|
+
getAttributes() {
|
|
755
|
+
const user = this.settingsService.unsafeUser;
|
|
756
|
+
const project = this.settingsService.unsafeProject;
|
|
757
|
+
const settings = this.settingsService.unsafeSettings;
|
|
758
|
+
return {
|
|
759
|
+
token: this.settingsService.token,
|
|
760
|
+
userId: user?.uuid,
|
|
761
|
+
userEmail: user?.email?.value,
|
|
762
|
+
projectId: project?.id,
|
|
763
|
+
merchantId: project?.merchantId,
|
|
764
|
+
locationUrl: this.window.location.href,
|
|
765
|
+
userAgent: this.userAgentService.userAgent,
|
|
766
|
+
referrerUrl: this.window.document.referrer,
|
|
767
|
+
viewportWidth: this.window.document.documentElement.clientWidth,
|
|
768
|
+
viewportHeight: this.window.document.documentElement.clientHeight,
|
|
769
|
+
cdnAddress: settings?.cdnUrl
|
|
770
|
+
? this.extractUrlHost(settings.cdnUrl)
|
|
771
|
+
: 'none',
|
|
772
|
+
country: user?.country?.value,
|
|
773
|
+
local: user?.country?.localized_name,
|
|
774
|
+
browserInfo: JSON.stringify(this.userAgentService.browserInfo),
|
|
775
|
+
};
|
|
776
|
+
}
|
|
777
|
+
extractUrlHost(url) {
|
|
778
|
+
return url.replace(/^https?:\/\/([^/?#]+).*$/i, '$1');
|
|
779
|
+
}
|
|
780
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: CommonLogAttributesService, deps: [{ token: windowToken }, { token: SettingsService }, { token: UserAgentService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
781
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: CommonLogAttributesService, providedIn: 'root' }); }
|
|
782
|
+
}
|
|
783
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: CommonLogAttributesService, decorators: [{
|
|
784
|
+
type: Injectable,
|
|
785
|
+
args: [{
|
|
786
|
+
providedIn: 'root',
|
|
787
|
+
}]
|
|
788
|
+
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
789
|
+
type: Inject,
|
|
790
|
+
args: [windowToken]
|
|
791
|
+
}] }, { type: SettingsService }, { type: UserAgentService }] });
|
|
792
|
+
|
|
793
|
+
class ElkLoggerService {
|
|
794
|
+
constructor(commonLogAttributesService, http, ngZone) {
|
|
795
|
+
this.commonLogAttributesService = commonLogAttributesService;
|
|
796
|
+
this.http = http;
|
|
797
|
+
this.ngZone = ngZone;
|
|
798
|
+
this.vendors = new RegExp('node_modules\\/(@angular|zone).*.js$');
|
|
799
|
+
this.stackTrace = this.loadStackTrace();
|
|
800
|
+
}
|
|
801
|
+
handleError(error) {
|
|
802
|
+
this.ngZone.runOutsideAngular(() => {
|
|
803
|
+
if (isDevMode()) {
|
|
804
|
+
console.error(error);
|
|
805
|
+
return;
|
|
806
|
+
}
|
|
807
|
+
this.parseError(error).catch(console.log);
|
|
808
|
+
});
|
|
809
|
+
}
|
|
810
|
+
log(message, tags, extra) {
|
|
811
|
+
const logTags = [ErrorTags.HEADLESS_UI, ...tags];
|
|
812
|
+
if (isDevMode()) {
|
|
813
|
+
console.log(message, tags);
|
|
814
|
+
return;
|
|
815
|
+
}
|
|
816
|
+
const logMessage = {
|
|
817
|
+
additionalInfo: this.getAdditionalInfo(),
|
|
818
|
+
extra,
|
|
819
|
+
message,
|
|
820
|
+
};
|
|
821
|
+
this.sendLog(logMessage, logTags);
|
|
822
|
+
}
|
|
823
|
+
async parseError(error) {
|
|
824
|
+
const errorObj = error instanceof TaggedError
|
|
825
|
+
? error
|
|
826
|
+
: new TaggedError(error.message || error.toString());
|
|
827
|
+
errorObj.trace = await this.getErrorTrace(errorObj);
|
|
828
|
+
errorObj.additionalInfo = this.getAdditionalInfo();
|
|
829
|
+
const { tags } = errorObj;
|
|
830
|
+
const cleanError = this.removeErrorMetaFields(errorObj);
|
|
831
|
+
this.sendLog(cleanError, tags);
|
|
832
|
+
return errorObj;
|
|
833
|
+
}
|
|
834
|
+
async loadStackTrace() {
|
|
835
|
+
const library = await import('stacktrace-js');
|
|
836
|
+
return library.default;
|
|
837
|
+
}
|
|
838
|
+
async getErrorTrace(error) {
|
|
839
|
+
const stackTrace = await this.stackTrace;
|
|
840
|
+
const stackFramesArr = await stackTrace.fromError(error);
|
|
841
|
+
const filteredFramesArr = stackFramesArr.filter(({ fileName }) => fileName && !this.vendors.test(fileName));
|
|
842
|
+
return filteredFramesArr
|
|
843
|
+
.map((stackFrame) => stackFrame.toString())
|
|
844
|
+
.join('\n');
|
|
845
|
+
}
|
|
846
|
+
getAdditionalInfo() {
|
|
847
|
+
const commonLogAttributes = this.commonLogAttributesService.getAttributes();
|
|
848
|
+
return {
|
|
849
|
+
token: commonLogAttributes.token,
|
|
850
|
+
location: {
|
|
851
|
+
url: commonLogAttributes.locationUrl ?? '',
|
|
852
|
+
},
|
|
853
|
+
project: {
|
|
854
|
+
id: commonLogAttributes.projectId ?? null,
|
|
855
|
+
},
|
|
856
|
+
referrer: {
|
|
857
|
+
url: commonLogAttributes.referrerUrl ?? '',
|
|
858
|
+
},
|
|
859
|
+
viewport: {
|
|
860
|
+
width: commonLogAttributes.viewportWidth,
|
|
861
|
+
height: commonLogAttributes.viewportHeight,
|
|
862
|
+
},
|
|
863
|
+
cdn_address: commonLogAttributes.cdnAddress,
|
|
864
|
+
country: commonLogAttributes.country ?? '',
|
|
865
|
+
local: commonLogAttributes.local ?? '',
|
|
866
|
+
};
|
|
867
|
+
}
|
|
868
|
+
removeErrorMetaFields(error) {
|
|
869
|
+
const metaPropList = [
|
|
870
|
+
'parentTag',
|
|
871
|
+
'childTag',
|
|
872
|
+
'RESTRICTED_KEYS_REGEXP',
|
|
873
|
+
'tags',
|
|
874
|
+
];
|
|
875
|
+
Object.keys(error).forEach((key) => {
|
|
876
|
+
if (metaPropList.includes(key))
|
|
877
|
+
delete error[key];
|
|
878
|
+
});
|
|
879
|
+
// implementing own 'message' property from prototype
|
|
880
|
+
return { ...error, message: error.message };
|
|
881
|
+
}
|
|
882
|
+
sendLog(message, tags) {
|
|
883
|
+
const url = `https://logs-01.xsolla.com/tag/${tags.join(',')}`;
|
|
884
|
+
firstValueFrom(this.http.post(url, message, {
|
|
885
|
+
headers: new HttpHeaders().set('Content-Type', 'text/plain'),
|
|
886
|
+
responseType: 'text',
|
|
887
|
+
})).catch((err) => console.error('Elk Logger: request error', err));
|
|
888
|
+
}
|
|
889
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: ElkLoggerService, deps: [{ token: CommonLogAttributesService }, { token: i1.HttpClient }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
890
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: ElkLoggerService, providedIn: 'root' }); }
|
|
891
|
+
}
|
|
892
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: ElkLoggerService, decorators: [{
|
|
893
|
+
type: Injectable,
|
|
894
|
+
args: [{
|
|
895
|
+
providedIn: 'root',
|
|
896
|
+
}]
|
|
897
|
+
}], ctorParameters: () => [{ type: CommonLogAttributesService }, { type: i1.HttpClient }, { type: i0.NgZone }] });
|
|
898
|
+
|
|
899
|
+
class LoggerService {
|
|
900
|
+
constructor(elkLoggerService) {
|
|
901
|
+
this.elkLoggerService = elkLoggerService;
|
|
902
|
+
this.handlers = [];
|
|
903
|
+
}
|
|
904
|
+
register(handler) {
|
|
905
|
+
this.handlers.push(handler);
|
|
906
|
+
}
|
|
907
|
+
error(error) {
|
|
908
|
+
this.elkLoggerService.handleError(error);
|
|
909
|
+
this.handlers.forEach((handler) => handler.handleError(error));
|
|
910
|
+
}
|
|
911
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: LoggerService, deps: [{ token: ElkLoggerService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
912
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: LoggerService, providedIn: 'root' }); }
|
|
913
|
+
}
|
|
914
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: LoggerService, decorators: [{
|
|
915
|
+
type: Injectable,
|
|
916
|
+
args: [{
|
|
917
|
+
providedIn: 'root',
|
|
918
|
+
}]
|
|
919
|
+
}], ctorParameters: () => [{ type: ElkLoggerService }] });
|
|
920
|
+
|
|
921
|
+
class CountryService {
|
|
922
|
+
get userIpCountry() {
|
|
923
|
+
const user = this.settingsService.user;
|
|
924
|
+
return user?.ip_country ?? user?.country.value ?? '';
|
|
925
|
+
}
|
|
926
|
+
constructor(settingsService) {
|
|
927
|
+
this.settingsService = settingsService;
|
|
928
|
+
this.userDefinedCountry = null;
|
|
929
|
+
}
|
|
930
|
+
setCountry(country) {
|
|
931
|
+
this.userDefinedCountry = country;
|
|
932
|
+
}
|
|
933
|
+
getCountry() {
|
|
934
|
+
return this.userDefinedCountry ?? this.getTokenCountry();
|
|
935
|
+
}
|
|
936
|
+
getTokenCountry() {
|
|
937
|
+
return this.settingsService.user.country.value;
|
|
938
|
+
}
|
|
939
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: CountryService, deps: [{ token: SettingsService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
940
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: CountryService, providedIn: 'root' }); }
|
|
941
|
+
}
|
|
942
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: CountryService, decorators: [{
|
|
943
|
+
type: Injectable,
|
|
944
|
+
args: [{
|
|
945
|
+
providedIn: 'root',
|
|
946
|
+
}]
|
|
947
|
+
}], ctorParameters: () => [{ type: SettingsService }] });
|
|
948
|
+
|
|
949
|
+
class ResponseError extends AppError {
|
|
950
|
+
constructor(message) {
|
|
951
|
+
super('Response failed' + (message ? `: "${message}".` : '.'));
|
|
952
|
+
}
|
|
953
|
+
}
|
|
954
|
+
|
|
955
|
+
var BooleanNumber;
|
|
956
|
+
(function (BooleanNumber) {
|
|
957
|
+
BooleanNumber[BooleanNumber["false"] = 0] = "false";
|
|
958
|
+
BooleanNumber[BooleanNumber["true"] = 1] = "true";
|
|
959
|
+
})(BooleanNumber || (BooleanNumber = {}));
|
|
960
|
+
|
|
961
|
+
class PaymentMethodsResponse {
|
|
962
|
+
constructor(paymentMethods) {
|
|
963
|
+
this.especial = paymentMethods.especial.map((method) => this.mapPaymentMethod(method));
|
|
964
|
+
this.top = paymentMethods.top.map((method) => this.mapPaymentMethod(method));
|
|
965
|
+
this.remained = paymentMethods.remained.map((method) => this.mapPaymentMethod(method));
|
|
966
|
+
this.remainedCount = {
|
|
967
|
+
total: paymentMethods.remained_count.total,
|
|
968
|
+
visible: paymentMethods.remained_count.visible,
|
|
969
|
+
};
|
|
1243
970
|
}
|
|
1244
|
-
|
|
1245
|
-
return
|
|
971
|
+
mapPaymentMethod(method) {
|
|
972
|
+
return {
|
|
973
|
+
id: method.id,
|
|
974
|
+
rank: method.rank,
|
|
975
|
+
name: method.name,
|
|
976
|
+
aliases: method.aliases,
|
|
977
|
+
categories: method.cat,
|
|
978
|
+
recommended: method.recommended === BooleanNumber.true,
|
|
979
|
+
enabledSaveAccount: method.enabled_save_account,
|
|
980
|
+
iconName: method.switch_icon_name,
|
|
981
|
+
};
|
|
1246
982
|
}
|
|
1247
|
-
|
|
1248
|
-
|
|
983
|
+
}
|
|
984
|
+
|
|
985
|
+
const paymentMethodsResponseFactoryToken = new InjectionToken('PaymentMethodsResponse');
|
|
986
|
+
const paymentMethodsResponseFactoryProvider = {
|
|
987
|
+
provide: paymentMethodsResponseFactoryToken,
|
|
988
|
+
useValue: (...args) => new PaymentMethodsResponse(...args),
|
|
989
|
+
};
|
|
990
|
+
|
|
991
|
+
class PaymentMethodsService {
|
|
992
|
+
constructor(responseFactory, settingsService, countryService, secureApi) {
|
|
993
|
+
this.responseFactory = responseFactory;
|
|
994
|
+
this.settingsService = settingsService;
|
|
995
|
+
this.countryService = countryService;
|
|
996
|
+
this.secureApi = secureApi;
|
|
997
|
+
this.apiRoute = 'remained_payment_methods';
|
|
998
|
+
this.cache = new Map();
|
|
1249
999
|
}
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1000
|
+
async getAllMethods() {
|
|
1001
|
+
return this.request();
|
|
1002
|
+
}
|
|
1003
|
+
async getList(isSaveMethodMode) {
|
|
1004
|
+
const response = await this.request(isSaveMethodMode);
|
|
1005
|
+
if (this.isFixedPaymentMethod) {
|
|
1006
|
+
return this.filterMethodsByFixedPaymentMethod(response.remained);
|
|
1253
1007
|
}
|
|
1254
|
-
return
|
|
1008
|
+
return response.remained;
|
|
1255
1009
|
}
|
|
1256
|
-
|
|
1257
|
-
|
|
1010
|
+
async getQuickMethods() {
|
|
1011
|
+
const response = await this.request();
|
|
1012
|
+
return response.especial;
|
|
1258
1013
|
}
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1014
|
+
async request(isSaveMethodMode) {
|
|
1015
|
+
const requestParams = {
|
|
1016
|
+
access_token: this.settingsService.token,
|
|
1017
|
+
country: this.countryService.getCountry(),
|
|
1018
|
+
save_payment_account_only: isSaveMethodMode
|
|
1019
|
+
? "1" /* XpsBoolean.true */
|
|
1020
|
+
: "0" /* XpsBoolean.false */,
|
|
1021
|
+
refer: this.settingsService.refer,
|
|
1022
|
+
};
|
|
1023
|
+
const cacheKey = JSON.stringify(requestParams);
|
|
1024
|
+
if (!this.cache.has(cacheKey)) {
|
|
1025
|
+
this.cache.set(cacheKey, lastValueFrom(this.secureApi
|
|
1026
|
+
.post(this.apiRoute, new URLSearchParams({
|
|
1027
|
+
...requestParams,
|
|
1028
|
+
refer: String(requestParams.refer),
|
|
1029
|
+
}), {
|
|
1030
|
+
headers: new HttpHeaders().set('Content-Type', 'application/x-www-form-urlencoded; charset=utf-8'),
|
|
1031
|
+
responseType: 'json',
|
|
1032
|
+
})
|
|
1033
|
+
.pipe(map((response) => this.responseFactory(response.payment_methods)))).catch((error) => {
|
|
1034
|
+
throw new ResponseError(error.message);
|
|
1035
|
+
}));
|
|
1262
1036
|
}
|
|
1263
|
-
|
|
1037
|
+
// @ts-expect-error the map already has the cache with key
|
|
1038
|
+
return this.cache.get(cacheKey);
|
|
1264
1039
|
}
|
|
1265
|
-
|
|
1266
|
-
|
|
1040
|
+
filterMethodsByFixedPaymentMethod(methods) {
|
|
1041
|
+
const fixedPid = this.settingsService.purchase?.payment_system?.id;
|
|
1042
|
+
const paymentMethod = methods.find((method) => method.id === fixedPid);
|
|
1043
|
+
return paymentMethod ? [paymentMethod] : [];
|
|
1267
1044
|
}
|
|
1268
|
-
get
|
|
1269
|
-
|
|
1270
|
-
return null;
|
|
1271
|
-
}
|
|
1272
|
-
const versionRegExp = new RegExp('(Version)\\/(.+)\\s');
|
|
1273
|
-
const version = versionRegExp.exec(this.userAgent);
|
|
1274
|
-
if (!version) {
|
|
1275
|
-
return null;
|
|
1276
|
-
}
|
|
1277
|
-
return Number(version[2].split('.')[0]);
|
|
1045
|
+
get isFixedPaymentMethod() {
|
|
1046
|
+
return !!this.settingsService.purchase?.payment_system?.id;
|
|
1278
1047
|
}
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1048
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: PaymentMethodsService, deps: [{ token: paymentMethodsResponseFactoryToken }, { token: SettingsService }, { token: CountryService }, { token: SecureApiClient }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1049
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: PaymentMethodsService, providedIn: 'root' }); }
|
|
1050
|
+
}
|
|
1051
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: PaymentMethodsService, decorators: [{
|
|
1052
|
+
type: Injectable,
|
|
1053
|
+
args: [{
|
|
1054
|
+
providedIn: 'root',
|
|
1055
|
+
}]
|
|
1056
|
+
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
1057
|
+
type: Inject,
|
|
1058
|
+
args: [paymentMethodsResponseFactoryToken]
|
|
1059
|
+
}] }, { type: SettingsService }, { type: CountryService }, { type: SecureApiClient }] });
|
|
1060
|
+
|
|
1061
|
+
class SavedMethodsResponse {
|
|
1062
|
+
constructor(savedMethods) {
|
|
1063
|
+
this.list = savedMethods.list.map((method) => this.mapSavedMethod(method));
|
|
1285
1064
|
}
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1065
|
+
mapSavedMethod(method) {
|
|
1066
|
+
return {
|
|
1067
|
+
currency: method.currency,
|
|
1068
|
+
form: method.form,
|
|
1069
|
+
id: method.id,
|
|
1070
|
+
isSelected: method.isSelected,
|
|
1071
|
+
isBabkaPay: method.is_babka_pay,
|
|
1072
|
+
name: method.name,
|
|
1073
|
+
pid: method.pid,
|
|
1074
|
+
psName: method.psName,
|
|
1075
|
+
recurrentType: method.recurrent_type,
|
|
1076
|
+
replaced: method.replaced,
|
|
1077
|
+
type: method.type,
|
|
1078
|
+
cardExpiryDate: method.card_expiry_date,
|
|
1079
|
+
dateCreate: method.date_create,
|
|
1080
|
+
dateLastCharge: method.date_last_charge,
|
|
1081
|
+
iconName: method.switch_icon_name,
|
|
1082
|
+
userEmail: method.user_email,
|
|
1083
|
+
partner: method.partner,
|
|
1294
1084
|
};
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1085
|
+
}
|
|
1086
|
+
}
|
|
1087
|
+
|
|
1088
|
+
const savedMethodsResponseFactoryToken = new InjectionToken('SavedMethodsResponse');
|
|
1089
|
+
const savedMethodsResponseFactoryProvider = {
|
|
1090
|
+
provide: savedMethodsResponseFactoryToken,
|
|
1091
|
+
useValue: (...args) => new SavedMethodsResponse(...args),
|
|
1092
|
+
};
|
|
1093
|
+
|
|
1094
|
+
class SavedMethodsService {
|
|
1095
|
+
constructor(responseFactory, settingsService, secureApi) {
|
|
1096
|
+
this.responseFactory = responseFactory;
|
|
1097
|
+
this.settingsService = settingsService;
|
|
1098
|
+
this.secureApi = secureApi;
|
|
1099
|
+
this.apiRoute = 'savedmethods';
|
|
1100
|
+
this.cache = new Map();
|
|
1101
|
+
}
|
|
1102
|
+
async getList(needResetCache = false) {
|
|
1103
|
+
if (needResetCache) {
|
|
1104
|
+
this.cache.clear();
|
|
1311
1105
|
}
|
|
1312
|
-
|
|
1313
|
-
|
|
1106
|
+
const response = await this.request();
|
|
1107
|
+
return response.list;
|
|
1108
|
+
}
|
|
1109
|
+
async request() {
|
|
1110
|
+
const requestParams = {
|
|
1111
|
+
access_token: this.settingsService.token,
|
|
1112
|
+
};
|
|
1113
|
+
const cacheKey = JSON.stringify(requestParams);
|
|
1114
|
+
if (!this.cache.has(cacheKey)) {
|
|
1115
|
+
this.cache.set(cacheKey, lastValueFrom(this.secureApi
|
|
1116
|
+
.post(this.apiRoute, new URLSearchParams({ ...requestParams }), {
|
|
1117
|
+
headers: new HttpHeaders().set('Content-Type', 'application/x-www-form-urlencoded; charset=utf-8'),
|
|
1118
|
+
responseType: 'json',
|
|
1119
|
+
})
|
|
1120
|
+
.pipe(map((response) => this.responseFactory(response)))).catch((error) => {
|
|
1121
|
+
throw new ResponseError(error.message);
|
|
1122
|
+
}));
|
|
1314
1123
|
}
|
|
1315
|
-
|
|
1124
|
+
// @ts-expect-error the map already has the cache with key
|
|
1125
|
+
return this.cache.get(cacheKey);
|
|
1316
1126
|
}
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1127
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: SavedMethodsService, deps: [{ token: savedMethodsResponseFactoryToken }, { token: SettingsService }, { token: SecureApiClient }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1128
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: SavedMethodsService, providedIn: 'root' }); }
|
|
1129
|
+
}
|
|
1130
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: SavedMethodsService, decorators: [{
|
|
1131
|
+
type: Injectable,
|
|
1132
|
+
args: [{
|
|
1133
|
+
providedIn: 'root',
|
|
1134
|
+
}]
|
|
1135
|
+
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
1136
|
+
type: Inject,
|
|
1137
|
+
args: [savedMethodsResponseFactoryToken]
|
|
1138
|
+
}] }, { type: SettingsService }, { type: SecureApiClient }] });
|
|
1139
|
+
|
|
1140
|
+
class UserBalanceResponse {
|
|
1141
|
+
constructor(userBalance) {
|
|
1142
|
+
this.isEnoughUserBalance = userBalance.is_enough_user_balance ?? false;
|
|
1143
|
+
this.isEnoughUserRecurrentBalance =
|
|
1144
|
+
userBalance.is_enough_user_recurrent_balance ?? false;
|
|
1145
|
+
}
|
|
1146
|
+
}
|
|
1147
|
+
|
|
1148
|
+
const userBalanceResponseFactoryToken = new InjectionToken('UserBalanceResponse');
|
|
1149
|
+
const userBalanceResponseFactoryProvider = {
|
|
1150
|
+
provide: userBalanceResponseFactoryToken,
|
|
1151
|
+
useValue: (...args) => new UserBalanceResponse(...args),
|
|
1152
|
+
};
|
|
1153
|
+
|
|
1154
|
+
class UserBalanceService {
|
|
1155
|
+
constructor(responseFactory, settingsService, secureApi) {
|
|
1156
|
+
this.responseFactory = responseFactory;
|
|
1157
|
+
this.settingsService = settingsService;
|
|
1158
|
+
this.secureApi = secureApi;
|
|
1159
|
+
this.apiRoute = 'balance/sufficiency';
|
|
1160
|
+
this.cache = new Map();
|
|
1336
1161
|
}
|
|
1337
|
-
|
|
1338
|
-
return
|
|
1162
|
+
async getUserBalance() {
|
|
1163
|
+
return this.request();
|
|
1339
1164
|
}
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
const platform = experimentalPlatformApi?.platform ??
|
|
1343
|
-
this.window?.navigator?.platform ??
|
|
1344
|
-
unknownValue;
|
|
1345
|
-
this._platform = platform.toLowerCase();
|
|
1165
|
+
getUserBalanceValue() {
|
|
1166
|
+
return this.settingsService.user.user_balance;
|
|
1346
1167
|
}
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
this.
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1168
|
+
async request() {
|
|
1169
|
+
const requestParams = {
|
|
1170
|
+
access_token: this.settingsService.token,
|
|
1171
|
+
};
|
|
1172
|
+
const cacheKey = JSON.stringify(requestParams);
|
|
1173
|
+
if (!this.cache.has(cacheKey)) {
|
|
1174
|
+
this.cache.set(cacheKey, lastValueFrom(this.secureApi
|
|
1175
|
+
.post(this.apiRoute, new URLSearchParams({ ...requestParams }), {
|
|
1176
|
+
headers: new HttpHeaders().set('Content-Type', 'application/x-www-form-urlencoded; charset=utf-8'),
|
|
1177
|
+
responseType: 'json',
|
|
1178
|
+
})
|
|
1179
|
+
.pipe(map((response) => this.responseFactory(response)))).catch((error) => {
|
|
1180
|
+
throw new ResponseError(error.message);
|
|
1181
|
+
}));
|
|
1360
1182
|
}
|
|
1183
|
+
// @ts-expect-error the map already has the cache with key
|
|
1184
|
+
return this.cache.get(cacheKey);
|
|
1361
1185
|
}
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1186
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: UserBalanceService, deps: [{ token: userBalanceResponseFactoryToken }, { token: SettingsService }, { token: SecureApiClient }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1187
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: UserBalanceService, providedIn: 'root' }); }
|
|
1188
|
+
}
|
|
1189
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: UserBalanceService, decorators: [{
|
|
1190
|
+
type: Injectable,
|
|
1191
|
+
args: [{
|
|
1192
|
+
providedIn: 'root',
|
|
1193
|
+
}]
|
|
1194
|
+
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
1195
|
+
type: Inject,
|
|
1196
|
+
args: [userBalanceResponseFactoryToken]
|
|
1197
|
+
}] }, { type: SettingsService }, { type: SecureApiClient }] });
|
|
1198
|
+
|
|
1199
|
+
class UrlService {
|
|
1200
|
+
addSearchParams(url, params = {}) {
|
|
1201
|
+
if (!url) {
|
|
1202
|
+
return '';
|
|
1371
1203
|
}
|
|
1204
|
+
const urlObject = new URL(url);
|
|
1205
|
+
for (const [key, value] of Object.entries(params)) {
|
|
1206
|
+
urlObject.searchParams.set(key, value);
|
|
1207
|
+
}
|
|
1208
|
+
return urlObject.toString();
|
|
1372
1209
|
}
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1210
|
+
getSearchParams(url) {
|
|
1211
|
+
if (!url) {
|
|
1212
|
+
return {};
|
|
1213
|
+
}
|
|
1214
|
+
const urlObject = new URL(url);
|
|
1215
|
+
const searchParams = {};
|
|
1216
|
+
for (const [key, value] of urlObject.searchParams) {
|
|
1217
|
+
searchParams[key] = value;
|
|
1218
|
+
}
|
|
1219
|
+
return searchParams;
|
|
1378
1220
|
}
|
|
1379
|
-
|
|
1380
|
-
|
|
1221
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: UrlService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1222
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: UrlService, providedIn: 'root' }); }
|
|
1223
|
+
}
|
|
1224
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: UrlService, decorators: [{
|
|
1225
|
+
type: Injectable,
|
|
1226
|
+
args: [{
|
|
1227
|
+
providedIn: 'root',
|
|
1228
|
+
}]
|
|
1229
|
+
}] });
|
|
1230
|
+
|
|
1231
|
+
class PaymentConfigService {
|
|
1232
|
+
constructor(urlService, settingsService) {
|
|
1233
|
+
this.urlService = urlService;
|
|
1234
|
+
this.settingsService = settingsService;
|
|
1381
1235
|
}
|
|
1382
|
-
|
|
1383
|
-
|
|
1236
|
+
enrich(config) {
|
|
1237
|
+
if (!config.returnUrl) {
|
|
1238
|
+
throw new Error('URL is not provided in payment config');
|
|
1239
|
+
}
|
|
1240
|
+
return {
|
|
1241
|
+
...config,
|
|
1242
|
+
returnUrl: this.enrichReturnUrl(config.returnUrl, !!config.savePaymentMethod),
|
|
1243
|
+
};
|
|
1384
1244
|
}
|
|
1385
|
-
|
|
1386
|
-
|
|
1245
|
+
enrichReturnUrl(returnUrl, savePaymentMethod) {
|
|
1246
|
+
const enrichedUrl = this.urlService.addSearchParams(returnUrl, {
|
|
1247
|
+
token: this.settingsService.token,
|
|
1248
|
+
isSavePaymentAccount: savePaymentMethod
|
|
1249
|
+
? "1" /* XpsBoolean.true */
|
|
1250
|
+
: "0" /* XpsBoolean.false */,
|
|
1251
|
+
});
|
|
1252
|
+
return enrichedUrl;
|
|
1387
1253
|
}
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
[
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1254
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: PaymentConfigService, deps: [{ token: UrlService }, { token: SettingsService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1255
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: PaymentConfigService, providedIn: 'root' }); }
|
|
1256
|
+
}
|
|
1257
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: PaymentConfigService, decorators: [{
|
|
1258
|
+
type: Injectable,
|
|
1259
|
+
args: [{
|
|
1260
|
+
providedIn: 'root',
|
|
1261
|
+
}]
|
|
1262
|
+
}], ctorParameters: () => [{ type: UrlService }, { type: SettingsService }] });
|
|
1263
|
+
|
|
1264
|
+
var XpsCommand;
|
|
1265
|
+
(function (XpsCommand) {
|
|
1266
|
+
XpsCommand["form"] = "form";
|
|
1267
|
+
XpsCommand["check"] = "check";
|
|
1268
|
+
XpsCommand["status"] = "status";
|
|
1269
|
+
XpsCommand["checkout"] = "checkout";
|
|
1270
|
+
XpsCommand["account"] = "account";
|
|
1271
|
+
XpsCommand["create"] = "create";
|
|
1272
|
+
})(XpsCommand || (XpsCommand = {}));
|
|
1273
|
+
|
|
1274
|
+
var FieldNames;
|
|
1275
|
+
(function (FieldNames) {
|
|
1276
|
+
FieldNames["address1"] = "address1";
|
|
1277
|
+
FieldNames["address2"] = "address2";
|
|
1278
|
+
FieldNames["address"] = "address";
|
|
1279
|
+
FieldNames["allowRecurrentSubscription"] = "allowRecurrentSubscription";
|
|
1280
|
+
FieldNames["allowSubscription"] = "allowSubscription";
|
|
1281
|
+
FieldNames["apt"] = "apt";
|
|
1282
|
+
FieldNames["availableCardTypes"] = "available_card_types";
|
|
1283
|
+
FieldNames["bank"] = "bank";
|
|
1284
|
+
FieldNames["birthDate"] = "birth_date";
|
|
1285
|
+
FieldNames["cardMonth"] = "card_month";
|
|
1286
|
+
FieldNames["cardYear"] = "card_year";
|
|
1287
|
+
FieldNames["cardExpire"] = "card_expire";
|
|
1288
|
+
FieldNames["cardNumber"] = "card_number";
|
|
1289
|
+
FieldNames["cardholdername"] = "cardholdername";
|
|
1290
|
+
FieldNames["city"] = "city";
|
|
1291
|
+
FieldNames["couponCode"] = "couponCode";
|
|
1292
|
+
FieldNames["cpfName"] = "cpf_name";
|
|
1293
|
+
FieldNames["cpfNumber"] = "cpf_number";
|
|
1294
|
+
FieldNames["cvv"] = "cvv";
|
|
1295
|
+
FieldNames["description"] = "description";
|
|
1296
|
+
FieldNames["email"] = "email";
|
|
1297
|
+
FieldNames["psEmail"] = "psEmail";
|
|
1298
|
+
FieldNames["psAccountCountry"] = "psAccountCountry";
|
|
1299
|
+
FieldNames["bazitemail"] = "bazitemail";
|
|
1300
|
+
FieldNames["euCheck"] = "eu_check";
|
|
1301
|
+
FieldNames["extraCvv"] = "extra_cvv";
|
|
1302
|
+
FieldNames["extraCardNumber"] = "extra_card_number";
|
|
1303
|
+
FieldNames["extraCardType"] = "extra_card_type";
|
|
1304
|
+
FieldNames["fName"] = "f_name";
|
|
1305
|
+
FieldNames["installments"] = "installments";
|
|
1306
|
+
FieldNames["lName"] = "l_name";
|
|
1307
|
+
FieldNames["needInstallments"] = "needInstallments";
|
|
1308
|
+
FieldNames["personId"] = "person_id";
|
|
1309
|
+
FieldNames["personIdAr"] = "person_id_ar";
|
|
1310
|
+
FieldNames["personIdCo"] = "person_id_co";
|
|
1311
|
+
FieldNames["phone"] = "phone";
|
|
1312
|
+
FieldNames["purchaseDescription"] = "purchaseDescription";
|
|
1313
|
+
FieldNames["recurrentType"] = "recurrent_type";
|
|
1314
|
+
FieldNames["rockstarTaxes"] = "rockstar_taxes";
|
|
1315
|
+
FieldNames["state"] = "state";
|
|
1316
|
+
FieldNames["street"] = "street";
|
|
1317
|
+
FieldNames["streetNumber"] = "street_number";
|
|
1318
|
+
FieldNames["take2Taxes"] = "take2_taxes";
|
|
1319
|
+
FieldNames["termsAndConditions"] = "termsAndConditions";
|
|
1320
|
+
FieldNames["termsAndConditionsAtariPp"] = "termsAndConditionsAtariPP";
|
|
1321
|
+
FieldNames["termsAndConditionsAtariTc"] = "termsAndConditionsAtariTC";
|
|
1322
|
+
FieldNames["termsAndConditionsHtcEula"] = "termsAndConditionsHtcEula";
|
|
1323
|
+
FieldNames["termsAndConditionsRobloxEula"] = "termsAndConditionsRobloxEula";
|
|
1324
|
+
FieldNames["termsAndConditionsRolandEula"] = "termsAndConditionsRolandEula";
|
|
1325
|
+
FieldNames["termsAndConditionsDeusLoVultEula"] = "termsAndConditionsDeusLoVultEula";
|
|
1326
|
+
FieldNames["termsAndConditionsOnzenga"] = "termsAndConditionsOnzenga";
|
|
1327
|
+
FieldNames["licenseDisclaimer"] = "licenseDisclaimer";
|
|
1328
|
+
FieldNames["xsollaTipsAmount"] = "xsollaTipsAmount";
|
|
1329
|
+
FieldNames["zip"] = "zip";
|
|
1330
|
+
FieldNames["allowSave"] = "allowSave";
|
|
1331
|
+
FieldNames["koreaLimitsInstruction"] = "korea_limits_instruction";
|
|
1332
|
+
FieldNames["tokenApplePay"] = "token_applepay";
|
|
1333
|
+
FieldNames["fixInvoice"] = "fix_invoice";
|
|
1334
|
+
FieldNames["fixPid"] = "fix_pid";
|
|
1335
|
+
FieldNames["signature"] = "signature";
|
|
1336
|
+
FieldNames["qr"] = "qr";
|
|
1337
|
+
FieldNames["sum"] = "sum";
|
|
1338
|
+
FieldNames["out"] = "out";
|
|
1339
|
+
FieldNames["tinkoffDisclaimer"] = "ps.tinkoff.disclaimer";
|
|
1340
|
+
FieldNames["ppEmail"] = "pp_email";
|
|
1341
|
+
FieldNames["redeemPoints"] = "redeemPoints";
|
|
1342
|
+
FieldNames["omnibusDirective"] = "omnibus_directive";
|
|
1343
|
+
FieldNames["labelApplePay"] = "label_applePay";
|
|
1344
|
+
FieldNames["countryCode"] = "countryCode";
|
|
1345
|
+
FieldNames["merchantCapabilities"] = "merchantCapabilities";
|
|
1346
|
+
FieldNames["requiredBillingContactFields"] = "requiredBillingContactFields";
|
|
1347
|
+
FieldNames["requiredShippingContactFields"] = "requiredShippingContactFields";
|
|
1348
|
+
FieldNames["supportedNetworks"] = "supportedNetworks";
|
|
1349
|
+
FieldNames["acquirer"] = "acquirer";
|
|
1350
|
+
FieldNames["isSandbox"] = "isSandbox";
|
|
1351
|
+
FieldNames["payInstanceAccountId"] = "payInstanceAccountId";
|
|
1352
|
+
FieldNames["getApplePaySessionUrl"] = "getApplePaySessionUrl";
|
|
1353
|
+
FieldNames["payViaCheckoutUrl"] = "payViaCheckoutUrl";
|
|
1354
|
+
FieldNames["googlePayInitData"] = "googlePayInitData";
|
|
1355
|
+
FieldNames["googlePayPaymentData"] = "googlePayPaymentData";
|
|
1356
|
+
})(FieldNames || (FieldNames = {}));
|
|
1357
|
+
|
|
1358
|
+
class SubmitResponse {
|
|
1359
|
+
constructor(parameters, responseNumber = 0) {
|
|
1360
|
+
this.responseNumber = responseNumber;
|
|
1361
|
+
/* Todo split into properties */
|
|
1362
|
+
this.parameters = parameters;
|
|
1363
|
+
this.fields = Object.keys(parameters.form).map((key) => parameters.form[key]);
|
|
1364
|
+
if (parameters.onlineBanking) {
|
|
1365
|
+
this.onlineBanking = {
|
|
1366
|
+
url: parameters.onlineBanking.value,
|
|
1367
|
+
};
|
|
1368
|
+
}
|
|
1369
|
+
this.isNeedRedirect =
|
|
1370
|
+
parameters.currentCommand === XpsCommand.account ||
|
|
1371
|
+
(parameters.currentCommand === XpsCommand.checkout &&
|
|
1372
|
+
Boolean(parameters.checkout));
|
|
1373
|
+
this.buyData = parameters.buyData;
|
|
1374
|
+
this.fixInvoice = this.fields.find((field) => field.name === FieldNames.fixInvoice)?.value;
|
|
1375
|
+
this.signature = this.fields.find((field) => field.name === FieldNames.signature)?.value;
|
|
1376
|
+
this.hasFatalErrors = parameters.textAll?.fatal;
|
|
1377
|
+
this.userSession = parameters.userSession;
|
|
1378
|
+
this.pid = parameters.pid;
|
|
1379
|
+
this.errors = parameters.errors;
|
|
1380
|
+
this.summary = parameters.summary;
|
|
1381
|
+
this.title = parameters.title;
|
|
1382
|
+
this.currentCommand = parameters.currentCommand;
|
|
1383
|
+
this.messages = parameters.messages;
|
|
1384
|
+
this.xsollaNumber = {
|
|
1385
|
+
accountXsolla: parameters.accountXsolla,
|
|
1386
|
+
isMap: parameters.isMap,
|
|
1387
|
+
};
|
|
1399
1388
|
}
|
|
1400
|
-
|
|
1401
|
-
|
|
1389
|
+
}
|
|
1390
|
+
|
|
1391
|
+
class InitializeResponse {
|
|
1392
|
+
constructor(response) {
|
|
1393
|
+
this.paymentForm = null;
|
|
1394
|
+
this.paymentForm = this.extractPaymentForm(response);
|
|
1402
1395
|
}
|
|
1403
|
-
|
|
1404
|
-
if (
|
|
1405
|
-
return
|
|
1406
|
-
}
|
|
1407
|
-
if (this.window.navigator.platform?.includes('MacIntel')) {
|
|
1408
|
-
return 'mac';
|
|
1409
|
-
}
|
|
1410
|
-
if (this.isXbox) {
|
|
1411
|
-
return 'xbox';
|
|
1412
|
-
}
|
|
1413
|
-
if (this.isWindows) {
|
|
1414
|
-
return 'windows';
|
|
1415
|
-
}
|
|
1416
|
-
if (this.isAndroid) {
|
|
1417
|
-
return 'android';
|
|
1418
|
-
}
|
|
1419
|
-
if (this.isLinux) {
|
|
1420
|
-
return 'linux';
|
|
1396
|
+
extractPaymentForm(response) {
|
|
1397
|
+
if (!response) {
|
|
1398
|
+
return null;
|
|
1421
1399
|
}
|
|
1422
|
-
return
|
|
1400
|
+
return {
|
|
1401
|
+
totalAmount: response.buyData.sum,
|
|
1402
|
+
currency: response.buyData.currency,
|
|
1403
|
+
fields: Object.keys(response.form).map((key) => response.form[key]),
|
|
1404
|
+
taxDisclaimer: response.taxDisclaimer,
|
|
1405
|
+
number: response.number,
|
|
1406
|
+
barcode: response.barcode,
|
|
1407
|
+
instruction: response.instruction,
|
|
1408
|
+
offers: response.offers,
|
|
1409
|
+
error: response.error,
|
|
1410
|
+
errors: response.errors,
|
|
1411
|
+
restrictions: response.restrictions,
|
|
1412
|
+
info: response.info,
|
|
1413
|
+
buyData: response.buyData,
|
|
1414
|
+
pid: response.pid,
|
|
1415
|
+
messages: response.messages ?? [],
|
|
1416
|
+
title: response.title,
|
|
1417
|
+
summary: response.summary,
|
|
1418
|
+
skipForm: response.skipForm,
|
|
1419
|
+
isSavedMethodPayment: !!response.form?.saved_method_id,
|
|
1420
|
+
couponCode: response.form?.couponCode?.value || '',
|
|
1421
|
+
publicId: response.public_id,
|
|
1422
|
+
skipCheckout: response.skipCheckout,
|
|
1423
|
+
koreaNotification: response.form.korea_limits_instruction,
|
|
1424
|
+
isCheckout: response.isCheckout,
|
|
1425
|
+
categories: response.categories,
|
|
1426
|
+
hasFatalErrors: response.textAll?.fatal,
|
|
1427
|
+
userSession: response.userSession,
|
|
1428
|
+
statusText: response.status?.statusData?.stateText ?? null,
|
|
1429
|
+
country: response.country ? response.country.iso : null,
|
|
1430
|
+
};
|
|
1423
1431
|
}
|
|
1424
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: UserAgentService, deps: [{ token: windowToken }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1425
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: UserAgentService, providedIn: 'root' }); }
|
|
1426
1432
|
}
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1433
|
+
|
|
1434
|
+
const isSubmitResponse = (value) => {
|
|
1435
|
+
return value instanceof SubmitResponse;
|
|
1436
|
+
};
|
|
1437
|
+
|
|
1438
|
+
var InputEventName;
|
|
1439
|
+
(function (InputEventName) {
|
|
1440
|
+
InputEventName["blur"] = "blur";
|
|
1441
|
+
InputEventName["focus"] = "focus";
|
|
1442
|
+
})(InputEventName || (InputEventName = {}));
|
|
1443
|
+
|
|
1444
|
+
const fieldsAllowedToOverride = new Set([
|
|
1445
|
+
FieldNames.allowSubscription,
|
|
1446
|
+
FieldNames.allowSave,
|
|
1447
|
+
]);
|
|
1448
|
+
|
|
1449
|
+
function isXpsBoolean(value) {
|
|
1450
|
+
return value === "1" /* XpsBoolean.true */ || value === "0" /* XpsBoolean.false */;
|
|
1451
|
+
}
|
|
1452
|
+
|
|
1453
|
+
/**
|
|
1454
|
+
* Configuration for fields that can be overridden by partner.
|
|
1455
|
+
* We can extend this configuration with additional fields in the future.
|
|
1456
|
+
*/
|
|
1457
|
+
const overrideFieldConfigs = {
|
|
1458
|
+
[FieldNames.allowSubscription]: {
|
|
1459
|
+
validator: isXpsBoolean,
|
|
1460
|
+
defaultValue: "0" /* XpsBoolean.false */,
|
|
1461
|
+
},
|
|
1462
|
+
[FieldNames.allowSave]: {
|
|
1463
|
+
validator: isXpsBoolean,
|
|
1464
|
+
defaultValue: "0" /* XpsBoolean.false */,
|
|
1465
|
+
},
|
|
1466
|
+
};
|
|
1467
|
+
|
|
1468
|
+
const initializeResponseFactoryToken = new InjectionToken('InitializeResponse');
|
|
1469
|
+
const initializeResponseFactoryProvider = {
|
|
1470
|
+
provide: initializeResponseFactoryToken,
|
|
1471
|
+
useValue: (...args) => new InitializeResponse(...args),
|
|
1472
|
+
};
|
|
1473
|
+
|
|
1474
|
+
var UserBehaviourEventName;
|
|
1475
|
+
(function (UserBehaviourEventName) {
|
|
1476
|
+
UserBehaviourEventName["openPaystation"] = "open-paystation";
|
|
1477
|
+
UserBehaviourEventName["showMethodHeader"] = "show-method-header";
|
|
1478
|
+
UserBehaviourEventName["showErrorMessage"] = "show-error-message";
|
|
1479
|
+
UserBehaviourEventName["openStatusError"] = "open-status-error";
|
|
1480
|
+
UserBehaviourEventName["sysTrackedScripts"] = "sys-tracked_scripts";
|
|
1481
|
+
})(UserBehaviourEventName || (UserBehaviourEventName = {}));
|
|
1482
|
+
|
|
1483
|
+
const userBehaviourEventTypes = {
|
|
1484
|
+
open: 'open',
|
|
1485
|
+
show: 'show',
|
|
1486
|
+
click: 'click',
|
|
1487
|
+
manual: 'manual',
|
|
1488
|
+
store: 'store',
|
|
1489
|
+
};
|
|
1490
|
+
|
|
1491
|
+
const masterCardAndVisaPaymentMethodId = 26;
|
|
1492
|
+
const maestroPaymentMethodId = 490;
|
|
1493
|
+
// eslint-disable-next-line @typescript-eslint/no-magic-numbers
|
|
1494
|
+
const creditCardPaymentMethodId = 1380;
|
|
1495
|
+
const americanExpressMethodId = 714;
|
|
1496
|
+
const specialCards = [
|
|
1497
|
+
maestroPaymentMethodId,
|
|
1498
|
+
masterCardAndVisaPaymentMethodId,
|
|
1499
|
+
americanExpressMethodId,
|
|
1500
|
+
];
|
|
1501
|
+
const cardsWith3ds = [
|
|
1502
|
+
masterCardAndVisaPaymentMethodId,
|
|
1503
|
+
maestroPaymentMethodId,
|
|
1504
|
+
creditCardPaymentMethodId,
|
|
1505
|
+
];
|
|
1436
1506
|
|
|
1437
1507
|
class XpsApiService {
|
|
1438
1508
|
constructor(window, secureApiClient, settingsService, countryService, userAgentService) {
|
|
@@ -1830,6 +1900,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImpor
|
|
|
1830
1900
|
type: Injectable
|
|
1831
1901
|
}] });
|
|
1832
1902
|
|
|
1903
|
+
const googlePayPid = 3431;
|
|
1904
|
+
|
|
1833
1905
|
class SpecialButtonActionCreator {
|
|
1834
1906
|
constructor() {
|
|
1835
1907
|
this.type = 'special_button';
|
|
@@ -5669,8 +5741,8 @@ class CentrifugoWebSocketService {
|
|
|
5669
5741
|
reconnection: 1000,
|
|
5670
5742
|
reconnectionMaxDeviation: 1000,
|
|
5671
5743
|
}; }
|
|
5672
|
-
constructor(
|
|
5673
|
-
this.
|
|
5744
|
+
constructor(loggerService) {
|
|
5745
|
+
this.loggerService = loggerService;
|
|
5674
5746
|
this.type = WebSocketClientType.centrifugo;
|
|
5675
5747
|
this.reconnectionTimerId = null;
|
|
5676
5748
|
this.isConnectionOpen = false;
|
|
@@ -5690,8 +5762,8 @@ class CentrifugoWebSocketService {
|
|
|
5690
5762
|
catch (error) {
|
|
5691
5763
|
// @ts-expect-error error is unknown
|
|
5692
5764
|
const message = (error?.message || error);
|
|
5693
|
-
const
|
|
5694
|
-
this.
|
|
5765
|
+
const wsError = new WsError(`unknown websocket error: ${message}`, channel);
|
|
5766
|
+
this.loggerService.error(wsError);
|
|
5695
5767
|
}
|
|
5696
5768
|
}
|
|
5697
5769
|
close() {
|
|
@@ -5770,9 +5842,9 @@ class CentrifugoWebSocketService {
|
|
|
5770
5842
|
})
|
|
5771
5843
|
.on('error', (ctx) => {
|
|
5772
5844
|
const message = `code ${ctx.error.code} - ${ctx.error.message}`;
|
|
5773
|
-
this.
|
|
5845
|
+
this.loggerService.error(new TaggedError(`connection error: ${message}`, [ErrorTags.WS], {
|
|
5774
5846
|
channel: websocketChannel,
|
|
5775
|
-
});
|
|
5847
|
+
}));
|
|
5776
5848
|
})
|
|
5777
5849
|
.connect();
|
|
5778
5850
|
this.subscription = this.connection.newSubscription(websocketChannel, this.getSubscriptionOptions(websocketChannel));
|
|
@@ -5783,16 +5855,16 @@ class CentrifugoWebSocketService {
|
|
|
5783
5855
|
})
|
|
5784
5856
|
.on('publication', (ctx) => {
|
|
5785
5857
|
const message = ctx.data;
|
|
5786
|
-
this.
|
|
5858
|
+
this.loggerService.error(new TaggedError(`websocket message received: ${message}`, [ErrorTags.WS], {
|
|
5787
5859
|
channel: websocketChannel,
|
|
5788
|
-
});
|
|
5860
|
+
}));
|
|
5789
5861
|
this.incomingMessages$.next(ctx);
|
|
5790
5862
|
})
|
|
5791
5863
|
.on('error', (ctx) => {
|
|
5792
5864
|
const message = `code ${ctx.error.code} - ${ctx.error.message}`;
|
|
5793
|
-
this.
|
|
5865
|
+
this.loggerService.error(new TaggedError(`subscription error: ${message}`, [ErrorTags.WS], {
|
|
5794
5866
|
channel: websocketChannel,
|
|
5795
|
-
});
|
|
5867
|
+
}));
|
|
5796
5868
|
})
|
|
5797
5869
|
.subscribe();
|
|
5798
5870
|
});
|
|
@@ -5808,9 +5880,9 @@ class CentrifugoWebSocketService {
|
|
|
5808
5880
|
/* If connection error, cause any connection error isn't 0 */
|
|
5809
5881
|
if (ctx.code !== 0) {
|
|
5810
5882
|
const message = `code ${ctx.code} - ${ctx.reason}`;
|
|
5811
|
-
this.
|
|
5883
|
+
this.loggerService.error(new TaggedError(`disconnected error: ${message}`, [ErrorTags.WS], {
|
|
5812
5884
|
channel: websocketChannel,
|
|
5813
|
-
});
|
|
5885
|
+
}));
|
|
5814
5886
|
(async () => {
|
|
5815
5887
|
await this.waitWhileNotReconnect();
|
|
5816
5888
|
})();
|
|
@@ -5837,9 +5909,9 @@ class CentrifugoWebSocketService {
|
|
|
5837
5909
|
}
|
|
5838
5910
|
const afterTimer = performance.now();
|
|
5839
5911
|
const timerDuration = afterTimer - beforeTimer;
|
|
5840
|
-
this.
|
|
5912
|
+
this.loggerService.error(new TaggedError(`fallback to reconnection timer: duration ${timerDuration}ms`, [ErrorTags.WS], {
|
|
5841
5913
|
channel: this.channel,
|
|
5842
|
-
});
|
|
5914
|
+
}));
|
|
5843
5915
|
this.successfulReconnectionEventsProxy$.next();
|
|
5844
5916
|
}
|
|
5845
5917
|
getSubscriptionOptions(websocketChannel) {
|
|
@@ -5852,7 +5924,7 @@ class CentrifugoWebSocketService {
|
|
|
5852
5924
|
}
|
|
5853
5925
|
return options;
|
|
5854
5926
|
}
|
|
5855
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: CentrifugoWebSocketService, deps: [{ token:
|
|
5927
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: CentrifugoWebSocketService, deps: [{ token: LoggerService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
5856
5928
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: CentrifugoWebSocketService, providedIn: 'root' }); }
|
|
5857
5929
|
}
|
|
5858
5930
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: CentrifugoWebSocketService, decorators: [{
|
|
@@ -5860,7 +5932,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImpor
|
|
|
5860
5932
|
args: [{
|
|
5861
5933
|
providedIn: 'root',
|
|
5862
5934
|
}]
|
|
5863
|
-
}], ctorParameters: () => [{ type:
|
|
5935
|
+
}], ctorParameters: () => [{ type: LoggerService }] });
|
|
5864
5936
|
|
|
5865
5937
|
// @todo: remove this factory and switch to centrifugo client after centrifugo issues resolved
|
|
5866
5938
|
class WebSocketFactory {
|
|
@@ -6308,8 +6380,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImpor
|
|
|
6308
6380
|
}] });
|
|
6309
6381
|
|
|
6310
6382
|
class InitializeSpecialButtonActionCreator {
|
|
6311
|
-
constructor(
|
|
6312
|
-
this.
|
|
6383
|
+
constructor(loggerService) {
|
|
6384
|
+
this.loggerService = loggerService;
|
|
6313
6385
|
this.type = 'special_button';
|
|
6314
6386
|
this.pids = [googlePayPid];
|
|
6315
6387
|
this.sdkPaymentMethodsName = new Map([
|
|
@@ -6333,19 +6405,19 @@ class InitializeSpecialButtonActionCreator {
|
|
|
6333
6405
|
getPaymentMethodName(pid = 0) {
|
|
6334
6406
|
const buttonName = this.sdkPaymentMethodsName.get(pid);
|
|
6335
6407
|
if (!buttonName) {
|
|
6336
|
-
this.
|
|
6408
|
+
this.loggerService.error(new TaggedError('No special button for provided pid', [ErrorTags.GOOGLEPAY], {
|
|
6337
6409
|
pid,
|
|
6338
|
-
});
|
|
6410
|
+
}));
|
|
6339
6411
|
throw new Error('Special button not found');
|
|
6340
6412
|
}
|
|
6341
6413
|
return buttonName;
|
|
6342
6414
|
}
|
|
6343
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: InitializeSpecialButtonActionCreator, deps: [{ token:
|
|
6415
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: InitializeSpecialButtonActionCreator, deps: [{ token: LoggerService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
6344
6416
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: InitializeSpecialButtonActionCreator }); }
|
|
6345
6417
|
}
|
|
6346
6418
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: InitializeSpecialButtonActionCreator, decorators: [{
|
|
6347
6419
|
type: Injectable
|
|
6348
|
-
}], ctorParameters: () => [{ type:
|
|
6420
|
+
}], ctorParameters: () => [{ type: LoggerService }] });
|
|
6349
6421
|
|
|
6350
6422
|
const initializeNextActionsToken = new InjectionToken('InitializeNextActions');
|
|
6351
6423
|
const initializeNextActions = [
|
|
@@ -6871,7 +6943,11 @@ class BehaviourStrategy {
|
|
|
6871
6943
|
isSuitable() {
|
|
6872
6944
|
return false;
|
|
6873
6945
|
}
|
|
6946
|
+
onInit() { }
|
|
6874
6947
|
onDestroy() { }
|
|
6948
|
+
canAutoSubmit() {
|
|
6949
|
+
return false;
|
|
6950
|
+
}
|
|
6875
6951
|
setPaymentData(paymentData) {
|
|
6876
6952
|
this.paymentData = paymentData;
|
|
6877
6953
|
}
|
|
@@ -6921,9 +6997,76 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImpor
|
|
|
6921
6997
|
type: Injectable
|
|
6922
6998
|
}], ctorParameters: () => [] });
|
|
6923
6999
|
|
|
7000
|
+
class GooglePayInstantFlowStrategy extends BehaviourStrategy {
|
|
7001
|
+
constructor() {
|
|
7002
|
+
super();
|
|
7003
|
+
}
|
|
7004
|
+
isSuitable() {
|
|
7005
|
+
if (!isInitializeResponse(this.paymentData)) {
|
|
7006
|
+
return false;
|
|
7007
|
+
}
|
|
7008
|
+
const isInstantPayFlow = this.paymentData.paymentForm?.fields.some((field) => {
|
|
7009
|
+
return field.name === FieldNames.googlePayInitData;
|
|
7010
|
+
});
|
|
7011
|
+
return (this.paymentData.paymentForm?.pid === googlePay && !!isInstantPayFlow);
|
|
7012
|
+
}
|
|
7013
|
+
onInit() {
|
|
7014
|
+
this.hideField(FieldNames.zip);
|
|
7015
|
+
this.hideField(FieldNames.email);
|
|
7016
|
+
}
|
|
7017
|
+
hideField(fieldName) {
|
|
7018
|
+
if (!isInitializeResponse(this.paymentData)) {
|
|
7019
|
+
return;
|
|
7020
|
+
}
|
|
7021
|
+
const fieldForHide = this.paymentData.paymentForm?.fields.find((field) => {
|
|
7022
|
+
return field.name === fieldName;
|
|
7023
|
+
});
|
|
7024
|
+
if (fieldForHide) {
|
|
7025
|
+
fieldForHide.isVisible = "0" /* XpsBoolean.false */;
|
|
7026
|
+
}
|
|
7027
|
+
}
|
|
7028
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: GooglePayInstantFlowStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
7029
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: GooglePayInstantFlowStrategy }); }
|
|
7030
|
+
}
|
|
7031
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: GooglePayInstantFlowStrategy, decorators: [{
|
|
7032
|
+
type: Injectable
|
|
7033
|
+
}], ctorParameters: () => [] });
|
|
7034
|
+
|
|
7035
|
+
class GooglePayRegularFlowStrategy extends BehaviourStrategy {
|
|
7036
|
+
constructor() {
|
|
7037
|
+
super();
|
|
7038
|
+
}
|
|
7039
|
+
isSuitable() {
|
|
7040
|
+
if (!isInitializeResponse(this.paymentData)) {
|
|
7041
|
+
return false;
|
|
7042
|
+
}
|
|
7043
|
+
const isInstantPayFlow = this.paymentData.paymentForm?.fields.some((field) => {
|
|
7044
|
+
return field.name === FieldNames.googlePayInitData;
|
|
7045
|
+
});
|
|
7046
|
+
return this.paymentData.paymentForm?.pid === googlePay && !isInstantPayFlow;
|
|
7047
|
+
}
|
|
7048
|
+
canAutoSubmit() {
|
|
7049
|
+
const visibleFields = this.getVisibleFields();
|
|
7050
|
+
return visibleFields.length === 0;
|
|
7051
|
+
}
|
|
7052
|
+
getVisibleFields() {
|
|
7053
|
+
if (!isInitializeResponse(this.paymentData)) {
|
|
7054
|
+
return [];
|
|
7055
|
+
}
|
|
7056
|
+
return (this.paymentData.paymentForm?.fields.filter((field) => field.isVisible === "1" /* XpsBoolean.true */ && field.isMandatory) ?? []);
|
|
7057
|
+
}
|
|
7058
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: GooglePayRegularFlowStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
7059
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: GooglePayRegularFlowStrategy }); }
|
|
7060
|
+
}
|
|
7061
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: GooglePayRegularFlowStrategy, decorators: [{
|
|
7062
|
+
type: Injectable
|
|
7063
|
+
}], ctorParameters: () => [] });
|
|
7064
|
+
|
|
6924
7065
|
const behaviourStrategiesToken = new InjectionToken('BehaviourStrategies');
|
|
6925
7066
|
const behaviourStrategies = [
|
|
6926
7067
|
ApplePayWithShippingAddressStrategy,
|
|
7068
|
+
GooglePayInstantFlowStrategy,
|
|
7069
|
+
GooglePayRegularFlowStrategy,
|
|
6927
7070
|
];
|
|
6928
7071
|
|
|
6929
7072
|
class PaymentBehaviourService {
|
|
@@ -6965,8 +7108,8 @@ class PaymentService {
|
|
|
6965
7108
|
get formResponseValue() {
|
|
6966
7109
|
return this._formResponse$.getValue();
|
|
6967
7110
|
}
|
|
6968
|
-
constructor(
|
|
6969
|
-
this.
|
|
7111
|
+
constructor(loggerService, initializeService, submitService, syncService, formService, statusService, financeDetailsService, creditCardStateService, nextActionService, initializeNextActionService, controlConfigService, threeDsService, formMessagesService, settingsService, countryService, checkStatusActionCreator, printInstructionService, paymentBehaviourService) {
|
|
7112
|
+
this.loggerService = loggerService;
|
|
6970
7113
|
this.initializeService = initializeService;
|
|
6971
7114
|
this.submitService = submitService;
|
|
6972
7115
|
this.syncService = syncService;
|
|
@@ -7057,9 +7200,9 @@ class PaymentService {
|
|
|
7057
7200
|
}
|
|
7058
7201
|
async submitWithFields(fields) {
|
|
7059
7202
|
if (!this.form) {
|
|
7060
|
-
this.
|
|
7203
|
+
this.loggerService.error(new TaggedError('submit error: trying to submit with no form', [
|
|
7061
7204
|
ErrorTags.GOOGLEPAY,
|
|
7062
|
-
]);
|
|
7205
|
+
]));
|
|
7063
7206
|
throw new Error('form is empty!');
|
|
7064
7207
|
}
|
|
7065
7208
|
this.isSavingMethodMode = this.fields.some(({ name, value }) => name === 'savePsAccountOnly' && value === "1" /* XpsBoolean.true */);
|
|
@@ -7381,16 +7524,13 @@ class PaymentService {
|
|
|
7381
7524
|
}
|
|
7382
7525
|
const isRedirectMethod = response.paymentForm.isCheckout;
|
|
7383
7526
|
const canSkipForm = response.paymentForm.skipForm;
|
|
7384
|
-
const
|
|
7385
|
-
|
|
7386
|
-
return ((!isRedirectMethod && canSkipForm) ||
|
|
7387
|
-
(visibleFields.length === 0 &&
|
|
7388
|
-
suitablePids.includes(response.paymentForm.pid)));
|
|
7527
|
+
const isSuitableByStrategy = this.autoSubmitBehaviourStrategies(this.config);
|
|
7528
|
+
return (!isRedirectMethod && canSkipForm) || isSuitableByStrategy;
|
|
7389
7529
|
}
|
|
7390
7530
|
getSdkPaymentDataFromResponse(data) {
|
|
7391
7531
|
if (isSubmitResponse(data)) {
|
|
7392
7532
|
return {
|
|
7393
|
-
checkoutData: data.parameters
|
|
7533
|
+
checkoutData: data.parameters?.checkout.data.data,
|
|
7394
7534
|
fields: data.fields,
|
|
7395
7535
|
summary: data.summary,
|
|
7396
7536
|
};
|
|
@@ -7413,7 +7553,13 @@ class PaymentService {
|
|
|
7413
7553
|
strategy.onDestroy();
|
|
7414
7554
|
});
|
|
7415
7555
|
}
|
|
7416
|
-
|
|
7556
|
+
autoSubmitBehaviourStrategies(config) {
|
|
7557
|
+
const behaviourStrategies = this.paymentBehaviourService.getApplicableBehaviourStrategies(this.data, config);
|
|
7558
|
+
return behaviourStrategies.some((strategy) => {
|
|
7559
|
+
return strategy.canAutoSubmit();
|
|
7560
|
+
});
|
|
7561
|
+
}
|
|
7562
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: PaymentService, deps: [{ token: LoggerService }, { token: InitializeService }, { token: SubmitService }, { token: SyncService }, { token: FormService }, { token: StatusService }, { token: FinanceDetailsService }, { token: CreditCardStateService }, { token: NextActionService }, { token: InitializeNextActionService }, { token: ControlConfigService }, { token: ThreeDsService }, { token: FormMessagesService }, { token: SettingsService }, { token: CountryService }, { token: CheckStatusActionCreator }, { token: PrintInstructionService }, { token: PaymentBehaviourService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
7417
7563
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: PaymentService, providedIn: 'root' }); }
|
|
7418
7564
|
}
|
|
7419
7565
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: PaymentService, decorators: [{
|
|
@@ -7421,7 +7567,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImpor
|
|
|
7421
7567
|
args: [{
|
|
7422
7568
|
providedIn: 'root',
|
|
7423
7569
|
}]
|
|
7424
|
-
}], ctorParameters: () => [{ type:
|
|
7570
|
+
}], ctorParameters: () => [{ type: LoggerService }, { type: InitializeService }, { type: SubmitService }, { type: SyncService }, { type: FormService }, { type: StatusService }, { type: FinanceDetailsService }, { type: CreditCardStateService }, { type: NextActionService }, { type: InitializeNextActionService }, { type: ControlConfigService }, { type: ThreeDsService }, { type: FormMessagesService }, { type: SettingsService }, { type: CountryService }, { type: CheckStatusActionCreator }, { type: PrintInstructionService }, { type: PaymentBehaviourService }] });
|
|
7425
7571
|
|
|
7426
7572
|
const euCountries = new Set([
|
|
7427
7573
|
'AT',
|
|
@@ -8074,8 +8220,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImpor
|
|
|
8074
8220
|
}] }] });
|
|
8075
8221
|
|
|
8076
8222
|
class CoreLibraryService {
|
|
8077
|
-
constructor(settingsService, countryService, paymentMethodsService, savedMethodsService, userBalanceService, paymentConfigService, paymentService, deviceFingerPrintService, financeDetailsService, legalService, statusService, nextActionService, creditCardService, creditCardStateService, formMessagesService, editSavedMethodsService, userBehaviourAnalyticsService, performanceService, combinedPaymentMethodsService, countriesApiService, sendInstructionService, scriptTrackerService, translateService) {
|
|
8223
|
+
constructor(settingsService, loggerService, countryService, paymentMethodsService, savedMethodsService, userBalanceService, paymentConfigService, paymentService, deviceFingerPrintService, financeDetailsService, legalService, statusService, nextActionService, creditCardService, creditCardStateService, formMessagesService, editSavedMethodsService, userBehaviourAnalyticsService, performanceService, combinedPaymentMethodsService, countriesApiService, sendInstructionService, scriptTrackerService, translateService, commonLogAttributesService) {
|
|
8078
8224
|
this.settingsService = settingsService;
|
|
8225
|
+
this.loggerService = loggerService;
|
|
8079
8226
|
this.countryService = countryService;
|
|
8080
8227
|
this.paymentMethodsService = paymentMethodsService;
|
|
8081
8228
|
this.savedMethodsService = savedMethodsService;
|
|
@@ -8098,6 +8245,7 @@ class CoreLibraryService {
|
|
|
8098
8245
|
this.sendInstructionService = sendInstructionService;
|
|
8099
8246
|
this.scriptTrackerService = scriptTrackerService;
|
|
8100
8247
|
this.translateService = translateService;
|
|
8248
|
+
this.commonLogAttributesService = commonLogAttributesService;
|
|
8101
8249
|
this.paymentMethods = {
|
|
8102
8250
|
getList: async (isSaveMethodMode) => this.paymentMethodsService.getList(isSaveMethodMode),
|
|
8103
8251
|
getQuickMethods: async () => this.paymentMethodsService.getQuickMethods(),
|
|
@@ -8211,6 +8359,9 @@ class CoreLibraryService {
|
|
|
8211
8359
|
getUserBalanceValue() {
|
|
8212
8360
|
return this.userBalanceService.getUserBalanceValue();
|
|
8213
8361
|
}
|
|
8362
|
+
registerLogHandler(handler) {
|
|
8363
|
+
this.loggerService.register(handler);
|
|
8364
|
+
}
|
|
8214
8365
|
get paymentForm$() {
|
|
8215
8366
|
return this.paymentService.paymentForm$;
|
|
8216
8367
|
}
|
|
@@ -8226,7 +8377,10 @@ class CoreLibraryService {
|
|
|
8226
8377
|
get isApplePayInstantFlowEnabled() {
|
|
8227
8378
|
return this.settingsService.isApplePayInstantFlowEnabled;
|
|
8228
8379
|
}
|
|
8229
|
-
|
|
8380
|
+
get commonLogAttributes() {
|
|
8381
|
+
return this.commonLogAttributesService.getAttributes();
|
|
8382
|
+
}
|
|
8383
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: CoreLibraryService, deps: [{ token: SettingsService }, { token: LoggerService }, { token: CountryService }, { token: PaymentMethodsService }, { token: SavedMethodsService }, { token: UserBalanceService }, { token: PaymentConfigService }, { token: PaymentService }, { token: DeviceFingerPrintService }, { token: FinanceDetailsService }, { token: LegalService }, { token: StatusService }, { token: NextActionService }, { token: CreditCardService }, { token: CreditCardStateService }, { token: FormMessagesService }, { token: EditSavedMethodsService }, { token: UserBehaviourAnalyticsService }, { token: PerformanceService }, { token: CombinedPaymentMethodsService }, { token: CountriesApiService }, { token: SendInstructionService }, { token: ScriptTrackerService }, { token: i24.TranslateService }, { token: CommonLogAttributesService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
8230
8384
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: CoreLibraryService, providedIn: 'root' }); }
|
|
8231
8385
|
}
|
|
8232
8386
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: CoreLibraryService, decorators: [{
|
|
@@ -8234,7 +8388,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImpor
|
|
|
8234
8388
|
args: [{
|
|
8235
8389
|
providedIn: 'root',
|
|
8236
8390
|
}]
|
|
8237
|
-
}], ctorParameters: () => [{ type: SettingsService }, { type: CountryService }, { type: PaymentMethodsService }, { type: SavedMethodsService }, { type: UserBalanceService }, { type: PaymentConfigService }, { type: PaymentService }, { type: DeviceFingerPrintService }, { type: FinanceDetailsService }, { type: LegalService }, { type: StatusService }, { type: NextActionService }, { type: CreditCardService }, { type: CreditCardStateService }, { type: FormMessagesService }, { type: EditSavedMethodsService }, { type: UserBehaviourAnalyticsService }, { type: PerformanceService }, { type: CombinedPaymentMethodsService }, { type: CountriesApiService }, { type: SendInstructionService }, { type: ScriptTrackerService }, { type:
|
|
8391
|
+
}], ctorParameters: () => [{ type: SettingsService }, { type: LoggerService }, { type: CountryService }, { type: PaymentMethodsService }, { type: SavedMethodsService }, { type: UserBalanceService }, { type: PaymentConfigService }, { type: PaymentService }, { type: DeviceFingerPrintService }, { type: FinanceDetailsService }, { type: LegalService }, { type: StatusService }, { type: NextActionService }, { type: CreditCardService }, { type: CreditCardStateService }, { type: FormMessagesService }, { type: EditSavedMethodsService }, { type: UserBehaviourAnalyticsService }, { type: PerformanceService }, { type: CombinedPaymentMethodsService }, { type: CountriesApiService }, { type: SendInstructionService }, { type: ScriptTrackerService }, { type: i24.TranslateService }, { type: CommonLogAttributesService }] });
|
|
8238
8392
|
|
|
8239
8393
|
class HttpError extends AppError {
|
|
8240
8394
|
constructor(error, req) {
|
|
@@ -8527,10 +8681,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImpor
|
|
|
8527
8681
|
}], ctorParameters: () => [{ type: SummaryFinanceDetailsAdapterService }] });
|
|
8528
8682
|
|
|
8529
8683
|
class BraintreeHandler extends ApplePaySessionHandlerAbstract {
|
|
8530
|
-
constructor(window,
|
|
8684
|
+
constructor(window, loggerService, applePayCartService) {
|
|
8531
8685
|
super();
|
|
8532
8686
|
this.window = window;
|
|
8533
|
-
this.
|
|
8687
|
+
this.loggerService = loggerService;
|
|
8534
8688
|
this.applePayCartService = applePayCartService;
|
|
8535
8689
|
this.paymentClient = null;
|
|
8536
8690
|
}
|
|
@@ -8540,9 +8694,9 @@ class BraintreeHandler extends ApplePaySessionHandlerAbstract {
|
|
|
8540
8694
|
startSession(params, additionalParams, applePayFinallyCallback) {
|
|
8541
8695
|
if (!this.paymentClient) {
|
|
8542
8696
|
console.error(ApplePayErrors.braintreeInitializeError);
|
|
8543
|
-
this.
|
|
8697
|
+
this.loggerService.error(new TaggedError(ApplePayErrors.braintreeInitializeError, [
|
|
8544
8698
|
ErrorTags.APPLEPAY,
|
|
8545
|
-
]);
|
|
8699
|
+
]));
|
|
8546
8700
|
return;
|
|
8547
8701
|
}
|
|
8548
8702
|
const request = this.buildPaymentRequest(params);
|
|
@@ -8613,7 +8767,7 @@ class BraintreeHandler extends ApplePaySessionHandlerAbstract {
|
|
|
8613
8767
|
};
|
|
8614
8768
|
session.begin();
|
|
8615
8769
|
}
|
|
8616
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: BraintreeHandler, deps: [{ token: windowToken }, { token:
|
|
8770
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: BraintreeHandler, deps: [{ token: windowToken }, { token: LoggerService }, { token: ApplePayCartService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
8617
8771
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: BraintreeHandler }); }
|
|
8618
8772
|
}
|
|
8619
8773
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: BraintreeHandler, decorators: [{
|
|
@@ -8621,7 +8775,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImpor
|
|
|
8621
8775
|
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
8622
8776
|
type: Inject,
|
|
8623
8777
|
args: [windowToken]
|
|
8624
|
-
}] }, { type:
|
|
8778
|
+
}] }, { type: LoggerService }, { type: ApplePayCartService }] });
|
|
8625
8779
|
|
|
8626
8780
|
class CheckoutHandler extends ApplePaySessionHandlerAbstract {
|
|
8627
8781
|
constructor(window, http, applePayCartService) {
|
|
@@ -9123,9 +9277,9 @@ class GooglePayService {
|
|
|
9123
9277
|
get googlePaymentClientWasInitialized() {
|
|
9124
9278
|
return !!this.googlePaymentClient;
|
|
9125
9279
|
}
|
|
9126
|
-
constructor(window,
|
|
9280
|
+
constructor(window, loggerService, paymentSystemProcessingService, googlePayCheckoutPaymentService, googlePayInstantPaymentService, injector) {
|
|
9127
9281
|
this.window = window;
|
|
9128
|
-
this.
|
|
9282
|
+
this.loggerService = loggerService;
|
|
9129
9283
|
this.paymentSystemProcessingService = paymentSystemProcessingService;
|
|
9130
9284
|
this.googlePayCheckoutPaymentService = googlePayCheckoutPaymentService;
|
|
9131
9285
|
this.googlePayInstantPaymentService = googlePayInstantPaymentService;
|
|
@@ -9159,7 +9313,9 @@ class GooglePayService {
|
|
|
9159
9313
|
.pipe(filter$1(Boolean), take(1))
|
|
9160
9314
|
.subscribe(() => {
|
|
9161
9315
|
if (!this.googlePaymentClient) {
|
|
9162
|
-
this.
|
|
9316
|
+
this.loggerService.error(new TaggedError('Google payment client is not initialized', [
|
|
9317
|
+
ErrorTags.GOOGLEPAY,
|
|
9318
|
+
]));
|
|
9163
9319
|
throw new AppError(`Google Pay: Google payment client is not initialized`);
|
|
9164
9320
|
}
|
|
9165
9321
|
this.paymentService = this.getPaymentService();
|
|
@@ -9168,9 +9324,7 @@ class GooglePayService {
|
|
|
9168
9324
|
checkDeviceData: data,
|
|
9169
9325
|
});
|
|
9170
9326
|
if (!initData) {
|
|
9171
|
-
this.
|
|
9172
|
-
ErrorTags.GOOGLEPAY,
|
|
9173
|
-
]);
|
|
9327
|
+
this.loggerService.error(new TaggedError('No initialization data', [ErrorTags.GOOGLEPAY]));
|
|
9174
9328
|
throw new AppError('Google Pay: no initialization data');
|
|
9175
9329
|
}
|
|
9176
9330
|
this.googlePaymentClient
|
|
@@ -9197,18 +9351,18 @@ class GooglePayService {
|
|
|
9197
9351
|
}
|
|
9198
9352
|
async proceedCheckout() {
|
|
9199
9353
|
if (!this.googlePaymentClient) {
|
|
9200
|
-
this.
|
|
9354
|
+
this.loggerService.error(new TaggedError('Google payment client is not initialized to proceed checkout', [ErrorTags.GOOGLEPAY]));
|
|
9201
9355
|
throw new AppError(`Google Pay. proceedCheckout: no google payment client`);
|
|
9202
9356
|
}
|
|
9203
9357
|
if (!this.paymentService) {
|
|
9204
|
-
this.
|
|
9358
|
+
this.loggerService.error(new TaggedError('Google payment service is not initialized to proceed checkout', [ErrorTags.GOOGLEPAY]));
|
|
9205
9359
|
throw new AppError(`Google Pay. proceedCheckout: no google payment service`);
|
|
9206
9360
|
}
|
|
9207
9361
|
const paymentDataRequest = this.paymentService.getPaymentRequest();
|
|
9208
9362
|
if (!paymentDataRequest) {
|
|
9209
|
-
this.
|
|
9363
|
+
this.loggerService.error(new TaggedError('No data for payment data request', [
|
|
9210
9364
|
ErrorTags.GOOGLEPAY,
|
|
9211
|
-
]);
|
|
9365
|
+
]));
|
|
9212
9366
|
throw new AppError(`Google Pay: No data for payment data request`);
|
|
9213
9367
|
}
|
|
9214
9368
|
const checkStatusAction = this.injector
|
|
@@ -9217,7 +9371,7 @@ class GooglePayService {
|
|
|
9217
9371
|
try {
|
|
9218
9372
|
const paymentData = await this.googlePaymentClient.loadPaymentData(paymentDataRequest);
|
|
9219
9373
|
if (!paymentData?.paymentMethodData?.tokenizationData?.token) {
|
|
9220
|
-
this.
|
|
9374
|
+
this.loggerService.error(new TaggedError('Token is missing', [ErrorTags.GOOGLEPAY]));
|
|
9221
9375
|
throw new AppError('Google Pay: token is missing');
|
|
9222
9376
|
}
|
|
9223
9377
|
this.paymentService.handleSuccessfulPayment?.(paymentData);
|
|
@@ -9290,7 +9444,7 @@ class GooglePayService {
|
|
|
9290
9444
|
isCanceledStatus(statusCode) {
|
|
9291
9445
|
return statusCode.toLowerCase() === 'canceled';
|
|
9292
9446
|
}
|
|
9293
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: GooglePayService, deps: [{ token: windowToken }, { token:
|
|
9447
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: GooglePayService, deps: [{ token: windowToken }, { token: LoggerService }, { token: PaymentSystemProcessingService }, { token: GooglePayCheckoutPaymentService }, { token: GooglePayInstantPaymentService }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
9294
9448
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: GooglePayService, providedIn: 'root' }); }
|
|
9295
9449
|
}
|
|
9296
9450
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: GooglePayService, decorators: [{
|
|
@@ -9301,7 +9455,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImpor
|
|
|
9301
9455
|
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
9302
9456
|
type: Inject,
|
|
9303
9457
|
args: [windowToken]
|
|
9304
|
-
}] }, { type:
|
|
9458
|
+
}] }, { type: LoggerService }, { type: PaymentSystemProcessingService }, { type: GooglePayCheckoutPaymentService }, { type: GooglePayInstantPaymentService }, { type: i0.Injector }] });
|
|
9305
9459
|
|
|
9306
9460
|
var ApplePayIntegrationType;
|
|
9307
9461
|
(function (ApplePayIntegrationType) {
|
|
@@ -9481,9 +9635,9 @@ class ApplePaySdkService {
|
|
|
9481
9635
|
listenApplePayPostMessages();
|
|
9482
9636
|
};
|
|
9483
9637
|
script.onerror = (error) => {
|
|
9484
|
-
this.loggerService.
|
|
9638
|
+
this.loggerService.error(new TaggedError('Apple pay: script sdk loading error', [ErrorTags.APPLEPAY],
|
|
9485
9639
|
// @ts-expect-error error type
|
|
9486
|
-
{ error: error?.message ? error.toString() : JSON.stringify(error) });
|
|
9640
|
+
{ error: error?.message ? error.toString() : JSON.stringify(error) }));
|
|
9487
9641
|
console.error('Apple pay: script sdk loading error', error);
|
|
9488
9642
|
};
|
|
9489
9643
|
}
|
|
@@ -9498,7 +9652,7 @@ class ApplePaySdkService {
|
|
|
9498
9652
|
const scriptsElements = this.window.document.querySelectorAll('script');
|
|
9499
9653
|
return Array.from(scriptsElements).some((element) => element.src === this.jsSdk);
|
|
9500
9654
|
}
|
|
9501
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: ApplePaySdkService, deps: [{ token: windowToken }, { token:
|
|
9655
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: ApplePaySdkService, deps: [{ token: windowToken }, { token: LoggerService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
9502
9656
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: ApplePaySdkService, providedIn: 'root' }); }
|
|
9503
9657
|
}
|
|
9504
9658
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: ApplePaySdkService, decorators: [{
|
|
@@ -9509,7 +9663,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImpor
|
|
|
9509
9663
|
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
9510
9664
|
type: Inject,
|
|
9511
9665
|
args: [windowToken]
|
|
9512
|
-
}] }, { type:
|
|
9666
|
+
}] }, { type: LoggerService }] });
|
|
9513
9667
|
|
|
9514
9668
|
class SocketBridgeService {
|
|
9515
9669
|
constructor(secureApiClient) {
|
|
@@ -9645,13 +9799,13 @@ class ApplePayService {
|
|
|
9645
9799
|
.getWindowReturnMessage$()
|
|
9646
9800
|
.pipe(takeUntil(this.destroy$));
|
|
9647
9801
|
}
|
|
9648
|
-
constructor(window, summaryFinanceDetailsAdapterService, braintreeHandler, checkoutHandler, appleParamsBuilder,
|
|
9802
|
+
constructor(window, summaryFinanceDetailsAdapterService, braintreeHandler, checkoutHandler, appleParamsBuilder, loggerService, applePaySdkService, externalWindowCommunicationService, settingsService) {
|
|
9649
9803
|
this.window = window;
|
|
9650
9804
|
this.summaryFinanceDetailsAdapterService = summaryFinanceDetailsAdapterService;
|
|
9651
9805
|
this.braintreeHandler = braintreeHandler;
|
|
9652
9806
|
this.checkoutHandler = checkoutHandler;
|
|
9653
9807
|
this.appleParamsBuilder = appleParamsBuilder;
|
|
9654
|
-
this.
|
|
9808
|
+
this.loggerService = loggerService;
|
|
9655
9809
|
this.applePaySdkService = applePaySdkService;
|
|
9656
9810
|
this.externalWindowCommunicationService = externalWindowCommunicationService;
|
|
9657
9811
|
this.settingsService = settingsService;
|
|
@@ -9698,9 +9852,9 @@ class ApplePayService {
|
|
|
9698
9852
|
}
|
|
9699
9853
|
catch (error) {
|
|
9700
9854
|
console.error(ApplePayErrors.braintreeInitializeError, error);
|
|
9701
|
-
this.
|
|
9855
|
+
this.loggerService.error(new TaggedError(ApplePayErrors.braintreeInitializeError, [
|
|
9702
9856
|
ErrorTags.APPLEPAY,
|
|
9703
|
-
]);
|
|
9857
|
+
]));
|
|
9704
9858
|
}
|
|
9705
9859
|
if (!this.paymentClient || !this.isDeviceCapable) {
|
|
9706
9860
|
this.emitError(ApplePayErrors.deviceIsNotCapableError);
|
|
@@ -9838,7 +9992,7 @@ class ApplePayService {
|
|
|
9838
9992
|
this.applePayQrOpened.next();
|
|
9839
9993
|
}
|
|
9840
9994
|
}
|
|
9841
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: ApplePayService, deps: [{ token: windowToken }, { token: SummaryFinanceDetailsAdapterService }, { token: BraintreeHandler }, { token: CheckoutHandler }, { token: ApplePayParamsBuilderService }, { token:
|
|
9995
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: ApplePayService, deps: [{ token: windowToken }, { token: SummaryFinanceDetailsAdapterService }, { token: BraintreeHandler }, { token: CheckoutHandler }, { token: ApplePayParamsBuilderService }, { token: LoggerService }, { token: ApplePaySdkService }, { token: ApplePayExternalWindowCommunicationService }, { token: SettingsService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
9842
9996
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: ApplePayService, providedIn: 'root' }); }
|
|
9843
9997
|
}
|
|
9844
9998
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: ApplePayService, decorators: [{
|
|
@@ -9849,7 +10003,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImpor
|
|
|
9849
10003
|
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
9850
10004
|
type: Inject,
|
|
9851
10005
|
args: [windowToken]
|
|
9852
|
-
}] }, { type: SummaryFinanceDetailsAdapterService }, { type: BraintreeHandler }, { type: CheckoutHandler }, { type: ApplePayParamsBuilderService }, { type:
|
|
10006
|
+
}] }, { type: SummaryFinanceDetailsAdapterService }, { type: BraintreeHandler }, { type: CheckoutHandler }, { type: ApplePayParamsBuilderService }, { type: LoggerService }, { type: ApplePaySdkService }, { type: ApplePayExternalWindowCommunicationService }, { type: SettingsService }] });
|
|
9853
10007
|
|
|
9854
10008
|
/*
|
|
9855
10009
|
* Public API Surface of core-library
|
|
@@ -9859,5 +10013,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImpor
|
|
|
9859
10013
|
* Generated bundle index. Do not edit.
|
|
9860
10014
|
*/
|
|
9861
10015
|
|
|
9862
|
-
export { ApplePayCartService, ApplePayService, CoreLibraryModule, CoreLibraryService, CreditCardTypes, FieldNames, GooglePayService, PaymentSystemProcessingService, userBehaviourEventTypes };
|
|
10016
|
+
export { ApplePayCartService, ApplePayService, CoreLibraryModule, CoreLibraryService, CreditCardTypes, ErrorTags, FieldNames, GooglePayService, PaymentSystemProcessingService, TaggedError, userBehaviourEventTypes };
|
|
9863
10017
|
//# sourceMappingURL=xsolla-payment-client-core.mjs.map
|