@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
|
@@ -261,7 +261,9 @@ class PaymentMethodsService {
|
|
|
261
261
|
const requestParams = {
|
|
262
262
|
access_token: this.settingsService.token,
|
|
263
263
|
country: this.countryService.getCountry(),
|
|
264
|
-
save_payment_account_only: isSaveMethodMode
|
|
264
|
+
save_payment_account_only: isSaveMethodMode
|
|
265
|
+
? "1" /* XpsBoolean.true */
|
|
266
|
+
: "0" /* XpsBoolean.false */,
|
|
265
267
|
};
|
|
266
268
|
const cacheKey = JSON.stringify(requestParams);
|
|
267
269
|
if (!this.cache.has(cacheKey)) {
|
|
@@ -483,11 +485,11 @@ class PaymentConfigService {
|
|
|
483
485
|
}
|
|
484
486
|
enrichReturnUrl(returnUrl, savePaymentMethod) {
|
|
485
487
|
let enrichedUrl = this.urlService.addSearchParams(returnUrl, {
|
|
486
|
-
token: this.settingsService.token
|
|
488
|
+
token: this.settingsService.token,
|
|
487
489
|
});
|
|
488
490
|
if (savePaymentMethod) {
|
|
489
491
|
enrichedUrl = this.urlService.addSearchParams(returnUrl, {
|
|
490
|
-
isSavePaymentAccount: "1" /* XpsBoolean.true
|
|
492
|
+
isSavePaymentAccount: "1" /* XpsBoolean.true */,
|
|
491
493
|
});
|
|
492
494
|
}
|
|
493
495
|
return enrichedUrl;
|
|
@@ -498,7 +500,7 @@ PaymentConfigService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0",
|
|
|
498
500
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: PaymentConfigService, decorators: [{
|
|
499
501
|
type: Injectable,
|
|
500
502
|
args: [{
|
|
501
|
-
providedIn: 'root'
|
|
503
|
+
providedIn: 'root',
|
|
502
504
|
}]
|
|
503
505
|
}], ctorParameters: function () { return [{ type: UrlService }, { type: SettingsService }]; } });
|
|
504
506
|
|
|
@@ -951,7 +953,7 @@ class StatusUpdatedAction {
|
|
|
951
953
|
isCanceled: status.isCanceled,
|
|
952
954
|
group: status.group,
|
|
953
955
|
isSavePaymentMethodMode,
|
|
954
|
-
savePaymentMethodStatus
|
|
956
|
+
savePaymentMethodStatus,
|
|
955
957
|
};
|
|
956
958
|
}
|
|
957
959
|
}
|
|
@@ -1596,7 +1598,9 @@ class InitializeService {
|
|
|
1596
1598
|
? "1" /* XpsBoolean.true */
|
|
1597
1599
|
: "0" /* XpsBoolean.false */,
|
|
1598
1600
|
saved_method_id: config.savedMethodId,
|
|
1599
|
-
save_payment_account_only: !!config.savePaymentMethod
|
|
1601
|
+
save_payment_account_only: !!config.savePaymentMethod
|
|
1602
|
+
? "1" /* XpsBoolean.true */
|
|
1603
|
+
: "0" /* XpsBoolean.false */,
|
|
1600
1604
|
};
|
|
1601
1605
|
return this.xpsApiService
|
|
1602
1606
|
.directPaymentRequest(requestParams)
|
|
@@ -1630,7 +1634,7 @@ InitializeService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", ve
|
|
|
1630
1634
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: InitializeService, decorators: [{
|
|
1631
1635
|
type: Injectable,
|
|
1632
1636
|
args: [{
|
|
1633
|
-
providedIn: 'root'
|
|
1637
|
+
providedIn: 'root',
|
|
1634
1638
|
}]
|
|
1635
1639
|
}], ctorParameters: function () {
|
|
1636
1640
|
return [{ type: undefined, decorators: [{
|
|
@@ -4732,7 +4736,7 @@ SavedPaymentAccountChangesService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersi
|
|
|
4732
4736
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: SavedPaymentAccountChangesService, decorators: [{
|
|
4733
4737
|
type: Injectable,
|
|
4734
4738
|
args: [{
|
|
4735
|
-
providedIn: 'root'
|
|
4739
|
+
providedIn: 'root',
|
|
4736
4740
|
}]
|
|
4737
4741
|
}], ctorParameters: function () { return [{ type: SettingsService }, { type: SecureApiClient }]; } });
|
|
4738
4742
|
|
|
@@ -4747,21 +4751,28 @@ class SavePaymentMethodStatusService {
|
|
|
4747
4751
|
}
|
|
4748
4752
|
getStatus(params) {
|
|
4749
4753
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4750
|
-
this.
|
|
4751
|
-
|
|
4752
|
-
|
|
4753
|
-
|
|
4754
|
-
|
|
4755
|
-
|
|
4756
|
-
|
|
4754
|
+
if (!this.accountData || !this.status) {
|
|
4755
|
+
this.statusRequestService.setRequestParams(params);
|
|
4756
|
+
this.statusRequestService.request();
|
|
4757
|
+
const statusResponse = yield firstValueFrom(this.statusRequestService.response$);
|
|
4758
|
+
this.status = statusResponse.status;
|
|
4759
|
+
this.status.isSavePaymentAccount = true;
|
|
4760
|
+
this.accountData = yield this.getPaymentAccountData(params.invoice);
|
|
4761
|
+
}
|
|
4762
|
+
if (this.savingFailedOrCancel(this.status) ||
|
|
4763
|
+
(this.accountData && this.savingSuccessful(this.accountData, this.status))) {
|
|
4764
|
+
return this.status;
|
|
4757
4765
|
}
|
|
4758
4766
|
if (!this.statusChecked) {
|
|
4759
4767
|
this.checkStatus(params);
|
|
4760
|
-
|
|
4761
|
-
return
|
|
4768
|
+
this.status.statusState = StatusEnum.processing;
|
|
4769
|
+
return this.status;
|
|
4762
4770
|
}
|
|
4763
|
-
|
|
4764
|
-
|
|
4771
|
+
this.statusChecked = false;
|
|
4772
|
+
this.status.statusState = StatusEnum.error;
|
|
4773
|
+
const outStatus = Object.assign({}, this.status);
|
|
4774
|
+
this.status = null;
|
|
4775
|
+
return outStatus;
|
|
4765
4776
|
});
|
|
4766
4777
|
}
|
|
4767
4778
|
checkStatus(params) {
|
|
@@ -4769,139 +4780,47 @@ class SavePaymentMethodStatusService {
|
|
|
4769
4780
|
this.statusChecked = true;
|
|
4770
4781
|
}
|
|
4771
4782
|
this.startWaitingStatusUpdates(params.invoice);
|
|
4772
|
-
|
|
4773
|
-
}
|
|
4774
|
-
getStatusOld(params) {
|
|
4775
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
4776
|
-
console.log('getStatus', params);
|
|
4777
|
-
this.statusRequestService.setRequestParams(params);
|
|
4778
|
-
// this.startWaitingStatusUpdates(params.invoice);
|
|
4779
|
-
this.statusRequestService.request();
|
|
4780
|
-
const statusResponse = yield firstValueFrom(this.statusRequestService.response$);
|
|
4781
|
-
this.checkStatusService.setRequestParams(params.invoice);
|
|
4782
|
-
this.checkStatusService.request();
|
|
4783
|
-
const checkStatusResponse = yield firstValueFrom(this.checkStatusService.response$);
|
|
4784
|
-
if (!checkStatusResponse.final) {
|
|
4785
|
-
this.startWaitingStatusUpdates(params.invoice);
|
|
4786
|
-
statusResponse.status.isSavePaymentAccount = true;
|
|
4787
|
-
statusResponse.status.statusState = StatusEnum.processing;
|
|
4788
|
-
return statusResponse.status;
|
|
4789
|
-
}
|
|
4790
|
-
// todo: get account
|
|
4791
|
-
const accountData = yield this.getPaymentAccountData(params.invoice);
|
|
4792
|
-
if (!this.savingFailedOrCancel(statusResponse === null || statusResponse === void 0 ? void 0 : statusResponse.status) && !this.savingSuccessful(accountData, statusResponse === null || statusResponse === void 0 ? void 0 : statusResponse.status)) {
|
|
4793
|
-
// todo is proccessing
|
|
4794
|
-
this.startWaitingStatusUpdates(params.invoice);
|
|
4795
|
-
statusResponse.status.statusState = StatusEnum.processing;
|
|
4796
|
-
}
|
|
4797
|
-
statusResponse.status.isSavePaymentAccount = true;
|
|
4798
|
-
return statusResponse.status;
|
|
4799
|
-
// this.listenStatusService.listen(params.invoice);
|
|
4800
|
-
// this.statusRequestService.request();
|
|
4801
|
-
// const paramsCheck = {
|
|
4802
|
-
// section: 'getstatus',
|
|
4803
|
-
// action: 'getstatus',
|
|
4804
|
-
// // invoice: params.invoice,
|
|
4805
|
-
// ...params,
|
|
4806
|
-
// access_token: params.token || '8sogPLisB328Snf9M9aChSwkZn4IzOzf_lc_en'
|
|
4807
|
-
// };
|
|
4808
|
-
// // const check = await this.checkStatusService.requestPromise('directpayment', paramsCheck);
|
|
4809
|
-
// // console.log('requestPromise', check);
|
|
4810
|
-
// // todo: get account
|
|
4811
|
-
// // const accountData = await this.getPaymentAccountData(params.invoice);
|
|
4812
|
-
// // this.startWaitingStatusUpdates(params.invoice);
|
|
4813
|
-
// // this.listenStatusService.statusUpdated$
|
|
4814
|
-
// this.startWaitingStatusUpdates(params.invoice);
|
|
4815
|
-
// this.statusRequestService.request();
|
|
4816
|
-
// this.checkStatusService.setRequestParams(params.invoice);
|
|
4817
|
-
// this.checkStatusService.request();
|
|
4818
|
-
// this.checkStatusService.response$.subscribe((resp) => {
|
|
4819
|
-
// console.log('checkSt', resp);
|
|
4820
|
-
// });
|
|
4821
|
-
// const statusResponse = await firstValueFrom(
|
|
4822
|
-
// this.statusRequestService.response$
|
|
4823
|
-
// );
|
|
4824
|
-
// const savingFailedOrCancel = statusResponse.status?.titleClass === TitleClass.cancel || statusResponse.status?.titleClass === TitleClass.cancelUser;
|
|
4825
|
-
// const savingSuccessful = statusResponse.status?.titleClass === TitleClass.done && accountData?.new_account;
|
|
4826
|
-
// if (!accountData) {
|
|
4827
|
-
// this.startWaitingStatusUpdates(params.invoice);
|
|
4828
|
-
// statusResponse.status.statusState = StatusEnum.processing;
|
|
4829
|
-
// }
|
|
4830
|
-
// if (!this.savingFailedOrCancel(statusResponse?.status) && !this.savingSuccessful(accountData, statusResponse?.status)) {
|
|
4831
|
-
// // todo is proccessing
|
|
4832
|
-
//
|
|
4833
|
-
// // this.startWaitingStatusUpdates(params.invoice);
|
|
4834
|
-
// statusResponse.status.statusState = StatusEnum.processing;
|
|
4835
|
-
// }
|
|
4836
|
-
// statusResponse.status.isSavePaymentAccount = true;
|
|
4837
|
-
// return statusResponse.status;
|
|
4838
|
-
// return null;
|
|
4839
|
-
// if (!this.savePaymentMethodStatus) {
|
|
4840
|
-
// statusResponse.status.statusState = StatusEnum.processing;
|
|
4841
|
-
// }
|
|
4842
|
-
// statusResponse.status.isSavePaymentAccount = true;
|
|
4843
|
-
// return statusResponse.status;
|
|
4844
|
-
});
|
|
4783
|
+
this.statusRequestService.request();
|
|
4845
4784
|
}
|
|
4846
4785
|
savingFailedOrCancel(status) {
|
|
4847
|
-
return (status === null || status === void 0 ? void 0 : status.titleClass) === TitleClass.cancel ||
|
|
4786
|
+
return ((status === null || status === void 0 ? void 0 : status.titleClass) === TitleClass.cancel ||
|
|
4787
|
+
(status === null || status === void 0 ? void 0 : status.titleClass) === TitleClass.cancelUser);
|
|
4848
4788
|
}
|
|
4849
4789
|
savingSuccessful(accountData, status, checkStatus) {
|
|
4850
|
-
return !!((status === null || status === void 0 ? void 0 : status.titleClass) === TitleClass.done &&
|
|
4790
|
+
return !!((status === null || status === void 0 ? void 0 : status.titleClass) === TitleClass.done &&
|
|
4791
|
+
((accountData === null || accountData === void 0 ? void 0 : accountData.new_account) || (checkStatus === null || checkStatus === void 0 ? void 0 : checkStatus.isPaymentAccountAttached)));
|
|
4851
4792
|
}
|
|
4852
4793
|
getPaymentAccountData(invoice) {
|
|
4853
|
-
return this.savedPaymentAccountChangesService
|
|
4854
|
-
.request(invoice);
|
|
4855
|
-
// .then((accountChanges: SavedPaymentAccountChanges) => {
|
|
4856
|
-
// if (accountChanges) {
|
|
4857
|
-
// this.handleSavingStatus(status, accountChanges.new_account);
|
|
4858
|
-
// }
|
|
4859
|
-
// });
|
|
4794
|
+
return this.savedPaymentAccountChangesService.request(invoice);
|
|
4860
4795
|
}
|
|
4861
4796
|
startWaitingStatusUpdates(invoice) {
|
|
4862
4797
|
if (this.listenStatusSubscription) {
|
|
4863
4798
|
this.listenStatusSubscription.unsubscribe();
|
|
4864
4799
|
this.listenStatusService.stopListening();
|
|
4865
4800
|
}
|
|
4866
|
-
// debugger
|
|
4867
4801
|
this.listenStatusService.listen(invoice);
|
|
4868
|
-
this.listenStatusSubscription =
|
|
4869
|
-
.subscribe((
|
|
4870
|
-
|
|
4871
|
-
|
|
4872
|
-
|
|
4873
|
-
|
|
4874
|
-
|
|
4875
|
-
|
|
4876
|
-
// });
|
|
4877
|
-
void firstValueFrom(this.checkStatusService.response$).then((checkStatusResponse) => {
|
|
4878
|
-
if (checkStatusResponse.final && (statusSettings === null || statusSettings === void 0 ? void 0 : statusSettings.statusResponse.status)) {
|
|
4879
|
-
this.loadNewPaymentAccountData(statusSettings === null || statusSettings === void 0 ? void 0 : statusSettings.statusResponse.status, checkStatusResponse);
|
|
4880
|
-
}
|
|
4802
|
+
this.listenStatusSubscription =
|
|
4803
|
+
this.listenStatusService.statusUpdated$.subscribe(({ statusResponse }) => {
|
|
4804
|
+
this.status = statusResponse.status;
|
|
4805
|
+
void firstValueFrom(this.checkStatusService.response$).then((checkStatusResponse) => {
|
|
4806
|
+
if (checkStatusResponse.final && statusResponse.status) {
|
|
4807
|
+
this.loadNewPaymentAccountData(statusResponse.status, checkStatusResponse);
|
|
4808
|
+
}
|
|
4809
|
+
});
|
|
4881
4810
|
});
|
|
4882
|
-
// this.checkStatusService.request();
|
|
4883
|
-
// const checkStatusResponse = await firstValueFrom(
|
|
4884
|
-
// this.checkStatusService.response$
|
|
4885
|
-
// );
|
|
4886
|
-
});
|
|
4887
|
-
// this.statusRequestService.request();
|
|
4888
4811
|
}
|
|
4889
4812
|
loadNewPaymentAccountData(status, checkStatus) {
|
|
4890
4813
|
if (!status.invoice) {
|
|
4891
4814
|
return;
|
|
4892
4815
|
}
|
|
4893
|
-
void this.
|
|
4894
|
-
.request(status.invoice)
|
|
4895
|
-
.then((accountChanges) => {
|
|
4816
|
+
void this.getPaymentAccountData(status.invoice).then((accountChanges) => {
|
|
4896
4817
|
if (accountChanges) {
|
|
4818
|
+
this.accountData = accountChanges;
|
|
4897
4819
|
this.handleSavingStatus(status, accountChanges, checkStatus);
|
|
4898
4820
|
}
|
|
4899
4821
|
});
|
|
4900
4822
|
}
|
|
4901
4823
|
handleSavingStatus(status, account, checkStatus) {
|
|
4902
|
-
// const savingFailedOrCancel = status?.titleClass === TitleClass.cancel || status?.titleClass === TitleClass.cancelUser;
|
|
4903
|
-
//
|
|
4904
|
-
// const savingSuccessful = status?.titleClass === TitleClass.done && account;
|
|
4905
4824
|
if (this.savingSuccessful(account, status, checkStatus)) {
|
|
4906
4825
|
this.savePaymentMethodStatus = SavePaymentMethodStatus.success;
|
|
4907
4826
|
}
|
|
@@ -4910,10 +4829,7 @@ class SavePaymentMethodStatusService {
|
|
|
4910
4829
|
}
|
|
4911
4830
|
this.listenStatusService.stopListening();
|
|
4912
4831
|
this.listenStatusSubscription.unsubscribe();
|
|
4913
|
-
// const paymentAccountWasSaved = status?.titleClass === TitleClass.done && account !== null;
|
|
4914
4832
|
const isSavePaymentMethod = true;
|
|
4915
|
-
// this.savePaymentMethodStatus = this.savingFailedOrCancel(status) ? SavePaymentMethodStatus.success : SavePaymentMethodStatus.failed;
|
|
4916
|
-
console.log(status, isSavePaymentMethod, this.savePaymentMethodStatus);
|
|
4917
4833
|
this.nextActionService.emitFlowUpdates(new StatusUpdatedAction(status, isSavePaymentMethod, this.savePaymentMethodStatus));
|
|
4918
4834
|
}
|
|
4919
4835
|
}
|
|
@@ -4922,7 +4838,7 @@ SavePaymentMethodStatusService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion:
|
|
|
4922
4838
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: SavePaymentMethodStatusService, decorators: [{
|
|
4923
4839
|
type: Injectable,
|
|
4924
4840
|
args: [{
|
|
4925
|
-
providedIn: 'root'
|
|
4841
|
+
providedIn: 'root',
|
|
4926
4842
|
}]
|
|
4927
4843
|
}], ctorParameters: function () { return [{ type: StatusRequestService }, { type: ListenStatusService }, { type: SavedPaymentAccountChangesService }, { type: NextActionService }, { type: CheckStatusService }]; } });
|
|
4928
4844
|
|
|
@@ -4937,11 +4853,9 @@ class StatusService {
|
|
|
4937
4853
|
}
|
|
4938
4854
|
getStatus(params) {
|
|
4939
4855
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4940
|
-
// todo: если params.savePaymentMethod, то надо выполнить логику для
|
|
4941
|
-
// account status
|
|
4942
4856
|
const isSavePaymentMethodMode = !!(params === null || params === void 0 ? void 0 : params.isSavePaymentAccount);
|
|
4943
4857
|
if (isSavePaymentMethodMode) {
|
|
4944
|
-
return this.savePaymentMethodStatusService.getStatus(params);
|
|
4858
|
+
return this.savePaymentMethodStatusService.getStatus(params);
|
|
4945
4859
|
}
|
|
4946
4860
|
this.statusRequestService.setRequestParams(params);
|
|
4947
4861
|
this.startWaitingStatusUpdates(params.invoice);
|
|
@@ -4954,7 +4868,6 @@ class StatusService {
|
|
|
4954
4868
|
getStatusWithUrlSearchParams(url) {
|
|
4955
4869
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4956
4870
|
const searchParams = this.getRequestParamsFromUrl(url);
|
|
4957
|
-
console.log('searchParams', searchParams);
|
|
4958
4871
|
if (!searchParams) {
|
|
4959
4872
|
throw new Error('No required search params to get status');
|
|
4960
4873
|
}
|
|
@@ -5507,8 +5420,6 @@ class PaymentService {
|
|
|
5507
5420
|
this.emitFormFieldsStatus(this.form);
|
|
5508
5421
|
return;
|
|
5509
5422
|
}
|
|
5510
|
-
console.log('this.fields', this.fields);
|
|
5511
|
-
console.log('this.form', this.form);
|
|
5512
5423
|
this.isSavingMethodMode = this.fields.some(({ name, value }) => name === 'savePsAccountOnly' && value === "1" /* XpsBoolean.true */);
|
|
5513
5424
|
const submitResponse = yield this.submitService.request(this.fields, this.form);
|
|
5514
5425
|
this.data = submitResponse;
|
|
@@ -5570,8 +5481,6 @@ class PaymentService {
|
|
|
5570
5481
|
locale: (_d = (_c = this.data.fields.find((field) => field.name === 'locale')) === null || _c === void 0 ? void 0 : _c.value) !== null && _d !== void 0 ? _d : 'en',
|
|
5571
5482
|
isSavePaymentAccount: this.isSavingMethodMode ? 1 : 0,
|
|
5572
5483
|
};
|
|
5573
|
-
console.log('this.data', this.data);
|
|
5574
|
-
console.log('getStatus', params);
|
|
5575
5484
|
return this.statusService.getStatus(params);
|
|
5576
5485
|
});
|
|
5577
5486
|
}
|