@xsolla/payment-client-core 0.2.0 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,12 +1,12 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { InjectionToken, Injectable, Inject, Pipe, isDevMode, NgModule } from '@angular/core';
3
3
  import { firstValueFrom, lastValueFrom, map, Subject, BehaviorSubject, filter as filter$1, takeUntil, skip, take, throwError } from 'rxjs';
4
- import * as i1 from '@angular/common/http';
4
+ import * as i2 from '@angular/common/http';
5
5
  import { HttpParams, HttpHeaders, HttpClientModule, HTTP_INTERCEPTORS } from '@angular/common/http';
6
6
  import JSEncrypt from 'jsencrypt';
7
7
  import { UntypedFormGroup, Validators, UntypedFormControl, ReactiveFormsModule } from '@angular/forms';
8
8
  import { filter, map as map$1, tap, catchError } from 'rxjs/operators';
9
- import * as i1$1 from '@angular/router';
9
+ import * as i1 from '@angular/router';
10
10
  import { CommonModule } from '@angular/common';
11
11
 
12
12
  const masksFunctionsMap = {
@@ -71,14 +71,14 @@ class SecureApiClient {
71
71
  return this.isSandboxMode ? sandboxApiUrl : defaultApiUrl;
72
72
  }
73
73
  }
74
- SecureApiClient.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: SecureApiClient, deps: [{ token: i1.HttpClient }, { token: windowToken }], target: i0.ɵɵFactoryTarget.Injectable });
74
+ SecureApiClient.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: SecureApiClient, deps: [{ token: i2.HttpClient }, { token: windowToken }], target: i0.ɵɵFactoryTarget.Injectable });
75
75
  SecureApiClient.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: SecureApiClient, providedIn: 'root' });
76
76
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: SecureApiClient, decorators: [{
77
77
  type: Injectable,
78
78
  args: [{
79
79
  providedIn: 'root',
80
80
  }]
81
- }], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: undefined, decorators: [{
81
+ }], ctorParameters: function () { return [{ type: i2.HttpClient }, { type: undefined, decorators: [{
82
82
  type: Inject,
83
83
  args: [windowToken]
84
84
  }] }]; } });
@@ -4294,7 +4294,7 @@ class ElkLoggerService {
4294
4294
  })).catch((err) => console.error('Elk Logger: request error', err));
4295
4295
  }
4296
4296
  }
4297
- ElkLoggerService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: ElkLoggerService, deps: [{ token: windowToken }, { token: SettingsService }, { token: i1.HttpClient }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Injectable });
4297
+ ElkLoggerService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: ElkLoggerService, deps: [{ token: windowToken }, { token: SettingsService }, { token: i2.HttpClient }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Injectable });
4298
4298
  ElkLoggerService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: ElkLoggerService, providedIn: 'root' });
4299
4299
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: ElkLoggerService, decorators: [{
4300
4300
  type: Injectable,
@@ -4304,7 +4304,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImpor
4304
4304
  }], ctorParameters: function () { return [{ type: undefined, decorators: [{
4305
4305
  type: Inject,
4306
4306
  args: [windowToken]
4307
- }] }, { type: SettingsService }, { type: i1.HttpClient }, { type: i0.NgZone }]; } });
4307
+ }] }, { type: SettingsService }, { type: i2.HttpClient }, { type: i0.NgZone }]; } });
4308
4308
 
4309
4309
  class CentrifugoWebSocketService {
4310
4310
  constructor(elkLoggerService) {
@@ -5830,9 +5830,8 @@ class GooglePayService {
5830
5830
  get googlePaymentClientWasInitialized() {
5831
5831
  return !!this.googlePaymentClient;
5832
5832
  }
5833
- constructor(window, elkLoggerService, commonPayProcessingService, httpClient, injector) {
5833
+ constructor(window, commonPayProcessingService, httpClient, injector) {
5834
5834
  this.window = window;
5835
- this.elkLoggerService = elkLoggerService;
5836
5835
  this.commonPayProcessingService = commonPayProcessingService;
5837
5836
  this.httpClient = httpClient;
5838
5837
  this.injector = injector;
@@ -5841,6 +5840,7 @@ class GooglePayService {
5841
5840
  this.checkout = null;
5842
5841
  this.googlePaymentClient = null;
5843
5842
  this.commonPayProcessingService.status$.subscribe((path) => {
5843
+ console.log('sendUserBack', path);
5844
5844
  this.sendUserBack(path);
5845
5845
  });
5846
5846
  }
@@ -5864,9 +5864,6 @@ class GooglePayService {
5864
5864
  return;
5865
5865
  }
5866
5866
  this.commonPayProcessingService.loadScript(this.googlePayScriptUrl, this.onLoadScript.bind(this));
5867
- this.elkLoggerService.log('Google Pay: loading script is starting', [
5868
- ErrorTags.GOOGLEPAY,
5869
- ]);
5870
5867
  }
5871
5868
  checkPaymentDevice(base64checkoutData) {
5872
5869
  this.commonPayProcessingService.initialize$
@@ -5889,12 +5886,7 @@ class GooglePayService {
5889
5886
  this.readyToPay.next(false);
5890
5887
  const result = response.result?.toString() ?? '';
5891
5888
  const isHavePaymentClient = Boolean(this.googlePaymentClient).toString();
5892
- this.elkLoggerService.log(`Google Pay: possibly no response.result or googlePaymentClient is missing, result - ${result}, isHavePaymentClient - ${isHavePaymentClient}`, [ErrorTags.GOOGLEPAY], {
5893
- result: response.result,
5894
- response: response,
5895
- googlePaymentClient: !!this.googlePaymentClient,
5896
- });
5897
- throw new Error();
5889
+ throw new Error(`Google Pay: possibly no response.result or googlePaymentClient is missing, result - ${result}, isHavePaymentClient - ${isHavePaymentClient}`);
5898
5890
  })
5899
5891
  .catch((error) => {
5900
5892
  this.readyToPay.next(false);
@@ -5925,6 +5917,7 @@ class GooglePayService {
5925
5917
  .getActionData();
5926
5918
  try {
5927
5919
  const paymentData = await this.googlePaymentClient.loadPaymentData(paymentDataRequest);
5920
+ console.log('paymentData', paymentData);
5928
5921
  if (!paymentData?.paymentMethodData?.tokenizationData?.token) {
5929
5922
  throw new AppError('Google Pay: token is missing');
5930
5923
  }
@@ -5935,12 +5928,11 @@ class GooglePayService {
5935
5928
  const data = this.checkout.request.form.fields;
5936
5929
  returnUrl += `&cpf_number=${data.cpf_number}&descriptor=${data.descriptor}&paymentData=${JSON.stringify(paymentData)}`;
5937
5930
  this.commonPayProcessingService.emitPayment(returnUrl);
5931
+ console.log('return successcheckStatusAction', returnUrl);
5938
5932
  return checkStatusAction;
5939
5933
  }
5940
5934
  catch (error) {
5941
- this.elkLoggerService.log(`Google Pay: google payment window error. ${JSON.stringify(error)}`, [ErrorTags.GOOGLEPAY], {
5942
- error: error,
5943
- });
5935
+ console.log('error', error);
5944
5936
  if (!this.checkout) {
5945
5937
  throw new AppError(`Google Pay: no checkout data`);
5946
5938
  }
@@ -5952,6 +5944,7 @@ class GooglePayService {
5952
5944
  }
5953
5945
  const returnUrl = this.checkout.request.form.fields.returnFailUrl;
5954
5946
  this.commonPayProcessingService.emitPayment(returnUrl);
5947
+ console.log('return failcheckStatusAction', returnUrl);
5955
5948
  return checkStatusAction;
5956
5949
  }
5957
5950
  }
@@ -5978,19 +5971,13 @@ class GooglePayService {
5978
5971
  new this.window.google.payments.api.PaymentsClient({
5979
5972
  environment,
5980
5973
  });
5981
- this.elkLoggerService.log(`Google Pay: payments client is initialized, paymentsClient - ${Boolean(this.googlePaymentClient).toString()}`, [ErrorTags.GOOGLEPAY], { environment: environment, initialized: !!this.googlePaymentClient });
5982
5974
  }
5983
5975
  onLoadScript() {
5984
5976
  if (!this.window.google) {
5985
5977
  const retryTimeout = 1000;
5986
5978
  setTimeout(() => {
5987
5979
  const isAvailableGoogleClient = !!this.window.google;
5988
- if (!isAvailableGoogleClient) {
5989
- this.elkLoggerService.log('Google Pay: google library is missing', [
5990
- ErrorTags.GOOGLEPAY,
5991
- ]);
5992
- }
5993
- else {
5980
+ if (isAvailableGoogleClient) {
5994
5981
  this.setupGooglePayClient();
5995
5982
  this.commonPayProcessingService.emitInitialize(true);
5996
5983
  }
@@ -6006,7 +5993,7 @@ class GooglePayService {
6006
5993
  return statusCode.toLowerCase() === 'canceled';
6007
5994
  }
6008
5995
  }
6009
- GooglePayService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: GooglePayService, deps: [{ token: windowToken }, { token: ElkLoggerService }, { token: PaymentSystemProcessingService }, { token: i1.HttpClient }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable });
5996
+ GooglePayService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: GooglePayService, deps: [{ token: windowToken }, { token: PaymentSystemProcessingService }, { token: i2.HttpClient }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable });
6010
5997
  GooglePayService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: GooglePayService, providedIn: 'root' });
6011
5998
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: GooglePayService, decorators: [{
6012
5999
  type: Injectable,
@@ -6016,7 +6003,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImpor
6016
6003
  }], ctorParameters: function () { return [{ type: undefined, decorators: [{
6017
6004
  type: Inject,
6018
6005
  args: [windowToken]
6019
- }] }, { type: ElkLoggerService }, { type: PaymentSystemProcessingService }, { type: i1.HttpClient }, { type: i0.Injector }]; } });
6006
+ }] }, { type: PaymentSystemProcessingService }, { type: i2.HttpClient }, { type: i0.Injector }]; } });
6020
6007
 
6021
6008
  class CoreLibraryService {
6022
6009
  constructor(settingsService, countryService, paymentMethodsService, savedMethodsService, userBalanceService, paymentConfigService, paymentService, deviceFingerPrintService, financeDetailsService, legalService, statusService, nextActionService, creditCardService, creditCardStateService, formMessagesService, editSavedMethodsService, googlePayService, commonPayProcessingService) {
@@ -6184,11 +6171,11 @@ class HttpExceptionsInterceptor {
6184
6171
  }));
6185
6172
  }
6186
6173
  }
6187
- HttpExceptionsInterceptor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: HttpExceptionsInterceptor, deps: [{ token: i1$1.Router }], target: i0.ɵɵFactoryTarget.Injectable });
6174
+ HttpExceptionsInterceptor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: HttpExceptionsInterceptor, deps: [{ token: i1.Router }], target: i0.ɵɵFactoryTarget.Injectable });
6188
6175
  HttpExceptionsInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: HttpExceptionsInterceptor });
6189
6176
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: HttpExceptionsInterceptor, decorators: [{
6190
6177
  type: Injectable
6191
- }], ctorParameters: function () { return [{ type: i1$1.Router }]; } });
6178
+ }], ctorParameters: function () { return [{ type: i1.Router }]; } });
6192
6179
 
6193
6180
  class ValidatorsModule {
6194
6181
  }