@xsolla/payment-client-core 0.1.14-test8 → 0.1.14
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 +7 -17
- package/esm2020/lib/core/payment/actions/status-updated/status-updated.action.type.mjs +1 -1
- package/esm2020/lib/core/payment/config/config.service.mjs +6 -12
- package/esm2020/lib/core/payment/initialize/initialize-request-params.interface.mjs +1 -1
- package/esm2020/lib/core/payment/initialize/initialize.service.mjs +3 -8
- package/esm2020/lib/core/payment/payment-config.interface.mjs +1 -1
- package/esm2020/lib/core/payment/payment.service.mjs +2 -7
- package/esm2020/lib/core/payment/status/status-request/status-request-params.interface.mjs +1 -1
- package/esm2020/lib/core/payment/status/status-request/status-search-param.enum.mjs +1 -2
- package/esm2020/lib/core/payment/status/status-request/status-search-params.map.mjs +1 -8
- package/esm2020/lib/core/payment/status/status.service.mjs +4 -13
- package/esm2020/lib/core/payment/submit/response/submit-response.class.mjs +2 -8
- 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 -5
- package/esm2020/lib/core-library.service.mjs +2 -2
- package/fesm2015/xsolla-payment-client-core.mjs +150 -311
- package/fesm2015/xsolla-payment-client-core.mjs.map +1 -1
- package/fesm2020/xsolla-payment-client-core.mjs +147 -304
- package/fesm2020/xsolla-payment-client-core.mjs.map +1 -1
- package/lib/core/payment/actions/status-updated/status-updated.action.class.d.ts +1 -3
- package/lib/core/payment/actions/status-updated/status-updated.action.type.d.ts +0 -3
- package/lib/core/payment/initialize/initialize-request-params.interface.d.ts +0 -4
- package/lib/core/payment/payment-config.interface.d.ts +0 -3
- package/lib/core/payment/status/status-request/status-request-params.interface.d.ts +0 -1
- package/lib/core/payment/status/status-request/status-search-param.enum.d.ts +1 -2
- package/lib/core/payment/status/status.service.d.ts +1 -3
- package/lib/core/payment/submit/response/submit-response.class.d.ts +0 -1
- package/lib/core/payment-methods/payment-methods-request-params.interface.d.ts +0 -2
- package/lib/core/payment-methods/payment-methods.service.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.tgz +0 -0
- package/esm2020/lib/core/payment/status/save-payment-method-status/api/saved-payment-account-changes.interface.mjs +0 -2
- package/esm2020/lib/core/payment/status/save-payment-method-status/api/saved-payment-account-changes.service.mjs +0 -44
- package/esm2020/lib/core/payment/status/save-payment-method-status/api/saved-payment-account.interface.mjs +0 -2
- package/esm2020/lib/core/payment/status/save-payment-method-status/save-payment-method-status.enum.mjs +0 -6
- package/esm2020/lib/core/payment/status/save-payment-method-status/save-payment-method-status.service.mjs +0 -71
- package/lib/core/payment/status/save-payment-method-status/api/saved-payment-account-changes.interface.d.ts +0 -6
- package/lib/core/payment/status/save-payment-method-status/api/saved-payment-account-changes.service.d.ts +0 -16
- package/lib/core/payment/status/save-payment-method-status/api/saved-payment-account.interface.d.ts +0 -7
- package/lib/core/payment/status/save-payment-method-status/save-payment-method-status.enum.d.ts +0 -4
- package/lib/core/payment/status/save-payment-method-status/save-payment-method-status.service.d.ts +0 -22
- package/xsolla-payment-client-core-0.1.14-test8.tgz +0 -0
|
@@ -6,7 +6,7 @@ import * as i1 from '@angular/common/http';
|
|
|
6
6
|
import { HttpParams, HttpHeaders, HttpClientModule, HTTP_INTERCEPTORS } from '@angular/common/http';
|
|
7
7
|
import JSEncrypt from 'jsencrypt';
|
|
8
8
|
import { UntypedFormGroup, Validators, UntypedFormControl, ReactiveFormsModule } from '@angular/forms';
|
|
9
|
-
import { filter, map as map$1,
|
|
9
|
+
import { filter, map as map$1, catchError } from 'rxjs/operators';
|
|
10
10
|
import * as i1$1 from '@angular/router';
|
|
11
11
|
import { CommonModule } from '@angular/common';
|
|
12
12
|
|
|
@@ -244,9 +244,9 @@ class PaymentMethodsService {
|
|
|
244
244
|
this.apiRoute = 'remained_payment_methods';
|
|
245
245
|
this.cache = new Map();
|
|
246
246
|
}
|
|
247
|
-
getList(
|
|
247
|
+
getList() {
|
|
248
248
|
return __awaiter(this, void 0, void 0, function* () {
|
|
249
|
-
const response = yield this.request(
|
|
249
|
+
const response = yield this.request();
|
|
250
250
|
return response.remained;
|
|
251
251
|
});
|
|
252
252
|
}
|
|
@@ -256,12 +256,11 @@ class PaymentMethodsService {
|
|
|
256
256
|
return response.especial;
|
|
257
257
|
});
|
|
258
258
|
}
|
|
259
|
-
request(
|
|
259
|
+
request() {
|
|
260
260
|
return __awaiter(this, void 0, void 0, function* () {
|
|
261
261
|
const requestParams = {
|
|
262
262
|
access_token: this.settingsService.token,
|
|
263
263
|
country: this.countryService.getCountry(),
|
|
264
|
-
save_payment_account_only: isSaveMethodMode ? "1" /* XpsBoolean.true */ : "0" /* XpsBoolean.false */
|
|
265
264
|
};
|
|
266
265
|
const cacheKey = JSON.stringify(requestParams);
|
|
267
266
|
if (!this.cache.has(cacheKey)) {
|
|
@@ -479,18 +478,12 @@ class PaymentConfigService {
|
|
|
479
478
|
if (!config.returnUrl) {
|
|
480
479
|
throw new Error('URL is not provided in payment config');
|
|
481
480
|
}
|
|
482
|
-
return Object.assign(Object.assign({}, config), { returnUrl: this.enrichReturnUrl(config.returnUrl
|
|
481
|
+
return Object.assign(Object.assign({}, config), { returnUrl: this.enrichReturnUrl(config.returnUrl) });
|
|
483
482
|
}
|
|
484
|
-
enrichReturnUrl(returnUrl
|
|
485
|
-
|
|
486
|
-
token: this.settingsService.token
|
|
483
|
+
enrichReturnUrl(returnUrl) {
|
|
484
|
+
return this.urlService.addSearchParams(returnUrl, {
|
|
485
|
+
token: this.settingsService.token,
|
|
487
486
|
});
|
|
488
|
-
if (savePaymentMethod) {
|
|
489
|
-
enrichedUrl = this.urlService.addSearchParams(returnUrl, {
|
|
490
|
-
isSavePaymentAccount: "1" /* XpsBoolean.true */
|
|
491
|
-
});
|
|
492
|
-
}
|
|
493
|
-
return enrichedUrl;
|
|
494
487
|
}
|
|
495
488
|
}
|
|
496
489
|
PaymentConfigService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: PaymentConfigService, deps: [{ token: UrlService }, { token: SettingsService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
@@ -498,7 +491,7 @@ PaymentConfigService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0",
|
|
|
498
491
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: PaymentConfigService, decorators: [{
|
|
499
492
|
type: Injectable,
|
|
500
493
|
args: [{
|
|
501
|
-
providedIn: 'root'
|
|
494
|
+
providedIn: 'root',
|
|
502
495
|
}]
|
|
503
496
|
}], ctorParameters: function () { return [{ type: UrlService }, { type: SettingsService }]; } });
|
|
504
497
|
|
|
@@ -580,15 +573,9 @@ class SubmitResponse {
|
|
|
580
573
|
constructor(parameters, responseNumber = 0) {
|
|
581
574
|
var _a, _b, _c;
|
|
582
575
|
this.responseNumber = responseNumber;
|
|
583
|
-
this.isSavingMethodMode = false;
|
|
584
576
|
/* Todo split into properties */
|
|
585
577
|
this.parameters = parameters;
|
|
586
|
-
this.fields = Object.keys(parameters.form).map((key) =>
|
|
587
|
-
if (key === 'save_payment_account_only') {
|
|
588
|
-
this.isSavingMethodMode = parameters.form[key].value === "1" /* XpsBoolean.true */;
|
|
589
|
-
}
|
|
590
|
-
return parameters.form[key];
|
|
591
|
-
});
|
|
578
|
+
this.fields = Object.keys(parameters.form).map((key) => parameters.form[key]);
|
|
592
579
|
if (parameters.onlineBanking) {
|
|
593
580
|
this.onlineBanking = {
|
|
594
581
|
url: parameters.onlineBanking.value,
|
|
@@ -818,146 +805,15 @@ const checkStatusActionFactoryProvider = {
|
|
|
818
805
|
},
|
|
819
806
|
};
|
|
820
807
|
|
|
821
|
-
class TerminalError extends AppError {
|
|
822
|
-
constructor(message, code) {
|
|
823
|
-
super(message);
|
|
824
|
-
this.code = code;
|
|
825
|
-
}
|
|
826
|
-
}
|
|
827
|
-
|
|
828
|
-
var StatusGroups;
|
|
829
|
-
(function (StatusGroups) {
|
|
830
|
-
StatusGroups["troubled"] = "troubled";
|
|
831
|
-
StatusGroups["done"] = "done";
|
|
832
|
-
StatusGroups["invoice"] = "invoice";
|
|
833
|
-
})(StatusGroups || (StatusGroups = {}));
|
|
834
|
-
|
|
835
|
-
var StatusEnum;
|
|
836
|
-
(function (StatusEnum) {
|
|
837
|
-
StatusEnum["created"] = "created";
|
|
838
|
-
StatusEnum["awaiting"] = "awaiting";
|
|
839
|
-
StatusEnum["processing"] = "processing";
|
|
840
|
-
StatusEnum["authorized"] = "authorized";
|
|
841
|
-
StatusEnum["held"] = "held";
|
|
842
|
-
StatusEnum["done"] = "done";
|
|
843
|
-
StatusEnum["error"] = "error";
|
|
844
|
-
StatusEnum["canceled"] = "canceled";
|
|
845
|
-
})(StatusEnum || (StatusEnum = {}));
|
|
846
|
-
|
|
847
|
-
class StatusResponse {
|
|
848
|
-
constructor(parameters) {
|
|
849
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
850
|
-
if ((_a = parameters.errors) === null || _a === void 0 ? void 0 : _a[0]) {
|
|
851
|
-
this.error = {
|
|
852
|
-
code: parameters.errors[0].code.toString(),
|
|
853
|
-
message: parameters.errors[0].message,
|
|
854
|
-
};
|
|
855
|
-
}
|
|
856
|
-
if (!parameters.status) {
|
|
857
|
-
throw new TerminalError((_c = (_b = this.error) === null || _b === void 0 ? void 0 : _b.message) !== null && _c !== void 0 ? _c : '', (_e = (_d = this.error) === null || _d === void 0 ? void 0 : _d.code.toString()) !== null && _e !== void 0 ? _e : '');
|
|
858
|
-
}
|
|
859
|
-
this.status = {
|
|
860
|
-
statusState: parameters.status.statusData.stateText,
|
|
861
|
-
email: parameters.status.statusData.email,
|
|
862
|
-
webSocketUrl: parameters.status.statusData.webSocketChannelUrl,
|
|
863
|
-
webSocketChannelName: parameters.status.statusData.webSocketChannelName,
|
|
864
|
-
webSocketClientType: parameters.status.statusData.webSocketClientType,
|
|
865
|
-
financeInfo: parameters.status.text.info,
|
|
866
|
-
discount: parameters.status.text.info.discount
|
|
867
|
-
? Math.abs(Number.parseFloat((_g = (_f = parameters.status.text.info.discount) === null || _f === void 0 ? void 0 : _f.value) !== null && _g !== void 0 ? _g : ''))
|
|
868
|
-
: null,
|
|
869
|
-
isCancelUser: parameters.status.isCancelUser,
|
|
870
|
-
postMessageStatus: parameters.status.isCancelUser
|
|
871
|
-
? StatusGroups.troubled
|
|
872
|
-
: parameters.status.group,
|
|
873
|
-
virtualCurrencyAmount: parameters.status.statusData.out,
|
|
874
|
-
backUrlSettings: {
|
|
875
|
-
backUrl: parameters.status.text.backurl,
|
|
876
|
-
backUrlAction: parameters.status.text.backurl_action,
|
|
877
|
-
backUrlCaption: parameters.status.text.backurl_caption,
|
|
878
|
-
returnRegion: parameters.status.return_region,
|
|
879
|
-
},
|
|
880
|
-
additionalBackButton: this.getAdditionalBackButton(parameters.status),
|
|
881
|
-
group: parameters.status.group,
|
|
882
|
-
needToCheck: parameters.status.needToCheck,
|
|
883
|
-
autoRedirect: parameters.status.autoredirect,
|
|
884
|
-
statusMessage: parameters.status.text.state,
|
|
885
|
-
userId: parameters.status.statusData.v1,
|
|
886
|
-
invoice: parameters.status.statusData.invoice,
|
|
887
|
-
pid: parameters.status.statusData.pid,
|
|
888
|
-
projectAmount: this.getProjectAmount(parameters.status),
|
|
889
|
-
titleClass: parameters.status.title_class,
|
|
890
|
-
paymentCountryIso: parameters.status.statusData.payment_country_iso,
|
|
891
|
-
order: parameters.status.text.order,
|
|
892
|
-
};
|
|
893
|
-
if (parameters.form) {
|
|
894
|
-
this.status.userReturnStatus = this.getUserReturnStatus(parameters.form);
|
|
895
|
-
}
|
|
896
|
-
if (this.status.statusState === StatusEnum.done ||
|
|
897
|
-
this.status.statusState === StatusEnum.authorized) {
|
|
898
|
-
this.status.isSuccess = true;
|
|
899
|
-
}
|
|
900
|
-
if (this.status.statusState === StatusEnum.canceled ||
|
|
901
|
-
this.status.isCancelUser) {
|
|
902
|
-
this.status.isCanceled = true;
|
|
903
|
-
}
|
|
904
|
-
}
|
|
905
|
-
getUserReturnStatus(form) {
|
|
906
|
-
var _a;
|
|
907
|
-
const value = (_a = form['fix_userReturnStatus']) === null || _a === void 0 ? void 0 : _a.value;
|
|
908
|
-
if (value === 'undefined')
|
|
909
|
-
return undefined;
|
|
910
|
-
return value;
|
|
911
|
-
}
|
|
912
|
-
getProjectAmount(status) {
|
|
913
|
-
if (!status.statusData.projectAmount) {
|
|
914
|
-
return;
|
|
915
|
-
}
|
|
916
|
-
const [amount, currency] = status.statusData.projectAmount.split(' ');
|
|
917
|
-
return {
|
|
918
|
-
amount,
|
|
919
|
-
currency,
|
|
920
|
-
};
|
|
921
|
-
}
|
|
922
|
-
getAdditionalBackButton(status) {
|
|
923
|
-
var _a, _b, _c, _d;
|
|
924
|
-
if (!status.text.is_additional_back_url_enabled) {
|
|
925
|
-
return {
|
|
926
|
-
link: '',
|
|
927
|
-
action: '',
|
|
928
|
-
label: '',
|
|
929
|
-
region: '',
|
|
930
|
-
isEnabled: false,
|
|
931
|
-
};
|
|
932
|
-
}
|
|
933
|
-
return {
|
|
934
|
-
link: (_a = status.text.additional_back_url_link) !== null && _a !== void 0 ? _a : '',
|
|
935
|
-
action: (_b = status.text.additional_back_url_action) !== null && _b !== void 0 ? _b : '',
|
|
936
|
-
label: (_c = status.text.additional_back_url_label) !== null && _c !== void 0 ? _c : '',
|
|
937
|
-
region: (_d = status.additional_button_return_region) !== null && _d !== void 0 ? _d : '',
|
|
938
|
-
isEnabled: status.text.is_additional_back_url_enabled,
|
|
939
|
-
};
|
|
940
|
-
}
|
|
941
|
-
}
|
|
942
|
-
|
|
943
808
|
class StatusUpdatedAction {
|
|
944
|
-
constructor(statusResponse
|
|
809
|
+
constructor(statusResponse) {
|
|
945
810
|
this.type = 'status_updated';
|
|
946
|
-
let status;
|
|
947
|
-
if (statusResponse instanceof StatusResponse) {
|
|
948
|
-
status = statusResponse.status;
|
|
949
|
-
}
|
|
950
|
-
else {
|
|
951
|
-
status = statusResponse;
|
|
952
|
-
}
|
|
953
811
|
this.data = {
|
|
954
|
-
statusState: status.statusState,
|
|
955
|
-
invoice: status.invoice,
|
|
956
|
-
isSuccess: status.isSuccess,
|
|
957
|
-
isCanceled: status.isCanceled,
|
|
958
|
-
group: status.group,
|
|
959
|
-
isSavePaymentMethodMode,
|
|
960
|
-
savePaymentMethodStatus
|
|
812
|
+
statusState: statusResponse.status.statusState,
|
|
813
|
+
invoice: statusResponse.status.invoice,
|
|
814
|
+
isSuccess: statusResponse.status.isSuccess,
|
|
815
|
+
isCanceled: statusResponse.status.isCanceled,
|
|
816
|
+
group: statusResponse.status.group,
|
|
961
817
|
};
|
|
962
818
|
}
|
|
963
819
|
}
|
|
@@ -1598,11 +1454,6 @@ class InitializeService {
|
|
|
1598
1454
|
refer: this.ps4ReferId,
|
|
1599
1455
|
country: this.countryService.getCountry(),
|
|
1600
1456
|
returnUrl: config.returnUrl,
|
|
1601
|
-
paymentWithSavedMethod: config.paymentWithSavedMethod === true
|
|
1602
|
-
? "1" /* XpsBoolean.true */
|
|
1603
|
-
: "0" /* XpsBoolean.false */,
|
|
1604
|
-
saved_method_id: config.savedMethodId,
|
|
1605
|
-
save_payment_account_only: !!config.savePaymentMethod ? "1" /* XpsBoolean.true */ : "0" /* XpsBoolean.false */
|
|
1606
1457
|
};
|
|
1607
1458
|
return this.xpsApiService
|
|
1608
1459
|
.directPaymentRequest(requestParams)
|
|
@@ -1636,7 +1487,7 @@ InitializeService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", ve
|
|
|
1636
1487
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: InitializeService, decorators: [{
|
|
1637
1488
|
type: Injectable,
|
|
1638
1489
|
args: [{
|
|
1639
|
-
providedIn: 'root'
|
|
1490
|
+
providedIn: 'root',
|
|
1640
1491
|
}]
|
|
1641
1492
|
}], ctorParameters: function () {
|
|
1642
1493
|
return [{ type: undefined, decorators: [{
|
|
@@ -3024,7 +2875,6 @@ var StatusSearchParam;
|
|
|
3024
2875
|
StatusSearchParam["testPs"] = "fix_testPs";
|
|
3025
2876
|
StatusSearchParam["testXsolla"] = "fix_testXsolla";
|
|
3026
2877
|
StatusSearchParam["userReturnStatus"] = "fix_userReturnStatus";
|
|
3027
|
-
StatusSearchParam["isSavePaymentAccount"] = "isSavePaymentAccount";
|
|
3028
2878
|
})(StatusSearchParam || (StatusSearchParam = {}));
|
|
3029
2879
|
|
|
3030
2880
|
const requiredStatusSearchParams = [
|
|
@@ -3104,15 +2954,15 @@ const statusSearchParamsMap = new Map([
|
|
|
3104
2954
|
converter: numberConverter,
|
|
3105
2955
|
},
|
|
3106
2956
|
],
|
|
3107
|
-
[
|
|
3108
|
-
StatusSearchParam.isSavePaymentAccount,
|
|
3109
|
-
{
|
|
3110
|
-
key: 'isSavePaymentAccount',
|
|
3111
|
-
converter: numberConverter,
|
|
3112
|
-
},
|
|
3113
|
-
],
|
|
3114
2957
|
]);
|
|
3115
2958
|
|
|
2959
|
+
class TerminalError extends AppError {
|
|
2960
|
+
constructor(message, code) {
|
|
2961
|
+
super(message);
|
|
2962
|
+
this.code = code;
|
|
2963
|
+
}
|
|
2964
|
+
}
|
|
2965
|
+
|
|
3116
2966
|
class XpsApiPart {
|
|
3117
2967
|
constructor() {
|
|
3118
2968
|
this.response = new BehaviorSubject(null);
|
|
@@ -3156,6 +3006,121 @@ const statusRequestFactoryProvider = {
|
|
|
3156
3006
|
useValue: (...args) => new StatusRequest(...args),
|
|
3157
3007
|
};
|
|
3158
3008
|
|
|
3009
|
+
var StatusGroups;
|
|
3010
|
+
(function (StatusGroups) {
|
|
3011
|
+
StatusGroups["troubled"] = "troubled";
|
|
3012
|
+
StatusGroups["done"] = "done";
|
|
3013
|
+
StatusGroups["invoice"] = "invoice";
|
|
3014
|
+
})(StatusGroups || (StatusGroups = {}));
|
|
3015
|
+
|
|
3016
|
+
var StatusEnum;
|
|
3017
|
+
(function (StatusEnum) {
|
|
3018
|
+
StatusEnum["created"] = "created";
|
|
3019
|
+
StatusEnum["awaiting"] = "awaiting";
|
|
3020
|
+
StatusEnum["processing"] = "processing";
|
|
3021
|
+
StatusEnum["authorized"] = "authorized";
|
|
3022
|
+
StatusEnum["held"] = "held";
|
|
3023
|
+
StatusEnum["done"] = "done";
|
|
3024
|
+
StatusEnum["error"] = "error";
|
|
3025
|
+
StatusEnum["canceled"] = "canceled";
|
|
3026
|
+
})(StatusEnum || (StatusEnum = {}));
|
|
3027
|
+
|
|
3028
|
+
class StatusResponse {
|
|
3029
|
+
constructor(parameters) {
|
|
3030
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
3031
|
+
if ((_a = parameters.errors) === null || _a === void 0 ? void 0 : _a[0]) {
|
|
3032
|
+
this.error = {
|
|
3033
|
+
code: parameters.errors[0].code.toString(),
|
|
3034
|
+
message: parameters.errors[0].message,
|
|
3035
|
+
};
|
|
3036
|
+
}
|
|
3037
|
+
if (!parameters.status) {
|
|
3038
|
+
throw new TerminalError((_c = (_b = this.error) === null || _b === void 0 ? void 0 : _b.message) !== null && _c !== void 0 ? _c : '', (_e = (_d = this.error) === null || _d === void 0 ? void 0 : _d.code.toString()) !== null && _e !== void 0 ? _e : '');
|
|
3039
|
+
}
|
|
3040
|
+
this.status = {
|
|
3041
|
+
statusState: parameters.status.statusData.stateText,
|
|
3042
|
+
email: parameters.status.statusData.email,
|
|
3043
|
+
webSocketUrl: parameters.status.statusData.webSocketChannelUrl,
|
|
3044
|
+
webSocketChannelName: parameters.status.statusData.webSocketChannelName,
|
|
3045
|
+
webSocketClientType: parameters.status.statusData.webSocketClientType,
|
|
3046
|
+
financeInfo: parameters.status.text.info,
|
|
3047
|
+
discount: parameters.status.text.info.discount
|
|
3048
|
+
? Math.abs(Number.parseFloat((_g = (_f = parameters.status.text.info.discount) === null || _f === void 0 ? void 0 : _f.value) !== null && _g !== void 0 ? _g : ''))
|
|
3049
|
+
: null,
|
|
3050
|
+
isCancelUser: parameters.status.isCancelUser,
|
|
3051
|
+
postMessageStatus: parameters.status.isCancelUser
|
|
3052
|
+
? StatusGroups.troubled
|
|
3053
|
+
: parameters.status.group,
|
|
3054
|
+
virtualCurrencyAmount: parameters.status.statusData.out,
|
|
3055
|
+
backUrlSettings: {
|
|
3056
|
+
backUrl: parameters.status.text.backurl,
|
|
3057
|
+
backUrlAction: parameters.status.text.backurl_action,
|
|
3058
|
+
backUrlCaption: parameters.status.text.backurl_caption,
|
|
3059
|
+
returnRegion: parameters.status.return_region,
|
|
3060
|
+
},
|
|
3061
|
+
additionalBackButton: this.getAdditionalBackButton(parameters.status),
|
|
3062
|
+
group: parameters.status.group,
|
|
3063
|
+
needToCheck: parameters.status.needToCheck,
|
|
3064
|
+
autoRedirect: parameters.status.autoredirect,
|
|
3065
|
+
statusMessage: parameters.status.text.state,
|
|
3066
|
+
userId: parameters.status.statusData.v1,
|
|
3067
|
+
invoice: parameters.status.statusData.invoice,
|
|
3068
|
+
pid: parameters.status.statusData.pid,
|
|
3069
|
+
projectAmount: this.getProjectAmount(parameters.status),
|
|
3070
|
+
titleClass: parameters.status.title_class,
|
|
3071
|
+
paymentCountryIso: parameters.status.statusData.payment_country_iso,
|
|
3072
|
+
order: parameters.status.text.order,
|
|
3073
|
+
};
|
|
3074
|
+
if (parameters.form) {
|
|
3075
|
+
this.status.userReturnStatus = this.getUserReturnStatus(parameters.form);
|
|
3076
|
+
}
|
|
3077
|
+
if (this.status.statusState === StatusEnum.done ||
|
|
3078
|
+
this.status.statusState === StatusEnum.authorized) {
|
|
3079
|
+
this.status.isSuccess = true;
|
|
3080
|
+
}
|
|
3081
|
+
if (this.status.statusState === StatusEnum.canceled ||
|
|
3082
|
+
this.status.isCancelUser) {
|
|
3083
|
+
this.status.isCanceled = true;
|
|
3084
|
+
}
|
|
3085
|
+
}
|
|
3086
|
+
getUserReturnStatus(form) {
|
|
3087
|
+
var _a;
|
|
3088
|
+
const value = (_a = form['fix_userReturnStatus']) === null || _a === void 0 ? void 0 : _a.value;
|
|
3089
|
+
if (value === 'undefined')
|
|
3090
|
+
return undefined;
|
|
3091
|
+
return value;
|
|
3092
|
+
}
|
|
3093
|
+
getProjectAmount(status) {
|
|
3094
|
+
if (!status.statusData.projectAmount) {
|
|
3095
|
+
return;
|
|
3096
|
+
}
|
|
3097
|
+
const [amount, currency] = status.statusData.projectAmount.split(' ');
|
|
3098
|
+
return {
|
|
3099
|
+
amount,
|
|
3100
|
+
currency,
|
|
3101
|
+
};
|
|
3102
|
+
}
|
|
3103
|
+
getAdditionalBackButton(status) {
|
|
3104
|
+
var _a, _b, _c, _d;
|
|
3105
|
+
if (!status.text.is_additional_back_url_enabled) {
|
|
3106
|
+
return {
|
|
3107
|
+
link: '',
|
|
3108
|
+
action: '',
|
|
3109
|
+
label: '',
|
|
3110
|
+
region: '',
|
|
3111
|
+
isEnabled: false,
|
|
3112
|
+
};
|
|
3113
|
+
}
|
|
3114
|
+
return {
|
|
3115
|
+
link: (_a = status.text.additional_back_url_link) !== null && _a !== void 0 ? _a : '',
|
|
3116
|
+
action: (_b = status.text.additional_back_url_action) !== null && _b !== void 0 ? _b : '',
|
|
3117
|
+
label: (_c = status.text.additional_back_url_label) !== null && _c !== void 0 ? _c : '',
|
|
3118
|
+
region: (_d = status.additional_button_return_region) !== null && _d !== void 0 ? _d : '',
|
|
3119
|
+
isEnabled: status.text.is_additional_back_url_enabled,
|
|
3120
|
+
};
|
|
3121
|
+
}
|
|
3122
|
+
}
|
|
3123
|
+
|
|
3159
3124
|
const statusResponseFactoryToken = new InjectionToken('StatusResponse');
|
|
3160
3125
|
const statusResponseFactoryProvider = {
|
|
3161
3126
|
provide: statusResponseFactoryToken,
|
|
@@ -4685,142 +4650,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImpor
|
|
|
4685
4650
|
}]
|
|
4686
4651
|
}], ctorParameters: function () { return [{ type: StatusRequestService }, { type: CheckStatusService }, { type: WebsocketStatusService }]; } });
|
|
4687
4652
|
|
|
4688
|
-
var TitleClass;
|
|
4689
|
-
(function (TitleClass) {
|
|
4690
|
-
TitleClass["done"] = "done";
|
|
4691
|
-
TitleClass["cancel"] = "cancel";
|
|
4692
|
-
TitleClass["cancelUser"] = "canceluser";
|
|
4693
|
-
})(TitleClass || (TitleClass = {}));
|
|
4694
|
-
|
|
4695
|
-
var SavePaymentMethodStatus;
|
|
4696
|
-
(function (SavePaymentMethodStatus) {
|
|
4697
|
-
SavePaymentMethodStatus["success"] = "success";
|
|
4698
|
-
SavePaymentMethodStatus["failed"] = "failed";
|
|
4699
|
-
})(SavePaymentMethodStatus || (SavePaymentMethodStatus = {}));
|
|
4700
|
-
|
|
4701
|
-
class XpsResponseError extends AppError {
|
|
4702
|
-
constructor(message) {
|
|
4703
|
-
super('XPS response failed' + (message ? `: "${message}".` : '.'));
|
|
4704
|
-
}
|
|
4705
|
-
}
|
|
4706
|
-
|
|
4707
|
-
class SavedPaymentAccountChangesService {
|
|
4708
|
-
constructor(settingsService, secureApi) {
|
|
4709
|
-
this.settingsService = settingsService;
|
|
4710
|
-
this.secureApi = secureApi;
|
|
4711
|
-
this.apiRoute = 'savedmethods/newaccountinfo';
|
|
4712
|
-
this.response = new Subject();
|
|
4713
|
-
}
|
|
4714
|
-
get response$() {
|
|
4715
|
-
return this.response.asObservable();
|
|
4716
|
-
}
|
|
4717
|
-
request(invoice) {
|
|
4718
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
4719
|
-
const requestParameters = {
|
|
4720
|
-
access_token: this.settingsService.token,
|
|
4721
|
-
invoice_id: invoice,
|
|
4722
|
-
};
|
|
4723
|
-
return lastValueFrom(this.secureApi
|
|
4724
|
-
.post(this.apiRoute, new URLSearchParams(requestParameters), {
|
|
4725
|
-
headers: new HttpHeaders().set('Content-Type', 'application/x-www-form-urlencoded; charset=utf-8'),
|
|
4726
|
-
responseType: 'json',
|
|
4727
|
-
})
|
|
4728
|
-
.pipe(tap((value) => {
|
|
4729
|
-
this.response.next(value);
|
|
4730
|
-
}))).catch((error) => {
|
|
4731
|
-
throw new XpsResponseError(error.message);
|
|
4732
|
-
});
|
|
4733
|
-
});
|
|
4734
|
-
}
|
|
4735
|
-
}
|
|
4736
|
-
SavedPaymentAccountChangesService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: SavedPaymentAccountChangesService, deps: [{ token: SettingsService }, { token: SecureApiClient }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
4737
|
-
SavedPaymentAccountChangesService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: SavedPaymentAccountChangesService, providedIn: 'root' });
|
|
4738
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: SavedPaymentAccountChangesService, decorators: [{
|
|
4739
|
-
type: Injectable,
|
|
4740
|
-
args: [{
|
|
4741
|
-
providedIn: 'root'
|
|
4742
|
-
}]
|
|
4743
|
-
}], ctorParameters: function () { return [{ type: SettingsService }, { type: SecureApiClient }]; } });
|
|
4744
|
-
|
|
4745
|
-
class SavePaymentMethodStatusService {
|
|
4746
|
-
constructor(statusRequestService, listenStatusService, savedPaymentAccountChangesService, nextActionService) {
|
|
4747
|
-
this.statusRequestService = statusRequestService;
|
|
4748
|
-
this.listenStatusService = listenStatusService;
|
|
4749
|
-
this.savedPaymentAccountChangesService = savedPaymentAccountChangesService;
|
|
4750
|
-
this.nextActionService = nextActionService;
|
|
4751
|
-
}
|
|
4752
|
-
getStatus(params) {
|
|
4753
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
4754
|
-
this.statusRequestService.setRequestParams(params);
|
|
4755
|
-
this.startWaitingStatusUpdates(params.invoice);
|
|
4756
|
-
this.statusRequestService.request();
|
|
4757
|
-
const statusResponse = yield firstValueFrom(this.statusRequestService.response$);
|
|
4758
|
-
if (!this.savePaymentMethodStatus) {
|
|
4759
|
-
statusResponse.status.statusState = StatusEnum.processing;
|
|
4760
|
-
}
|
|
4761
|
-
return statusResponse.status;
|
|
4762
|
-
});
|
|
4763
|
-
}
|
|
4764
|
-
startWaitingStatusUpdates(invoice) {
|
|
4765
|
-
this.listenStatusService.listen(invoice);
|
|
4766
|
-
this.listenStatusSubscription = this.listenStatusService.statusUpdated$
|
|
4767
|
-
.subscribe(({ statusResponse }) => {
|
|
4768
|
-
if (statusResponse.status) {
|
|
4769
|
-
this.loadNewPaymentAccountData(statusResponse.status);
|
|
4770
|
-
}
|
|
4771
|
-
});
|
|
4772
|
-
}
|
|
4773
|
-
loadNewPaymentAccountData(status) {
|
|
4774
|
-
if (!status.invoice) {
|
|
4775
|
-
return;
|
|
4776
|
-
}
|
|
4777
|
-
void this.savedPaymentAccountChangesService
|
|
4778
|
-
.request(status.invoice)
|
|
4779
|
-
.then((accountChanges) => {
|
|
4780
|
-
if (accountChanges) {
|
|
4781
|
-
this.handleSavingStatus(status, accountChanges.new_account);
|
|
4782
|
-
}
|
|
4783
|
-
});
|
|
4784
|
-
}
|
|
4785
|
-
handleSavingStatus(status, account) {
|
|
4786
|
-
this.listenStatusService.stopListening();
|
|
4787
|
-
this.listenStatusSubscription.unsubscribe();
|
|
4788
|
-
const updatingIsProcessing = (status === null || status === void 0 ? void 0 : status.titleClass) !== TitleClass.cancel && (status === null || status === void 0 ? void 0 : status.titleClass) !== TitleClass.cancelUser && !account;
|
|
4789
|
-
if (updatingIsProcessing) {
|
|
4790
|
-
return;
|
|
4791
|
-
}
|
|
4792
|
-
const paymentAccountWasSaved = (status === null || status === void 0 ? void 0 : status.titleClass) === TitleClass.done && account !== null;
|
|
4793
|
-
const isSavePaymentMethod = true;
|
|
4794
|
-
this.savePaymentMethodStatus = paymentAccountWasSaved ? SavePaymentMethodStatus.success : SavePaymentMethodStatus.failed;
|
|
4795
|
-
this.nextActionService.emitFlowUpdates(new StatusUpdatedAction(status, isSavePaymentMethod, this.savePaymentMethodStatus));
|
|
4796
|
-
}
|
|
4797
|
-
}
|
|
4798
|
-
SavePaymentMethodStatusService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: SavePaymentMethodStatusService, deps: [{ token: StatusRequestService }, { token: ListenStatusService }, { token: SavedPaymentAccountChangesService }, { token: NextActionService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
4799
|
-
SavePaymentMethodStatusService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: SavePaymentMethodStatusService, providedIn: 'root' });
|
|
4800
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: SavePaymentMethodStatusService, decorators: [{
|
|
4801
|
-
type: Injectable,
|
|
4802
|
-
args: [{
|
|
4803
|
-
providedIn: 'root'
|
|
4804
|
-
}]
|
|
4805
|
-
}], ctorParameters: function () { return [{ type: StatusRequestService }, { type: ListenStatusService }, { type: SavedPaymentAccountChangesService }, { type: NextActionService }]; } });
|
|
4806
|
-
|
|
4807
4653
|
class StatusService {
|
|
4808
|
-
constructor(urlService, statusRequestService, financeDetailsService, listenStatusService, nextActionService
|
|
4654
|
+
constructor(urlService, statusRequestService, financeDetailsService, listenStatusService, nextActionService) {
|
|
4809
4655
|
this.urlService = urlService;
|
|
4810
4656
|
this.statusRequestService = statusRequestService;
|
|
4811
4657
|
this.financeDetailsService = financeDetailsService;
|
|
4812
4658
|
this.listenStatusService = listenStatusService;
|
|
4813
4659
|
this.nextActionService = nextActionService;
|
|
4814
|
-
this.savePaymentMethodStatusService = savePaymentMethodStatusService;
|
|
4815
4660
|
}
|
|
4816
4661
|
getStatus(params) {
|
|
4817
4662
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4818
|
-
// todo: если params.savePaymentMethod, то надо выполнить логику для
|
|
4819
|
-
// account status
|
|
4820
|
-
const isSavePaymentMethodMode = !!(params === null || params === void 0 ? void 0 : params.isSavePaymentAccount);
|
|
4821
|
-
if (isSavePaymentMethodMode) {
|
|
4822
|
-
return this.savePaymentMethodStatusService.getStatus(params); // todo: saveMethodStatus.getStatus();
|
|
4823
|
-
}
|
|
4824
4663
|
this.statusRequestService.setRequestParams(params);
|
|
4825
4664
|
this.startWaitingStatusUpdates(params.invoice);
|
|
4826
4665
|
this.statusRequestService.request();
|
|
@@ -4832,7 +4671,6 @@ class StatusService {
|
|
|
4832
4671
|
getStatusWithUrlSearchParams(url) {
|
|
4833
4672
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4834
4673
|
const searchParams = this.getRequestParamsFromUrl(url);
|
|
4835
|
-
console.log('searchParams', searchParams);
|
|
4836
4674
|
if (!searchParams) {
|
|
4837
4675
|
throw new Error('No required search params to get status');
|
|
4838
4676
|
}
|
|
@@ -4861,14 +4699,14 @@ class StatusService {
|
|
|
4861
4699
|
});
|
|
4862
4700
|
}
|
|
4863
4701
|
}
|
|
4864
|
-
StatusService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: StatusService, deps: [{ token: UrlService }, { token: StatusRequestService }, { token: FinanceDetailsService }, { token: ListenStatusService }, { token: NextActionService }
|
|
4702
|
+
StatusService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: StatusService, deps: [{ token: UrlService }, { token: StatusRequestService }, { token: FinanceDetailsService }, { token: ListenStatusService }, { token: NextActionService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
4865
4703
|
StatusService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: StatusService, providedIn: 'root' });
|
|
4866
4704
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: StatusService, decorators: [{
|
|
4867
4705
|
type: Injectable,
|
|
4868
4706
|
args: [{
|
|
4869
4707
|
providedIn: 'root',
|
|
4870
4708
|
}]
|
|
4871
|
-
}], ctorParameters: function () { return [{ type: UrlService }, { type: StatusRequestService }, { type: FinanceDetailsService }, { type: ListenStatusService }, { type: NextActionService }
|
|
4709
|
+
}], ctorParameters: function () { return [{ type: UrlService }, { type: StatusRequestService }, { type: FinanceDetailsService }, { type: ListenStatusService }, { type: NextActionService }]; } });
|
|
4872
4710
|
|
|
4873
4711
|
class CreditCardStateService extends EmitDataService {
|
|
4874
4712
|
}
|
|
@@ -4893,6 +4731,12 @@ var ThreeDsStatusTypes;
|
|
|
4893
4731
|
ThreeDsStatusTypes["collectDfp"] = "collect_dfp";
|
|
4894
4732
|
})(ThreeDsStatusTypes || (ThreeDsStatusTypes = {}));
|
|
4895
4733
|
|
|
4734
|
+
class XpsResponseError extends AppError {
|
|
4735
|
+
constructor(message) {
|
|
4736
|
+
super('XPS response failed' + (message ? `: "${message}".` : '.'));
|
|
4737
|
+
}
|
|
4738
|
+
}
|
|
4739
|
+
|
|
4896
4740
|
class StatusThreeDsRequest {
|
|
4897
4741
|
constructor(token, threeDsId) {
|
|
4898
4742
|
this.access_token = token;
|
|
@@ -5386,9 +5230,7 @@ class PaymentService {
|
|
|
5386
5230
|
}
|
|
5387
5231
|
const submitResponse = yield this.submitService.request(this.fields, this.form);
|
|
5388
5232
|
this.data = submitResponse;
|
|
5389
|
-
|
|
5390
|
-
this.emitFinanceDetails(submitResponse.summary);
|
|
5391
|
-
}
|
|
5233
|
+
this.emitFinanceDetails(submitResponse.summary);
|
|
5392
5234
|
this.emitFormMessages(submitResponse.messages);
|
|
5393
5235
|
// Handle 3ds flow
|
|
5394
5236
|
if (submitResponse.currentCommand === XpsCommand.create) {
|
|
@@ -5442,10 +5284,7 @@ class PaymentService {
|
|
|
5442
5284
|
invoice: parseInt((_a = this.data.fixInvoice) !== null && _a !== void 0 ? _a : ''),
|
|
5443
5285
|
signature: (_b = this.data.signature) !== null && _b !== void 0 ? _b : '',
|
|
5444
5286
|
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',
|
|
5445
|
-
isSavePaymentAccount: this.data.isSavingMethodMode ? 1 : 0,
|
|
5446
5287
|
};
|
|
5447
|
-
console.log('this.data', this.data);
|
|
5448
|
-
console.log('getStatus', params);
|
|
5449
5288
|
return this.statusService.getStatus(params);
|
|
5450
5289
|
});
|
|
5451
5290
|
}
|
|
@@ -5669,7 +5508,7 @@ class CoreLibraryService {
|
|
|
5669
5508
|
this.creditCardStateService = creditCardStateService;
|
|
5670
5509
|
this.formMessagesService = formMessagesService;
|
|
5671
5510
|
this.paymentMethods = {
|
|
5672
|
-
getList: (
|
|
5511
|
+
getList: () => __awaiter(this, void 0, void 0, function* () { return this.paymentMethodsService.getList(); }),
|
|
5673
5512
|
getQuickMethods: () => __awaiter(this, void 0, void 0, function* () { return this.paymentMethodsService.getQuickMethods(); }),
|
|
5674
5513
|
getSavedMethods: () => __awaiter(this, void 0, void 0, function* () { return this.savedMethodsService.getList(); }),
|
|
5675
5514
|
getUserBalance: () => __awaiter(this, void 0, void 0, function* () { return this.userBalanceService.getUserBalance(); }),
|