@xsolla/payment-client-core 0.2.9 → 0.2.10

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.
Files changed (25) hide show
  1. package/esm2020/lib/core/payment/actions/next-action.interface.mjs +1 -1
  2. package/esm2020/lib/core/payment/actions/next-actions.mjs +3 -1
  3. package/esm2020/lib/core/payment/actions/show-mobile-payment-screen/show-mobile-payment-screen.action.class.mjs +26 -0
  4. package/esm2020/lib/core/payment/actions/show-mobile-payment-screen/show-mobile-payment-screen.action.type.mjs +2 -0
  5. package/esm2020/lib/core/payment/actions/show-qr-code/show-qr-code.action.class.mjs +6 -3
  6. package/esm2020/lib/core/payment/actions/show-qr-code/show-qr-code.action.type.mjs +1 -1
  7. package/esm2020/lib/core/payment/payment.interface.mjs +1 -1
  8. package/esm2020/lib/core/payment/payment.service.mjs +18 -6
  9. package/esm2020/lib/core/payment/status/status.service.mjs +4 -1
  10. package/esm2020/lib/core-library.service.mjs +2 -1
  11. package/fesm2015/xsolla-payment-client-core.mjs +50 -6
  12. package/fesm2015/xsolla-payment-client-core.mjs.map +1 -1
  13. package/fesm2020/xsolla-payment-client-core.mjs +48 -6
  14. package/fesm2020/xsolla-payment-client-core.mjs.map +1 -1
  15. package/lib/core/payment/actions/next-action.interface.d.ts +2 -1
  16. package/lib/core/payment/actions/show-mobile-payment-screen/show-mobile-payment-screen.action.class.d.ts +11 -0
  17. package/lib/core/payment/actions/show-mobile-payment-screen/show-mobile-payment-screen.action.type.d.ts +6 -0
  18. package/lib/core/payment/actions/show-qr-code/show-qr-code.action.class.d.ts +1 -1
  19. package/lib/core/payment/actions/show-qr-code/show-qr-code.action.type.d.ts +4 -1
  20. package/lib/core/payment/payment.interface.d.ts +1 -0
  21. package/lib/core/payment/payment.service.d.ts +4 -1
  22. package/lib/core/payment/status/status.service.d.ts +3 -0
  23. package/package.json +1 -1
  24. package/xsolla-payment-client-core-0.2.10.tgz +0 -0
  25. package/xsolla-payment-client-core-0.2.9.tgz +0 -0
@@ -1108,10 +1108,13 @@ class ShowQrCodeActionCreator {
1108
1108
  constructor() {
1109
1109
  this.type = 'show_qr_code';
1110
1110
  }
1111
- getActionData() {
1111
+ getActionData(response) {
1112
+ const submitButtonText = response.parameters.buyData.value;
1112
1113
  return {
1113
1114
  type: this.type,
1114
- data: null,
1115
+ data: {
1116
+ submitButtonText,
1117
+ },
1115
1118
  };
1116
1119
  }
1117
1120
  isSuitable(response) {
@@ -1124,6 +1127,29 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImpor
1124
1127
  type: Injectable
1125
1128
  }] });
1126
1129
 
1130
+ class ShowMobilePaymentScreenActionCreator {
1131
+ constructor() {
1132
+ this.type = 'show_mobile_payment_screen';
1133
+ }
1134
+ getActionData(response) {
1135
+ const submitButtonText = response.parameters.buyData.value;
1136
+ return {
1137
+ type: this.type,
1138
+ data: {
1139
+ submitButtonText,
1140
+ },
1141
+ };
1142
+ }
1143
+ isSuitable(response) {
1144
+ return response.currentCommand === XpsCommand.create;
1145
+ }
1146
+ }
1147
+ ShowMobilePaymentScreenActionCreator.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: ShowMobilePaymentScreenActionCreator, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1148
+ ShowMobilePaymentScreenActionCreator.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: ShowMobilePaymentScreenActionCreator });
1149
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: ShowMobilePaymentScreenActionCreator, decorators: [{
1150
+ type: Injectable
1151
+ }] });
1152
+
1127
1153
  const nextActionsToken = new InjectionToken('Action');
1128
1154
  const nextActions = [
1129
1155
  ShowFieldsActionCreator,
@@ -1131,6 +1157,7 @@ const nextActions = [
1131
1157
  SpecialButtonActionCreator,
1132
1158
  ShowQrCodeActionCreator,
1133
1159
  RedirectActionCreator,
1160
+ ShowMobilePaymentScreenActionCreator,
1134
1161
  ];
1135
1162
  const flowUpdateNextActions = [
1136
1163
  ShowErrorsActionCreator,
@@ -4920,6 +4947,9 @@ class StatusService {
4920
4947
  }
4921
4948
  return this.getStatus(searchParams);
4922
4949
  }
4950
+ listenFinalStatus(invoice) {
4951
+ return this.listenStatusService.listen(invoice);
4952
+ }
4923
4953
  getRequestParamsFromUrl(url) {
4924
4954
  const searchParams = this.urlService.getSearchParams(url ?? '');
4925
4955
  const keys = new Set(Object.keys(searchParams));
@@ -5412,7 +5442,7 @@ class PaymentService {
5412
5442
  get formResponseValue() {
5413
5443
  return this._formResponse$.getValue();
5414
5444
  }
5415
- constructor(initializeService, submitService, syncService, formService, statusService, financeDetailsService, creditCardStateService, nextActionService, controlConfigService, threeDsService, formMessagesService, settingsService, countryService) {
5445
+ constructor(initializeService, submitService, syncService, formService, statusService, financeDetailsService, creditCardStateService, nextActionService, controlConfigService, threeDsService, formMessagesService, settingsService, countryService, checkStatusActionCreator) {
5416
5446
  this.initializeService = initializeService;
5417
5447
  this.submitService = submitService;
5418
5448
  this.syncService = syncService;
@@ -5426,6 +5456,7 @@ class PaymentService {
5426
5456
  this.formMessagesService = formMessagesService;
5427
5457
  this.settingsService = settingsService;
5428
5458
  this.countryService = countryService;
5459
+ this.checkStatusActionCreator = checkStatusActionCreator;
5429
5460
  this.form = null;
5430
5461
  this.data = null;
5431
5462
  this.financeDetails = null;
@@ -5473,7 +5504,8 @@ class PaymentService {
5473
5504
  }
5474
5505
  this.emitFormMessages(submitResponse.messages);
5475
5506
  // Handle 3ds flow
5476
- if (submitResponse.currentCommand === XpsCommand.create) {
5507
+ if (submitResponse.currentCommand === XpsCommand.create &&
5508
+ submitResponse.parameters.threeDSForm) {
5477
5509
  this.runThreeDs();
5478
5510
  return;
5479
5511
  }
@@ -5552,6 +5584,15 @@ class PaymentService {
5552
5584
  };
5553
5585
  return this.statusService.getStatus(params);
5554
5586
  }
5587
+ async listenFinalStatus() {
5588
+ const { invoice } = await this.getStatus();
5589
+ this.statusService
5590
+ .listenFinalStatus(invoice)
5591
+ .pipe(take(1))
5592
+ .subscribe(() => {
5593
+ this.nextActionService.emitFlowUpdates(this.checkStatusActionCreator.getActionData());
5594
+ });
5595
+ }
5555
5596
  getFieldConfig(field) {
5556
5597
  return this.controlConfigService.getConfig(field);
5557
5598
  }
@@ -5688,14 +5729,14 @@ class PaymentService {
5688
5729
  this._formResponse$.next({ type, data, token: this.settingsService.token });
5689
5730
  }
5690
5731
  }
5691
- 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 }, { token: SettingsService }, { token: CountryService }], target: i0.ɵɵFactoryTarget.Injectable });
5732
+ 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 }, { token: SettingsService }, { token: CountryService }, { token: CheckStatusActionCreator }], target: i0.ɵɵFactoryTarget.Injectable });
5692
5733
  PaymentService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: PaymentService, providedIn: 'root' });
5693
5734
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: PaymentService, decorators: [{
5694
5735
  type: Injectable,
5695
5736
  args: [{
5696
5737
  providedIn: 'root',
5697
5738
  }]
5698
- }], 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 }, { type: SettingsService }, { type: CountryService }]; } });
5739
+ }], 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 }, { type: SettingsService }, { type: CountryService }, { type: CheckStatusActionCreator }]; } });
5699
5740
 
5700
5741
  class RefundPolicyService {
5701
5742
  constructor(settingsService) {
@@ -6157,6 +6198,7 @@ class CoreLibraryService {
6157
6198
  getFinanceDetails: () => this.paymentService.getFinanceDetails(),
6158
6199
  runThreeDs: () => this.paymentService.runThreeDs(),
6159
6200
  getStatus: async () => this.paymentService.getStatus(),
6201
+ listenFinalStatus: async () => this.paymentService.listenFinalStatus(),
6160
6202
  financeDetailsUpdates$: this.financeDetailsService.data$,
6161
6203
  form: {
6162
6204
  fieldsStatus$: this.paymentService.formFieldsStatus$,