@xsolla/payment-client-core 0.1.14-test9 → 0.1.15
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 -4
- package/esm2020/lib/core/payment/payment-config.interface.mjs +1 -1
- package/esm2020/lib/core/payment/payment.service.mjs +2 -9
- 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 -309
- package/fesm2015/xsolla-payment-client-core.mjs.map +1 -1
- package/fesm2020/xsolla-payment-client-core.mjs +147 -302
- 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 +1 -2
- package/lib/core/payment/payment-config.interface.d.ts +0 -1
- 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.15.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-test9.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
|
}
|
|
@@ -1602,7 +1458,6 @@ class InitializeService {
|
|
|
1602
1458
|
? "1" /* XpsBoolean.true */
|
|
1603
1459
|
: "0" /* XpsBoolean.false */,
|
|
1604
1460
|
saved_method_id: config.savedMethodId,
|
|
1605
|
-
save_payment_account_only: !!config.savePaymentMethod ? "1" /* XpsBoolean.true */ : "0" /* XpsBoolean.false */
|
|
1606
1461
|
};
|
|
1607
1462
|
return this.xpsApiService
|
|
1608
1463
|
.directPaymentRequest(requestParams)
|
|
@@ -1636,7 +1491,7 @@ InitializeService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", ve
|
|
|
1636
1491
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: InitializeService, decorators: [{
|
|
1637
1492
|
type: Injectable,
|
|
1638
1493
|
args: [{
|
|
1639
|
-
providedIn: 'root'
|
|
1494
|
+
providedIn: 'root',
|
|
1640
1495
|
}]
|
|
1641
1496
|
}], ctorParameters: function () {
|
|
1642
1497
|
return [{ type: undefined, decorators: [{
|
|
@@ -3024,7 +2879,6 @@ var StatusSearchParam;
|
|
|
3024
2879
|
StatusSearchParam["testPs"] = "fix_testPs";
|
|
3025
2880
|
StatusSearchParam["testXsolla"] = "fix_testXsolla";
|
|
3026
2881
|
StatusSearchParam["userReturnStatus"] = "fix_userReturnStatus";
|
|
3027
|
-
StatusSearchParam["isSavePaymentAccount"] = "isSavePaymentAccount";
|
|
3028
2882
|
})(StatusSearchParam || (StatusSearchParam = {}));
|
|
3029
2883
|
|
|
3030
2884
|
const requiredStatusSearchParams = [
|
|
@@ -3104,15 +2958,15 @@ const statusSearchParamsMap = new Map([
|
|
|
3104
2958
|
converter: numberConverter,
|
|
3105
2959
|
},
|
|
3106
2960
|
],
|
|
3107
|
-
[
|
|
3108
|
-
StatusSearchParam.isSavePaymentAccount,
|
|
3109
|
-
{
|
|
3110
|
-
key: 'isSavePaymentAccount',
|
|
3111
|
-
converter: numberConverter,
|
|
3112
|
-
},
|
|
3113
|
-
],
|
|
3114
2961
|
]);
|
|
3115
2962
|
|
|
2963
|
+
class TerminalError extends AppError {
|
|
2964
|
+
constructor(message, code) {
|
|
2965
|
+
super(message);
|
|
2966
|
+
this.code = code;
|
|
2967
|
+
}
|
|
2968
|
+
}
|
|
2969
|
+
|
|
3116
2970
|
class XpsApiPart {
|
|
3117
2971
|
constructor() {
|
|
3118
2972
|
this.response = new BehaviorSubject(null);
|
|
@@ -3156,6 +3010,121 @@ const statusRequestFactoryProvider = {
|
|
|
3156
3010
|
useValue: (...args) => new StatusRequest(...args),
|
|
3157
3011
|
};
|
|
3158
3012
|
|
|
3013
|
+
var StatusGroups;
|
|
3014
|
+
(function (StatusGroups) {
|
|
3015
|
+
StatusGroups["troubled"] = "troubled";
|
|
3016
|
+
StatusGroups["done"] = "done";
|
|
3017
|
+
StatusGroups["invoice"] = "invoice";
|
|
3018
|
+
})(StatusGroups || (StatusGroups = {}));
|
|
3019
|
+
|
|
3020
|
+
var StatusEnum;
|
|
3021
|
+
(function (StatusEnum) {
|
|
3022
|
+
StatusEnum["created"] = "created";
|
|
3023
|
+
StatusEnum["awaiting"] = "awaiting";
|
|
3024
|
+
StatusEnum["processing"] = "processing";
|
|
3025
|
+
StatusEnum["authorized"] = "authorized";
|
|
3026
|
+
StatusEnum["held"] = "held";
|
|
3027
|
+
StatusEnum["done"] = "done";
|
|
3028
|
+
StatusEnum["error"] = "error";
|
|
3029
|
+
StatusEnum["canceled"] = "canceled";
|
|
3030
|
+
})(StatusEnum || (StatusEnum = {}));
|
|
3031
|
+
|
|
3032
|
+
class StatusResponse {
|
|
3033
|
+
constructor(parameters) {
|
|
3034
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
3035
|
+
if ((_a = parameters.errors) === null || _a === void 0 ? void 0 : _a[0]) {
|
|
3036
|
+
this.error = {
|
|
3037
|
+
code: parameters.errors[0].code.toString(),
|
|
3038
|
+
message: parameters.errors[0].message,
|
|
3039
|
+
};
|
|
3040
|
+
}
|
|
3041
|
+
if (!parameters.status) {
|
|
3042
|
+
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 : '');
|
|
3043
|
+
}
|
|
3044
|
+
this.status = {
|
|
3045
|
+
statusState: parameters.status.statusData.stateText,
|
|
3046
|
+
email: parameters.status.statusData.email,
|
|
3047
|
+
webSocketUrl: parameters.status.statusData.webSocketChannelUrl,
|
|
3048
|
+
webSocketChannelName: parameters.status.statusData.webSocketChannelName,
|
|
3049
|
+
webSocketClientType: parameters.status.statusData.webSocketClientType,
|
|
3050
|
+
financeInfo: parameters.status.text.info,
|
|
3051
|
+
discount: parameters.status.text.info.discount
|
|
3052
|
+
? Math.abs(Number.parseFloat((_g = (_f = parameters.status.text.info.discount) === null || _f === void 0 ? void 0 : _f.value) !== null && _g !== void 0 ? _g : ''))
|
|
3053
|
+
: null,
|
|
3054
|
+
isCancelUser: parameters.status.isCancelUser,
|
|
3055
|
+
postMessageStatus: parameters.status.isCancelUser
|
|
3056
|
+
? StatusGroups.troubled
|
|
3057
|
+
: parameters.status.group,
|
|
3058
|
+
virtualCurrencyAmount: parameters.status.statusData.out,
|
|
3059
|
+
backUrlSettings: {
|
|
3060
|
+
backUrl: parameters.status.text.backurl,
|
|
3061
|
+
backUrlAction: parameters.status.text.backurl_action,
|
|
3062
|
+
backUrlCaption: parameters.status.text.backurl_caption,
|
|
3063
|
+
returnRegion: parameters.status.return_region,
|
|
3064
|
+
},
|
|
3065
|
+
additionalBackButton: this.getAdditionalBackButton(parameters.status),
|
|
3066
|
+
group: parameters.status.group,
|
|
3067
|
+
needToCheck: parameters.status.needToCheck,
|
|
3068
|
+
autoRedirect: parameters.status.autoredirect,
|
|
3069
|
+
statusMessage: parameters.status.text.state,
|
|
3070
|
+
userId: parameters.status.statusData.v1,
|
|
3071
|
+
invoice: parameters.status.statusData.invoice,
|
|
3072
|
+
pid: parameters.status.statusData.pid,
|
|
3073
|
+
projectAmount: this.getProjectAmount(parameters.status),
|
|
3074
|
+
titleClass: parameters.status.title_class,
|
|
3075
|
+
paymentCountryIso: parameters.status.statusData.payment_country_iso,
|
|
3076
|
+
order: parameters.status.text.order,
|
|
3077
|
+
};
|
|
3078
|
+
if (parameters.form) {
|
|
3079
|
+
this.status.userReturnStatus = this.getUserReturnStatus(parameters.form);
|
|
3080
|
+
}
|
|
3081
|
+
if (this.status.statusState === StatusEnum.done ||
|
|
3082
|
+
this.status.statusState === StatusEnum.authorized) {
|
|
3083
|
+
this.status.isSuccess = true;
|
|
3084
|
+
}
|
|
3085
|
+
if (this.status.statusState === StatusEnum.canceled ||
|
|
3086
|
+
this.status.isCancelUser) {
|
|
3087
|
+
this.status.isCanceled = true;
|
|
3088
|
+
}
|
|
3089
|
+
}
|
|
3090
|
+
getUserReturnStatus(form) {
|
|
3091
|
+
var _a;
|
|
3092
|
+
const value = (_a = form['fix_userReturnStatus']) === null || _a === void 0 ? void 0 : _a.value;
|
|
3093
|
+
if (value === 'undefined')
|
|
3094
|
+
return undefined;
|
|
3095
|
+
return value;
|
|
3096
|
+
}
|
|
3097
|
+
getProjectAmount(status) {
|
|
3098
|
+
if (!status.statusData.projectAmount) {
|
|
3099
|
+
return;
|
|
3100
|
+
}
|
|
3101
|
+
const [amount, currency] = status.statusData.projectAmount.split(' ');
|
|
3102
|
+
return {
|
|
3103
|
+
amount,
|
|
3104
|
+
currency,
|
|
3105
|
+
};
|
|
3106
|
+
}
|
|
3107
|
+
getAdditionalBackButton(status) {
|
|
3108
|
+
var _a, _b, _c, _d;
|
|
3109
|
+
if (!status.text.is_additional_back_url_enabled) {
|
|
3110
|
+
return {
|
|
3111
|
+
link: '',
|
|
3112
|
+
action: '',
|
|
3113
|
+
label: '',
|
|
3114
|
+
region: '',
|
|
3115
|
+
isEnabled: false,
|
|
3116
|
+
};
|
|
3117
|
+
}
|
|
3118
|
+
return {
|
|
3119
|
+
link: (_a = status.text.additional_back_url_link) !== null && _a !== void 0 ? _a : '',
|
|
3120
|
+
action: (_b = status.text.additional_back_url_action) !== null && _b !== void 0 ? _b : '',
|
|
3121
|
+
label: (_c = status.text.additional_back_url_label) !== null && _c !== void 0 ? _c : '',
|
|
3122
|
+
region: (_d = status.additional_button_return_region) !== null && _d !== void 0 ? _d : '',
|
|
3123
|
+
isEnabled: status.text.is_additional_back_url_enabled,
|
|
3124
|
+
};
|
|
3125
|
+
}
|
|
3126
|
+
}
|
|
3127
|
+
|
|
3159
3128
|
const statusResponseFactoryToken = new InjectionToken('StatusResponse');
|
|
3160
3129
|
const statusResponseFactoryProvider = {
|
|
3161
3130
|
provide: statusResponseFactoryToken,
|
|
@@ -4685,142 +4654,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImpor
|
|
|
4685
4654
|
}]
|
|
4686
4655
|
}], ctorParameters: function () { return [{ type: StatusRequestService }, { type: CheckStatusService }, { type: WebsocketStatusService }]; } });
|
|
4687
4656
|
|
|
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
4657
|
class StatusService {
|
|
4808
|
-
constructor(urlService, statusRequestService, financeDetailsService, listenStatusService, nextActionService
|
|
4658
|
+
constructor(urlService, statusRequestService, financeDetailsService, listenStatusService, nextActionService) {
|
|
4809
4659
|
this.urlService = urlService;
|
|
4810
4660
|
this.statusRequestService = statusRequestService;
|
|
4811
4661
|
this.financeDetailsService = financeDetailsService;
|
|
4812
4662
|
this.listenStatusService = listenStatusService;
|
|
4813
4663
|
this.nextActionService = nextActionService;
|
|
4814
|
-
this.savePaymentMethodStatusService = savePaymentMethodStatusService;
|
|
4815
4664
|
}
|
|
4816
4665
|
getStatus(params) {
|
|
4817
4666
|
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
4667
|
this.statusRequestService.setRequestParams(params);
|
|
4825
4668
|
this.startWaitingStatusUpdates(params.invoice);
|
|
4826
4669
|
this.statusRequestService.request();
|
|
@@ -4832,7 +4675,6 @@ class StatusService {
|
|
|
4832
4675
|
getStatusWithUrlSearchParams(url) {
|
|
4833
4676
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4834
4677
|
const searchParams = this.getRequestParamsFromUrl(url);
|
|
4835
|
-
console.log('searchParams', searchParams);
|
|
4836
4678
|
if (!searchParams) {
|
|
4837
4679
|
throw new Error('No required search params to get status');
|
|
4838
4680
|
}
|
|
@@ -4861,14 +4703,14 @@ class StatusService {
|
|
|
4861
4703
|
});
|
|
4862
4704
|
}
|
|
4863
4705
|
}
|
|
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 }
|
|
4706
|
+
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
4707
|
StatusService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: StatusService, providedIn: 'root' });
|
|
4866
4708
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: StatusService, decorators: [{
|
|
4867
4709
|
type: Injectable,
|
|
4868
4710
|
args: [{
|
|
4869
4711
|
providedIn: 'root',
|
|
4870
4712
|
}]
|
|
4871
|
-
}], ctorParameters: function () { return [{ type: UrlService }, { type: StatusRequestService }, { type: FinanceDetailsService }, { type: ListenStatusService }, { type: NextActionService }
|
|
4713
|
+
}], ctorParameters: function () { return [{ type: UrlService }, { type: StatusRequestService }, { type: FinanceDetailsService }, { type: ListenStatusService }, { type: NextActionService }]; } });
|
|
4872
4714
|
|
|
4873
4715
|
class CreditCardStateService extends EmitDataService {
|
|
4874
4716
|
}
|
|
@@ -4893,6 +4735,12 @@ var ThreeDsStatusTypes;
|
|
|
4893
4735
|
ThreeDsStatusTypes["collectDfp"] = "collect_dfp";
|
|
4894
4736
|
})(ThreeDsStatusTypes || (ThreeDsStatusTypes = {}));
|
|
4895
4737
|
|
|
4738
|
+
class XpsResponseError extends AppError {
|
|
4739
|
+
constructor(message) {
|
|
4740
|
+
super('XPS response failed' + (message ? `: "${message}".` : '.'));
|
|
4741
|
+
}
|
|
4742
|
+
}
|
|
4743
|
+
|
|
4896
4744
|
class StatusThreeDsRequest {
|
|
4897
4745
|
constructor(token, threeDsId) {
|
|
4898
4746
|
this.access_token = token;
|
|
@@ -5384,13 +5232,9 @@ class PaymentService {
|
|
|
5384
5232
|
this.emitFormFieldsStatus(this.form);
|
|
5385
5233
|
return;
|
|
5386
5234
|
}
|
|
5387
|
-
console.log('this.fields', this.fields);
|
|
5388
|
-
console.log('this.form', this.form);
|
|
5389
5235
|
const submitResponse = yield this.submitService.request(this.fields, this.form);
|
|
5390
5236
|
this.data = submitResponse;
|
|
5391
|
-
|
|
5392
|
-
this.emitFinanceDetails(submitResponse.summary);
|
|
5393
|
-
}
|
|
5237
|
+
this.emitFinanceDetails(submitResponse.summary);
|
|
5394
5238
|
this.emitFormMessages(submitResponse.messages);
|
|
5395
5239
|
// Handle 3ds flow
|
|
5396
5240
|
if (submitResponse.currentCommand === XpsCommand.create) {
|
|
@@ -5444,10 +5288,7 @@ class PaymentService {
|
|
|
5444
5288
|
invoice: parseInt((_a = this.data.fixInvoice) !== null && _a !== void 0 ? _a : ''),
|
|
5445
5289
|
signature: (_b = this.data.signature) !== null && _b !== void 0 ? _b : '',
|
|
5446
5290
|
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',
|
|
5447
|
-
isSavePaymentAccount: this.data.isSavingMethodMode ? 1 : 0,
|
|
5448
5291
|
};
|
|
5449
|
-
console.log('this.data', this.data);
|
|
5450
|
-
console.log('getStatus', params);
|
|
5451
5292
|
return this.statusService.getStatus(params);
|
|
5452
5293
|
});
|
|
5453
5294
|
}
|
|
@@ -5671,7 +5512,7 @@ class CoreLibraryService {
|
|
|
5671
5512
|
this.creditCardStateService = creditCardStateService;
|
|
5672
5513
|
this.formMessagesService = formMessagesService;
|
|
5673
5514
|
this.paymentMethods = {
|
|
5674
|
-
getList: (
|
|
5515
|
+
getList: () => __awaiter(this, void 0, void 0, function* () { return this.paymentMethodsService.getList(); }),
|
|
5675
5516
|
getQuickMethods: () => __awaiter(this, void 0, void 0, function* () { return this.paymentMethodsService.getQuickMethods(); }),
|
|
5676
5517
|
getSavedMethods: () => __awaiter(this, void 0, void 0, function* () { return this.savedMethodsService.getList(); }),
|
|
5677
5518
|
getUserBalance: () => __awaiter(this, void 0, void 0, function* () { return this.userBalanceService.getUserBalance(); }),
|