@xsolla/payment-client-core 0.2.25 → 0.2.27
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.
- package/esm2022/lib/core/cash-payment/cash-payment-pids.const.mjs +15 -0
- package/esm2022/lib/core/cash-payment/cash-payment.service.mjs +17 -0
- package/esm2022/lib/core/payment/actions/next-action.interface.mjs +1 -1
- package/esm2022/lib/core/payment/actions/next-actions.mjs +3 -1
- package/esm2022/lib/core/payment/actions/show-xsolla-number/show-xsolla-number.action.class.mjs +36 -0
- package/esm2022/lib/core/payment/actions/show-xsolla-number/show-xsolla-number.action.type.mjs +2 -0
- package/esm2022/lib/core/payment/cash-payment-data.interface.mjs +2 -0
- package/esm2022/lib/core/payment/form/converters/cvv/cvv.converter.mjs +2 -1
- package/esm2022/lib/core/payment/payment.service.mjs +25 -4
- package/esm2022/lib/core/payment/submit/response/submit-response.class.mjs +5 -1
- package/esm2022/lib/core/payment/submit/response/xsolla-number.interface.mjs +2 -0
- package/esm2022/lib/core/xsolla-number/api/print-instruction/print-instruction.service.mjs +34 -0
- package/esm2022/lib/core/xsolla-number/api/print-instruction/request/print-instruction-request.class.mjs +9 -0
- package/esm2022/lib/core/xsolla-number/api/print-instruction/request/print-instruction-request.interface.mjs +2 -0
- package/esm2022/lib/core/xsolla-number/api/print-instruction/request/print-instruction-request.token.mjs +8 -0
- package/esm2022/lib/core/xsolla-number/api/send-instruction/request/send-instruction-request.class.mjs +19 -0
- package/esm2022/lib/core/xsolla-number/api/send-instruction/request/send-instruction-request.interface.mjs +2 -0
- package/esm2022/lib/core/xsolla-number/api/send-instruction/request/send-instruction-request.token.mjs +8 -0
- package/esm2022/lib/core/xsolla-number/api/send-instruction/response/send-instruction-response.class.mjs +25 -0
- package/esm2022/lib/core/xsolla-number/api/send-instruction/response/send-instruction-response.interface.mjs +2 -0
- package/esm2022/lib/core/xsolla-number/api/send-instruction/response/send-instruction-response.token.mjs +8 -0
- package/esm2022/lib/core/xsolla-number/api/send-instruction/response/send-status.enum.mjs +6 -0
- package/esm2022/lib/core/xsolla-number/api/send-instruction/send-error.interface.mjs +2 -0
- package/esm2022/lib/core/xsolla-number/api/send-instruction/send-instruction-api-routes.enum.mjs +6 -0
- package/esm2022/lib/core/xsolla-number/api/send-instruction/send-instruction-parameters.interface.mjs +2 -0
- package/esm2022/lib/core/xsolla-number/api/send-instruction/send-instruction.service.mjs +53 -0
- package/esm2022/lib/core/xsolla-number/shipping-methods.enum.mjs +7 -0
- package/esm2022/lib/core-library.module.mjs +10 -1
- package/esm2022/lib/core-library.service.mjs +15 -4
- package/esm2022/public-api.mjs +2 -1
- package/fesm2022/xsolla-payment-client-core.mjs +269 -6
- package/fesm2022/xsolla-payment-client-core.mjs.map +1 -1
- package/lib/core/cash-payment/cash-payment-pids.const.d.ts +1 -0
- package/lib/core/cash-payment/cash-payment.service.d.ts +6 -0
- package/lib/core/payment/actions/next-action.interface.d.ts +2 -1
- package/lib/core/payment/actions/show-xsolla-number/show-xsolla-number.action.class.d.ts +13 -0
- package/lib/core/payment/actions/show-xsolla-number/show-xsolla-number.action.type.d.ts +4 -0
- package/lib/core/payment/cash-payment-data.interface.d.ts +9 -0
- package/lib/core/payment/payment.service.d.ts +7 -1
- package/lib/core/payment/submit/response/submit-response.class.d.ts +2 -0
- package/lib/core/payment/submit/response/xsolla-number.interface.d.ts +4 -0
- package/lib/core/xsolla-number/api/print-instruction/print-instruction.service.d.ts +15 -0
- package/lib/core/xsolla-number/api/print-instruction/request/print-instruction-request.class.d.ts +8 -0
- package/lib/core/xsolla-number/api/print-instruction/request/print-instruction-request.interface.d.ts +6 -0
- package/lib/core/xsolla-number/api/print-instruction/request/print-instruction-request.token.d.ts +7 -0
- package/lib/core/xsolla-number/api/send-instruction/request/send-instruction-request.class.d.ts +11 -0
- package/lib/core/xsolla-number/api/send-instruction/request/send-instruction-request.interface.d.ts +4 -0
- package/lib/core/xsolla-number/api/send-instruction/request/send-instruction-request.token.d.ts +7 -0
- package/lib/core/xsolla-number/api/send-instruction/response/send-instruction-response.class.d.ts +8 -0
- package/lib/core/xsolla-number/api/send-instruction/response/send-instruction-response.interface.d.ts +6 -0
- package/lib/core/xsolla-number/api/send-instruction/response/send-instruction-response.token.d.ts +7 -0
- package/lib/core/xsolla-number/api/send-instruction/response/send-status.enum.d.ts +4 -0
- package/lib/core/xsolla-number/api/send-instruction/send-error.interface.d.ts +5 -0
- package/lib/core/xsolla-number/api/send-instruction/send-instruction-api-routes.enum.d.ts +4 -0
- package/lib/core/xsolla-number/api/send-instruction/send-instruction-parameters.interface.d.ts +8 -0
- package/lib/core/xsolla-number/api/send-instruction/send-instruction.service.d.ts +20 -0
- package/lib/core/xsolla-number/shipping-methods.enum.d.ts +5 -0
- package/lib/core-library.service.d.ts +9 -1
- package/package.json +1 -1
- package/public-api.d.ts +1 -0
- package/xsolla-payment-client-core-0.2.27.tgz +0 -0
- package/xsolla-payment-client-core-0.2.25.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,40 @@ 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
|
+
|
|
1692
1730
|
const nextActionsToken = new InjectionToken('Action');
|
|
1693
1731
|
const nextActions = [
|
|
1694
1732
|
ShowFieldsActionCreator,
|
|
@@ -1697,6 +1735,7 @@ const nextActions = [
|
|
|
1697
1735
|
ShowQrCodeActionCreator,
|
|
1698
1736
|
RedirectActionCreator,
|
|
1699
1737
|
ShowMobilePaymentScreenActionCreator,
|
|
1738
|
+
ShowXsollaNumberActionCreator,
|
|
1700
1739
|
];
|
|
1701
1740
|
const flowUpdateNextActions = [
|
|
1702
1741
|
ShowErrorsActionCreator,
|
|
@@ -3429,6 +3468,7 @@ class CvvConverter extends Converter {
|
|
|
3429
3468
|
position: 'input',
|
|
3430
3469
|
analyticsAction: 'show-cvv-tooltip',
|
|
3431
3470
|
};
|
|
3471
|
+
config.placeholder = `CVV2/CVC2`;
|
|
3432
3472
|
config.inputMode = 'numeric';
|
|
3433
3473
|
config.shouldHideUserInput = this.shouldHideUserInput();
|
|
3434
3474
|
config.disabled = formState?.disabled ?? false;
|
|
@@ -6306,6 +6346,79 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImpor
|
|
|
6306
6346
|
}]
|
|
6307
6347
|
}], ctorParameters: () => [{ type: UnescapeHtmlPipe }] });
|
|
6308
6348
|
|
|
6349
|
+
const sevenEleven = 1776;
|
|
6350
|
+
const caseysGeneralStores = 3412;
|
|
6351
|
+
const cvsPharmacy1 = 1330;
|
|
6352
|
+
const cvsPharmacy2 = 3339;
|
|
6353
|
+
const familyDollar1 = 2931;
|
|
6354
|
+
const familyDollar2 = 3380;
|
|
6355
|
+
const cashPaymentPids = [
|
|
6356
|
+
sevenEleven,
|
|
6357
|
+
caseysGeneralStores,
|
|
6358
|
+
cvsPharmacy1,
|
|
6359
|
+
cvsPharmacy2,
|
|
6360
|
+
familyDollar1,
|
|
6361
|
+
familyDollar2,
|
|
6362
|
+
];
|
|
6363
|
+
|
|
6364
|
+
class CashPaymentService {
|
|
6365
|
+
isCashPaymentMethod(paymentMethodId) {
|
|
6366
|
+
return cashPaymentPids.includes(paymentMethodId);
|
|
6367
|
+
}
|
|
6368
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: CashPaymentService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
6369
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: CashPaymentService, providedIn: 'root' }); }
|
|
6370
|
+
}
|
|
6371
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: CashPaymentService, decorators: [{
|
|
6372
|
+
type: Injectable,
|
|
6373
|
+
args: [{
|
|
6374
|
+
providedIn: 'root',
|
|
6375
|
+
}]
|
|
6376
|
+
}] });
|
|
6377
|
+
|
|
6378
|
+
class PrintInstructionRequest {
|
|
6379
|
+
constructor(parameters) {
|
|
6380
|
+
this.xsolla_num = parameters.xsollaNumber;
|
|
6381
|
+
this.public_id = parameters.publicId;
|
|
6382
|
+
this.payment_name = parameters.title;
|
|
6383
|
+
this.pid = parameters.pid;
|
|
6384
|
+
}
|
|
6385
|
+
}
|
|
6386
|
+
|
|
6387
|
+
const printInstructionRequestFactoryToken = new InjectionToken('PrintInstructionResponse');
|
|
6388
|
+
const printInstructionRequestFactoryProvider = {
|
|
6389
|
+
provide: printInstructionRequestFactoryToken,
|
|
6390
|
+
useValue: (...args) => new PrintInstructionRequest(...args),
|
|
6391
|
+
};
|
|
6392
|
+
|
|
6393
|
+
class PrintInstructionService {
|
|
6394
|
+
constructor(settingsService, secureApi, printInstructionRequestFactory) {
|
|
6395
|
+
this.settingsService = settingsService;
|
|
6396
|
+
this.secureApi = secureApi;
|
|
6397
|
+
this.printInstructionRequestFactory = printInstructionRequestFactory;
|
|
6398
|
+
this.apiRoute = 'xsollanumber';
|
|
6399
|
+
}
|
|
6400
|
+
getPrintInstructionUrl(parameters) {
|
|
6401
|
+
const printUrlParameters = {
|
|
6402
|
+
...this.printInstructionRequestFactory(parameters),
|
|
6403
|
+
access_token: this.settingsService.token,
|
|
6404
|
+
};
|
|
6405
|
+
const printInstructionUrl = new URL(`${this.secureApi.baseUrl}${this.apiRoute}/printNumber`);
|
|
6406
|
+
Object.entries(printUrlParameters).forEach(([key, parameter]) => printInstructionUrl.searchParams.append(key, String(parameter)));
|
|
6407
|
+
return printInstructionUrl.toString();
|
|
6408
|
+
}
|
|
6409
|
+
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 }); }
|
|
6410
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: PrintInstructionService, providedIn: 'root' }); }
|
|
6411
|
+
}
|
|
6412
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: PrintInstructionService, decorators: [{
|
|
6413
|
+
type: Injectable,
|
|
6414
|
+
args: [{
|
|
6415
|
+
providedIn: 'root',
|
|
6416
|
+
}]
|
|
6417
|
+
}], ctorParameters: () => [{ type: SettingsService }, { type: SecureApiClient }, { type: undefined, decorators: [{
|
|
6418
|
+
type: Inject,
|
|
6419
|
+
args: [printInstructionRequestFactoryToken]
|
|
6420
|
+
}] }] });
|
|
6421
|
+
|
|
6309
6422
|
class PaymentService {
|
|
6310
6423
|
get formFieldsStatus$() {
|
|
6311
6424
|
return this.formFieldsStatusSubject.asObservable().pipe(filter$1(Boolean));
|
|
@@ -6319,7 +6432,7 @@ class PaymentService {
|
|
|
6319
6432
|
get formResponseValue() {
|
|
6320
6433
|
return this._formResponse$.getValue();
|
|
6321
6434
|
}
|
|
6322
|
-
constructor(initializeService, submitService, syncService, formService, statusService, financeDetailsService, creditCardStateService, nextActionService, controlConfigService, threeDsService, formMessagesService, settingsService, countryService, checkStatusActionCreator) {
|
|
6435
|
+
constructor(initializeService, submitService, syncService, formService, statusService, financeDetailsService, creditCardStateService, nextActionService, controlConfigService, threeDsService, formMessagesService, settingsService, countryService, checkStatusActionCreator, cashPaymentService, printInstructionService) {
|
|
6323
6436
|
this.initializeService = initializeService;
|
|
6324
6437
|
this.submitService = submitService;
|
|
6325
6438
|
this.syncService = syncService;
|
|
@@ -6334,6 +6447,8 @@ class PaymentService {
|
|
|
6334
6447
|
this.settingsService = settingsService;
|
|
6335
6448
|
this.countryService = countryService;
|
|
6336
6449
|
this.checkStatusActionCreator = checkStatusActionCreator;
|
|
6450
|
+
this.cashPaymentService = cashPaymentService;
|
|
6451
|
+
this.printInstructionService = printInstructionService;
|
|
6337
6452
|
this.form = null;
|
|
6338
6453
|
this.data = null;
|
|
6339
6454
|
this.financeDetails = null;
|
|
@@ -6436,6 +6551,23 @@ class PaymentService {
|
|
|
6436
6551
|
}
|
|
6437
6552
|
return this.data.parameters.form.qr.title;
|
|
6438
6553
|
}
|
|
6554
|
+
getCashPaymentData() {
|
|
6555
|
+
if (!isSubmitResponse(this.data)) {
|
|
6556
|
+
throw new Error('Should submit form first');
|
|
6557
|
+
}
|
|
6558
|
+
const params = {
|
|
6559
|
+
isCashPaymentMethod: this.cashPaymentService.isCashPaymentMethod(this.data.parameters.pid),
|
|
6560
|
+
xsollaNumber: this.data.xsollaNumber.accountXsolla,
|
|
6561
|
+
pid: this.data.parameters.pid,
|
|
6562
|
+
publicId: this.data.parameters.public_id,
|
|
6563
|
+
title: this.data.parameters.title,
|
|
6564
|
+
projectName: this.settingsService.project.name,
|
|
6565
|
+
};
|
|
6566
|
+
return {
|
|
6567
|
+
...params,
|
|
6568
|
+
printUrl: this.printInstructionService.getPrintInstructionUrl(params),
|
|
6569
|
+
};
|
|
6570
|
+
}
|
|
6439
6571
|
getPid() {
|
|
6440
6572
|
if (this.data instanceof SubmitResponse) {
|
|
6441
6573
|
return (Number(this.data.fields.find((field) => field.name === 'fix_pid')?.value) || null);
|
|
@@ -6661,7 +6793,7 @@ class PaymentService {
|
|
|
6661
6793
|
const canSkipForm = response.paymentForm.skipForm;
|
|
6662
6794
|
return !isRedirectMethod && canSkipForm;
|
|
6663
6795
|
}
|
|
6664
|
-
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 }); }
|
|
6796
|
+
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 }); }
|
|
6665
6797
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: PaymentService, providedIn: 'root' }); }
|
|
6666
6798
|
}
|
|
6667
6799
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: PaymentService, decorators: [{
|
|
@@ -6669,7 +6801,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImpor
|
|
|
6669
6801
|
args: [{
|
|
6670
6802
|
providedIn: 'root',
|
|
6671
6803
|
}]
|
|
6672
|
-
}], 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 }] });
|
|
6804
|
+
}], 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 }] });
|
|
6673
6805
|
|
|
6674
6806
|
class RefundPolicyService {
|
|
6675
6807
|
constructor(settingsService) {
|
|
@@ -7079,8 +7211,123 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImpor
|
|
|
7079
7211
|
}]
|
|
7080
7212
|
}], ctorParameters: () => [{ type: SecureApiClient }, { type: SettingsService }] });
|
|
7081
7213
|
|
|
7214
|
+
class SendInstructionRequest {
|
|
7215
|
+
constructor(parameters) {
|
|
7216
|
+
if (isNull(parameters.accessToken)) {
|
|
7217
|
+
throw new TokenError();
|
|
7218
|
+
}
|
|
7219
|
+
this.access_token = parameters.accessToken;
|
|
7220
|
+
this.xsolla_num = parameters.xsollaNumber;
|
|
7221
|
+
this.public_id = parameters.publicId;
|
|
7222
|
+
this.recipient = parameters.recipient;
|
|
7223
|
+
this.payment_name = parameters.title;
|
|
7224
|
+
this.pid = parameters.pid;
|
|
7225
|
+
if (parameters.purchase) {
|
|
7226
|
+
this.purchase = JSON.stringify(parameters.purchase);
|
|
7227
|
+
}
|
|
7228
|
+
}
|
|
7229
|
+
}
|
|
7230
|
+
|
|
7231
|
+
const sendInstructionRequestFactoryToken = new InjectionToken('SendInstructionRequest');
|
|
7232
|
+
const sendInstructionRequestFactoryProvider = {
|
|
7233
|
+
provide: sendInstructionRequestFactoryToken,
|
|
7234
|
+
useValue: (...args) => new SendInstructionRequest(...args),
|
|
7235
|
+
};
|
|
7236
|
+
|
|
7237
|
+
var ShippingMethodsEnum;
|
|
7238
|
+
(function (ShippingMethodsEnum) {
|
|
7239
|
+
ShippingMethodsEnum["sms"] = "sms";
|
|
7240
|
+
ShippingMethodsEnum["email"] = "email";
|
|
7241
|
+
ShippingMethodsEnum["print"] = "print";
|
|
7242
|
+
})(ShippingMethodsEnum || (ShippingMethodsEnum = {}));
|
|
7243
|
+
|
|
7244
|
+
var SendStatus;
|
|
7245
|
+
(function (SendStatus) {
|
|
7246
|
+
SendStatus["succeed"] = "succeed";
|
|
7247
|
+
SendStatus["failed"] = "failed";
|
|
7248
|
+
})(SendStatus || (SendStatus = {}));
|
|
7249
|
+
|
|
7250
|
+
class SendInstructionStatusResponse {
|
|
7251
|
+
constructor(sendResponse, sendInstructionRoute) {
|
|
7252
|
+
this.errors = [];
|
|
7253
|
+
this.type =
|
|
7254
|
+
sendInstructionRoute === 'sendSms'
|
|
7255
|
+
? ShippingMethodsEnum.sms
|
|
7256
|
+
: ShippingMethodsEnum.email;
|
|
7257
|
+
if (sendResponse.errors) {
|
|
7258
|
+
this.errors = sendResponse.errors.map(({ message }) => message);
|
|
7259
|
+
}
|
|
7260
|
+
if (sendResponse.status) {
|
|
7261
|
+
this.status =
|
|
7262
|
+
sendResponse?.status ===
|
|
7263
|
+
SendStatus.succeed
|
|
7264
|
+
? SendStatus.succeed
|
|
7265
|
+
: SendStatus.failed;
|
|
7266
|
+
}
|
|
7267
|
+
else {
|
|
7268
|
+
this.status = SendStatus.failed;
|
|
7269
|
+
}
|
|
7270
|
+
}
|
|
7271
|
+
}
|
|
7272
|
+
|
|
7273
|
+
const sendInstructionStatusResponseFactoryToken = new InjectionToken('SendInstructionStatusResponse');
|
|
7274
|
+
const sendInstructionStatusResponseFactoryProvider = {
|
|
7275
|
+
provide: sendInstructionStatusResponseFactoryToken,
|
|
7276
|
+
useValue: (...args) => new SendInstructionStatusResponse(...args),
|
|
7277
|
+
};
|
|
7278
|
+
|
|
7279
|
+
var SendInstructionApiRoutesEnum;
|
|
7280
|
+
(function (SendInstructionApiRoutesEnum) {
|
|
7281
|
+
SendInstructionApiRoutesEnum["sendSms"] = "sendSms";
|
|
7282
|
+
SendInstructionApiRoutesEnum["sendEmail"] = "sendEmail";
|
|
7283
|
+
})(SendInstructionApiRoutesEnum || (SendInstructionApiRoutesEnum = {}));
|
|
7284
|
+
|
|
7285
|
+
class SendInstructionService {
|
|
7286
|
+
constructor(secureApi, settingsService, sendInstructionRequestFactory, sendInstructionStatusResponseFactory) {
|
|
7287
|
+
this.secureApi = secureApi;
|
|
7288
|
+
this.settingsService = settingsService;
|
|
7289
|
+
this.sendInstructionRequestFactory = sendInstructionRequestFactory;
|
|
7290
|
+
this.sendInstructionStatusResponseFactory = sendInstructionStatusResponseFactory;
|
|
7291
|
+
this.apiRoute = 'xsollanumber';
|
|
7292
|
+
}
|
|
7293
|
+
async sendInstructionWithEmail(parameters) {
|
|
7294
|
+
return this.request(SendInstructionApiRoutesEnum.sendEmail, this.sendInstructionRequestFactory({
|
|
7295
|
+
accessToken: this.settingsService.token,
|
|
7296
|
+
...parameters,
|
|
7297
|
+
}));
|
|
7298
|
+
}
|
|
7299
|
+
async sendInstructionWithSms(parameters) {
|
|
7300
|
+
return this.request(SendInstructionApiRoutesEnum.sendSms, this.sendInstructionRequestFactory({
|
|
7301
|
+
accessToken: this.settingsService.token,
|
|
7302
|
+
...parameters,
|
|
7303
|
+
}));
|
|
7304
|
+
}
|
|
7305
|
+
async request(route, parameters) {
|
|
7306
|
+
return lastValueFrom(this.secureApi
|
|
7307
|
+
.post(`${this.apiRoute}/${route}`, new URLSearchParams(parameters), {
|
|
7308
|
+
headers: new HttpHeaders().set('Content-Type', 'application/x-www-form-urlencoded; charset=utf-8'),
|
|
7309
|
+
responseType: 'json',
|
|
7310
|
+
})
|
|
7311
|
+
.pipe(map((response) => this.sendInstructionStatusResponseFactory(response, route))));
|
|
7312
|
+
}
|
|
7313
|
+
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 }); }
|
|
7314
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: SendInstructionService, providedIn: 'root' }); }
|
|
7315
|
+
}
|
|
7316
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: SendInstructionService, decorators: [{
|
|
7317
|
+
type: Injectable,
|
|
7318
|
+
args: [{
|
|
7319
|
+
providedIn: 'root',
|
|
7320
|
+
}]
|
|
7321
|
+
}], ctorParameters: () => [{ type: SecureApiClient }, { type: SettingsService }, { type: undefined, decorators: [{
|
|
7322
|
+
type: Inject,
|
|
7323
|
+
args: [sendInstructionRequestFactoryToken]
|
|
7324
|
+
}] }, { type: undefined, decorators: [{
|
|
7325
|
+
type: Inject,
|
|
7326
|
+
args: [sendInstructionStatusResponseFactoryToken]
|
|
7327
|
+
}] }] });
|
|
7328
|
+
|
|
7082
7329
|
class CoreLibraryService {
|
|
7083
|
-
constructor(settingsService, countryService, paymentMethodsService, savedMethodsService, userBalanceService, paymentConfigService, paymentService, deviceFingerPrintService, financeDetailsService, legalService, statusService, nextActionService, creditCardService, creditCardStateService, formMessagesService, editSavedMethodsService, userBehaviourAnalyticsService, performanceService, combinedPaymentMethodsService, countriesApiService) {
|
|
7330
|
+
constructor(settingsService, countryService, paymentMethodsService, savedMethodsService, userBalanceService, paymentConfigService, paymentService, deviceFingerPrintService, financeDetailsService, legalService, statusService, nextActionService, creditCardService, creditCardStateService, formMessagesService, editSavedMethodsService, userBehaviourAnalyticsService, performanceService, combinedPaymentMethodsService, countriesApiService, sendInstructionService) {
|
|
7084
7331
|
this.settingsService = settingsService;
|
|
7085
7332
|
this.countryService = countryService;
|
|
7086
7333
|
this.paymentMethodsService = paymentMethodsService;
|
|
@@ -7101,6 +7348,7 @@ class CoreLibraryService {
|
|
|
7101
7348
|
this.performanceService = performanceService;
|
|
7102
7349
|
this.combinedPaymentMethodsService = combinedPaymentMethodsService;
|
|
7103
7350
|
this.countriesApiService = countriesApiService;
|
|
7351
|
+
this.sendInstructionService = sendInstructionService;
|
|
7104
7352
|
this.paymentMethods = {
|
|
7105
7353
|
getList: async (isSaveMethodMode) => this.paymentMethodsService.getList(isSaveMethodMode),
|
|
7106
7354
|
getQuickMethods: async () => this.paymentMethodsService.getQuickMethods(),
|
|
@@ -7131,6 +7379,15 @@ class CoreLibraryService {
|
|
|
7131
7379
|
pid: this.paymentService.getPid(),
|
|
7132
7380
|
};
|
|
7133
7381
|
}
|
|
7382
|
+
getCashPaymentData() {
|
|
7383
|
+
return this.paymentService.getCashPaymentData();
|
|
7384
|
+
}
|
|
7385
|
+
async sendXsollaNumberWithEmail(params) {
|
|
7386
|
+
return this.sendInstructionService.sendInstructionWithEmail(params);
|
|
7387
|
+
}
|
|
7388
|
+
async sendXsollaNumberWithSms(params) {
|
|
7389
|
+
return this.sendInstructionService.sendInstructionWithSms(params);
|
|
7390
|
+
}
|
|
7134
7391
|
async getCountries() {
|
|
7135
7392
|
return this.countriesApiService.request();
|
|
7136
7393
|
}
|
|
@@ -7199,7 +7456,7 @@ class CoreLibraryService {
|
|
|
7199
7456
|
get formResponseValue() {
|
|
7200
7457
|
return this.paymentService.formResponseValue;
|
|
7201
7458
|
}
|
|
7202
|
-
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 }); }
|
|
7459
|
+
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 }); }
|
|
7203
7460
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: CoreLibraryService, providedIn: 'root' }); }
|
|
7204
7461
|
}
|
|
7205
7462
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: CoreLibraryService, decorators: [{
|
|
@@ -7207,7 +7464,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImpor
|
|
|
7207
7464
|
args: [{
|
|
7208
7465
|
providedIn: 'root',
|
|
7209
7466
|
}]
|
|
7210
|
-
}], 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 }] });
|
|
7467
|
+
}], 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 }] });
|
|
7211
7468
|
|
|
7212
7469
|
class HttpError extends AppError {
|
|
7213
7470
|
constructor(error, req) {
|
|
@@ -7392,6 +7649,9 @@ class CoreLibraryModule {
|
|
|
7392
7649
|
},
|
|
7393
7650
|
...nextActions,
|
|
7394
7651
|
...flowUpdateNextActions,
|
|
7652
|
+
printInstructionRequestFactoryProvider,
|
|
7653
|
+
sendInstructionRequestFactoryProvider,
|
|
7654
|
+
sendInstructionStatusResponseFactoryProvider,
|
|
7395
7655
|
], imports: [HttpClientModule, FormModule, PipesModule] }); }
|
|
7396
7656
|
}
|
|
7397
7657
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: CoreLibraryModule, decorators: [{
|
|
@@ -7426,6 +7686,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImpor
|
|
|
7426
7686
|
},
|
|
7427
7687
|
...nextActions,
|
|
7428
7688
|
...flowUpdateNextActions,
|
|
7689
|
+
printInstructionRequestFactoryProvider,
|
|
7690
|
+
sendInstructionRequestFactoryProvider,
|
|
7691
|
+
sendInstructionStatusResponseFactoryProvider,
|
|
7429
7692
|
],
|
|
7430
7693
|
}]
|
|
7431
7694
|
}] });
|