@xsolla/payment-client-core 0.1.13 → 0.1.14-test10
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 +17 -7
- package/esm2020/lib/core/payment/actions/status-updated/status-updated.action.type.mjs +1 -1
- package/esm2020/lib/core/payment/config/config.service.mjs +12 -6
- package/esm2020/lib/core/payment/form-messages/form-messages.service.mjs +26 -0
- package/esm2020/lib/core/payment/initialize/initialize-request-params.interface.mjs +1 -1
- package/esm2020/lib/core/payment/initialize/initialize.service.mjs +8 -3
- package/esm2020/lib/core/payment/payment-config.interface.mjs +1 -1
- package/esm2020/lib/core/payment/payment.interface.mjs +1 -1
- package/esm2020/lib/core/payment/payment.service.mjs +22 -5
- package/esm2020/lib/core/payment/status/save-payment-method-status/api/saved-payment-account-changes.interface.mjs +2 -0
- package/esm2020/lib/core/payment/status/save-payment-method-status/api/saved-payment-account-changes.service.mjs +44 -0
- package/esm2020/lib/core/payment/status/save-payment-method-status/api/saved-payment-account.interface.mjs +2 -0
- package/esm2020/lib/core/payment/status/save-payment-method-status/save-payment-method-status.enum.mjs +6 -0
- package/esm2020/lib/core/payment/status/save-payment-method-status/save-payment-method-status.service.mjs +71 -0
- 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 +2 -1
- package/esm2020/lib/core/payment/status/status-request/status-search-params.map.mjs +8 -1
- package/esm2020/lib/core/payment/status/status.service.mjs +13 -4
- package/esm2020/lib/core/payment-methods/payment-methods-request-params.interface.mjs +1 -1
- package/esm2020/lib/core/payment-methods/payment-methods.service.mjs +5 -4
- package/esm2020/lib/core-library.service.mjs +8 -5
- package/fesm2015/xsolla-payment-client-core.mjs +346 -156
- package/fesm2015/xsolla-payment-client-core.mjs.map +1 -1
- package/fesm2020/xsolla-payment-client-core.mjs +338 -152
- package/fesm2020/xsolla-payment-client-core.mjs.map +1 -1
- package/lib/core/payment/actions/status-updated/status-updated.action.class.d.ts +3 -1
- package/lib/core/payment/actions/status-updated/status-updated.action.type.d.ts +3 -0
- package/lib/core/payment/form-messages/form-messages.service.d.ts +11 -0
- package/lib/core/payment/initialize/initialize-request-params.interface.d.ts +4 -0
- package/lib/core/payment/payment-config.interface.d.ts +3 -0
- package/lib/core/payment/payment.interface.d.ts +1 -0
- package/lib/core/payment/payment.service.d.ts +5 -1
- package/lib/core/payment/status/save-payment-method-status/api/saved-payment-account-changes.interface.d.ts +6 -0
- package/lib/core/payment/status/save-payment-method-status/api/saved-payment-account-changes.service.d.ts +16 -0
- package/lib/core/payment/status/save-payment-method-status/api/saved-payment-account.interface.d.ts +7 -0
- package/lib/core/payment/status/save-payment-method-status/save-payment-method-status.enum.d.ts +4 -0
- package/lib/core/payment/status/save-payment-method-status/save-payment-method-status.service.d.ts +22 -0
- package/lib/core/payment/status/status-request/status-request-params.interface.d.ts +1 -0
- package/lib/core/payment/status/status-request/status-search-param.enum.d.ts +2 -1
- package/lib/core/payment/status/status.service.d.ts +3 -1
- package/lib/core/payment-methods/payment-methods-request-params.interface.d.ts +2 -0
- package/lib/core/payment-methods/payment-methods.service.d.ts +1 -1
- package/lib/core-library.service.d.ts +4 -2
- package/package.json +1 -1
- package/xsolla-payment-client-core-0.1.14-test10.tgz +0 -0
- package/xsolla-payment-client-core-0.1.13.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, catchError } from 'rxjs/operators';
|
|
9
|
+
import { filter, map as map$1, tap, 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(isSaveMethodMode) {
|
|
248
248
|
return __awaiter(this, void 0, void 0, function* () {
|
|
249
|
-
const response = yield this.request();
|
|
249
|
+
const response = yield this.request(isSaveMethodMode);
|
|
250
250
|
return response.remained;
|
|
251
251
|
});
|
|
252
252
|
}
|
|
@@ -256,11 +256,12 @@ class PaymentMethodsService {
|
|
|
256
256
|
return response.especial;
|
|
257
257
|
});
|
|
258
258
|
}
|
|
259
|
-
request() {
|
|
259
|
+
request(isSaveMethodMode) {
|
|
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 */
|
|
264
265
|
};
|
|
265
266
|
const cacheKey = JSON.stringify(requestParams);
|
|
266
267
|
if (!this.cache.has(cacheKey)) {
|
|
@@ -478,12 +479,18 @@ class PaymentConfigService {
|
|
|
478
479
|
if (!config.returnUrl) {
|
|
479
480
|
throw new Error('URL is not provided in payment config');
|
|
480
481
|
}
|
|
481
|
-
return Object.assign(Object.assign({}, config), { returnUrl: this.enrichReturnUrl(config.returnUrl) });
|
|
482
|
+
return Object.assign(Object.assign({}, config), { returnUrl: this.enrichReturnUrl(config.returnUrl, !!config.savePaymentMethod) });
|
|
482
483
|
}
|
|
483
|
-
enrichReturnUrl(returnUrl) {
|
|
484
|
-
|
|
485
|
-
token: this.settingsService.token
|
|
484
|
+
enrichReturnUrl(returnUrl, savePaymentMethod) {
|
|
485
|
+
let enrichedUrl = this.urlService.addSearchParams(returnUrl, {
|
|
486
|
+
token: this.settingsService.token
|
|
486
487
|
});
|
|
488
|
+
if (savePaymentMethod) {
|
|
489
|
+
enrichedUrl = this.urlService.addSearchParams(returnUrl, {
|
|
490
|
+
isSavePaymentAccount: "1" /* XpsBoolean.true */
|
|
491
|
+
});
|
|
492
|
+
}
|
|
493
|
+
return enrichedUrl;
|
|
487
494
|
}
|
|
488
495
|
}
|
|
489
496
|
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 });
|
|
@@ -491,7 +498,7 @@ PaymentConfigService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0",
|
|
|
491
498
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: PaymentConfigService, decorators: [{
|
|
492
499
|
type: Injectable,
|
|
493
500
|
args: [{
|
|
494
|
-
providedIn: 'root'
|
|
501
|
+
providedIn: 'root'
|
|
495
502
|
}]
|
|
496
503
|
}], ctorParameters: function () { return [{ type: UrlService }, { type: SettingsService }]; } });
|
|
497
504
|
|
|
@@ -805,15 +812,146 @@ const checkStatusActionFactoryProvider = {
|
|
|
805
812
|
},
|
|
806
813
|
};
|
|
807
814
|
|
|
815
|
+
class TerminalError extends AppError {
|
|
816
|
+
constructor(message, code) {
|
|
817
|
+
super(message);
|
|
818
|
+
this.code = code;
|
|
819
|
+
}
|
|
820
|
+
}
|
|
821
|
+
|
|
822
|
+
var StatusGroups;
|
|
823
|
+
(function (StatusGroups) {
|
|
824
|
+
StatusGroups["troubled"] = "troubled";
|
|
825
|
+
StatusGroups["done"] = "done";
|
|
826
|
+
StatusGroups["invoice"] = "invoice";
|
|
827
|
+
})(StatusGroups || (StatusGroups = {}));
|
|
828
|
+
|
|
829
|
+
var StatusEnum;
|
|
830
|
+
(function (StatusEnum) {
|
|
831
|
+
StatusEnum["created"] = "created";
|
|
832
|
+
StatusEnum["awaiting"] = "awaiting";
|
|
833
|
+
StatusEnum["processing"] = "processing";
|
|
834
|
+
StatusEnum["authorized"] = "authorized";
|
|
835
|
+
StatusEnum["held"] = "held";
|
|
836
|
+
StatusEnum["done"] = "done";
|
|
837
|
+
StatusEnum["error"] = "error";
|
|
838
|
+
StatusEnum["canceled"] = "canceled";
|
|
839
|
+
})(StatusEnum || (StatusEnum = {}));
|
|
840
|
+
|
|
841
|
+
class StatusResponse {
|
|
842
|
+
constructor(parameters) {
|
|
843
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
844
|
+
if ((_a = parameters.errors) === null || _a === void 0 ? void 0 : _a[0]) {
|
|
845
|
+
this.error = {
|
|
846
|
+
code: parameters.errors[0].code.toString(),
|
|
847
|
+
message: parameters.errors[0].message,
|
|
848
|
+
};
|
|
849
|
+
}
|
|
850
|
+
if (!parameters.status) {
|
|
851
|
+
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 : '');
|
|
852
|
+
}
|
|
853
|
+
this.status = {
|
|
854
|
+
statusState: parameters.status.statusData.stateText,
|
|
855
|
+
email: parameters.status.statusData.email,
|
|
856
|
+
webSocketUrl: parameters.status.statusData.webSocketChannelUrl,
|
|
857
|
+
webSocketChannelName: parameters.status.statusData.webSocketChannelName,
|
|
858
|
+
webSocketClientType: parameters.status.statusData.webSocketClientType,
|
|
859
|
+
financeInfo: parameters.status.text.info,
|
|
860
|
+
discount: parameters.status.text.info.discount
|
|
861
|
+
? Math.abs(Number.parseFloat((_g = (_f = parameters.status.text.info.discount) === null || _f === void 0 ? void 0 : _f.value) !== null && _g !== void 0 ? _g : ''))
|
|
862
|
+
: null,
|
|
863
|
+
isCancelUser: parameters.status.isCancelUser,
|
|
864
|
+
postMessageStatus: parameters.status.isCancelUser
|
|
865
|
+
? StatusGroups.troubled
|
|
866
|
+
: parameters.status.group,
|
|
867
|
+
virtualCurrencyAmount: parameters.status.statusData.out,
|
|
868
|
+
backUrlSettings: {
|
|
869
|
+
backUrl: parameters.status.text.backurl,
|
|
870
|
+
backUrlAction: parameters.status.text.backurl_action,
|
|
871
|
+
backUrlCaption: parameters.status.text.backurl_caption,
|
|
872
|
+
returnRegion: parameters.status.return_region,
|
|
873
|
+
},
|
|
874
|
+
additionalBackButton: this.getAdditionalBackButton(parameters.status),
|
|
875
|
+
group: parameters.status.group,
|
|
876
|
+
needToCheck: parameters.status.needToCheck,
|
|
877
|
+
autoRedirect: parameters.status.autoredirect,
|
|
878
|
+
statusMessage: parameters.status.text.state,
|
|
879
|
+
userId: parameters.status.statusData.v1,
|
|
880
|
+
invoice: parameters.status.statusData.invoice,
|
|
881
|
+
pid: parameters.status.statusData.pid,
|
|
882
|
+
projectAmount: this.getProjectAmount(parameters.status),
|
|
883
|
+
titleClass: parameters.status.title_class,
|
|
884
|
+
paymentCountryIso: parameters.status.statusData.payment_country_iso,
|
|
885
|
+
order: parameters.status.text.order,
|
|
886
|
+
};
|
|
887
|
+
if (parameters.form) {
|
|
888
|
+
this.status.userReturnStatus = this.getUserReturnStatus(parameters.form);
|
|
889
|
+
}
|
|
890
|
+
if (this.status.statusState === StatusEnum.done ||
|
|
891
|
+
this.status.statusState === StatusEnum.authorized) {
|
|
892
|
+
this.status.isSuccess = true;
|
|
893
|
+
}
|
|
894
|
+
if (this.status.statusState === StatusEnum.canceled ||
|
|
895
|
+
this.status.isCancelUser) {
|
|
896
|
+
this.status.isCanceled = true;
|
|
897
|
+
}
|
|
898
|
+
}
|
|
899
|
+
getUserReturnStatus(form) {
|
|
900
|
+
var _a;
|
|
901
|
+
const value = (_a = form['fix_userReturnStatus']) === null || _a === void 0 ? void 0 : _a.value;
|
|
902
|
+
if (value === 'undefined')
|
|
903
|
+
return undefined;
|
|
904
|
+
return value;
|
|
905
|
+
}
|
|
906
|
+
getProjectAmount(status) {
|
|
907
|
+
if (!status.statusData.projectAmount) {
|
|
908
|
+
return;
|
|
909
|
+
}
|
|
910
|
+
const [amount, currency] = status.statusData.projectAmount.split(' ');
|
|
911
|
+
return {
|
|
912
|
+
amount,
|
|
913
|
+
currency,
|
|
914
|
+
};
|
|
915
|
+
}
|
|
916
|
+
getAdditionalBackButton(status) {
|
|
917
|
+
var _a, _b, _c, _d;
|
|
918
|
+
if (!status.text.is_additional_back_url_enabled) {
|
|
919
|
+
return {
|
|
920
|
+
link: '',
|
|
921
|
+
action: '',
|
|
922
|
+
label: '',
|
|
923
|
+
region: '',
|
|
924
|
+
isEnabled: false,
|
|
925
|
+
};
|
|
926
|
+
}
|
|
927
|
+
return {
|
|
928
|
+
link: (_a = status.text.additional_back_url_link) !== null && _a !== void 0 ? _a : '',
|
|
929
|
+
action: (_b = status.text.additional_back_url_action) !== null && _b !== void 0 ? _b : '',
|
|
930
|
+
label: (_c = status.text.additional_back_url_label) !== null && _c !== void 0 ? _c : '',
|
|
931
|
+
region: (_d = status.additional_button_return_region) !== null && _d !== void 0 ? _d : '',
|
|
932
|
+
isEnabled: status.text.is_additional_back_url_enabled,
|
|
933
|
+
};
|
|
934
|
+
}
|
|
935
|
+
}
|
|
936
|
+
|
|
808
937
|
class StatusUpdatedAction {
|
|
809
|
-
constructor(statusResponse) {
|
|
938
|
+
constructor(statusResponse, isSavePaymentMethodMode = false, savePaymentMethodStatus) {
|
|
810
939
|
this.type = 'status_updated';
|
|
940
|
+
let status;
|
|
941
|
+
if (statusResponse instanceof StatusResponse) {
|
|
942
|
+
status = statusResponse.status;
|
|
943
|
+
}
|
|
944
|
+
else {
|
|
945
|
+
status = statusResponse;
|
|
946
|
+
}
|
|
811
947
|
this.data = {
|
|
812
|
-
statusState:
|
|
813
|
-
invoice:
|
|
814
|
-
isSuccess:
|
|
815
|
-
isCanceled:
|
|
816
|
-
group:
|
|
948
|
+
statusState: status.statusState,
|
|
949
|
+
invoice: status.invoice,
|
|
950
|
+
isSuccess: status.isSuccess,
|
|
951
|
+
isCanceled: status.isCanceled,
|
|
952
|
+
group: status.group,
|
|
953
|
+
isSavePaymentMethodMode,
|
|
954
|
+
savePaymentMethodStatus
|
|
817
955
|
};
|
|
818
956
|
}
|
|
819
957
|
}
|
|
@@ -1454,6 +1592,11 @@ class InitializeService {
|
|
|
1454
1592
|
refer: this.ps4ReferId,
|
|
1455
1593
|
country: this.countryService.getCountry(),
|
|
1456
1594
|
returnUrl: config.returnUrl,
|
|
1595
|
+
paymentWithSavedMethod: config.paymentWithSavedMethod === true
|
|
1596
|
+
? "1" /* XpsBoolean.true */
|
|
1597
|
+
: "0" /* XpsBoolean.false */,
|
|
1598
|
+
saved_method_id: config.savedMethodId,
|
|
1599
|
+
save_payment_account_only: !!config.savePaymentMethod ? "1" /* XpsBoolean.true */ : "0" /* XpsBoolean.false */
|
|
1457
1600
|
};
|
|
1458
1601
|
return this.xpsApiService
|
|
1459
1602
|
.directPaymentRequest(requestParams)
|
|
@@ -1487,7 +1630,7 @@ InitializeService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", ve
|
|
|
1487
1630
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: InitializeService, decorators: [{
|
|
1488
1631
|
type: Injectable,
|
|
1489
1632
|
args: [{
|
|
1490
|
-
providedIn: 'root'
|
|
1633
|
+
providedIn: 'root'
|
|
1491
1634
|
}]
|
|
1492
1635
|
}], ctorParameters: function () {
|
|
1493
1636
|
return [{ type: undefined, decorators: [{
|
|
@@ -2875,6 +3018,7 @@ var StatusSearchParam;
|
|
|
2875
3018
|
StatusSearchParam["testPs"] = "fix_testPs";
|
|
2876
3019
|
StatusSearchParam["testXsolla"] = "fix_testXsolla";
|
|
2877
3020
|
StatusSearchParam["userReturnStatus"] = "fix_userReturnStatus";
|
|
3021
|
+
StatusSearchParam["isSavePaymentAccount"] = "isSavePaymentAccount";
|
|
2878
3022
|
})(StatusSearchParam || (StatusSearchParam = {}));
|
|
2879
3023
|
|
|
2880
3024
|
const requiredStatusSearchParams = [
|
|
@@ -2954,15 +3098,15 @@ const statusSearchParamsMap = new Map([
|
|
|
2954
3098
|
converter: numberConverter,
|
|
2955
3099
|
},
|
|
2956
3100
|
],
|
|
3101
|
+
[
|
|
3102
|
+
StatusSearchParam.isSavePaymentAccount,
|
|
3103
|
+
{
|
|
3104
|
+
key: 'isSavePaymentAccount',
|
|
3105
|
+
converter: numberConverter,
|
|
3106
|
+
},
|
|
3107
|
+
],
|
|
2957
3108
|
]);
|
|
2958
3109
|
|
|
2959
|
-
class TerminalError extends AppError {
|
|
2960
|
-
constructor(message, code) {
|
|
2961
|
-
super(message);
|
|
2962
|
-
this.code = code;
|
|
2963
|
-
}
|
|
2964
|
-
}
|
|
2965
|
-
|
|
2966
3110
|
class XpsApiPart {
|
|
2967
3111
|
constructor() {
|
|
2968
3112
|
this.response = new BehaviorSubject(null);
|
|
@@ -3006,121 +3150,6 @@ const statusRequestFactoryProvider = {
|
|
|
3006
3150
|
useValue: (...args) => new StatusRequest(...args),
|
|
3007
3151
|
};
|
|
3008
3152
|
|
|
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
|
-
|
|
3124
3153
|
const statusResponseFactoryToken = new InjectionToken('StatusResponse');
|
|
3125
3154
|
const statusResponseFactoryProvider = {
|
|
3126
3155
|
provide: statusResponseFactoryToken,
|
|
@@ -4650,16 +4679,142 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImpor
|
|
|
4650
4679
|
}]
|
|
4651
4680
|
}], ctorParameters: function () { return [{ type: StatusRequestService }, { type: CheckStatusService }, { type: WebsocketStatusService }]; } });
|
|
4652
4681
|
|
|
4682
|
+
var TitleClass;
|
|
4683
|
+
(function (TitleClass) {
|
|
4684
|
+
TitleClass["done"] = "done";
|
|
4685
|
+
TitleClass["cancel"] = "cancel";
|
|
4686
|
+
TitleClass["cancelUser"] = "canceluser";
|
|
4687
|
+
})(TitleClass || (TitleClass = {}));
|
|
4688
|
+
|
|
4689
|
+
var SavePaymentMethodStatus;
|
|
4690
|
+
(function (SavePaymentMethodStatus) {
|
|
4691
|
+
SavePaymentMethodStatus["success"] = "success";
|
|
4692
|
+
SavePaymentMethodStatus["failed"] = "failed";
|
|
4693
|
+
})(SavePaymentMethodStatus || (SavePaymentMethodStatus = {}));
|
|
4694
|
+
|
|
4695
|
+
class XpsResponseError extends AppError {
|
|
4696
|
+
constructor(message) {
|
|
4697
|
+
super('XPS response failed' + (message ? `: "${message}".` : '.'));
|
|
4698
|
+
}
|
|
4699
|
+
}
|
|
4700
|
+
|
|
4701
|
+
class SavedPaymentAccountChangesService {
|
|
4702
|
+
constructor(settingsService, secureApi) {
|
|
4703
|
+
this.settingsService = settingsService;
|
|
4704
|
+
this.secureApi = secureApi;
|
|
4705
|
+
this.apiRoute = 'savedmethods/newaccountinfo';
|
|
4706
|
+
this.response = new Subject();
|
|
4707
|
+
}
|
|
4708
|
+
get response$() {
|
|
4709
|
+
return this.response.asObservable();
|
|
4710
|
+
}
|
|
4711
|
+
request(invoice) {
|
|
4712
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
4713
|
+
const requestParameters = {
|
|
4714
|
+
access_token: this.settingsService.token,
|
|
4715
|
+
invoice_id: invoice,
|
|
4716
|
+
};
|
|
4717
|
+
return lastValueFrom(this.secureApi
|
|
4718
|
+
.post(this.apiRoute, new URLSearchParams(requestParameters), {
|
|
4719
|
+
headers: new HttpHeaders().set('Content-Type', 'application/x-www-form-urlencoded; charset=utf-8'),
|
|
4720
|
+
responseType: 'json',
|
|
4721
|
+
})
|
|
4722
|
+
.pipe(tap((value) => {
|
|
4723
|
+
this.response.next(value);
|
|
4724
|
+
}))).catch((error) => {
|
|
4725
|
+
throw new XpsResponseError(error.message);
|
|
4726
|
+
});
|
|
4727
|
+
});
|
|
4728
|
+
}
|
|
4729
|
+
}
|
|
4730
|
+
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 });
|
|
4731
|
+
SavedPaymentAccountChangesService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: SavedPaymentAccountChangesService, providedIn: 'root' });
|
|
4732
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: SavedPaymentAccountChangesService, decorators: [{
|
|
4733
|
+
type: Injectable,
|
|
4734
|
+
args: [{
|
|
4735
|
+
providedIn: 'root'
|
|
4736
|
+
}]
|
|
4737
|
+
}], ctorParameters: function () { return [{ type: SettingsService }, { type: SecureApiClient }]; } });
|
|
4738
|
+
|
|
4739
|
+
class SavePaymentMethodStatusService {
|
|
4740
|
+
constructor(statusRequestService, listenStatusService, savedPaymentAccountChangesService, nextActionService) {
|
|
4741
|
+
this.statusRequestService = statusRequestService;
|
|
4742
|
+
this.listenStatusService = listenStatusService;
|
|
4743
|
+
this.savedPaymentAccountChangesService = savedPaymentAccountChangesService;
|
|
4744
|
+
this.nextActionService = nextActionService;
|
|
4745
|
+
}
|
|
4746
|
+
getStatus(params) {
|
|
4747
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
4748
|
+
this.statusRequestService.setRequestParams(params);
|
|
4749
|
+
this.startWaitingStatusUpdates(params.invoice);
|
|
4750
|
+
this.statusRequestService.request();
|
|
4751
|
+
const statusResponse = yield firstValueFrom(this.statusRequestService.response$);
|
|
4752
|
+
if (!this.savePaymentMethodStatus) {
|
|
4753
|
+
statusResponse.status.statusState = StatusEnum.processing;
|
|
4754
|
+
}
|
|
4755
|
+
return statusResponse.status;
|
|
4756
|
+
});
|
|
4757
|
+
}
|
|
4758
|
+
startWaitingStatusUpdates(invoice) {
|
|
4759
|
+
this.listenStatusService.listen(invoice);
|
|
4760
|
+
this.listenStatusSubscription = this.listenStatusService.statusUpdated$
|
|
4761
|
+
.subscribe(({ statusResponse }) => {
|
|
4762
|
+
if (statusResponse.status) {
|
|
4763
|
+
this.loadNewPaymentAccountData(statusResponse.status);
|
|
4764
|
+
}
|
|
4765
|
+
});
|
|
4766
|
+
}
|
|
4767
|
+
loadNewPaymentAccountData(status) {
|
|
4768
|
+
if (!status.invoice) {
|
|
4769
|
+
return;
|
|
4770
|
+
}
|
|
4771
|
+
void this.savedPaymentAccountChangesService
|
|
4772
|
+
.request(status.invoice)
|
|
4773
|
+
.then((accountChanges) => {
|
|
4774
|
+
if (accountChanges) {
|
|
4775
|
+
this.handleSavingStatus(status, accountChanges.new_account);
|
|
4776
|
+
}
|
|
4777
|
+
});
|
|
4778
|
+
}
|
|
4779
|
+
handleSavingStatus(status, account) {
|
|
4780
|
+
this.listenStatusService.stopListening();
|
|
4781
|
+
this.listenStatusSubscription.unsubscribe();
|
|
4782
|
+
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;
|
|
4783
|
+
if (updatingIsProcessing) {
|
|
4784
|
+
return;
|
|
4785
|
+
}
|
|
4786
|
+
const paymentAccountWasSaved = (status === null || status === void 0 ? void 0 : status.titleClass) === TitleClass.done && account !== null;
|
|
4787
|
+
const isSavePaymentMethod = true;
|
|
4788
|
+
this.savePaymentMethodStatus = paymentAccountWasSaved ? SavePaymentMethodStatus.success : SavePaymentMethodStatus.failed;
|
|
4789
|
+
this.nextActionService.emitFlowUpdates(new StatusUpdatedAction(status, isSavePaymentMethod, this.savePaymentMethodStatus));
|
|
4790
|
+
}
|
|
4791
|
+
}
|
|
4792
|
+
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 });
|
|
4793
|
+
SavePaymentMethodStatusService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: SavePaymentMethodStatusService, providedIn: 'root' });
|
|
4794
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: SavePaymentMethodStatusService, decorators: [{
|
|
4795
|
+
type: Injectable,
|
|
4796
|
+
args: [{
|
|
4797
|
+
providedIn: 'root'
|
|
4798
|
+
}]
|
|
4799
|
+
}], ctorParameters: function () { return [{ type: StatusRequestService }, { type: ListenStatusService }, { type: SavedPaymentAccountChangesService }, { type: NextActionService }]; } });
|
|
4800
|
+
|
|
4653
4801
|
class StatusService {
|
|
4654
|
-
constructor(urlService, statusRequestService, financeDetailsService, listenStatusService, nextActionService) {
|
|
4802
|
+
constructor(urlService, statusRequestService, financeDetailsService, listenStatusService, nextActionService, savePaymentMethodStatusService) {
|
|
4655
4803
|
this.urlService = urlService;
|
|
4656
4804
|
this.statusRequestService = statusRequestService;
|
|
4657
4805
|
this.financeDetailsService = financeDetailsService;
|
|
4658
4806
|
this.listenStatusService = listenStatusService;
|
|
4659
4807
|
this.nextActionService = nextActionService;
|
|
4808
|
+
this.savePaymentMethodStatusService = savePaymentMethodStatusService;
|
|
4660
4809
|
}
|
|
4661
4810
|
getStatus(params) {
|
|
4662
4811
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4812
|
+
// todo: если params.savePaymentMethod, то надо выполнить логику для
|
|
4813
|
+
// account status
|
|
4814
|
+
const isSavePaymentMethodMode = !!(params === null || params === void 0 ? void 0 : params.isSavePaymentAccount);
|
|
4815
|
+
if (isSavePaymentMethodMode) {
|
|
4816
|
+
return this.savePaymentMethodStatusService.getStatus(params); // todo: saveMethodStatus.getStatus();
|
|
4817
|
+
}
|
|
4663
4818
|
this.statusRequestService.setRequestParams(params);
|
|
4664
4819
|
this.startWaitingStatusUpdates(params.invoice);
|
|
4665
4820
|
this.statusRequestService.request();
|
|
@@ -4671,6 +4826,7 @@ class StatusService {
|
|
|
4671
4826
|
getStatusWithUrlSearchParams(url) {
|
|
4672
4827
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4673
4828
|
const searchParams = this.getRequestParamsFromUrl(url);
|
|
4829
|
+
console.log('searchParams', searchParams);
|
|
4674
4830
|
if (!searchParams) {
|
|
4675
4831
|
throw new Error('No required search params to get status');
|
|
4676
4832
|
}
|
|
@@ -4699,14 +4855,14 @@ class StatusService {
|
|
|
4699
4855
|
});
|
|
4700
4856
|
}
|
|
4701
4857
|
}
|
|
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 });
|
|
4858
|
+
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 }, { token: SavePaymentMethodStatusService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
4703
4859
|
StatusService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: StatusService, providedIn: 'root' });
|
|
4704
4860
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: StatusService, decorators: [{
|
|
4705
4861
|
type: Injectable,
|
|
4706
4862
|
args: [{
|
|
4707
4863
|
providedIn: 'root',
|
|
4708
4864
|
}]
|
|
4709
|
-
}], ctorParameters: function () { return [{ type: UrlService }, { type: StatusRequestService }, { type: FinanceDetailsService }, { type: ListenStatusService }, { type: NextActionService }]; } });
|
|
4865
|
+
}], ctorParameters: function () { return [{ type: UrlService }, { type: StatusRequestService }, { type: FinanceDetailsService }, { type: ListenStatusService }, { type: NextActionService }, { type: SavePaymentMethodStatusService }]; } });
|
|
4710
4866
|
|
|
4711
4867
|
class CreditCardStateService extends EmitDataService {
|
|
4712
4868
|
}
|
|
@@ -4731,12 +4887,6 @@ var ThreeDsStatusTypes;
|
|
|
4731
4887
|
ThreeDsStatusTypes["collectDfp"] = "collect_dfp";
|
|
4732
4888
|
})(ThreeDsStatusTypes || (ThreeDsStatusTypes = {}));
|
|
4733
4889
|
|
|
4734
|
-
class XpsResponseError extends AppError {
|
|
4735
|
-
constructor(message) {
|
|
4736
|
-
super('XPS response failed' + (message ? `: "${message}".` : '.'));
|
|
4737
|
-
}
|
|
4738
|
-
}
|
|
4739
|
-
|
|
4740
4890
|
class StatusThreeDsRequest {
|
|
4741
4891
|
constructor(token, threeDsId) {
|
|
4742
4892
|
this.access_token = token;
|
|
@@ -5153,11 +5303,33 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImpor
|
|
|
5153
5303
|
}]
|
|
5154
5304
|
}], ctorParameters: function () { return [{ type: ThreeDs20Service }, { type: NextActionService }]; } });
|
|
5155
5305
|
|
|
5306
|
+
class FormMessagesService extends EmitDataService {
|
|
5307
|
+
constructor(unescapeHtmlPipe) {
|
|
5308
|
+
super();
|
|
5309
|
+
this.unescapeHtmlPipe = unescapeHtmlPipe;
|
|
5310
|
+
}
|
|
5311
|
+
emitOnResponse(messages) {
|
|
5312
|
+
if (!messages) {
|
|
5313
|
+
return;
|
|
5314
|
+
}
|
|
5315
|
+
const mapInfoMessages = (infoMessage) => this.unescapeHtmlPipe.transform(infoMessage.message);
|
|
5316
|
+
super.emit(messages.map(mapInfoMessages));
|
|
5317
|
+
}
|
|
5318
|
+
}
|
|
5319
|
+
FormMessagesService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: FormMessagesService, deps: [{ token: UnescapeHtmlPipe }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
5320
|
+
FormMessagesService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: FormMessagesService, providedIn: 'root' });
|
|
5321
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: FormMessagesService, decorators: [{
|
|
5322
|
+
type: Injectable,
|
|
5323
|
+
args: [{
|
|
5324
|
+
providedIn: 'root',
|
|
5325
|
+
}]
|
|
5326
|
+
}], ctorParameters: function () { return [{ type: UnescapeHtmlPipe }]; } });
|
|
5327
|
+
|
|
5156
5328
|
class PaymentService {
|
|
5157
5329
|
get formFieldsStatus$() {
|
|
5158
5330
|
return this.formFieldsStatusSubject.asObservable().pipe(filter$1(Boolean));
|
|
5159
5331
|
}
|
|
5160
|
-
constructor(initializeService, submitService, syncService, formService, statusService, financeDetailsService, creditCardStateService, nextActionService, controlConfigService, threeDsService) {
|
|
5332
|
+
constructor(initializeService, submitService, syncService, formService, statusService, financeDetailsService, creditCardStateService, nextActionService, controlConfigService, threeDsService, formMessagesService) {
|
|
5161
5333
|
this.initializeService = initializeService;
|
|
5162
5334
|
this.submitService = submitService;
|
|
5163
5335
|
this.syncService = syncService;
|
|
@@ -5168,6 +5340,7 @@ class PaymentService {
|
|
|
5168
5340
|
this.nextActionService = nextActionService;
|
|
5169
5341
|
this.controlConfigService = controlConfigService;
|
|
5170
5342
|
this.threeDsService = threeDsService;
|
|
5343
|
+
this.formMessagesService = formMessagesService;
|
|
5171
5344
|
this.form = null;
|
|
5172
5345
|
this.data = null;
|
|
5173
5346
|
this.financeDetails = null;
|
|
@@ -5176,9 +5349,10 @@ class PaymentService {
|
|
|
5176
5349
|
this.destroy$ = new Subject();
|
|
5177
5350
|
this.formDestroy$ = new Subject();
|
|
5178
5351
|
this.formFieldsStatusSubject = new BehaviorSubject(null);
|
|
5352
|
+
this.isSavingMethodMode = false;
|
|
5179
5353
|
}
|
|
5180
5354
|
initialize(config) {
|
|
5181
|
-
var _a;
|
|
5355
|
+
var _a, _b;
|
|
5182
5356
|
return __awaiter(this, void 0, void 0, function* () {
|
|
5183
5357
|
this.destroy$ = new Subject();
|
|
5184
5358
|
this.formDestroy$ = new Subject();
|
|
@@ -5191,6 +5365,7 @@ class PaymentService {
|
|
|
5191
5365
|
this.listenFormStatusChanges(this.form);
|
|
5192
5366
|
this.emitFinanceDetails((_a = this.data.paymentForm) === null || _a === void 0 ? void 0 : _a.summary);
|
|
5193
5367
|
this.emitFormFieldsStatus(this.form);
|
|
5368
|
+
this.emitFormMessages((_b = this.data.paymentForm) === null || _b === void 0 ? void 0 : _b.messages);
|
|
5194
5369
|
return this.fields.filter((field) => (field === null || field === void 0 ? void 0 : field.isVisible) === "1" /* XpsBoolean.true */);
|
|
5195
5370
|
});
|
|
5196
5371
|
}
|
|
@@ -5204,9 +5379,15 @@ class PaymentService {
|
|
|
5204
5379
|
this.emitFormFieldsStatus(this.form);
|
|
5205
5380
|
return;
|
|
5206
5381
|
}
|
|
5382
|
+
console.log('this.fields', this.fields);
|
|
5383
|
+
console.log('this.form', this.form);
|
|
5384
|
+
this.isSavingMethodMode = this.fields.some(({ name, value }) => name === 'savePsAccountOnly' && value === "1" /* XpsBoolean.true */);
|
|
5207
5385
|
const submitResponse = yield this.submitService.request(this.fields, this.form);
|
|
5208
5386
|
this.data = submitResponse;
|
|
5209
|
-
this.
|
|
5387
|
+
if (!this.isSavingMethodMode) {
|
|
5388
|
+
this.emitFinanceDetails(submitResponse.summary);
|
|
5389
|
+
}
|
|
5390
|
+
this.emitFormMessages(submitResponse.messages);
|
|
5210
5391
|
// Handle 3ds flow
|
|
5211
5392
|
if (submitResponse.currentCommand === XpsCommand.create) {
|
|
5212
5393
|
this.runThreeDs();
|
|
@@ -5259,7 +5440,10 @@ class PaymentService {
|
|
|
5259
5440
|
invoice: parseInt((_a = this.data.fixInvoice) !== null && _a !== void 0 ? _a : ''),
|
|
5260
5441
|
signature: (_b = this.data.signature) !== null && _b !== void 0 ? _b : '',
|
|
5261
5442
|
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',
|
|
5443
|
+
isSavePaymentAccount: this.isSavingMethodMode ? 1 : 0,
|
|
5262
5444
|
};
|
|
5445
|
+
console.log('this.data', this.data);
|
|
5446
|
+
console.log('getStatus', params);
|
|
5263
5447
|
return this.statusService.getStatus(params);
|
|
5264
5448
|
});
|
|
5265
5449
|
}
|
|
@@ -5320,12 +5504,16 @@ class PaymentService {
|
|
|
5320
5504
|
});
|
|
5321
5505
|
this.formFieldsStatusSubject.next(formFieldsStatus);
|
|
5322
5506
|
}
|
|
5507
|
+
emitFormMessages(messages) {
|
|
5508
|
+
this.formMessagesService.emitOnResponse(messages);
|
|
5509
|
+
}
|
|
5323
5510
|
setupSyncService(form, fields) {
|
|
5324
5511
|
this.syncService.setup(form, fields);
|
|
5325
5512
|
this.syncService.data$
|
|
5326
5513
|
.pipe(takeUntil(this.destroy$))
|
|
5327
5514
|
.subscribe((response) => {
|
|
5328
5515
|
this.emitFinanceDetails(response.summary);
|
|
5516
|
+
this.emitFormMessages(response.messages);
|
|
5329
5517
|
});
|
|
5330
5518
|
this.syncService.fieldAsyncValidation$
|
|
5331
5519
|
.pipe(takeUntil(this.destroy$))
|
|
@@ -5347,14 +5535,14 @@ class PaymentService {
|
|
|
5347
5535
|
.subscribe(() => this.emitFormFieldsStatus(form));
|
|
5348
5536
|
}
|
|
5349
5537
|
}
|
|
5350
|
-
PaymentService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: PaymentService, deps: [{ token: InitializeService }, { token: SubmitService }, { token: SyncService }, { token: FormService }, { token: StatusService }, { token: FinanceDetailsService }, { token: CreditCardStateService }, { token: NextActionService }, { token: ControlConfigService }, { token: ThreeDsService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
5538
|
+
PaymentService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: PaymentService, deps: [{ token: InitializeService }, { token: SubmitService }, { token: SyncService }, { token: FormService }, { token: StatusService }, { token: FinanceDetailsService }, { token: CreditCardStateService }, { token: NextActionService }, { token: ControlConfigService }, { token: ThreeDsService }, { token: FormMessagesService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
5351
5539
|
PaymentService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: PaymentService, providedIn: 'root' });
|
|
5352
5540
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: PaymentService, decorators: [{
|
|
5353
5541
|
type: Injectable,
|
|
5354
5542
|
args: [{
|
|
5355
5543
|
providedIn: 'root',
|
|
5356
5544
|
}]
|
|
5357
|
-
}], ctorParameters: function () { return [{ type: InitializeService }, { type: SubmitService }, { type: SyncService }, { type: FormService }, { type: StatusService }, { type: FinanceDetailsService }, { type: CreditCardStateService }, { type: NextActionService }, { type: ControlConfigService }, { type: ThreeDsService }]; } });
|
|
5545
|
+
}], ctorParameters: function () { return [{ type: InitializeService }, { type: SubmitService }, { type: SyncService }, { type: FormService }, { type: StatusService }, { type: FinanceDetailsService }, { type: CreditCardStateService }, { type: NextActionService }, { type: ControlConfigService }, { type: ThreeDsService }, { type: FormMessagesService }]; } });
|
|
5358
5546
|
|
|
5359
5547
|
class RefundPolicyService {
|
|
5360
5548
|
constructor(settingsService) {
|
|
@@ -5462,7 +5650,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImpor
|
|
|
5462
5650
|
}], ctorParameters: function () { return [{ type: SettingsService }, { type: RefundPolicyService }, { type: SecureConnectionService }, { type: DisclaimerService }]; } });
|
|
5463
5651
|
|
|
5464
5652
|
class CoreLibraryService {
|
|
5465
|
-
constructor(settingsService, countryService, paymentMethodsService, savedMethodsService, userBalanceService, paymentConfigService, paymentService, deviceFingerPrintService, financeDetailsService, legalService, statusService, nextActionService, creditCardService, creditCardStateService) {
|
|
5653
|
+
constructor(settingsService, countryService, paymentMethodsService, savedMethodsService, userBalanceService, paymentConfigService, paymentService, deviceFingerPrintService, financeDetailsService, legalService, statusService, nextActionService, creditCardService, creditCardStateService, formMessagesService) {
|
|
5466
5654
|
this.settingsService = settingsService;
|
|
5467
5655
|
this.countryService = countryService;
|
|
5468
5656
|
this.paymentMethodsService = paymentMethodsService;
|
|
@@ -5477,8 +5665,9 @@ class CoreLibraryService {
|
|
|
5477
5665
|
this.nextActionService = nextActionService;
|
|
5478
5666
|
this.creditCardService = creditCardService;
|
|
5479
5667
|
this.creditCardStateService = creditCardStateService;
|
|
5668
|
+
this.formMessagesService = formMessagesService;
|
|
5480
5669
|
this.paymentMethods = {
|
|
5481
|
-
getList: () => __awaiter(this, void 0, void 0, function* () { return this.paymentMethodsService.getList(); }),
|
|
5670
|
+
getList: (isSaveMethodMode) => __awaiter(this, void 0, void 0, function* () { return this.paymentMethodsService.getList(isSaveMethodMode); }),
|
|
5482
5671
|
getQuickMethods: () => __awaiter(this, void 0, void 0, function* () { return this.paymentMethodsService.getQuickMethods(); }),
|
|
5483
5672
|
getSavedMethods: () => __awaiter(this, void 0, void 0, function* () { return this.savedMethodsService.getList(); }),
|
|
5484
5673
|
getUserBalance: () => __awaiter(this, void 0, void 0, function* () { return this.userBalanceService.getUserBalance(); }),
|
|
@@ -5518,6 +5707,7 @@ class CoreLibraryService {
|
|
|
5518
5707
|
changeFieldValue: (name, value) => this.paymentService.changeFieldValue(name, value),
|
|
5519
5708
|
changeFieldState: (name, state) => this.paymentService.changeFieldState(name, state),
|
|
5520
5709
|
updateFieldFormState: (fieldName, formState) => this.paymentService.updateFieldFormState(fieldName, formState),
|
|
5710
|
+
formMessages$: this.formMessagesService.data$,
|
|
5521
5711
|
},
|
|
5522
5712
|
};
|
|
5523
5713
|
}
|
|
@@ -5548,14 +5738,14 @@ class CoreLibraryService {
|
|
|
5548
5738
|
return this.userBalanceService.getUserBalanceValue();
|
|
5549
5739
|
}
|
|
5550
5740
|
}
|
|
5551
|
-
CoreLibraryService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: CoreLibraryService, deps: [{ token: SettingsService }, { token: CountryService }, { token: PaymentMethodsService }, { token: SavedMethodsService }, { token: UserBalanceService }, { token: PaymentConfigService }, { token: PaymentService }, { token: DeviceFingerPrintService }, { token: FinanceDetailsService }, { token: LegalService }, { token: StatusService }, { token: NextActionService }, { token: CreditCardService }, { token: CreditCardStateService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
5741
|
+
CoreLibraryService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: CoreLibraryService, deps: [{ token: SettingsService }, { token: CountryService }, { token: PaymentMethodsService }, { token: SavedMethodsService }, { token: UserBalanceService }, { token: PaymentConfigService }, { token: PaymentService }, { token: DeviceFingerPrintService }, { token: FinanceDetailsService }, { token: LegalService }, { token: StatusService }, { token: NextActionService }, { token: CreditCardService }, { token: CreditCardStateService }, { token: FormMessagesService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
5552
5742
|
CoreLibraryService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: CoreLibraryService, providedIn: 'root' });
|
|
5553
5743
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: CoreLibraryService, decorators: [{
|
|
5554
5744
|
type: Injectable,
|
|
5555
5745
|
args: [{
|
|
5556
5746
|
providedIn: 'root',
|
|
5557
5747
|
}]
|
|
5558
|
-
}], ctorParameters: function () { return [{ type: SettingsService }, { type: CountryService }, { type: PaymentMethodsService }, { type: SavedMethodsService }, { type: UserBalanceService }, { type: PaymentConfigService }, { type: PaymentService }, { type: DeviceFingerPrintService }, { type: FinanceDetailsService }, { type: LegalService }, { type: StatusService }, { type: NextActionService }, { type: CreditCardService }, { type: CreditCardStateService }]; } });
|
|
5748
|
+
}], ctorParameters: function () { return [{ type: SettingsService }, { type: CountryService }, { type: PaymentMethodsService }, { type: SavedMethodsService }, { type: UserBalanceService }, { type: PaymentConfigService }, { type: PaymentService }, { type: DeviceFingerPrintService }, { type: FinanceDetailsService }, { type: LegalService }, { type: StatusService }, { type: NextActionService }, { type: CreditCardService }, { type: CreditCardStateService }, { type: FormMessagesService }]; } });
|
|
5559
5749
|
|
|
5560
5750
|
class HttpError extends AppError {
|
|
5561
5751
|
constructor(error, req) {
|