@xsolla/payment-client-core 0.2.26 → 0.2.28

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 (65) hide show
  1. package/esm2022/lib/core/cash-payment/cash-payment-pids.const.mjs +15 -0
  2. package/esm2022/lib/core/cash-payment/cash-payment.service.mjs +17 -0
  3. package/esm2022/lib/core/payment/actions/next-action.interface.mjs +1 -1
  4. package/esm2022/lib/core/payment/actions/next-actions.mjs +5 -1
  5. package/esm2022/lib/core/payment/actions/show-cash-payment-instruction/show-cash-payment-instruction.action.class.mjs +24 -0
  6. package/esm2022/lib/core/payment/actions/show-cash-payment-instruction/show-cash-payment-instruction.action.type.mjs +2 -0
  7. package/esm2022/lib/core/payment/actions/show-xsolla-number/show-xsolla-number.action.class.mjs +36 -0
  8. package/esm2022/lib/core/payment/actions/show-xsolla-number/show-xsolla-number.action.type.mjs +2 -0
  9. package/esm2022/lib/core/payment/cash-payment-data.interface.mjs +2 -0
  10. package/esm2022/lib/core/payment/payment.service.mjs +27 -4
  11. package/esm2022/lib/core/payment/submit/response/submit-response.class.mjs +5 -1
  12. package/esm2022/lib/core/payment/submit/response/xsolla-number.interface.mjs +2 -0
  13. package/esm2022/lib/core/xsolla-number/api/print-instruction/print-instruction.service.mjs +34 -0
  14. package/esm2022/lib/core/xsolla-number/api/print-instruction/request/print-instruction-request.class.mjs +9 -0
  15. package/esm2022/lib/core/xsolla-number/api/print-instruction/request/print-instruction-request.interface.mjs +2 -0
  16. package/esm2022/lib/core/xsolla-number/api/print-instruction/request/print-instruction-request.token.mjs +8 -0
  17. package/esm2022/lib/core/xsolla-number/api/send-instruction/request/send-instruction-request.class.mjs +19 -0
  18. package/esm2022/lib/core/xsolla-number/api/send-instruction/request/send-instruction-request.interface.mjs +2 -0
  19. package/esm2022/lib/core/xsolla-number/api/send-instruction/request/send-instruction-request.token.mjs +8 -0
  20. package/esm2022/lib/core/xsolla-number/api/send-instruction/response/send-instruction-response.class.mjs +25 -0
  21. package/esm2022/lib/core/xsolla-number/api/send-instruction/response/send-instruction-response.interface.mjs +2 -0
  22. package/esm2022/lib/core/xsolla-number/api/send-instruction/response/send-instruction-response.token.mjs +8 -0
  23. package/esm2022/lib/core/xsolla-number/api/send-instruction/response/send-status.enum.mjs +6 -0
  24. package/esm2022/lib/core/xsolla-number/api/send-instruction/send-error.interface.mjs +2 -0
  25. package/esm2022/lib/core/xsolla-number/api/send-instruction/send-instruction-api-routes.enum.mjs +6 -0
  26. package/esm2022/lib/core/xsolla-number/api/send-instruction/send-instruction-parameters.interface.mjs +2 -0
  27. package/esm2022/lib/core/xsolla-number/api/send-instruction/send-instruction.service.mjs +53 -0
  28. package/esm2022/lib/core/xsolla-number/shipping-methods.enum.mjs +7 -0
  29. package/esm2022/lib/core-library.module.mjs +10 -1
  30. package/esm2022/lib/core-library.service.mjs +15 -4
  31. package/esm2022/public-api.mjs +2 -1
  32. package/fesm2022/xsolla-payment-client-core.mjs +292 -6
  33. package/fesm2022/xsolla-payment-client-core.mjs.map +1 -1
  34. package/lib/core/cash-payment/cash-payment-pids.const.d.ts +1 -0
  35. package/lib/core/cash-payment/cash-payment.service.d.ts +6 -0
  36. package/lib/core/payment/actions/next-action.interface.d.ts +3 -1
  37. package/lib/core/payment/actions/show-cash-payment-instruction/show-cash-payment-instruction.action.class.d.ts +14 -0
  38. package/lib/core/payment/actions/show-cash-payment-instruction/show-cash-payment-instruction.action.type.d.ts +4 -0
  39. package/lib/core/payment/actions/show-xsolla-number/show-xsolla-number.action.class.d.ts +13 -0
  40. package/lib/core/payment/actions/show-xsolla-number/show-xsolla-number.action.type.d.ts +5 -0
  41. package/lib/core/payment/cash-payment-data.interface.d.ts +10 -0
  42. package/lib/core/payment/payment.service.d.ts +7 -1
  43. package/lib/core/payment/submit/response/submit-response.class.d.ts +2 -0
  44. package/lib/core/payment/submit/response/xsolla-number.interface.d.ts +4 -0
  45. package/lib/core/xsolla-number/api/print-instruction/print-instruction.service.d.ts +15 -0
  46. package/lib/core/xsolla-number/api/print-instruction/request/print-instruction-request.class.d.ts +8 -0
  47. package/lib/core/xsolla-number/api/print-instruction/request/print-instruction-request.interface.d.ts +6 -0
  48. package/lib/core/xsolla-number/api/print-instruction/request/print-instruction-request.token.d.ts +7 -0
  49. package/lib/core/xsolla-number/api/send-instruction/request/send-instruction-request.class.d.ts +11 -0
  50. package/lib/core/xsolla-number/api/send-instruction/request/send-instruction-request.interface.d.ts +4 -0
  51. package/lib/core/xsolla-number/api/send-instruction/request/send-instruction-request.token.d.ts +7 -0
  52. package/lib/core/xsolla-number/api/send-instruction/response/send-instruction-response.class.d.ts +8 -0
  53. package/lib/core/xsolla-number/api/send-instruction/response/send-instruction-response.interface.d.ts +6 -0
  54. package/lib/core/xsolla-number/api/send-instruction/response/send-instruction-response.token.d.ts +7 -0
  55. package/lib/core/xsolla-number/api/send-instruction/response/send-status.enum.d.ts +4 -0
  56. package/lib/core/xsolla-number/api/send-instruction/send-error.interface.d.ts +5 -0
  57. package/lib/core/xsolla-number/api/send-instruction/send-instruction-api-routes.enum.d.ts +4 -0
  58. package/lib/core/xsolla-number/api/send-instruction/send-instruction-parameters.interface.d.ts +8 -0
  59. package/lib/core/xsolla-number/api/send-instruction/send-instruction.service.d.ts +20 -0
  60. package/lib/core/xsolla-number/shipping-methods.enum.d.ts +5 -0
  61. package/lib/core-library.service.d.ts +9 -1
  62. package/package.json +1 -1
  63. package/public-api.d.ts +1 -0
  64. package/xsolla-payment-client-core-0.2.28.tgz +0 -0
  65. package/xsolla-payment-client-core-0.2.26.tgz +0 -0
@@ -603,6 +603,10 @@ class SubmitResponse {
603
603
  this.title = parameters.title;
604
604
  this.currentCommand = parameters.currentCommand;
605
605
  this.messages = parameters.messages;
606
+ this.xsollaNumber = {
607
+ accountXsolla: parameters.accountXsolla,
608
+ isMap: parameters.isMap,
609
+ };
606
610
  }
607
611
  }
608
612
 
@@ -1689,6 +1693,90 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImpor
1689
1693
  type: Injectable
1690
1694
  }] });
1691
1695
 
1696
+ class ShowXsollaNumberActionCreator {
1697
+ constructor() {
1698
+ this.type = 'show_cash_payment_instruction';
1699
+ }
1700
+ getActionData() {
1701
+ return {
1702
+ type: this.type,
1703
+ data: null,
1704
+ };
1705
+ }
1706
+ isSuitable(response) {
1707
+ return (this.isCashPayment(response.parameters?.categories) &&
1708
+ !this.isRedirectPaymentMethod(response));
1709
+ }
1710
+ isCashPayment(categories = []) {
1711
+ const cashPaymentCategory = 1;
1712
+ /**
1713
+ * For some methods, the category array may contain not just [1], but [0, 1];
1714
+ * 0 is a recommended category, so it checks that all categories <= cashPaymentCategory
1715
+ */
1716
+ return (!!categories?.length &&
1717
+ categories.includes(cashPaymentCategory) &&
1718
+ categories.every((category) => category <= cashPaymentCategory));
1719
+ }
1720
+ isRedirectPaymentMethod(submitResponse) {
1721
+ return submitResponse.parameters.isCheckout ?? false;
1722
+ }
1723
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: ShowXsollaNumberActionCreator, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
1724
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: ShowXsollaNumberActionCreator }); }
1725
+ }
1726
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: ShowXsollaNumberActionCreator, decorators: [{
1727
+ type: Injectable
1728
+ }] });
1729
+
1730
+ const sevenEleven = 1776;
1731
+ const caseysGeneralStores = 3412;
1732
+ const cvsPharmacy1 = 1330;
1733
+ const cvsPharmacy2 = 3339;
1734
+ const familyDollar1 = 2931;
1735
+ const familyDollar2 = 3380;
1736
+ const cashPaymentPids = [
1737
+ sevenEleven,
1738
+ caseysGeneralStores,
1739
+ cvsPharmacy1,
1740
+ cvsPharmacy2,
1741
+ familyDollar1,
1742
+ familyDollar2,
1743
+ ];
1744
+
1745
+ class CashPaymentService {
1746
+ isCashPaymentMethod(paymentMethodId) {
1747
+ return cashPaymentPids.includes(paymentMethodId);
1748
+ }
1749
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: CashPaymentService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
1750
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: CashPaymentService, providedIn: 'root' }); }
1751
+ }
1752
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: CashPaymentService, decorators: [{
1753
+ type: Injectable,
1754
+ args: [{
1755
+ providedIn: 'root',
1756
+ }]
1757
+ }] });
1758
+
1759
+ class ShowCashPaymentInstructionActionCreator {
1760
+ constructor(cashPaymentService) {
1761
+ this.cashPaymentService = cashPaymentService;
1762
+ this.type = 'show_cash_payment_instruction';
1763
+ }
1764
+ getActionData() {
1765
+ return {
1766
+ type: this.type,
1767
+ data: null,
1768
+ };
1769
+ }
1770
+ isSuitable(response) {
1771
+ return this.cashPaymentService.isCashPaymentMethod(response.pid);
1772
+ }
1773
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: ShowCashPaymentInstructionActionCreator, deps: [{ token: CashPaymentService }], target: i0.ɵɵFactoryTarget.Injectable }); }
1774
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: ShowCashPaymentInstructionActionCreator }); }
1775
+ }
1776
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: ShowCashPaymentInstructionActionCreator, decorators: [{
1777
+ type: Injectable
1778
+ }], ctorParameters: () => [{ type: CashPaymentService }] });
1779
+
1692
1780
  const nextActionsToken = new InjectionToken('Action');
1693
1781
  const nextActions = [
1694
1782
  ShowFieldsActionCreator,
@@ -1696,7 +1784,9 @@ const nextActions = [
1696
1784
  SpecialButtonActionCreator,
1697
1785
  ShowQrCodeActionCreator,
1698
1786
  RedirectActionCreator,
1787
+ ShowCashPaymentInstructionActionCreator,
1699
1788
  ShowMobilePaymentScreenActionCreator,
1789
+ ShowXsollaNumberActionCreator,
1700
1790
  ];
1701
1791
  const flowUpdateNextActions = [
1702
1792
  ShowErrorsActionCreator,
@@ -6307,6 +6397,50 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImpor
6307
6397
  }]
6308
6398
  }], ctorParameters: () => [{ type: UnescapeHtmlPipe }] });
6309
6399
 
6400
+ class PrintInstructionRequest {
6401
+ constructor(parameters) {
6402
+ this.xsolla_num = parameters.xsollaNumber;
6403
+ this.public_id = parameters.publicId;
6404
+ this.payment_name = parameters.title;
6405
+ this.pid = parameters.pid;
6406
+ }
6407
+ }
6408
+
6409
+ const printInstructionRequestFactoryToken = new InjectionToken('PrintInstructionResponse');
6410
+ const printInstructionRequestFactoryProvider = {
6411
+ provide: printInstructionRequestFactoryToken,
6412
+ useValue: (...args) => new PrintInstructionRequest(...args),
6413
+ };
6414
+
6415
+ class PrintInstructionService {
6416
+ constructor(settingsService, secureApi, printInstructionRequestFactory) {
6417
+ this.settingsService = settingsService;
6418
+ this.secureApi = secureApi;
6419
+ this.printInstructionRequestFactory = printInstructionRequestFactory;
6420
+ this.apiRoute = 'xsollanumber';
6421
+ }
6422
+ getPrintInstructionUrl(parameters) {
6423
+ const printUrlParameters = {
6424
+ ...this.printInstructionRequestFactory(parameters),
6425
+ access_token: this.settingsService.token,
6426
+ };
6427
+ const printInstructionUrl = new URL(`${this.secureApi.baseUrl}${this.apiRoute}/printNumber`);
6428
+ Object.entries(printUrlParameters).forEach(([key, parameter]) => printInstructionUrl.searchParams.append(key, String(parameter)));
6429
+ return printInstructionUrl.toString();
6430
+ }
6431
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: PrintInstructionService, deps: [{ token: SettingsService }, { token: SecureApiClient }, { token: printInstructionRequestFactoryToken }], target: i0.ɵɵFactoryTarget.Injectable }); }
6432
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: PrintInstructionService, providedIn: 'root' }); }
6433
+ }
6434
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: PrintInstructionService, decorators: [{
6435
+ type: Injectable,
6436
+ args: [{
6437
+ providedIn: 'root',
6438
+ }]
6439
+ }], ctorParameters: () => [{ type: SettingsService }, { type: SecureApiClient }, { type: undefined, decorators: [{
6440
+ type: Inject,
6441
+ args: [printInstructionRequestFactoryToken]
6442
+ }] }] });
6443
+
6310
6444
  class PaymentService {
6311
6445
  get formFieldsStatus$() {
6312
6446
  return this.formFieldsStatusSubject.asObservable().pipe(filter$1(Boolean));
@@ -6320,7 +6454,7 @@ class PaymentService {
6320
6454
  get formResponseValue() {
6321
6455
  return this._formResponse$.getValue();
6322
6456
  }
6323
- constructor(initializeService, submitService, syncService, formService, statusService, financeDetailsService, creditCardStateService, nextActionService, controlConfigService, threeDsService, formMessagesService, settingsService, countryService, checkStatusActionCreator) {
6457
+ constructor(initializeService, submitService, syncService, formService, statusService, financeDetailsService, creditCardStateService, nextActionService, controlConfigService, threeDsService, formMessagesService, settingsService, countryService, checkStatusActionCreator, cashPaymentService, printInstructionService) {
6324
6458
  this.initializeService = initializeService;
6325
6459
  this.submitService = submitService;
6326
6460
  this.syncService = syncService;
@@ -6335,6 +6469,8 @@ class PaymentService {
6335
6469
  this.settingsService = settingsService;
6336
6470
  this.countryService = countryService;
6337
6471
  this.checkStatusActionCreator = checkStatusActionCreator;
6472
+ this.cashPaymentService = cashPaymentService;
6473
+ this.printInstructionService = printInstructionService;
6338
6474
  this.form = null;
6339
6475
  this.data = null;
6340
6476
  this.financeDetails = null;
@@ -6437,6 +6573,25 @@ class PaymentService {
6437
6573
  }
6438
6574
  return this.data.parameters.form.qr.title;
6439
6575
  }
6576
+ getCashPaymentData() {
6577
+ if (!isSubmitResponse(this.data)) {
6578
+ throw new Error('Should submit form first');
6579
+ }
6580
+ const params = {
6581
+ isCashPaymentMethod: this.cashPaymentService.isCashPaymentMethod(this.data.parameters.pid),
6582
+ xsollaNumber: this.data.xsollaNumber.accountXsolla,
6583
+ pid: this.data.parameters.pid,
6584
+ publicId: this.data.parameters.public_id,
6585
+ title: this.data.parameters.title,
6586
+ projectName: this.settingsService.project.name,
6587
+ instruction: this.data.fields.find((field) => field.name === 'email_info')
6588
+ ?.title,
6589
+ };
6590
+ return {
6591
+ ...params,
6592
+ printUrl: this.printInstructionService.getPrintInstructionUrl(params),
6593
+ };
6594
+ }
6440
6595
  getPid() {
6441
6596
  if (this.data instanceof SubmitResponse) {
6442
6597
  return (Number(this.data.fields.find((field) => field.name === 'fix_pid')?.value) || null);
@@ -6662,7 +6817,7 @@ class PaymentService {
6662
6817
  const canSkipForm = response.paymentForm.skipForm;
6663
6818
  return !isRedirectMethod && canSkipForm;
6664
6819
  }
6665
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", 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 }); }
6820
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", 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 }, { token: CashPaymentService }, { token: PrintInstructionService }], target: i0.ɵɵFactoryTarget.Injectable }); }
6666
6821
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: PaymentService, providedIn: 'root' }); }
6667
6822
  }
6668
6823
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: PaymentService, decorators: [{
@@ -6670,7 +6825,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImpor
6670
6825
  args: [{
6671
6826
  providedIn: 'root',
6672
6827
  }]
6673
- }], ctorParameters: () => [{ 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 }] });
6828
+ }], ctorParameters: () => [{ 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 }, { type: CashPaymentService }, { type: PrintInstructionService }] });
6674
6829
 
6675
6830
  class RefundPolicyService {
6676
6831
  constructor(settingsService) {
@@ -7080,8 +7235,123 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImpor
7080
7235
  }]
7081
7236
  }], ctorParameters: () => [{ type: SecureApiClient }, { type: SettingsService }] });
7082
7237
 
7238
+ class SendInstructionRequest {
7239
+ constructor(parameters) {
7240
+ if (isNull(parameters.accessToken)) {
7241
+ throw new TokenError();
7242
+ }
7243
+ this.access_token = parameters.accessToken;
7244
+ this.xsolla_num = parameters.xsollaNumber;
7245
+ this.public_id = parameters.publicId;
7246
+ this.recipient = parameters.recipient;
7247
+ this.payment_name = parameters.title;
7248
+ this.pid = parameters.pid;
7249
+ if (parameters.purchase) {
7250
+ this.purchase = JSON.stringify(parameters.purchase);
7251
+ }
7252
+ }
7253
+ }
7254
+
7255
+ const sendInstructionRequestFactoryToken = new InjectionToken('SendInstructionRequest');
7256
+ const sendInstructionRequestFactoryProvider = {
7257
+ provide: sendInstructionRequestFactoryToken,
7258
+ useValue: (...args) => new SendInstructionRequest(...args),
7259
+ };
7260
+
7261
+ var ShippingMethodsEnum;
7262
+ (function (ShippingMethodsEnum) {
7263
+ ShippingMethodsEnum["sms"] = "sms";
7264
+ ShippingMethodsEnum["email"] = "email";
7265
+ ShippingMethodsEnum["print"] = "print";
7266
+ })(ShippingMethodsEnum || (ShippingMethodsEnum = {}));
7267
+
7268
+ var SendStatus;
7269
+ (function (SendStatus) {
7270
+ SendStatus["succeed"] = "succeed";
7271
+ SendStatus["failed"] = "failed";
7272
+ })(SendStatus || (SendStatus = {}));
7273
+
7274
+ class SendInstructionStatusResponse {
7275
+ constructor(sendResponse, sendInstructionRoute) {
7276
+ this.errors = [];
7277
+ this.type =
7278
+ sendInstructionRoute === 'sendSms'
7279
+ ? ShippingMethodsEnum.sms
7280
+ : ShippingMethodsEnum.email;
7281
+ if (sendResponse.errors) {
7282
+ this.errors = sendResponse.errors.map(({ message }) => message);
7283
+ }
7284
+ if (sendResponse.status) {
7285
+ this.status =
7286
+ sendResponse?.status ===
7287
+ SendStatus.succeed
7288
+ ? SendStatus.succeed
7289
+ : SendStatus.failed;
7290
+ }
7291
+ else {
7292
+ this.status = SendStatus.failed;
7293
+ }
7294
+ }
7295
+ }
7296
+
7297
+ const sendInstructionStatusResponseFactoryToken = new InjectionToken('SendInstructionStatusResponse');
7298
+ const sendInstructionStatusResponseFactoryProvider = {
7299
+ provide: sendInstructionStatusResponseFactoryToken,
7300
+ useValue: (...args) => new SendInstructionStatusResponse(...args),
7301
+ };
7302
+
7303
+ var SendInstructionApiRoutesEnum;
7304
+ (function (SendInstructionApiRoutesEnum) {
7305
+ SendInstructionApiRoutesEnum["sendSms"] = "sendSms";
7306
+ SendInstructionApiRoutesEnum["sendEmail"] = "sendEmail";
7307
+ })(SendInstructionApiRoutesEnum || (SendInstructionApiRoutesEnum = {}));
7308
+
7309
+ class SendInstructionService {
7310
+ constructor(secureApi, settingsService, sendInstructionRequestFactory, sendInstructionStatusResponseFactory) {
7311
+ this.secureApi = secureApi;
7312
+ this.settingsService = settingsService;
7313
+ this.sendInstructionRequestFactory = sendInstructionRequestFactory;
7314
+ this.sendInstructionStatusResponseFactory = sendInstructionStatusResponseFactory;
7315
+ this.apiRoute = 'xsollanumber';
7316
+ }
7317
+ async sendInstructionWithEmail(parameters) {
7318
+ return this.request(SendInstructionApiRoutesEnum.sendEmail, this.sendInstructionRequestFactory({
7319
+ accessToken: this.settingsService.token,
7320
+ ...parameters,
7321
+ }));
7322
+ }
7323
+ async sendInstructionWithSms(parameters) {
7324
+ return this.request(SendInstructionApiRoutesEnum.sendSms, this.sendInstructionRequestFactory({
7325
+ accessToken: this.settingsService.token,
7326
+ ...parameters,
7327
+ }));
7328
+ }
7329
+ async request(route, parameters) {
7330
+ return lastValueFrom(this.secureApi
7331
+ .post(`${this.apiRoute}/${route}`, new URLSearchParams(parameters), {
7332
+ headers: new HttpHeaders().set('Content-Type', 'application/x-www-form-urlencoded; charset=utf-8'),
7333
+ responseType: 'json',
7334
+ })
7335
+ .pipe(map((response) => this.sendInstructionStatusResponseFactory(response, route))));
7336
+ }
7337
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: SendInstructionService, deps: [{ token: SecureApiClient }, { token: SettingsService }, { token: sendInstructionRequestFactoryToken }, { token: sendInstructionStatusResponseFactoryToken }], target: i0.ɵɵFactoryTarget.Injectable }); }
7338
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: SendInstructionService, providedIn: 'root' }); }
7339
+ }
7340
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: SendInstructionService, decorators: [{
7341
+ type: Injectable,
7342
+ args: [{
7343
+ providedIn: 'root',
7344
+ }]
7345
+ }], ctorParameters: () => [{ type: SecureApiClient }, { type: SettingsService }, { type: undefined, decorators: [{
7346
+ type: Inject,
7347
+ args: [sendInstructionRequestFactoryToken]
7348
+ }] }, { type: undefined, decorators: [{
7349
+ type: Inject,
7350
+ args: [sendInstructionStatusResponseFactoryToken]
7351
+ }] }] });
7352
+
7083
7353
  class CoreLibraryService {
7084
- constructor(settingsService, countryService, paymentMethodsService, savedMethodsService, userBalanceService, paymentConfigService, paymentService, deviceFingerPrintService, financeDetailsService, legalService, statusService, nextActionService, creditCardService, creditCardStateService, formMessagesService, editSavedMethodsService, userBehaviourAnalyticsService, performanceService, combinedPaymentMethodsService, countriesApiService) {
7354
+ constructor(settingsService, countryService, paymentMethodsService, savedMethodsService, userBalanceService, paymentConfigService, paymentService, deviceFingerPrintService, financeDetailsService, legalService, statusService, nextActionService, creditCardService, creditCardStateService, formMessagesService, editSavedMethodsService, userBehaviourAnalyticsService, performanceService, combinedPaymentMethodsService, countriesApiService, sendInstructionService) {
7085
7355
  this.settingsService = settingsService;
7086
7356
  this.countryService = countryService;
7087
7357
  this.paymentMethodsService = paymentMethodsService;
@@ -7102,6 +7372,7 @@ class CoreLibraryService {
7102
7372
  this.performanceService = performanceService;
7103
7373
  this.combinedPaymentMethodsService = combinedPaymentMethodsService;
7104
7374
  this.countriesApiService = countriesApiService;
7375
+ this.sendInstructionService = sendInstructionService;
7105
7376
  this.paymentMethods = {
7106
7377
  getList: async (isSaveMethodMode) => this.paymentMethodsService.getList(isSaveMethodMode),
7107
7378
  getQuickMethods: async () => this.paymentMethodsService.getQuickMethods(),
@@ -7132,6 +7403,15 @@ class CoreLibraryService {
7132
7403
  pid: this.paymentService.getPid(),
7133
7404
  };
7134
7405
  }
7406
+ getCashPaymentData() {
7407
+ return this.paymentService.getCashPaymentData();
7408
+ }
7409
+ async sendXsollaNumberWithEmail(params) {
7410
+ return this.sendInstructionService.sendInstructionWithEmail(params);
7411
+ }
7412
+ async sendXsollaNumberWithSms(params) {
7413
+ return this.sendInstructionService.sendInstructionWithSms(params);
7414
+ }
7135
7415
  async getCountries() {
7136
7416
  return this.countriesApiService.request();
7137
7417
  }
@@ -7200,7 +7480,7 @@ class CoreLibraryService {
7200
7480
  get formResponseValue() {
7201
7481
  return this.paymentService.formResponseValue;
7202
7482
  }
7203
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", 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 }, { token: EditSavedMethodsService }, { token: UserBehaviourAnalyticsService }, { token: PerformanceService }, { token: CombinedPaymentMethodsService }, { token: CountriesApiService }], target: i0.ɵɵFactoryTarget.Injectable }); }
7483
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", 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 }, { token: EditSavedMethodsService }, { token: UserBehaviourAnalyticsService }, { token: PerformanceService }, { token: CombinedPaymentMethodsService }, { token: CountriesApiService }, { token: SendInstructionService }], target: i0.ɵɵFactoryTarget.Injectable }); }
7204
7484
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: CoreLibraryService, providedIn: 'root' }); }
7205
7485
  }
7206
7486
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: CoreLibraryService, decorators: [{
@@ -7208,7 +7488,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImpor
7208
7488
  args: [{
7209
7489
  providedIn: 'root',
7210
7490
  }]
7211
- }], ctorParameters: () => [{ 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 }, { type: EditSavedMethodsService }, { type: UserBehaviourAnalyticsService }, { type: PerformanceService }, { type: CombinedPaymentMethodsService }, { type: CountriesApiService }] });
7491
+ }], ctorParameters: () => [{ 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 }, { type: EditSavedMethodsService }, { type: UserBehaviourAnalyticsService }, { type: PerformanceService }, { type: CombinedPaymentMethodsService }, { type: CountriesApiService }, { type: SendInstructionService }] });
7212
7492
 
7213
7493
  class HttpError extends AppError {
7214
7494
  constructor(error, req) {
@@ -7393,6 +7673,9 @@ class CoreLibraryModule {
7393
7673
  },
7394
7674
  ...nextActions,
7395
7675
  ...flowUpdateNextActions,
7676
+ printInstructionRequestFactoryProvider,
7677
+ sendInstructionRequestFactoryProvider,
7678
+ sendInstructionStatusResponseFactoryProvider,
7396
7679
  ], imports: [HttpClientModule, FormModule, PipesModule] }); }
7397
7680
  }
7398
7681
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: CoreLibraryModule, decorators: [{
@@ -7427,6 +7710,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImpor
7427
7710
  },
7428
7711
  ...nextActions,
7429
7712
  ...flowUpdateNextActions,
7713
+ printInstructionRequestFactoryProvider,
7714
+ sendInstructionRequestFactoryProvider,
7715
+ sendInstructionStatusResponseFactoryProvider,
7430
7716
  ],
7431
7717
  }]
7432
7718
  }] });