@xsolla/payment-client-core 0.1.11 → 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.
@@ -5020,11 +5020,29 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImpor
5020
5020
  }]
5021
5021
  }], ctorParameters: function () { return [{ type: ThreeDs20Service }, { type: NextActionService }]; } });
5022
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
+
5023
5041
  class PaymentService {
5024
5042
  get formFieldsStatus$() {
5025
5043
  return this.formFieldsStatusSubject.asObservable().pipe(filter$1(Boolean));
5026
5044
  }
5027
- constructor(initializeService, submitService, syncService, formService, statusService, financeDetailsService, creditCardStateService, nextActionService, controlConfigService, threeDsService) {
5045
+ constructor(initializeService, submitService, syncService, formService, statusService, financeDetailsService, creditCardStateService, nextActionService, controlConfigService, threeDsService, formMessagesService) {
5028
5046
  this.initializeService = initializeService;
5029
5047
  this.submitService = submitService;
5030
5048
  this.syncService = syncService;
@@ -5035,6 +5053,7 @@ class PaymentService {
5035
5053
  this.nextActionService = nextActionService;
5036
5054
  this.controlConfigService = controlConfigService;
5037
5055
  this.threeDsService = threeDsService;
5056
+ this.formMessagesService = formMessagesService;
5038
5057
  this.form = null;
5039
5058
  this.data = null;
5040
5059
  this.financeDetails = null;
@@ -5056,6 +5075,7 @@ class PaymentService {
5056
5075
  this.listenFormStatusChanges(this.form);
5057
5076
  this.emitFinanceDetails(this.data.paymentForm?.summary);
5058
5077
  this.emitFormFieldsStatus(this.form);
5078
+ this.emitFormMessages(this.data.paymentForm?.messages);
5059
5079
  return this.fields.filter((field) => field?.isVisible === "1" /* XpsBoolean.true */);
5060
5080
  }
5061
5081
  async submit() {
@@ -5070,6 +5090,7 @@ class PaymentService {
5070
5090
  const submitResponse = await this.submitService.request(this.fields, this.form);
5071
5091
  this.data = submitResponse;
5072
5092
  this.emitFinanceDetails(submitResponse.summary);
5093
+ this.emitFormMessages(submitResponse.messages);
5073
5094
  // Handle 3ds flow
5074
5095
  if (submitResponse.currentCommand === XpsCommand.create) {
5075
5096
  this.runThreeDs();
@@ -5077,6 +5098,7 @@ class PaymentService {
5077
5098
  }
5078
5099
  this.fields = this.getFields();
5079
5100
  this.form = this.formService.createForm(this.fields);
5101
+ this.syncService.setup(this.form, this.fields);
5080
5102
  return this.nextActionService.getNextAction(submitResponse);
5081
5103
  }
5082
5104
  getFields() {
@@ -5174,12 +5196,16 @@ class PaymentService {
5174
5196
  });
5175
5197
  this.formFieldsStatusSubject.next(formFieldsStatus);
5176
5198
  }
5199
+ emitFormMessages(messages) {
5200
+ this.formMessagesService.emitOnResponse(messages);
5201
+ }
5177
5202
  setupSyncService(form, fields) {
5178
5203
  this.syncService.setup(form, fields);
5179
5204
  this.syncService.data$
5180
5205
  .pipe(takeUntil(this.destroy$))
5181
5206
  .subscribe((response) => {
5182
5207
  this.emitFinanceDetails(response.summary);
5208
+ this.emitFormMessages(response.messages);
5183
5209
  });
5184
5210
  this.syncService.fieldAsyncValidation$
5185
5211
  .pipe(takeUntil(this.destroy$))
@@ -5201,14 +5227,14 @@ class PaymentService {
5201
5227
  .subscribe(() => this.emitFormFieldsStatus(form));
5202
5228
  }
5203
5229
  }
5204
- 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 });
5205
5231
  PaymentService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: PaymentService, providedIn: 'root' });
5206
5232
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: PaymentService, decorators: [{
5207
5233
  type: Injectable,
5208
5234
  args: [{
5209
5235
  providedIn: 'root',
5210
5236
  }]
5211
- }], 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 }]; } });
5212
5238
 
5213
5239
  class RefundPolicyService {
5214
5240
  constructor(settingsService) {
@@ -5313,7 +5339,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImpor
5313
5339
  }], ctorParameters: function () { return [{ type: SettingsService }, { type: RefundPolicyService }, { type: SecureConnectionService }, { type: DisclaimerService }]; } });
5314
5340
 
5315
5341
  class CoreLibraryService {
5316
- 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) {
5317
5343
  this.settingsService = settingsService;
5318
5344
  this.countryService = countryService;
5319
5345
  this.paymentMethodsService = paymentMethodsService;
@@ -5328,6 +5354,7 @@ class CoreLibraryService {
5328
5354
  this.nextActionService = nextActionService;
5329
5355
  this.creditCardService = creditCardService;
5330
5356
  this.creditCardStateService = creditCardStateService;
5357
+ this.formMessagesService = formMessagesService;
5331
5358
  this.paymentMethods = {
5332
5359
  getList: async () => this.paymentMethodsService.getList(),
5333
5360
  getQuickMethods: async () => this.paymentMethodsService.getQuickMethods(),
@@ -5365,6 +5392,7 @@ class CoreLibraryService {
5365
5392
  changeFieldValue: (name, value) => this.paymentService.changeFieldValue(name, value),
5366
5393
  changeFieldState: (name, state) => this.paymentService.changeFieldState(name, state),
5367
5394
  updateFieldFormState: (fieldName, formState) => this.paymentService.updateFieldFormState(fieldName, formState),
5395
+ formMessages$: this.formMessagesService.data$,
5368
5396
  },
5369
5397
  };
5370
5398
  }
@@ -5392,14 +5420,14 @@ class CoreLibraryService {
5392
5420
  return masksFunctionsMap[sanitizedName];
5393
5421
  }
5394
5422
  }
5395
- 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 });
5396
5424
  CoreLibraryService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: CoreLibraryService, providedIn: 'root' });
5397
5425
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: CoreLibraryService, decorators: [{
5398
5426
  type: Injectable,
5399
5427
  args: [{
5400
5428
  providedIn: 'root',
5401
5429
  }]
5402
- }], 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 }]; } });
5403
5431
 
5404
5432
  class HttpError extends AppError {
5405
5433
  constructor(error, req) {