@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
|
@@ -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
|
}
|
|
@@ -1576,7 +1435,6 @@ class InitializeService {
|
|
|
1576
1435
|
? "1" /* XpsBoolean.true */
|
|
1577
1436
|
: "0" /* XpsBoolean.false */,
|
|
1578
1437
|
saved_method_id: config.savedMethodId,
|
|
1579
|
-
save_payment_account_only: !!config.savePaymentMethod ? "1" /* XpsBoolean.true */ : "0" /* XpsBoolean.false */
|
|
1580
1438
|
};
|
|
1581
1439
|
return this.xpsApiService
|
|
1582
1440
|
.directPaymentRequest(requestParams)
|
|
@@ -1608,7 +1466,7 @@ InitializeService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", ve
|
|
|
1608
1466
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: InitializeService, decorators: [{
|
|
1609
1467
|
type: Injectable,
|
|
1610
1468
|
args: [{
|
|
1611
|
-
providedIn: 'root'
|
|
1469
|
+
providedIn: 'root',
|
|
1612
1470
|
}]
|
|
1613
1471
|
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
1614
1472
|
type: Inject,
|
|
@@ -2966,7 +2824,6 @@ var StatusSearchParam;
|
|
|
2966
2824
|
StatusSearchParam["testPs"] = "fix_testPs";
|
|
2967
2825
|
StatusSearchParam["testXsolla"] = "fix_testXsolla";
|
|
2968
2826
|
StatusSearchParam["userReturnStatus"] = "fix_userReturnStatus";
|
|
2969
|
-
StatusSearchParam["isSavePaymentAccount"] = "isSavePaymentAccount";
|
|
2970
2827
|
})(StatusSearchParam || (StatusSearchParam = {}));
|
|
2971
2828
|
|
|
2972
2829
|
const requiredStatusSearchParams = [
|
|
@@ -3046,15 +2903,15 @@ const statusSearchParamsMap = new Map([
|
|
|
3046
2903
|
converter: numberConverter,
|
|
3047
2904
|
},
|
|
3048
2905
|
],
|
|
3049
|
-
[
|
|
3050
|
-
StatusSearchParam.isSavePaymentAccount,
|
|
3051
|
-
{
|
|
3052
|
-
key: 'isSavePaymentAccount',
|
|
3053
|
-
converter: numberConverter,
|
|
3054
|
-
},
|
|
3055
|
-
],
|
|
3056
2906
|
]);
|
|
3057
2907
|
|
|
2908
|
+
class TerminalError extends AppError {
|
|
2909
|
+
constructor(message, code) {
|
|
2910
|
+
super(message);
|
|
2911
|
+
this.code = code;
|
|
2912
|
+
}
|
|
2913
|
+
}
|
|
2914
|
+
|
|
3058
2915
|
class XpsApiPart {
|
|
3059
2916
|
constructor() {
|
|
3060
2917
|
this.response = new BehaviorSubject(null);
|
|
@@ -3098,6 +2955,118 @@ const statusRequestFactoryProvider = {
|
|
|
3098
2955
|
useValue: (...args) => new StatusRequest(...args),
|
|
3099
2956
|
};
|
|
3100
2957
|
|
|
2958
|
+
var StatusGroups;
|
|
2959
|
+
(function (StatusGroups) {
|
|
2960
|
+
StatusGroups["troubled"] = "troubled";
|
|
2961
|
+
StatusGroups["done"] = "done";
|
|
2962
|
+
StatusGroups["invoice"] = "invoice";
|
|
2963
|
+
})(StatusGroups || (StatusGroups = {}));
|
|
2964
|
+
|
|
2965
|
+
var StatusEnum;
|
|
2966
|
+
(function (StatusEnum) {
|
|
2967
|
+
StatusEnum["created"] = "created";
|
|
2968
|
+
StatusEnum["awaiting"] = "awaiting";
|
|
2969
|
+
StatusEnum["processing"] = "processing";
|
|
2970
|
+
StatusEnum["authorized"] = "authorized";
|
|
2971
|
+
StatusEnum["held"] = "held";
|
|
2972
|
+
StatusEnum["done"] = "done";
|
|
2973
|
+
StatusEnum["error"] = "error";
|
|
2974
|
+
StatusEnum["canceled"] = "canceled";
|
|
2975
|
+
})(StatusEnum || (StatusEnum = {}));
|
|
2976
|
+
|
|
2977
|
+
class StatusResponse {
|
|
2978
|
+
constructor(parameters) {
|
|
2979
|
+
if (parameters.errors?.[0]) {
|
|
2980
|
+
this.error = {
|
|
2981
|
+
code: parameters.errors[0].code.toString(),
|
|
2982
|
+
message: parameters.errors[0].message,
|
|
2983
|
+
};
|
|
2984
|
+
}
|
|
2985
|
+
if (!parameters.status) {
|
|
2986
|
+
throw new TerminalError(this.error?.message ?? '', this.error?.code.toString() ?? '');
|
|
2987
|
+
}
|
|
2988
|
+
this.status = {
|
|
2989
|
+
statusState: parameters.status.statusData.stateText,
|
|
2990
|
+
email: parameters.status.statusData.email,
|
|
2991
|
+
webSocketUrl: parameters.status.statusData.webSocketChannelUrl,
|
|
2992
|
+
webSocketChannelName: parameters.status.statusData.webSocketChannelName,
|
|
2993
|
+
webSocketClientType: parameters.status.statusData.webSocketClientType,
|
|
2994
|
+
financeInfo: parameters.status.text.info,
|
|
2995
|
+
discount: parameters.status.text.info.discount
|
|
2996
|
+
? Math.abs(Number.parseFloat(parameters.status.text.info.discount?.value ?? ''))
|
|
2997
|
+
: null,
|
|
2998
|
+
isCancelUser: parameters.status.isCancelUser,
|
|
2999
|
+
postMessageStatus: parameters.status.isCancelUser
|
|
3000
|
+
? StatusGroups.troubled
|
|
3001
|
+
: parameters.status.group,
|
|
3002
|
+
virtualCurrencyAmount: parameters.status.statusData.out,
|
|
3003
|
+
backUrlSettings: {
|
|
3004
|
+
backUrl: parameters.status.text.backurl,
|
|
3005
|
+
backUrlAction: parameters.status.text.backurl_action,
|
|
3006
|
+
backUrlCaption: parameters.status.text.backurl_caption,
|
|
3007
|
+
returnRegion: parameters.status.return_region,
|
|
3008
|
+
},
|
|
3009
|
+
additionalBackButton: this.getAdditionalBackButton(parameters.status),
|
|
3010
|
+
group: parameters.status.group,
|
|
3011
|
+
needToCheck: parameters.status.needToCheck,
|
|
3012
|
+
autoRedirect: parameters.status.autoredirect,
|
|
3013
|
+
statusMessage: parameters.status.text.state,
|
|
3014
|
+
userId: parameters.status.statusData.v1,
|
|
3015
|
+
invoice: parameters.status.statusData.invoice,
|
|
3016
|
+
pid: parameters.status.statusData.pid,
|
|
3017
|
+
projectAmount: this.getProjectAmount(parameters.status),
|
|
3018
|
+
titleClass: parameters.status.title_class,
|
|
3019
|
+
paymentCountryIso: parameters.status.statusData.payment_country_iso,
|
|
3020
|
+
order: parameters.status.text.order,
|
|
3021
|
+
};
|
|
3022
|
+
if (parameters.form) {
|
|
3023
|
+
this.status.userReturnStatus = this.getUserReturnStatus(parameters.form);
|
|
3024
|
+
}
|
|
3025
|
+
if (this.status.statusState === StatusEnum.done ||
|
|
3026
|
+
this.status.statusState === StatusEnum.authorized) {
|
|
3027
|
+
this.status.isSuccess = true;
|
|
3028
|
+
}
|
|
3029
|
+
if (this.status.statusState === StatusEnum.canceled ||
|
|
3030
|
+
this.status.isCancelUser) {
|
|
3031
|
+
this.status.isCanceled = true;
|
|
3032
|
+
}
|
|
3033
|
+
}
|
|
3034
|
+
getUserReturnStatus(form) {
|
|
3035
|
+
const value = form['fix_userReturnStatus']?.value;
|
|
3036
|
+
if (value === 'undefined')
|
|
3037
|
+
return undefined;
|
|
3038
|
+
return value;
|
|
3039
|
+
}
|
|
3040
|
+
getProjectAmount(status) {
|
|
3041
|
+
if (!status.statusData.projectAmount) {
|
|
3042
|
+
return;
|
|
3043
|
+
}
|
|
3044
|
+
const [amount, currency] = status.statusData.projectAmount.split(' ');
|
|
3045
|
+
return {
|
|
3046
|
+
amount,
|
|
3047
|
+
currency,
|
|
3048
|
+
};
|
|
3049
|
+
}
|
|
3050
|
+
getAdditionalBackButton(status) {
|
|
3051
|
+
if (!status.text.is_additional_back_url_enabled) {
|
|
3052
|
+
return {
|
|
3053
|
+
link: '',
|
|
3054
|
+
action: '',
|
|
3055
|
+
label: '',
|
|
3056
|
+
region: '',
|
|
3057
|
+
isEnabled: false,
|
|
3058
|
+
};
|
|
3059
|
+
}
|
|
3060
|
+
return {
|
|
3061
|
+
link: status.text.additional_back_url_link ?? '',
|
|
3062
|
+
action: status.text.additional_back_url_action ?? '',
|
|
3063
|
+
label: status.text.additional_back_url_label ?? '',
|
|
3064
|
+
region: status.additional_button_return_region ?? '',
|
|
3065
|
+
isEnabled: status.text.is_additional_back_url_enabled,
|
|
3066
|
+
};
|
|
3067
|
+
}
|
|
3068
|
+
}
|
|
3069
|
+
|
|
3101
3070
|
const statusResponseFactoryToken = new InjectionToken('StatusResponse');
|
|
3102
3071
|
const statusResponseFactoryProvider = {
|
|
3103
3072
|
provide: statusResponseFactoryToken,
|
|
@@ -4574,137 +4543,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImpor
|
|
|
4574
4543
|
}]
|
|
4575
4544
|
}], ctorParameters: function () { return [{ type: StatusRequestService }, { type: CheckStatusService }, { type: WebsocketStatusService }]; } });
|
|
4576
4545
|
|
|
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
4546
|
class StatusService {
|
|
4693
|
-
constructor(urlService, statusRequestService, financeDetailsService, listenStatusService, nextActionService
|
|
4547
|
+
constructor(urlService, statusRequestService, financeDetailsService, listenStatusService, nextActionService) {
|
|
4694
4548
|
this.urlService = urlService;
|
|
4695
4549
|
this.statusRequestService = statusRequestService;
|
|
4696
4550
|
this.financeDetailsService = financeDetailsService;
|
|
4697
4551
|
this.listenStatusService = listenStatusService;
|
|
4698
4552
|
this.nextActionService = nextActionService;
|
|
4699
|
-
this.savePaymentMethodStatusService = savePaymentMethodStatusService;
|
|
4700
4553
|
}
|
|
4701
4554
|
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
4555
|
this.statusRequestService.setRequestParams(params);
|
|
4709
4556
|
this.startWaitingStatusUpdates(params.invoice);
|
|
4710
4557
|
this.statusRequestService.request();
|
|
@@ -4714,7 +4561,6 @@ class StatusService {
|
|
|
4714
4561
|
}
|
|
4715
4562
|
async getStatusWithUrlSearchParams(url) {
|
|
4716
4563
|
const searchParams = this.getRequestParamsFromUrl(url);
|
|
4717
|
-
console.log('searchParams', searchParams);
|
|
4718
4564
|
if (!searchParams) {
|
|
4719
4565
|
throw new Error('No required search params to get status');
|
|
4720
4566
|
}
|
|
@@ -4742,14 +4588,14 @@ class StatusService {
|
|
|
4742
4588
|
});
|
|
4743
4589
|
}
|
|
4744
4590
|
}
|
|
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 }
|
|
4591
|
+
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
4592
|
StatusService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: StatusService, providedIn: 'root' });
|
|
4747
4593
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: StatusService, decorators: [{
|
|
4748
4594
|
type: Injectable,
|
|
4749
4595
|
args: [{
|
|
4750
4596
|
providedIn: 'root',
|
|
4751
4597
|
}]
|
|
4752
|
-
}], ctorParameters: function () { return [{ type: UrlService }, { type: StatusRequestService }, { type: FinanceDetailsService }, { type: ListenStatusService }, { type: NextActionService }
|
|
4598
|
+
}], ctorParameters: function () { return [{ type: UrlService }, { type: StatusRequestService }, { type: FinanceDetailsService }, { type: ListenStatusService }, { type: NextActionService }]; } });
|
|
4753
4599
|
|
|
4754
4600
|
class CreditCardStateService extends EmitDataService {
|
|
4755
4601
|
}
|
|
@@ -4774,6 +4620,12 @@ var ThreeDsStatusTypes;
|
|
|
4774
4620
|
ThreeDsStatusTypes["collectDfp"] = "collect_dfp";
|
|
4775
4621
|
})(ThreeDsStatusTypes || (ThreeDsStatusTypes = {}));
|
|
4776
4622
|
|
|
4623
|
+
class XpsResponseError extends AppError {
|
|
4624
|
+
constructor(message) {
|
|
4625
|
+
super('XPS response failed' + (message ? `: "${message}".` : '.'));
|
|
4626
|
+
}
|
|
4627
|
+
}
|
|
4628
|
+
|
|
4777
4629
|
class StatusThreeDsRequest {
|
|
4778
4630
|
constructor(token, threeDsId) {
|
|
4779
4631
|
this.access_token = token;
|
|
@@ -5246,13 +5098,9 @@ class PaymentService {
|
|
|
5246
5098
|
this.emitFormFieldsStatus(this.form);
|
|
5247
5099
|
return;
|
|
5248
5100
|
}
|
|
5249
|
-
console.log('this.fields', this.fields);
|
|
5250
|
-
console.log('this.form', this.form);
|
|
5251
5101
|
const submitResponse = await this.submitService.request(this.fields, this.form);
|
|
5252
5102
|
this.data = submitResponse;
|
|
5253
|
-
|
|
5254
|
-
this.emitFinanceDetails(submitResponse.summary);
|
|
5255
|
-
}
|
|
5103
|
+
this.emitFinanceDetails(submitResponse.summary);
|
|
5256
5104
|
this.emitFormMessages(submitResponse.messages);
|
|
5257
5105
|
// Handle 3ds flow
|
|
5258
5106
|
if (submitResponse.currentCommand === XpsCommand.create) {
|
|
@@ -5301,10 +5149,7 @@ class PaymentService {
|
|
|
5301
5149
|
signature: this.data.signature ?? '',
|
|
5302
5150
|
locale: this.data.fields.find((field) => field.name === 'locale')?.value ??
|
|
5303
5151
|
'en',
|
|
5304
|
-
isSavePaymentAccount: this.data.isSavingMethodMode ? 1 : 0,
|
|
5305
5152
|
};
|
|
5306
|
-
console.log('this.data', this.data);
|
|
5307
|
-
console.log('getStatus', params);
|
|
5308
5153
|
return this.statusService.getStatus(params);
|
|
5309
5154
|
}
|
|
5310
5155
|
getFieldConfig(field) {
|
|
@@ -5522,7 +5367,7 @@ class CoreLibraryService {
|
|
|
5522
5367
|
this.creditCardStateService = creditCardStateService;
|
|
5523
5368
|
this.formMessagesService = formMessagesService;
|
|
5524
5369
|
this.paymentMethods = {
|
|
5525
|
-
getList: async (
|
|
5370
|
+
getList: async () => this.paymentMethodsService.getList(),
|
|
5526
5371
|
getQuickMethods: async () => this.paymentMethodsService.getQuickMethods(),
|
|
5527
5372
|
getSavedMethods: async () => this.savedMethodsService.getList(),
|
|
5528
5373
|
getUserBalance: async () => this.userBalanceService.getUserBalance(),
|