@xsolla/payment-client-core 0.1.12-test → 0.1.12-test2

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.
@@ -394,9 +394,6 @@ class UserBalanceService {
394
394
  // @ts-expect-error the map already has the cache with key
395
395
  return this.cache.get(cacheKey);
396
396
  }
397
- getUserBalanceValue() {
398
- return this.settingsService.user.user_balance;
399
- }
400
397
  }
401
398
  UserBalanceService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: UserBalanceService, deps: [{ token: userBalanceResponseFactoryToken }, { token: SettingsService }, { token: SecureApiClient }], target: i0.ɵɵFactoryTarget.Injectable });
402
399
  UserBalanceService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: UserBalanceService, providedIn: 'root' });
@@ -5023,11 +5020,29 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImpor
5023
5020
  }]
5024
5021
  }], ctorParameters: function () { return [{ type: ThreeDs20Service }, { type: NextActionService }]; } });
5025
5022
 
5023
+ class FormMessagesService extends EmitDataService {
5024
+ emitOnResponse(messages) {
5025
+ if (!messages) {
5026
+ return;
5027
+ }
5028
+ const mapInfoMessages = (infoMessage) => infoMessage.message;
5029
+ super.emit(messages.map(mapInfoMessages));
5030
+ }
5031
+ }
5032
+ FormMessagesService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: FormMessagesService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
5033
+ FormMessagesService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: FormMessagesService, providedIn: 'root' });
5034
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: FormMessagesService, decorators: [{
5035
+ type: Injectable,
5036
+ args: [{
5037
+ providedIn: 'root',
5038
+ }]
5039
+ }] });
5040
+
5026
5041
  class PaymentService {
5027
5042
  get formFieldsStatus$() {
5028
5043
  return this.formFieldsStatusSubject.asObservable().pipe(filter$1(Boolean));
5029
5044
  }
5030
- constructor(initializeService, submitService, syncService, formService, statusService, financeDetailsService, creditCardStateService, nextActionService, controlConfigService, threeDsService) {
5045
+ constructor(initializeService, submitService, syncService, formService, statusService, financeDetailsService, creditCardStateService, nextActionService, controlConfigService, threeDsService, formMessagesService) {
5031
5046
  this.initializeService = initializeService;
5032
5047
  this.submitService = submitService;
5033
5048
  this.syncService = syncService;
@@ -5038,6 +5053,7 @@ class PaymentService {
5038
5053
  this.nextActionService = nextActionService;
5039
5054
  this.controlConfigService = controlConfigService;
5040
5055
  this.threeDsService = threeDsService;
5056
+ this.formMessagesService = formMessagesService;
5041
5057
  this.form = null;
5042
5058
  this.data = null;
5043
5059
  this.financeDetails = null;
@@ -5059,6 +5075,7 @@ class PaymentService {
5059
5075
  this.listenFormStatusChanges(this.form);
5060
5076
  this.emitFinanceDetails(this.data.paymentForm?.summary);
5061
5077
  this.emitFormFieldsStatus(this.form);
5078
+ this.emitFormMessages(this.data.paymentForm?.messages);
5062
5079
  return this.fields.filter((field) => field?.isVisible === "1" /* XpsBoolean.true */);
5063
5080
  }
5064
5081
  async submit() {
@@ -5073,6 +5090,7 @@ class PaymentService {
5073
5090
  const submitResponse = await this.submitService.request(this.fields, this.form);
5074
5091
  this.data = submitResponse;
5075
5092
  this.emitFinanceDetails(submitResponse.summary);
5093
+ this.emitFormMessages(submitResponse.messages);
5076
5094
  // Handle 3ds flow
5077
5095
  if (submitResponse.currentCommand === XpsCommand.create) {
5078
5096
  this.runThreeDs();
@@ -5178,12 +5196,16 @@ class PaymentService {
5178
5196
  });
5179
5197
  this.formFieldsStatusSubject.next(formFieldsStatus);
5180
5198
  }
5199
+ emitFormMessages(messages) {
5200
+ this.formMessagesService.emitOnResponse(messages);
5201
+ }
5181
5202
  setupSyncService(form, fields) {
5182
5203
  this.syncService.setup(form, fields);
5183
5204
  this.syncService.data$
5184
5205
  .pipe(takeUntil(this.destroy$))
5185
5206
  .subscribe((response) => {
5186
5207
  this.emitFinanceDetails(response.summary);
5208
+ this.emitFormMessages(response.messages);
5187
5209
  });
5188
5210
  this.syncService.fieldAsyncValidation$
5189
5211
  .pipe(takeUntil(this.destroy$))
@@ -5205,14 +5227,14 @@ class PaymentService {
5205
5227
  .subscribe(() => this.emitFormFieldsStatus(form));
5206
5228
  }
5207
5229
  }
5208
- PaymentService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: PaymentService, deps: [{ token: InitializeService }, { token: SubmitService }, { token: SyncService }, { token: FormService }, { token: StatusService }, { token: FinanceDetailsService }, { token: CreditCardStateService }, { token: NextActionService }, { token: ControlConfigService }, { token: ThreeDsService }], target: i0.ɵɵFactoryTarget.Injectable });
5230
+ PaymentService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: PaymentService, deps: [{ token: InitializeService }, { token: SubmitService }, { token: SyncService }, { token: FormService }, { token: StatusService }, { token: FinanceDetailsService }, { token: CreditCardStateService }, { token: NextActionService }, { token: ControlConfigService }, { token: ThreeDsService }, { token: FormMessagesService }], target: i0.ɵɵFactoryTarget.Injectable });
5209
5231
  PaymentService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: PaymentService, providedIn: 'root' });
5210
5232
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: PaymentService, decorators: [{
5211
5233
  type: Injectable,
5212
5234
  args: [{
5213
5235
  providedIn: 'root',
5214
5236
  }]
5215
- }], ctorParameters: function () { return [{ type: InitializeService }, { type: SubmitService }, { type: SyncService }, { type: FormService }, { type: StatusService }, { type: FinanceDetailsService }, { type: CreditCardStateService }, { type: NextActionService }, { type: ControlConfigService }, { type: ThreeDsService }]; } });
5237
+ }], ctorParameters: function () { return [{ type: InitializeService }, { type: SubmitService }, { type: SyncService }, { type: FormService }, { type: StatusService }, { type: FinanceDetailsService }, { type: CreditCardStateService }, { type: NextActionService }, { type: ControlConfigService }, { type: ThreeDsService }, { type: FormMessagesService }]; } });
5216
5238
 
5217
5239
  class RefundPolicyService {
5218
5240
  constructor(settingsService) {
@@ -5317,7 +5339,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImpor
5317
5339
  }], ctorParameters: function () { return [{ type: SettingsService }, { type: RefundPolicyService }, { type: SecureConnectionService }, { type: DisclaimerService }]; } });
5318
5340
 
5319
5341
  class CoreLibraryService {
5320
- constructor(settingsService, countryService, paymentMethodsService, savedMethodsService, userBalanceService, paymentConfigService, paymentService, deviceFingerPrintService, financeDetailsService, legalService, statusService, nextActionService, creditCardService, creditCardStateService) {
5342
+ constructor(settingsService, countryService, paymentMethodsService, savedMethodsService, userBalanceService, paymentConfigService, paymentService, deviceFingerPrintService, financeDetailsService, legalService, statusService, nextActionService, creditCardService, creditCardStateService, formMessagesService) {
5321
5343
  this.settingsService = settingsService;
5322
5344
  this.countryService = countryService;
5323
5345
  this.paymentMethodsService = paymentMethodsService;
@@ -5332,6 +5354,7 @@ class CoreLibraryService {
5332
5354
  this.nextActionService = nextActionService;
5333
5355
  this.creditCardService = creditCardService;
5334
5356
  this.creditCardStateService = creditCardStateService;
5357
+ this.formMessagesService = formMessagesService;
5335
5358
  this.paymentMethods = {
5336
5359
  getList: async () => this.paymentMethodsService.getList(),
5337
5360
  getQuickMethods: async () => this.paymentMethodsService.getQuickMethods(),
@@ -5369,6 +5392,7 @@ class CoreLibraryService {
5369
5392
  changeFieldValue: (name, value) => this.paymentService.changeFieldValue(name, value),
5370
5393
  changeFieldState: (name, state) => this.paymentService.changeFieldState(name, state),
5371
5394
  updateFieldFormState: (fieldName, formState) => this.paymentService.updateFieldFormState(fieldName, formState),
5395
+ formMessages$: this.formMessagesService.data$,
5372
5396
  },
5373
5397
  };
5374
5398
  }
@@ -5395,18 +5419,15 @@ class CoreLibraryService {
5395
5419
  const sanitizedName = field.name.replace(/^fix_/i, '');
5396
5420
  return masksFunctionsMap[sanitizedName];
5397
5421
  }
5398
- getUserBalanceValue() {
5399
- return this.userBalanceService.getUserBalanceValue();
5400
- }
5401
5422
  }
5402
- CoreLibraryService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: CoreLibraryService, deps: [{ token: SettingsService }, { token: CountryService }, { token: PaymentMethodsService }, { token: SavedMethodsService }, { token: UserBalanceService }, { token: PaymentConfigService }, { token: PaymentService }, { token: DeviceFingerPrintService }, { token: FinanceDetailsService }, { token: LegalService }, { token: StatusService }, { token: NextActionService }, { token: CreditCardService }, { token: CreditCardStateService }], target: i0.ɵɵFactoryTarget.Injectable });
5423
+ CoreLibraryService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: CoreLibraryService, deps: [{ token: SettingsService }, { token: CountryService }, { token: PaymentMethodsService }, { token: SavedMethodsService }, { token: UserBalanceService }, { token: PaymentConfigService }, { token: PaymentService }, { token: DeviceFingerPrintService }, { token: FinanceDetailsService }, { token: LegalService }, { token: StatusService }, { token: NextActionService }, { token: CreditCardService }, { token: CreditCardStateService }, { token: FormMessagesService }], target: i0.ɵɵFactoryTarget.Injectable });
5403
5424
  CoreLibraryService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: CoreLibraryService, providedIn: 'root' });
5404
5425
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: CoreLibraryService, decorators: [{
5405
5426
  type: Injectable,
5406
5427
  args: [{
5407
5428
  providedIn: 'root',
5408
5429
  }]
5409
- }], ctorParameters: function () { return [{ type: SettingsService }, { type: CountryService }, { type: PaymentMethodsService }, { type: SavedMethodsService }, { type: UserBalanceService }, { type: PaymentConfigService }, { type: PaymentService }, { type: DeviceFingerPrintService }, { type: FinanceDetailsService }, { type: LegalService }, { type: StatusService }, { type: NextActionService }, { type: CreditCardService }, { type: CreditCardStateService }]; } });
5430
+ }], ctorParameters: function () { return [{ type: SettingsService }, { type: CountryService }, { type: PaymentMethodsService }, { type: SavedMethodsService }, { type: UserBalanceService }, { type: PaymentConfigService }, { type: PaymentService }, { type: DeviceFingerPrintService }, { type: FinanceDetailsService }, { type: LegalService }, { type: StatusService }, { type: NextActionService }, { type: CreditCardService }, { type: CreditCardStateService }, { type: FormMessagesService }]; } });
5410
5431
 
5411
5432
  class HttpError extends AppError {
5412
5433
  constructor(error, req) {