@xsolla/payment-client-core 0.1.14-test20 → 0.1.14-test22
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/esm2020/lib/core/payment/actions/status-updated/status-updated.action.class.mjs +2 -2
- package/esm2020/lib/core/payment/config/config.service.mjs +5 -5
- package/esm2020/lib/core/payment/initialize/initialize-request-params.interface.mjs +1 -1
- package/esm2020/lib/core/payment/initialize/initialize.service.mjs +6 -4
- package/esm2020/lib/core/payment/payment.interface.mjs +1 -1
- package/esm2020/lib/core/payment/payment.service.mjs +1 -5
- package/esm2020/lib/core/payment/status/save-payment-method-status/api/saved-payment-account-changes.service.mjs +2 -2
- package/esm2020/lib/core/payment/status/save-payment-method-status/save-payment-method-status.enum.mjs +1 -1
- package/esm2020/lib/core/payment/status/save-payment-method-status/save-payment-method-status.service.mjs +35 -121
- package/esm2020/lib/core/payment/status/status.service.mjs +2 -5
- package/esm2020/lib/core/payment-methods/payment-methods-request-params.interface.mjs +1 -1
- package/esm2020/lib/core/payment-methods/payment-methods.service.mjs +4 -2
- package/esm2020/lib/core-library.service.mjs +1 -1
- package/fesm2015/xsolla-payment-client-core.mjs +48 -139
- package/fesm2015/xsolla-payment-client-core.mjs.map +1 -1
- package/fesm2020/xsolla-payment-client-core.mjs +48 -137
- package/fesm2020/xsolla-payment-client-core.mjs.map +1 -1
- package/lib/core/payment/initialize/initialize-request-params.interface.d.ts +1 -1
- package/lib/core/payment/payment.interface.d.ts +1 -1
- package/lib/core/payment/payment.service.d.ts +1 -1
- package/lib/core/payment/status/save-payment-method-status/save-payment-method-status.service.d.ts +2 -1
- package/lib/core/payment/status/status.service.d.ts +2 -2
- package/lib/core/payment-methods/payment-methods-request-params.interface.d.ts +1 -1
- package/lib/core-library.service.d.ts +1 -1
- package/package.json +1 -1
- package/xsolla-payment-client-core-0.1.14-test22.tgz +0 -0
- package/xsolla-payment-client-core-0.1.14-test20.tgz +0 -0
|
@@ -250,7 +250,9 @@ class PaymentMethodsService {
|
|
|
250
250
|
const requestParams = {
|
|
251
251
|
access_token: this.settingsService.token,
|
|
252
252
|
country: this.countryService.getCountry(),
|
|
253
|
-
save_payment_account_only: isSaveMethodMode
|
|
253
|
+
save_payment_account_only: isSaveMethodMode
|
|
254
|
+
? "1" /* XpsBoolean.true */
|
|
255
|
+
: "0" /* XpsBoolean.false */,
|
|
254
256
|
};
|
|
255
257
|
const cacheKey = JSON.stringify(requestParams);
|
|
256
258
|
if (!this.cache.has(cacheKey)) {
|
|
@@ -454,16 +456,16 @@ class PaymentConfigService {
|
|
|
454
456
|
}
|
|
455
457
|
return {
|
|
456
458
|
...config,
|
|
457
|
-
returnUrl: this.enrichReturnUrl(config.returnUrl, !!config.savePaymentMethod)
|
|
459
|
+
returnUrl: this.enrichReturnUrl(config.returnUrl, !!config.savePaymentMethod),
|
|
458
460
|
};
|
|
459
461
|
}
|
|
460
462
|
enrichReturnUrl(returnUrl, savePaymentMethod) {
|
|
461
463
|
let enrichedUrl = this.urlService.addSearchParams(returnUrl, {
|
|
462
|
-
token: this.settingsService.token
|
|
464
|
+
token: this.settingsService.token,
|
|
463
465
|
});
|
|
464
466
|
if (savePaymentMethod) {
|
|
465
467
|
enrichedUrl = this.urlService.addSearchParams(returnUrl, {
|
|
466
|
-
isSavePaymentAccount: "1" /* XpsBoolean.true
|
|
468
|
+
isSavePaymentAccount: "1" /* XpsBoolean.true */,
|
|
467
469
|
});
|
|
468
470
|
}
|
|
469
471
|
return enrichedUrl;
|
|
@@ -474,7 +476,7 @@ PaymentConfigService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0",
|
|
|
474
476
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: PaymentConfigService, decorators: [{
|
|
475
477
|
type: Injectable,
|
|
476
478
|
args: [{
|
|
477
|
-
providedIn: 'root'
|
|
479
|
+
providedIn: 'root',
|
|
478
480
|
}]
|
|
479
481
|
}], ctorParameters: function () { return [{ type: UrlService }, { type: SettingsService }]; } });
|
|
480
482
|
|
|
@@ -924,7 +926,7 @@ class StatusUpdatedAction {
|
|
|
924
926
|
isCanceled: status.isCanceled,
|
|
925
927
|
group: status.group,
|
|
926
928
|
isSavePaymentMethodMode,
|
|
927
|
-
savePaymentMethodStatus
|
|
929
|
+
savePaymentMethodStatus,
|
|
928
930
|
};
|
|
929
931
|
}
|
|
930
932
|
}
|
|
@@ -1570,7 +1572,9 @@ class InitializeService {
|
|
|
1570
1572
|
? "1" /* XpsBoolean.true */
|
|
1571
1573
|
: "0" /* XpsBoolean.false */,
|
|
1572
1574
|
saved_method_id: config.savedMethodId,
|
|
1573
|
-
save_payment_account_only: !!config.savePaymentMethod
|
|
1575
|
+
save_payment_account_only: !!config.savePaymentMethod
|
|
1576
|
+
? "1" /* XpsBoolean.true */
|
|
1577
|
+
: "0" /* XpsBoolean.false */,
|
|
1574
1578
|
};
|
|
1575
1579
|
return this.xpsApiService
|
|
1576
1580
|
.directPaymentRequest(requestParams)
|
|
@@ -1602,7 +1606,7 @@ InitializeService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", ve
|
|
|
1602
1606
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: InitializeService, decorators: [{
|
|
1603
1607
|
type: Injectable,
|
|
1604
1608
|
args: [{
|
|
1605
|
-
providedIn: 'root'
|
|
1609
|
+
providedIn: 'root',
|
|
1606
1610
|
}]
|
|
1607
1611
|
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
1608
1612
|
type: Inject,
|
|
@@ -4619,7 +4623,7 @@ SavedPaymentAccountChangesService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersi
|
|
|
4619
4623
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: SavedPaymentAccountChangesService, decorators: [{
|
|
4620
4624
|
type: Injectable,
|
|
4621
4625
|
args: [{
|
|
4622
|
-
providedIn: 'root'
|
|
4626
|
+
providedIn: 'root',
|
|
4623
4627
|
}]
|
|
4624
4628
|
}], ctorParameters: function () { return [{ type: SettingsService }, { type: SecureApiClient }]; } });
|
|
4625
4629
|
|
|
@@ -4633,158 +4637,75 @@ class SavePaymentMethodStatusService {
|
|
|
4633
4637
|
this.statusChecked = false;
|
|
4634
4638
|
}
|
|
4635
4639
|
async getStatus(params) {
|
|
4636
|
-
this.
|
|
4637
|
-
|
|
4638
|
-
|
|
4639
|
-
|
|
4640
|
-
|
|
4641
|
-
|
|
4642
|
-
|
|
4640
|
+
if (!this.accountData || !this.status) {
|
|
4641
|
+
this.statusRequestService.setRequestParams(params);
|
|
4642
|
+
this.statusRequestService.request();
|
|
4643
|
+
const statusResponse = await firstValueFrom(this.statusRequestService.response$);
|
|
4644
|
+
this.status = statusResponse.status;
|
|
4645
|
+
this.status.isSavePaymentAccount = true;
|
|
4646
|
+
this.accountData = await this.getPaymentAccountData(params.invoice);
|
|
4647
|
+
}
|
|
4648
|
+
if (this.savingFailedOrCancel(this.status) ||
|
|
4649
|
+
(this.accountData && this.savingSuccessful(this.accountData, this.status))) {
|
|
4650
|
+
return this.status;
|
|
4643
4651
|
}
|
|
4644
4652
|
if (!this.statusChecked) {
|
|
4645
4653
|
this.checkStatus(params);
|
|
4646
|
-
|
|
4647
|
-
return
|
|
4654
|
+
this.status.statusState = StatusEnum.processing;
|
|
4655
|
+
return this.status;
|
|
4648
4656
|
}
|
|
4649
|
-
|
|
4650
|
-
|
|
4657
|
+
this.statusChecked = false;
|
|
4658
|
+
this.status.statusState = StatusEnum.error;
|
|
4659
|
+
const outStatus = { ...this.status };
|
|
4660
|
+
this.status = null;
|
|
4661
|
+
return outStatus;
|
|
4651
4662
|
}
|
|
4652
4663
|
checkStatus(params) {
|
|
4653
4664
|
if (!this.statusChecked) {
|
|
4654
4665
|
this.statusChecked = true;
|
|
4655
4666
|
}
|
|
4656
4667
|
this.startWaitingStatusUpdates(params.invoice);
|
|
4657
|
-
// this.statusRequestService.request();
|
|
4658
|
-
}
|
|
4659
|
-
async getStatusOld(params) {
|
|
4660
|
-
console.log('getStatus', params);
|
|
4661
|
-
this.statusRequestService.setRequestParams(params);
|
|
4662
|
-
// this.startWaitingStatusUpdates(params.invoice);
|
|
4663
4668
|
this.statusRequestService.request();
|
|
4664
|
-
const statusResponse = await firstValueFrom(this.statusRequestService.response$);
|
|
4665
|
-
this.checkStatusService.setRequestParams(params.invoice);
|
|
4666
|
-
this.checkStatusService.request();
|
|
4667
|
-
const checkStatusResponse = await firstValueFrom(this.checkStatusService.response$);
|
|
4668
|
-
if (!checkStatusResponse.final) {
|
|
4669
|
-
this.startWaitingStatusUpdates(params.invoice);
|
|
4670
|
-
statusResponse.status.isSavePaymentAccount = true;
|
|
4671
|
-
statusResponse.status.statusState = StatusEnum.processing;
|
|
4672
|
-
return statusResponse.status;
|
|
4673
|
-
}
|
|
4674
|
-
// todo: get account
|
|
4675
|
-
const accountData = await this.getPaymentAccountData(params.invoice);
|
|
4676
|
-
if (!this.savingFailedOrCancel(statusResponse?.status) && !this.savingSuccessful(accountData, statusResponse?.status)) {
|
|
4677
|
-
// todo is proccessing
|
|
4678
|
-
this.startWaitingStatusUpdates(params.invoice);
|
|
4679
|
-
statusResponse.status.statusState = StatusEnum.processing;
|
|
4680
|
-
}
|
|
4681
|
-
statusResponse.status.isSavePaymentAccount = true;
|
|
4682
|
-
return statusResponse.status;
|
|
4683
|
-
// this.listenStatusService.listen(params.invoice);
|
|
4684
|
-
// this.statusRequestService.request();
|
|
4685
|
-
// const paramsCheck = {
|
|
4686
|
-
// section: 'getstatus',
|
|
4687
|
-
// action: 'getstatus',
|
|
4688
|
-
// // invoice: params.invoice,
|
|
4689
|
-
// ...params,
|
|
4690
|
-
// access_token: params.token || '8sogPLisB328Snf9M9aChSwkZn4IzOzf_lc_en'
|
|
4691
|
-
// };
|
|
4692
|
-
// // const check = await this.checkStatusService.requestPromise('directpayment', paramsCheck);
|
|
4693
|
-
// // console.log('requestPromise', check);
|
|
4694
|
-
// // todo: get account
|
|
4695
|
-
// // const accountData = await this.getPaymentAccountData(params.invoice);
|
|
4696
|
-
// // this.startWaitingStatusUpdates(params.invoice);
|
|
4697
|
-
// // this.listenStatusService.statusUpdated$
|
|
4698
|
-
// this.startWaitingStatusUpdates(params.invoice);
|
|
4699
|
-
// this.statusRequestService.request();
|
|
4700
|
-
// this.checkStatusService.setRequestParams(params.invoice);
|
|
4701
|
-
// this.checkStatusService.request();
|
|
4702
|
-
// this.checkStatusService.response$.subscribe((resp) => {
|
|
4703
|
-
// console.log('checkSt', resp);
|
|
4704
|
-
// });
|
|
4705
|
-
// const statusResponse = await firstValueFrom(
|
|
4706
|
-
// this.statusRequestService.response$
|
|
4707
|
-
// );
|
|
4708
|
-
// const savingFailedOrCancel = statusResponse.status?.titleClass === TitleClass.cancel || statusResponse.status?.titleClass === TitleClass.cancelUser;
|
|
4709
|
-
// const savingSuccessful = statusResponse.status?.titleClass === TitleClass.done && accountData?.new_account;
|
|
4710
|
-
// if (!accountData) {
|
|
4711
|
-
// this.startWaitingStatusUpdates(params.invoice);
|
|
4712
|
-
// statusResponse.status.statusState = StatusEnum.processing;
|
|
4713
|
-
// }
|
|
4714
|
-
// if (!this.savingFailedOrCancel(statusResponse?.status) && !this.savingSuccessful(accountData, statusResponse?.status)) {
|
|
4715
|
-
// // todo is proccessing
|
|
4716
|
-
//
|
|
4717
|
-
// // this.startWaitingStatusUpdates(params.invoice);
|
|
4718
|
-
// statusResponse.status.statusState = StatusEnum.processing;
|
|
4719
|
-
// }
|
|
4720
|
-
// statusResponse.status.isSavePaymentAccount = true;
|
|
4721
|
-
// return statusResponse.status;
|
|
4722
|
-
// return null;
|
|
4723
|
-
// if (!this.savePaymentMethodStatus) {
|
|
4724
|
-
// statusResponse.status.statusState = StatusEnum.processing;
|
|
4725
|
-
// }
|
|
4726
|
-
// statusResponse.status.isSavePaymentAccount = true;
|
|
4727
|
-
// return statusResponse.status;
|
|
4728
4669
|
}
|
|
4729
4670
|
savingFailedOrCancel(status) {
|
|
4730
|
-
return status?.titleClass === TitleClass.cancel ||
|
|
4671
|
+
return (status?.titleClass === TitleClass.cancel ||
|
|
4672
|
+
status?.titleClass === TitleClass.cancelUser);
|
|
4731
4673
|
}
|
|
4732
4674
|
savingSuccessful(accountData, status, checkStatus) {
|
|
4733
|
-
return !!(status?.titleClass === TitleClass.done &&
|
|
4675
|
+
return !!(status?.titleClass === TitleClass.done &&
|
|
4676
|
+
(accountData?.new_account || checkStatus?.isPaymentAccountAttached));
|
|
4734
4677
|
}
|
|
4735
4678
|
getPaymentAccountData(invoice) {
|
|
4736
|
-
return this.savedPaymentAccountChangesService
|
|
4737
|
-
.request(invoice);
|
|
4738
|
-
// .then((accountChanges: SavedPaymentAccountChanges) => {
|
|
4739
|
-
// if (accountChanges) {
|
|
4740
|
-
// this.handleSavingStatus(status, accountChanges.new_account);
|
|
4741
|
-
// }
|
|
4742
|
-
// });
|
|
4679
|
+
return this.savedPaymentAccountChangesService.request(invoice);
|
|
4743
4680
|
}
|
|
4744
4681
|
startWaitingStatusUpdates(invoice) {
|
|
4745
4682
|
if (this.listenStatusSubscription) {
|
|
4746
4683
|
this.listenStatusSubscription.unsubscribe();
|
|
4747
4684
|
this.listenStatusService.stopListening();
|
|
4748
4685
|
}
|
|
4749
|
-
// debugger
|
|
4750
4686
|
this.listenStatusService.listen(invoice);
|
|
4751
|
-
this.listenStatusSubscription =
|
|
4752
|
-
.subscribe((
|
|
4753
|
-
|
|
4754
|
-
|
|
4755
|
-
|
|
4756
|
-
|
|
4757
|
-
|
|
4758
|
-
|
|
4759
|
-
// });
|
|
4760
|
-
void firstValueFrom(this.checkStatusService.response$).then((checkStatusResponse) => {
|
|
4761
|
-
if (checkStatusResponse.final && statusSettings?.statusResponse.status) {
|
|
4762
|
-
this.loadNewPaymentAccountData(statusSettings?.statusResponse.status, checkStatusResponse);
|
|
4763
|
-
}
|
|
4687
|
+
this.listenStatusSubscription =
|
|
4688
|
+
this.listenStatusService.statusUpdated$.subscribe(({ statusResponse }) => {
|
|
4689
|
+
this.status = statusResponse.status;
|
|
4690
|
+
void firstValueFrom(this.checkStatusService.response$).then((checkStatusResponse) => {
|
|
4691
|
+
if (checkStatusResponse.final && statusResponse.status) {
|
|
4692
|
+
this.loadNewPaymentAccountData(statusResponse.status, checkStatusResponse);
|
|
4693
|
+
}
|
|
4694
|
+
});
|
|
4764
4695
|
});
|
|
4765
|
-
// this.checkStatusService.request();
|
|
4766
|
-
// const checkStatusResponse = await firstValueFrom(
|
|
4767
|
-
// this.checkStatusService.response$
|
|
4768
|
-
// );
|
|
4769
|
-
});
|
|
4770
|
-
// this.statusRequestService.request();
|
|
4771
4696
|
}
|
|
4772
4697
|
loadNewPaymentAccountData(status, checkStatus) {
|
|
4773
4698
|
if (!status.invoice) {
|
|
4774
4699
|
return;
|
|
4775
4700
|
}
|
|
4776
|
-
void this.
|
|
4777
|
-
.request(status.invoice)
|
|
4778
|
-
.then((accountChanges) => {
|
|
4701
|
+
void this.getPaymentAccountData(status.invoice).then((accountChanges) => {
|
|
4779
4702
|
if (accountChanges) {
|
|
4703
|
+
this.accountData = accountChanges;
|
|
4780
4704
|
this.handleSavingStatus(status, accountChanges, checkStatus);
|
|
4781
4705
|
}
|
|
4782
4706
|
});
|
|
4783
4707
|
}
|
|
4784
4708
|
handleSavingStatus(status, account, checkStatus) {
|
|
4785
|
-
// const savingFailedOrCancel = status?.titleClass === TitleClass.cancel || status?.titleClass === TitleClass.cancelUser;
|
|
4786
|
-
//
|
|
4787
|
-
// const savingSuccessful = status?.titleClass === TitleClass.done && account;
|
|
4788
4709
|
if (this.savingSuccessful(account, status, checkStatus)) {
|
|
4789
4710
|
this.savePaymentMethodStatus = SavePaymentMethodStatus.success;
|
|
4790
4711
|
}
|
|
@@ -4793,10 +4714,7 @@ class SavePaymentMethodStatusService {
|
|
|
4793
4714
|
}
|
|
4794
4715
|
this.listenStatusService.stopListening();
|
|
4795
4716
|
this.listenStatusSubscription.unsubscribe();
|
|
4796
|
-
// const paymentAccountWasSaved = status?.titleClass === TitleClass.done && account !== null;
|
|
4797
4717
|
const isSavePaymentMethod = true;
|
|
4798
|
-
// this.savePaymentMethodStatus = this.savingFailedOrCancel(status) ? SavePaymentMethodStatus.success : SavePaymentMethodStatus.failed;
|
|
4799
|
-
console.log(status, isSavePaymentMethod, this.savePaymentMethodStatus);
|
|
4800
4718
|
this.nextActionService.emitFlowUpdates(new StatusUpdatedAction(status, isSavePaymentMethod, this.savePaymentMethodStatus));
|
|
4801
4719
|
}
|
|
4802
4720
|
}
|
|
@@ -4805,7 +4723,7 @@ SavePaymentMethodStatusService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion:
|
|
|
4805
4723
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: SavePaymentMethodStatusService, decorators: [{
|
|
4806
4724
|
type: Injectable,
|
|
4807
4725
|
args: [{
|
|
4808
|
-
providedIn: 'root'
|
|
4726
|
+
providedIn: 'root',
|
|
4809
4727
|
}]
|
|
4810
4728
|
}], ctorParameters: function () { return [{ type: StatusRequestService }, { type: ListenStatusService }, { type: SavedPaymentAccountChangesService }, { type: NextActionService }, { type: CheckStatusService }]; } });
|
|
4811
4729
|
|
|
@@ -4819,11 +4737,9 @@ class StatusService {
|
|
|
4819
4737
|
this.savePaymentMethodStatusService = savePaymentMethodStatusService;
|
|
4820
4738
|
}
|
|
4821
4739
|
async getStatus(params) {
|
|
4822
|
-
// todo: если params.savePaymentMethod, то надо выполнить логику для
|
|
4823
|
-
// account status
|
|
4824
4740
|
const isSavePaymentMethodMode = !!params?.isSavePaymentAccount;
|
|
4825
4741
|
if (isSavePaymentMethodMode) {
|
|
4826
|
-
return this.savePaymentMethodStatusService.getStatus(params);
|
|
4742
|
+
return this.savePaymentMethodStatusService.getStatus(params);
|
|
4827
4743
|
}
|
|
4828
4744
|
this.statusRequestService.setRequestParams(params);
|
|
4829
4745
|
this.startWaitingStatusUpdates(params.invoice);
|
|
@@ -4834,7 +4750,6 @@ class StatusService {
|
|
|
4834
4750
|
}
|
|
4835
4751
|
async getStatusWithUrlSearchParams(url) {
|
|
4836
4752
|
const searchParams = this.getRequestParamsFromUrl(url);
|
|
4837
|
-
console.log('searchParams', searchParams);
|
|
4838
4753
|
if (!searchParams) {
|
|
4839
4754
|
throw new Error('No required search params to get status');
|
|
4840
4755
|
}
|
|
@@ -5367,8 +5282,6 @@ class PaymentService {
|
|
|
5367
5282
|
this.emitFormFieldsStatus(this.form);
|
|
5368
5283
|
return;
|
|
5369
5284
|
}
|
|
5370
|
-
console.log('this.fields', this.fields);
|
|
5371
|
-
console.log('this.form', this.form);
|
|
5372
5285
|
this.isSavingMethodMode = this.fields.some(({ name, value }) => name === 'savePsAccountOnly' && value === "1" /* XpsBoolean.true */);
|
|
5373
5286
|
const submitResponse = await this.submitService.request(this.fields, this.form);
|
|
5374
5287
|
this.data = submitResponse;
|
|
@@ -5425,8 +5338,6 @@ class PaymentService {
|
|
|
5425
5338
|
'en',
|
|
5426
5339
|
isSavePaymentAccount: this.isSavingMethodMode ? 1 : 0,
|
|
5427
5340
|
};
|
|
5428
|
-
console.log('this.data', this.data);
|
|
5429
|
-
console.log('getStatus', params);
|
|
5430
5341
|
return this.statusService.getStatus(params);
|
|
5431
5342
|
}
|
|
5432
5343
|
getFieldConfig(field) {
|