@xsolla/payment-client-core 0.1.14-test9 → 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 -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 -313
- package/fesm2015/xsolla-payment-client-core.mjs.map +1 -1
- package/fesm2020/xsolla-payment-client-core.mjs +147 -306
- 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-test9.tgz +0 -0
|
@@ -5,7 +5,7 @@ import * as i1 from '@angular/common/http';
|
|
|
5
5
|
import { HttpParams, HttpHeaders, HttpClientModule, HTTP_INTERCEPTORS } from '@angular/common/http';
|
|
6
6
|
import JSEncrypt from 'jsencrypt';
|
|
7
7
|
import { UntypedFormGroup, Validators, UntypedFormControl, ReactiveFormsModule } from '@angular/forms';
|
|
8
|
-
import { filter, map as map$1,
|
|
8
|
+
import { filter, map as map$1, catchError } from 'rxjs/operators';
|
|
9
9
|
import * as i1$1 from '@angular/router';
|
|
10
10
|
import { CommonModule } from '@angular/common';
|
|
11
11
|
|
|
@@ -238,19 +238,18 @@ class PaymentMethodsService {
|
|
|
238
238
|
this.apiRoute = 'remained_payment_methods';
|
|
239
239
|
this.cache = new Map();
|
|
240
240
|
}
|
|
241
|
-
async getList(
|
|
242
|
-
const response = await this.request(
|
|
241
|
+
async getList() {
|
|
242
|
+
const response = await this.request();
|
|
243
243
|
return response.remained;
|
|
244
244
|
}
|
|
245
245
|
async getQuickMethods() {
|
|
246
246
|
const response = await this.request();
|
|
247
247
|
return response.especial;
|
|
248
248
|
}
|
|
249
|
-
async request(
|
|
249
|
+
async request() {
|
|
250
250
|
const requestParams = {
|
|
251
251
|
access_token: this.settingsService.token,
|
|
252
252
|
country: this.countryService.getCountry(),
|
|
253
|
-
save_payment_account_only: isSaveMethodMode ? "1" /* XpsBoolean.true */ : "0" /* XpsBoolean.false */
|
|
254
253
|
};
|
|
255
254
|
const cacheKey = JSON.stringify(requestParams);
|
|
256
255
|
if (!this.cache.has(cacheKey)) {
|
|
@@ -454,19 +453,13 @@ class PaymentConfigService {
|
|
|
454
453
|
}
|
|
455
454
|
return {
|
|
456
455
|
...config,
|
|
457
|
-
returnUrl: this.enrichReturnUrl(config.returnUrl,
|
|
456
|
+
returnUrl: this.enrichReturnUrl(config.returnUrl),
|
|
458
457
|
};
|
|
459
458
|
}
|
|
460
|
-
enrichReturnUrl(returnUrl
|
|
461
|
-
|
|
462
|
-
token: this.settingsService.token
|
|
459
|
+
enrichReturnUrl(returnUrl) {
|
|
460
|
+
return this.urlService.addSearchParams(returnUrl, {
|
|
461
|
+
token: this.settingsService.token,
|
|
463
462
|
});
|
|
464
|
-
if (savePaymentMethod) {
|
|
465
|
-
enrichedUrl = this.urlService.addSearchParams(returnUrl, {
|
|
466
|
-
isSavePaymentAccount: "1" /* XpsBoolean.true */
|
|
467
|
-
});
|
|
468
|
-
}
|
|
469
|
-
return enrichedUrl;
|
|
470
463
|
}
|
|
471
464
|
}
|
|
472
465
|
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 });
|
|
@@ -474,7 +467,7 @@ PaymentConfigService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0",
|
|
|
474
467
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: PaymentConfigService, decorators: [{
|
|
475
468
|
type: Injectable,
|
|
476
469
|
args: [{
|
|
477
|
-
providedIn: 'root'
|
|
470
|
+
providedIn: 'root',
|
|
478
471
|
}]
|
|
479
472
|
}], ctorParameters: function () { return [{ type: UrlService }, { type: SettingsService }]; } });
|
|
480
473
|
|
|
@@ -555,15 +548,9 @@ var FieldNames;
|
|
|
555
548
|
class SubmitResponse {
|
|
556
549
|
constructor(parameters, responseNumber = 0) {
|
|
557
550
|
this.responseNumber = responseNumber;
|
|
558
|
-
this.isSavingMethodMode = false;
|
|
559
551
|
/* Todo split into properties */
|
|
560
552
|
this.parameters = parameters;
|
|
561
|
-
this.fields = Object.keys(parameters.form).map((key) =>
|
|
562
|
-
if (key === 'save_payment_account_only') {
|
|
563
|
-
this.isSavingMethodMode = parameters.form[key].value === "1" /* XpsBoolean.true */;
|
|
564
|
-
}
|
|
565
|
-
return parameters.form[key];
|
|
566
|
-
});
|
|
553
|
+
this.fields = Object.keys(parameters.form).map((key) => parameters.form[key]);
|
|
567
554
|
if (parameters.onlineBanking) {
|
|
568
555
|
this.onlineBanking = {
|
|
569
556
|
url: parameters.onlineBanking.value,
|
|
@@ -794,143 +781,15 @@ const checkStatusActionFactoryProvider = {
|
|
|
794
781
|
},
|
|
795
782
|
};
|
|
796
783
|
|
|
797
|
-
class TerminalError extends AppError {
|
|
798
|
-
constructor(message, code) {
|
|
799
|
-
super(message);
|
|
800
|
-
this.code = code;
|
|
801
|
-
}
|
|
802
|
-
}
|
|
803
|
-
|
|
804
|
-
var StatusGroups;
|
|
805
|
-
(function (StatusGroups) {
|
|
806
|
-
StatusGroups["troubled"] = "troubled";
|
|
807
|
-
StatusGroups["done"] = "done";
|
|
808
|
-
StatusGroups["invoice"] = "invoice";
|
|
809
|
-
})(StatusGroups || (StatusGroups = {}));
|
|
810
|
-
|
|
811
|
-
var StatusEnum;
|
|
812
|
-
(function (StatusEnum) {
|
|
813
|
-
StatusEnum["created"] = "created";
|
|
814
|
-
StatusEnum["awaiting"] = "awaiting";
|
|
815
|
-
StatusEnum["processing"] = "processing";
|
|
816
|
-
StatusEnum["authorized"] = "authorized";
|
|
817
|
-
StatusEnum["held"] = "held";
|
|
818
|
-
StatusEnum["done"] = "done";
|
|
819
|
-
StatusEnum["error"] = "error";
|
|
820
|
-
StatusEnum["canceled"] = "canceled";
|
|
821
|
-
})(StatusEnum || (StatusEnum = {}));
|
|
822
|
-
|
|
823
|
-
class StatusResponse {
|
|
824
|
-
constructor(parameters) {
|
|
825
|
-
if (parameters.errors?.[0]) {
|
|
826
|
-
this.error = {
|
|
827
|
-
code: parameters.errors[0].code.toString(),
|
|
828
|
-
message: parameters.errors[0].message,
|
|
829
|
-
};
|
|
830
|
-
}
|
|
831
|
-
if (!parameters.status) {
|
|
832
|
-
throw new TerminalError(this.error?.message ?? '', this.error?.code.toString() ?? '');
|
|
833
|
-
}
|
|
834
|
-
this.status = {
|
|
835
|
-
statusState: parameters.status.statusData.stateText,
|
|
836
|
-
email: parameters.status.statusData.email,
|
|
837
|
-
webSocketUrl: parameters.status.statusData.webSocketChannelUrl,
|
|
838
|
-
webSocketChannelName: parameters.status.statusData.webSocketChannelName,
|
|
839
|
-
webSocketClientType: parameters.status.statusData.webSocketClientType,
|
|
840
|
-
financeInfo: parameters.status.text.info,
|
|
841
|
-
discount: parameters.status.text.info.discount
|
|
842
|
-
? Math.abs(Number.parseFloat(parameters.status.text.info.discount?.value ?? ''))
|
|
843
|
-
: null,
|
|
844
|
-
isCancelUser: parameters.status.isCancelUser,
|
|
845
|
-
postMessageStatus: parameters.status.isCancelUser
|
|
846
|
-
? StatusGroups.troubled
|
|
847
|
-
: parameters.status.group,
|
|
848
|
-
virtualCurrencyAmount: parameters.status.statusData.out,
|
|
849
|
-
backUrlSettings: {
|
|
850
|
-
backUrl: parameters.status.text.backurl,
|
|
851
|
-
backUrlAction: parameters.status.text.backurl_action,
|
|
852
|
-
backUrlCaption: parameters.status.text.backurl_caption,
|
|
853
|
-
returnRegion: parameters.status.return_region,
|
|
854
|
-
},
|
|
855
|
-
additionalBackButton: this.getAdditionalBackButton(parameters.status),
|
|
856
|
-
group: parameters.status.group,
|
|
857
|
-
needToCheck: parameters.status.needToCheck,
|
|
858
|
-
autoRedirect: parameters.status.autoredirect,
|
|
859
|
-
statusMessage: parameters.status.text.state,
|
|
860
|
-
userId: parameters.status.statusData.v1,
|
|
861
|
-
invoice: parameters.status.statusData.invoice,
|
|
862
|
-
pid: parameters.status.statusData.pid,
|
|
863
|
-
projectAmount: this.getProjectAmount(parameters.status),
|
|
864
|
-
titleClass: parameters.status.title_class,
|
|
865
|
-
paymentCountryIso: parameters.status.statusData.payment_country_iso,
|
|
866
|
-
order: parameters.status.text.order,
|
|
867
|
-
};
|
|
868
|
-
if (parameters.form) {
|
|
869
|
-
this.status.userReturnStatus = this.getUserReturnStatus(parameters.form);
|
|
870
|
-
}
|
|
871
|
-
if (this.status.statusState === StatusEnum.done ||
|
|
872
|
-
this.status.statusState === StatusEnum.authorized) {
|
|
873
|
-
this.status.isSuccess = true;
|
|
874
|
-
}
|
|
875
|
-
if (this.status.statusState === StatusEnum.canceled ||
|
|
876
|
-
this.status.isCancelUser) {
|
|
877
|
-
this.status.isCanceled = true;
|
|
878
|
-
}
|
|
879
|
-
}
|
|
880
|
-
getUserReturnStatus(form) {
|
|
881
|
-
const value = form['fix_userReturnStatus']?.value;
|
|
882
|
-
if (value === 'undefined')
|
|
883
|
-
return undefined;
|
|
884
|
-
return value;
|
|
885
|
-
}
|
|
886
|
-
getProjectAmount(status) {
|
|
887
|
-
if (!status.statusData.projectAmount) {
|
|
888
|
-
return;
|
|
889
|
-
}
|
|
890
|
-
const [amount, currency] = status.statusData.projectAmount.split(' ');
|
|
891
|
-
return {
|
|
892
|
-
amount,
|
|
893
|
-
currency,
|
|
894
|
-
};
|
|
895
|
-
}
|
|
896
|
-
getAdditionalBackButton(status) {
|
|
897
|
-
if (!status.text.is_additional_back_url_enabled) {
|
|
898
|
-
return {
|
|
899
|
-
link: '',
|
|
900
|
-
action: '',
|
|
901
|
-
label: '',
|
|
902
|
-
region: '',
|
|
903
|
-
isEnabled: false,
|
|
904
|
-
};
|
|
905
|
-
}
|
|
906
|
-
return {
|
|
907
|
-
link: status.text.additional_back_url_link ?? '',
|
|
908
|
-
action: status.text.additional_back_url_action ?? '',
|
|
909
|
-
label: status.text.additional_back_url_label ?? '',
|
|
910
|
-
region: status.additional_button_return_region ?? '',
|
|
911
|
-
isEnabled: status.text.is_additional_back_url_enabled,
|
|
912
|
-
};
|
|
913
|
-
}
|
|
914
|
-
}
|
|
915
|
-
|
|
916
784
|
class StatusUpdatedAction {
|
|
917
|
-
constructor(statusResponse
|
|
785
|
+
constructor(statusResponse) {
|
|
918
786
|
this.type = 'status_updated';
|
|
919
|
-
let status;
|
|
920
|
-
if (statusResponse instanceof StatusResponse) {
|
|
921
|
-
status = statusResponse.status;
|
|
922
|
-
}
|
|
923
|
-
else {
|
|
924
|
-
status = statusResponse;
|
|
925
|
-
}
|
|
926
787
|
this.data = {
|
|
927
|
-
statusState: status.statusState,
|
|
928
|
-
invoice: status.invoice,
|
|
929
|
-
isSuccess: status.isSuccess,
|
|
930
|
-
isCanceled: status.isCanceled,
|
|
931
|
-
group: status.group,
|
|
932
|
-
isSavePaymentMethodMode,
|
|
933
|
-
savePaymentMethodStatus
|
|
788
|
+
statusState: statusResponse.status.statusState,
|
|
789
|
+
invoice: statusResponse.status.invoice,
|
|
790
|
+
isSuccess: statusResponse.status.isSuccess,
|
|
791
|
+
isCanceled: statusResponse.status.isCanceled,
|
|
792
|
+
group: statusResponse.status.group,
|
|
934
793
|
};
|
|
935
794
|
}
|
|
936
795
|
}
|
|
@@ -1572,11 +1431,6 @@ class InitializeService {
|
|
|
1572
1431
|
refer: this.ps4ReferId,
|
|
1573
1432
|
country: this.countryService.getCountry(),
|
|
1574
1433
|
returnUrl: config.returnUrl,
|
|
1575
|
-
paymentWithSavedMethod: config.paymentWithSavedMethod === true
|
|
1576
|
-
? "1" /* XpsBoolean.true */
|
|
1577
|
-
: "0" /* XpsBoolean.false */,
|
|
1578
|
-
saved_method_id: config.savedMethodId,
|
|
1579
|
-
save_payment_account_only: !!config.savePaymentMethod ? "1" /* XpsBoolean.true */ : "0" /* XpsBoolean.false */
|
|
1580
1434
|
};
|
|
1581
1435
|
return this.xpsApiService
|
|
1582
1436
|
.directPaymentRequest(requestParams)
|
|
@@ -1608,7 +1462,7 @@ InitializeService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", ve
|
|
|
1608
1462
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: InitializeService, decorators: [{
|
|
1609
1463
|
type: Injectable,
|
|
1610
1464
|
args: [{
|
|
1611
|
-
providedIn: 'root'
|
|
1465
|
+
providedIn: 'root',
|
|
1612
1466
|
}]
|
|
1613
1467
|
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
1614
1468
|
type: Inject,
|
|
@@ -2966,7 +2820,6 @@ var StatusSearchParam;
|
|
|
2966
2820
|
StatusSearchParam["testPs"] = "fix_testPs";
|
|
2967
2821
|
StatusSearchParam["testXsolla"] = "fix_testXsolla";
|
|
2968
2822
|
StatusSearchParam["userReturnStatus"] = "fix_userReturnStatus";
|
|
2969
|
-
StatusSearchParam["isSavePaymentAccount"] = "isSavePaymentAccount";
|
|
2970
2823
|
})(StatusSearchParam || (StatusSearchParam = {}));
|
|
2971
2824
|
|
|
2972
2825
|
const requiredStatusSearchParams = [
|
|
@@ -3046,15 +2899,15 @@ const statusSearchParamsMap = new Map([
|
|
|
3046
2899
|
converter: numberConverter,
|
|
3047
2900
|
},
|
|
3048
2901
|
],
|
|
3049
|
-
[
|
|
3050
|
-
StatusSearchParam.isSavePaymentAccount,
|
|
3051
|
-
{
|
|
3052
|
-
key: 'isSavePaymentAccount',
|
|
3053
|
-
converter: numberConverter,
|
|
3054
|
-
},
|
|
3055
|
-
],
|
|
3056
2902
|
]);
|
|
3057
2903
|
|
|
2904
|
+
class TerminalError extends AppError {
|
|
2905
|
+
constructor(message, code) {
|
|
2906
|
+
super(message);
|
|
2907
|
+
this.code = code;
|
|
2908
|
+
}
|
|
2909
|
+
}
|
|
2910
|
+
|
|
3058
2911
|
class XpsApiPart {
|
|
3059
2912
|
constructor() {
|
|
3060
2913
|
this.response = new BehaviorSubject(null);
|
|
@@ -3098,6 +2951,118 @@ const statusRequestFactoryProvider = {
|
|
|
3098
2951
|
useValue: (...args) => new StatusRequest(...args),
|
|
3099
2952
|
};
|
|
3100
2953
|
|
|
2954
|
+
var StatusGroups;
|
|
2955
|
+
(function (StatusGroups) {
|
|
2956
|
+
StatusGroups["troubled"] = "troubled";
|
|
2957
|
+
StatusGroups["done"] = "done";
|
|
2958
|
+
StatusGroups["invoice"] = "invoice";
|
|
2959
|
+
})(StatusGroups || (StatusGroups = {}));
|
|
2960
|
+
|
|
2961
|
+
var StatusEnum;
|
|
2962
|
+
(function (StatusEnum) {
|
|
2963
|
+
StatusEnum["created"] = "created";
|
|
2964
|
+
StatusEnum["awaiting"] = "awaiting";
|
|
2965
|
+
StatusEnum["processing"] = "processing";
|
|
2966
|
+
StatusEnum["authorized"] = "authorized";
|
|
2967
|
+
StatusEnum["held"] = "held";
|
|
2968
|
+
StatusEnum["done"] = "done";
|
|
2969
|
+
StatusEnum["error"] = "error";
|
|
2970
|
+
StatusEnum["canceled"] = "canceled";
|
|
2971
|
+
})(StatusEnum || (StatusEnum = {}));
|
|
2972
|
+
|
|
2973
|
+
class StatusResponse {
|
|
2974
|
+
constructor(parameters) {
|
|
2975
|
+
if (parameters.errors?.[0]) {
|
|
2976
|
+
this.error = {
|
|
2977
|
+
code: parameters.errors[0].code.toString(),
|
|
2978
|
+
message: parameters.errors[0].message,
|
|
2979
|
+
};
|
|
2980
|
+
}
|
|
2981
|
+
if (!parameters.status) {
|
|
2982
|
+
throw new TerminalError(this.error?.message ?? '', this.error?.code.toString() ?? '');
|
|
2983
|
+
}
|
|
2984
|
+
this.status = {
|
|
2985
|
+
statusState: parameters.status.statusData.stateText,
|
|
2986
|
+
email: parameters.status.statusData.email,
|
|
2987
|
+
webSocketUrl: parameters.status.statusData.webSocketChannelUrl,
|
|
2988
|
+
webSocketChannelName: parameters.status.statusData.webSocketChannelName,
|
|
2989
|
+
webSocketClientType: parameters.status.statusData.webSocketClientType,
|
|
2990
|
+
financeInfo: parameters.status.text.info,
|
|
2991
|
+
discount: parameters.status.text.info.discount
|
|
2992
|
+
? Math.abs(Number.parseFloat(parameters.status.text.info.discount?.value ?? ''))
|
|
2993
|
+
: null,
|
|
2994
|
+
isCancelUser: parameters.status.isCancelUser,
|
|
2995
|
+
postMessageStatus: parameters.status.isCancelUser
|
|
2996
|
+
? StatusGroups.troubled
|
|
2997
|
+
: parameters.status.group,
|
|
2998
|
+
virtualCurrencyAmount: parameters.status.statusData.out,
|
|
2999
|
+
backUrlSettings: {
|
|
3000
|
+
backUrl: parameters.status.text.backurl,
|
|
3001
|
+
backUrlAction: parameters.status.text.backurl_action,
|
|
3002
|
+
backUrlCaption: parameters.status.text.backurl_caption,
|
|
3003
|
+
returnRegion: parameters.status.return_region,
|
|
3004
|
+
},
|
|
3005
|
+
additionalBackButton: this.getAdditionalBackButton(parameters.status),
|
|
3006
|
+
group: parameters.status.group,
|
|
3007
|
+
needToCheck: parameters.status.needToCheck,
|
|
3008
|
+
autoRedirect: parameters.status.autoredirect,
|
|
3009
|
+
statusMessage: parameters.status.text.state,
|
|
3010
|
+
userId: parameters.status.statusData.v1,
|
|
3011
|
+
invoice: parameters.status.statusData.invoice,
|
|
3012
|
+
pid: parameters.status.statusData.pid,
|
|
3013
|
+
projectAmount: this.getProjectAmount(parameters.status),
|
|
3014
|
+
titleClass: parameters.status.title_class,
|
|
3015
|
+
paymentCountryIso: parameters.status.statusData.payment_country_iso,
|
|
3016
|
+
order: parameters.status.text.order,
|
|
3017
|
+
};
|
|
3018
|
+
if (parameters.form) {
|
|
3019
|
+
this.status.userReturnStatus = this.getUserReturnStatus(parameters.form);
|
|
3020
|
+
}
|
|
3021
|
+
if (this.status.statusState === StatusEnum.done ||
|
|
3022
|
+
this.status.statusState === StatusEnum.authorized) {
|
|
3023
|
+
this.status.isSuccess = true;
|
|
3024
|
+
}
|
|
3025
|
+
if (this.status.statusState === StatusEnum.canceled ||
|
|
3026
|
+
this.status.isCancelUser) {
|
|
3027
|
+
this.status.isCanceled = true;
|
|
3028
|
+
}
|
|
3029
|
+
}
|
|
3030
|
+
getUserReturnStatus(form) {
|
|
3031
|
+
const value = form['fix_userReturnStatus']?.value;
|
|
3032
|
+
if (value === 'undefined')
|
|
3033
|
+
return undefined;
|
|
3034
|
+
return value;
|
|
3035
|
+
}
|
|
3036
|
+
getProjectAmount(status) {
|
|
3037
|
+
if (!status.statusData.projectAmount) {
|
|
3038
|
+
return;
|
|
3039
|
+
}
|
|
3040
|
+
const [amount, currency] = status.statusData.projectAmount.split(' ');
|
|
3041
|
+
return {
|
|
3042
|
+
amount,
|
|
3043
|
+
currency,
|
|
3044
|
+
};
|
|
3045
|
+
}
|
|
3046
|
+
getAdditionalBackButton(status) {
|
|
3047
|
+
if (!status.text.is_additional_back_url_enabled) {
|
|
3048
|
+
return {
|
|
3049
|
+
link: '',
|
|
3050
|
+
action: '',
|
|
3051
|
+
label: '',
|
|
3052
|
+
region: '',
|
|
3053
|
+
isEnabled: false,
|
|
3054
|
+
};
|
|
3055
|
+
}
|
|
3056
|
+
return {
|
|
3057
|
+
link: status.text.additional_back_url_link ?? '',
|
|
3058
|
+
action: status.text.additional_back_url_action ?? '',
|
|
3059
|
+
label: status.text.additional_back_url_label ?? '',
|
|
3060
|
+
region: status.additional_button_return_region ?? '',
|
|
3061
|
+
isEnabled: status.text.is_additional_back_url_enabled,
|
|
3062
|
+
};
|
|
3063
|
+
}
|
|
3064
|
+
}
|
|
3065
|
+
|
|
3101
3066
|
const statusResponseFactoryToken = new InjectionToken('StatusResponse');
|
|
3102
3067
|
const statusResponseFactoryProvider = {
|
|
3103
3068
|
provide: statusResponseFactoryToken,
|
|
@@ -4574,137 +4539,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImpor
|
|
|
4574
4539
|
}]
|
|
4575
4540
|
}], ctorParameters: function () { return [{ type: StatusRequestService }, { type: CheckStatusService }, { type: WebsocketStatusService }]; } });
|
|
4576
4541
|
|
|
4577
|
-
var TitleClass;
|
|
4578
|
-
(function (TitleClass) {
|
|
4579
|
-
TitleClass["done"] = "done";
|
|
4580
|
-
TitleClass["cancel"] = "cancel";
|
|
4581
|
-
TitleClass["cancelUser"] = "canceluser";
|
|
4582
|
-
})(TitleClass || (TitleClass = {}));
|
|
4583
|
-
|
|
4584
|
-
var SavePaymentMethodStatus;
|
|
4585
|
-
(function (SavePaymentMethodStatus) {
|
|
4586
|
-
SavePaymentMethodStatus["success"] = "success";
|
|
4587
|
-
SavePaymentMethodStatus["failed"] = "failed";
|
|
4588
|
-
})(SavePaymentMethodStatus || (SavePaymentMethodStatus = {}));
|
|
4589
|
-
|
|
4590
|
-
class XpsResponseError extends AppError {
|
|
4591
|
-
constructor(message) {
|
|
4592
|
-
super('XPS response failed' + (message ? `: "${message}".` : '.'));
|
|
4593
|
-
}
|
|
4594
|
-
}
|
|
4595
|
-
|
|
4596
|
-
class SavedPaymentAccountChangesService {
|
|
4597
|
-
constructor(settingsService, secureApi) {
|
|
4598
|
-
this.settingsService = settingsService;
|
|
4599
|
-
this.secureApi = secureApi;
|
|
4600
|
-
this.apiRoute = 'savedmethods/newaccountinfo';
|
|
4601
|
-
this.response = new Subject();
|
|
4602
|
-
}
|
|
4603
|
-
get response$() {
|
|
4604
|
-
return this.response.asObservable();
|
|
4605
|
-
}
|
|
4606
|
-
async request(invoice) {
|
|
4607
|
-
const requestParameters = {
|
|
4608
|
-
access_token: this.settingsService.token,
|
|
4609
|
-
invoice_id: invoice,
|
|
4610
|
-
};
|
|
4611
|
-
return lastValueFrom(this.secureApi
|
|
4612
|
-
.post(this.apiRoute, new URLSearchParams(requestParameters), {
|
|
4613
|
-
headers: new HttpHeaders().set('Content-Type', 'application/x-www-form-urlencoded; charset=utf-8'),
|
|
4614
|
-
responseType: 'json',
|
|
4615
|
-
})
|
|
4616
|
-
.pipe(tap((value) => {
|
|
4617
|
-
this.response.next(value);
|
|
4618
|
-
}))).catch((error) => {
|
|
4619
|
-
throw new XpsResponseError(error.message);
|
|
4620
|
-
});
|
|
4621
|
-
}
|
|
4622
|
-
}
|
|
4623
|
-
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 });
|
|
4624
|
-
SavedPaymentAccountChangesService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: SavedPaymentAccountChangesService, providedIn: 'root' });
|
|
4625
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: SavedPaymentAccountChangesService, decorators: [{
|
|
4626
|
-
type: Injectable,
|
|
4627
|
-
args: [{
|
|
4628
|
-
providedIn: 'root'
|
|
4629
|
-
}]
|
|
4630
|
-
}], ctorParameters: function () { return [{ type: SettingsService }, { type: SecureApiClient }]; } });
|
|
4631
|
-
|
|
4632
|
-
class SavePaymentMethodStatusService {
|
|
4633
|
-
constructor(statusRequestService, listenStatusService, savedPaymentAccountChangesService, nextActionService) {
|
|
4634
|
-
this.statusRequestService = statusRequestService;
|
|
4635
|
-
this.listenStatusService = listenStatusService;
|
|
4636
|
-
this.savedPaymentAccountChangesService = savedPaymentAccountChangesService;
|
|
4637
|
-
this.nextActionService = nextActionService;
|
|
4638
|
-
}
|
|
4639
|
-
async getStatus(params) {
|
|
4640
|
-
this.statusRequestService.setRequestParams(params);
|
|
4641
|
-
this.startWaitingStatusUpdates(params.invoice);
|
|
4642
|
-
this.statusRequestService.request();
|
|
4643
|
-
const statusResponse = await firstValueFrom(this.statusRequestService.response$);
|
|
4644
|
-
if (!this.savePaymentMethodStatus) {
|
|
4645
|
-
statusResponse.status.statusState = StatusEnum.processing;
|
|
4646
|
-
}
|
|
4647
|
-
return statusResponse.status;
|
|
4648
|
-
}
|
|
4649
|
-
startWaitingStatusUpdates(invoice) {
|
|
4650
|
-
this.listenStatusService.listen(invoice);
|
|
4651
|
-
this.listenStatusSubscription = this.listenStatusService.statusUpdated$
|
|
4652
|
-
.subscribe(({ statusResponse }) => {
|
|
4653
|
-
if (statusResponse.status) {
|
|
4654
|
-
this.loadNewPaymentAccountData(statusResponse.status);
|
|
4655
|
-
}
|
|
4656
|
-
});
|
|
4657
|
-
}
|
|
4658
|
-
loadNewPaymentAccountData(status) {
|
|
4659
|
-
if (!status.invoice) {
|
|
4660
|
-
return;
|
|
4661
|
-
}
|
|
4662
|
-
void this.savedPaymentAccountChangesService
|
|
4663
|
-
.request(status.invoice)
|
|
4664
|
-
.then((accountChanges) => {
|
|
4665
|
-
if (accountChanges) {
|
|
4666
|
-
this.handleSavingStatus(status, accountChanges.new_account);
|
|
4667
|
-
}
|
|
4668
|
-
});
|
|
4669
|
-
}
|
|
4670
|
-
handleSavingStatus(status, account) {
|
|
4671
|
-
this.listenStatusService.stopListening();
|
|
4672
|
-
this.listenStatusSubscription.unsubscribe();
|
|
4673
|
-
const updatingIsProcessing = status?.titleClass !== TitleClass.cancel && status?.titleClass !== TitleClass.cancelUser && !account;
|
|
4674
|
-
if (updatingIsProcessing) {
|
|
4675
|
-
return;
|
|
4676
|
-
}
|
|
4677
|
-
const paymentAccountWasSaved = status?.titleClass === TitleClass.done && account !== null;
|
|
4678
|
-
const isSavePaymentMethod = true;
|
|
4679
|
-
this.savePaymentMethodStatus = paymentAccountWasSaved ? SavePaymentMethodStatus.success : SavePaymentMethodStatus.failed;
|
|
4680
|
-
this.nextActionService.emitFlowUpdates(new StatusUpdatedAction(status, isSavePaymentMethod, this.savePaymentMethodStatus));
|
|
4681
|
-
}
|
|
4682
|
-
}
|
|
4683
|
-
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 });
|
|
4684
|
-
SavePaymentMethodStatusService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: SavePaymentMethodStatusService, providedIn: 'root' });
|
|
4685
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: SavePaymentMethodStatusService, decorators: [{
|
|
4686
|
-
type: Injectable,
|
|
4687
|
-
args: [{
|
|
4688
|
-
providedIn: 'root'
|
|
4689
|
-
}]
|
|
4690
|
-
}], ctorParameters: function () { return [{ type: StatusRequestService }, { type: ListenStatusService }, { type: SavedPaymentAccountChangesService }, { type: NextActionService }]; } });
|
|
4691
|
-
|
|
4692
4542
|
class StatusService {
|
|
4693
|
-
constructor(urlService, statusRequestService, financeDetailsService, listenStatusService, nextActionService
|
|
4543
|
+
constructor(urlService, statusRequestService, financeDetailsService, listenStatusService, nextActionService) {
|
|
4694
4544
|
this.urlService = urlService;
|
|
4695
4545
|
this.statusRequestService = statusRequestService;
|
|
4696
4546
|
this.financeDetailsService = financeDetailsService;
|
|
4697
4547
|
this.listenStatusService = listenStatusService;
|
|
4698
4548
|
this.nextActionService = nextActionService;
|
|
4699
|
-
this.savePaymentMethodStatusService = savePaymentMethodStatusService;
|
|
4700
4549
|
}
|
|
4701
4550
|
async getStatus(params) {
|
|
4702
|
-
// todo: если params.savePaymentMethod, то надо выполнить логику для
|
|
4703
|
-
// account status
|
|
4704
|
-
const isSavePaymentMethodMode = !!params?.isSavePaymentAccount;
|
|
4705
|
-
if (isSavePaymentMethodMode) {
|
|
4706
|
-
return this.savePaymentMethodStatusService.getStatus(params); // todo: saveMethodStatus.getStatus();
|
|
4707
|
-
}
|
|
4708
4551
|
this.statusRequestService.setRequestParams(params);
|
|
4709
4552
|
this.startWaitingStatusUpdates(params.invoice);
|
|
4710
4553
|
this.statusRequestService.request();
|
|
@@ -4714,7 +4557,6 @@ class StatusService {
|
|
|
4714
4557
|
}
|
|
4715
4558
|
async getStatusWithUrlSearchParams(url) {
|
|
4716
4559
|
const searchParams = this.getRequestParamsFromUrl(url);
|
|
4717
|
-
console.log('searchParams', searchParams);
|
|
4718
4560
|
if (!searchParams) {
|
|
4719
4561
|
throw new Error('No required search params to get status');
|
|
4720
4562
|
}
|
|
@@ -4742,14 +4584,14 @@ class StatusService {
|
|
|
4742
4584
|
});
|
|
4743
4585
|
}
|
|
4744
4586
|
}
|
|
4745
|
-
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 }
|
|
4587
|
+
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 });
|
|
4746
4588
|
StatusService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: StatusService, providedIn: 'root' });
|
|
4747
4589
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: StatusService, decorators: [{
|
|
4748
4590
|
type: Injectable,
|
|
4749
4591
|
args: [{
|
|
4750
4592
|
providedIn: 'root',
|
|
4751
4593
|
}]
|
|
4752
|
-
}], ctorParameters: function () { return [{ type: UrlService }, { type: StatusRequestService }, { type: FinanceDetailsService }, { type: ListenStatusService }, { type: NextActionService }
|
|
4594
|
+
}], ctorParameters: function () { return [{ type: UrlService }, { type: StatusRequestService }, { type: FinanceDetailsService }, { type: ListenStatusService }, { type: NextActionService }]; } });
|
|
4753
4595
|
|
|
4754
4596
|
class CreditCardStateService extends EmitDataService {
|
|
4755
4597
|
}
|
|
@@ -4774,6 +4616,12 @@ var ThreeDsStatusTypes;
|
|
|
4774
4616
|
ThreeDsStatusTypes["collectDfp"] = "collect_dfp";
|
|
4775
4617
|
})(ThreeDsStatusTypes || (ThreeDsStatusTypes = {}));
|
|
4776
4618
|
|
|
4619
|
+
class XpsResponseError extends AppError {
|
|
4620
|
+
constructor(message) {
|
|
4621
|
+
super('XPS response failed' + (message ? `: "${message}".` : '.'));
|
|
4622
|
+
}
|
|
4623
|
+
}
|
|
4624
|
+
|
|
4777
4625
|
class StatusThreeDsRequest {
|
|
4778
4626
|
constructor(token, threeDsId) {
|
|
4779
4627
|
this.access_token = token;
|
|
@@ -5246,13 +5094,9 @@ class PaymentService {
|
|
|
5246
5094
|
this.emitFormFieldsStatus(this.form);
|
|
5247
5095
|
return;
|
|
5248
5096
|
}
|
|
5249
|
-
console.log('this.fields', this.fields);
|
|
5250
|
-
console.log('this.form', this.form);
|
|
5251
5097
|
const submitResponse = await this.submitService.request(this.fields, this.form);
|
|
5252
5098
|
this.data = submitResponse;
|
|
5253
|
-
|
|
5254
|
-
this.emitFinanceDetails(submitResponse.summary);
|
|
5255
|
-
}
|
|
5099
|
+
this.emitFinanceDetails(submitResponse.summary);
|
|
5256
5100
|
this.emitFormMessages(submitResponse.messages);
|
|
5257
5101
|
// Handle 3ds flow
|
|
5258
5102
|
if (submitResponse.currentCommand === XpsCommand.create) {
|
|
@@ -5301,10 +5145,7 @@ class PaymentService {
|
|
|
5301
5145
|
signature: this.data.signature ?? '',
|
|
5302
5146
|
locale: this.data.fields.find((field) => field.name === 'locale')?.value ??
|
|
5303
5147
|
'en',
|
|
5304
|
-
isSavePaymentAccount: this.data.isSavingMethodMode ? 1 : 0,
|
|
5305
5148
|
};
|
|
5306
|
-
console.log('this.data', this.data);
|
|
5307
|
-
console.log('getStatus', params);
|
|
5308
5149
|
return this.statusService.getStatus(params);
|
|
5309
5150
|
}
|
|
5310
5151
|
getFieldConfig(field) {
|
|
@@ -5522,7 +5363,7 @@ class CoreLibraryService {
|
|
|
5522
5363
|
this.creditCardStateService = creditCardStateService;
|
|
5523
5364
|
this.formMessagesService = formMessagesService;
|
|
5524
5365
|
this.paymentMethods = {
|
|
5525
|
-
getList: async (
|
|
5366
|
+
getList: async () => this.paymentMethodsService.getList(),
|
|
5526
5367
|
getQuickMethods: async () => this.paymentMethodsService.getQuickMethods(),
|
|
5527
5368
|
getSavedMethods: async () => this.savedMethodsService.getList(),
|
|
5528
5369
|
getUserBalance: async () => this.userBalanceService.getUserBalance(),
|