@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
@@ -1138,10 +1138,13 @@ class ShowQrCodeActionCreator {
1138
1138
  constructor() {
1139
1139
  this.type = 'show_qr_code';
1140
1140
  }
1141
- getActionData() {
1141
+ getActionData(response) {
1142
+ const submitButtonText = response.parameters.buyData.value;
1142
1143
  return {
1143
1144
  type: this.type,
1144
- data: null,
1145
+ data: {
1146
+ submitButtonText,
1147
+ },
1145
1148
  };
1146
1149
  }
1147
1150
  isSuitable(response) {
@@ -1155,6 +1158,29 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImpor
1155
1158
  type: Injectable
1156
1159
  }] });
1157
1160
 
1161
+ class ShowMobilePaymentScreenActionCreator {
1162
+ constructor() {
1163
+ this.type = 'show_mobile_payment_screen';
1164
+ }
1165
+ getActionData(response) {
1166
+ const submitButtonText = response.parameters.buyData.value;
1167
+ return {
1168
+ type: this.type,
1169
+ data: {
1170
+ submitButtonText,
1171
+ },
1172
+ };
1173
+ }
1174
+ isSuitable(response) {
1175
+ return response.currentCommand === XpsCommand.create;
1176
+ }
1177
+ }
1178
+ ShowMobilePaymentScreenActionCreator.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: ShowMobilePaymentScreenActionCreator, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1179
+ ShowMobilePaymentScreenActionCreator.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: ShowMobilePaymentScreenActionCreator });
1180
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: ShowMobilePaymentScreenActionCreator, decorators: [{
1181
+ type: Injectable
1182
+ }] });
1183
+
1158
1184
  const nextActionsToken = new InjectionToken('Action');
1159
1185
  const nextActions = [
1160
1186
  ShowFieldsActionCreator,
@@ -1162,6 +1188,7 @@ const nextActions = [
1162
1188
  SpecialButtonActionCreator,
1163
1189
  ShowQrCodeActionCreator,
1164
1190
  RedirectActionCreator,
1191
+ ShowMobilePaymentScreenActionCreator,
1165
1192
  ];
1166
1193
  const flowUpdateNextActions = [
1167
1194
  ShowErrorsActionCreator,
@@ -5042,6 +5069,9 @@ class StatusService {
5042
5069
  return this.getStatus(searchParams);
5043
5070
  });
5044
5071
  }
5072
+ listenFinalStatus(invoice) {
5073
+ return this.listenStatusService.listen(invoice);
5074
+ }
5045
5075
  getRequestParamsFromUrl(url) {
5046
5076
  const searchParams = this.urlService.getSearchParams(url !== null && url !== void 0 ? url : '');
5047
5077
  const keys = new Set(Object.keys(searchParams));
@@ -5549,7 +5579,7 @@ class PaymentService {
5549
5579
  get formResponseValue() {
5550
5580
  return this._formResponse$.getValue();
5551
5581
  }
5552
- constructor(initializeService, submitService, syncService, formService, statusService, financeDetailsService, creditCardStateService, nextActionService, controlConfigService, threeDsService, formMessagesService, settingsService, countryService) {
5582
+ constructor(initializeService, submitService, syncService, formService, statusService, financeDetailsService, creditCardStateService, nextActionService, controlConfigService, threeDsService, formMessagesService, settingsService, countryService, checkStatusActionCreator) {
5553
5583
  this.initializeService = initializeService;
5554
5584
  this.submitService = submitService;
5555
5585
  this.syncService = syncService;
@@ -5563,6 +5593,7 @@ class PaymentService {
5563
5593
  this.formMessagesService = formMessagesService;
5564
5594
  this.settingsService = settingsService;
5565
5595
  this.countryService = countryService;
5596
+ this.checkStatusActionCreator = checkStatusActionCreator;
5566
5597
  this.form = null;
5567
5598
  this.data = null;
5568
5599
  this.financeDetails = null;
@@ -5614,7 +5645,8 @@ class PaymentService {
5614
5645
  }
5615
5646
  this.emitFormMessages(submitResponse.messages);
5616
5647
  // Handle 3ds flow
5617
- if (submitResponse.currentCommand === XpsCommand.create) {
5648
+ if (submitResponse.currentCommand === XpsCommand.create &&
5649
+ submitResponse.parameters.threeDSForm) {
5618
5650
  this.runThreeDs();
5619
5651
  return;
5620
5652
  }
@@ -5700,6 +5732,17 @@ class PaymentService {
5700
5732
  return this.statusService.getStatus(params);
5701
5733
  });
5702
5734
  }
5735
+ listenFinalStatus() {
5736
+ return __awaiter(this, void 0, void 0, function* () {
5737
+ const { invoice } = yield this.getStatus();
5738
+ this.statusService
5739
+ .listenFinalStatus(invoice)
5740
+ .pipe(take(1))
5741
+ .subscribe(() => {
5742
+ this.nextActionService.emitFlowUpdates(this.checkStatusActionCreator.getActionData());
5743
+ });
5744
+ });
5745
+ }
5703
5746
  getFieldConfig(field) {
5704
5747
  return this.controlConfigService.getConfig(field);
5705
5748
  }
@@ -5838,14 +5881,14 @@ class PaymentService {
5838
5881
  this._formResponse$.next({ type, data, token: this.settingsService.token });
5839
5882
  }
5840
5883
  }
5841
- 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 });
5884
+ 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 });
5842
5885
  PaymentService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: PaymentService, providedIn: 'root' });
5843
5886
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: PaymentService, decorators: [{
5844
5887
  type: Injectable,
5845
5888
  args: [{
5846
5889
  providedIn: 'root',
5847
5890
  }]
5848
- }], 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 }]; } });
5891
+ }], 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 }]; } });
5849
5892
 
5850
5893
  class RefundPolicyService {
5851
5894
  constructor(settingsService) {
@@ -6323,6 +6366,7 @@ class CoreLibraryService {
6323
6366
  getFinanceDetails: () => this.paymentService.getFinanceDetails(),
6324
6367
  runThreeDs: () => this.paymentService.runThreeDs(),
6325
6368
  getStatus: () => __awaiter(this, void 0, void 0, function* () { return this.paymentService.getStatus(); }),
6369
+ listenFinalStatus: () => __awaiter(this, void 0, void 0, function* () { return this.paymentService.listenFinalStatus(); }),
6326
6370
  financeDetailsUpdates$: this.financeDetailsService.data$,
6327
6371
  form: {
6328
6372
  fieldsStatus$: this.paymentService.formFieldsStatus$,