@xsolla/payment-client-core 0.1.14-test18 → 0.1.14-test2
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.service.mjs +3 -3
- package/esm2020/lib/core/payment/payment.interface.mjs +1 -1
- package/esm2020/lib/core/payment/payment.service.mjs +2 -11
- 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.interface.mjs +1 -1
- package/esm2020/lib/core/payment/status/status.service.mjs +4 -13
- package/esm2020/lib/core/payment-methods/payment-methods.service.mjs +1 -1
- package/esm2020/lib/core-library.service.mjs +1 -1
- package/fesm2015/xsolla-payment-client-core.mjs +145 -419
- package/fesm2015/xsolla-payment-client-core.mjs.map +1 -1
- package/fesm2020/xsolla-payment-client-core.mjs +142 -410
- 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/payment.interface.d.ts +1 -1
- package/lib/core/payment/payment.service.d.ts +1 -2
- 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.interface.d.ts +0 -1
- package/lib/core/payment/status/status.service.d.ts +3 -5
- package/lib/core/payment-methods/payment-methods.service.d.ts +1 -1
- package/lib/core-library.service.d.ts +2 -2
- package/package.json +1 -1
- package/xsolla-payment-client-core-0.1.14-test2.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 -191
- 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 -29
- package/xsolla-payment-client-core-0.1.14-test18.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
|
|
|
@@ -454,19 +454,13 @@ class PaymentConfigService {
|
|
|
454
454
|
}
|
|
455
455
|
return {
|
|
456
456
|
...config,
|
|
457
|
-
returnUrl: this.enrichReturnUrl(config.returnUrl,
|
|
457
|
+
returnUrl: this.enrichReturnUrl(config.returnUrl),
|
|
458
458
|
};
|
|
459
459
|
}
|
|
460
|
-
enrichReturnUrl(returnUrl
|
|
461
|
-
|
|
462
|
-
token: this.settingsService.token
|
|
460
|
+
enrichReturnUrl(returnUrl) {
|
|
461
|
+
return this.urlService.addSearchParams(returnUrl, {
|
|
462
|
+
token: this.settingsService.token,
|
|
463
463
|
});
|
|
464
|
-
if (savePaymentMethod) {
|
|
465
|
-
enrichedUrl = this.urlService.addSearchParams(returnUrl, {
|
|
466
|
-
isSavePaymentAccount: "1" /* XpsBoolean.true */
|
|
467
|
-
});
|
|
468
|
-
}
|
|
469
|
-
return enrichedUrl;
|
|
470
464
|
}
|
|
471
465
|
}
|
|
472
466
|
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 +468,7 @@ PaymentConfigService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0",
|
|
|
474
468
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: PaymentConfigService, decorators: [{
|
|
475
469
|
type: Injectable,
|
|
476
470
|
args: [{
|
|
477
|
-
providedIn: 'root'
|
|
471
|
+
providedIn: 'root',
|
|
478
472
|
}]
|
|
479
473
|
}], ctorParameters: function () { return [{ type: UrlService }, { type: SettingsService }]; } });
|
|
480
474
|
|
|
@@ -788,143 +782,15 @@ const checkStatusActionFactoryProvider = {
|
|
|
788
782
|
},
|
|
789
783
|
};
|
|
790
784
|
|
|
791
|
-
class TerminalError extends AppError {
|
|
792
|
-
constructor(message, code) {
|
|
793
|
-
super(message);
|
|
794
|
-
this.code = code;
|
|
795
|
-
}
|
|
796
|
-
}
|
|
797
|
-
|
|
798
|
-
var StatusGroups;
|
|
799
|
-
(function (StatusGroups) {
|
|
800
|
-
StatusGroups["troubled"] = "troubled";
|
|
801
|
-
StatusGroups["done"] = "done";
|
|
802
|
-
StatusGroups["invoice"] = "invoice";
|
|
803
|
-
})(StatusGroups || (StatusGroups = {}));
|
|
804
|
-
|
|
805
|
-
var StatusEnum;
|
|
806
|
-
(function (StatusEnum) {
|
|
807
|
-
StatusEnum["created"] = "created";
|
|
808
|
-
StatusEnum["awaiting"] = "awaiting";
|
|
809
|
-
StatusEnum["processing"] = "processing";
|
|
810
|
-
StatusEnum["authorized"] = "authorized";
|
|
811
|
-
StatusEnum["held"] = "held";
|
|
812
|
-
StatusEnum["done"] = "done";
|
|
813
|
-
StatusEnum["error"] = "error";
|
|
814
|
-
StatusEnum["canceled"] = "canceled";
|
|
815
|
-
})(StatusEnum || (StatusEnum = {}));
|
|
816
|
-
|
|
817
|
-
class StatusResponse {
|
|
818
|
-
constructor(parameters) {
|
|
819
|
-
if (parameters.errors?.[0]) {
|
|
820
|
-
this.error = {
|
|
821
|
-
code: parameters.errors[0].code.toString(),
|
|
822
|
-
message: parameters.errors[0].message,
|
|
823
|
-
};
|
|
824
|
-
}
|
|
825
|
-
if (!parameters.status) {
|
|
826
|
-
throw new TerminalError(this.error?.message ?? '', this.error?.code.toString() ?? '');
|
|
827
|
-
}
|
|
828
|
-
this.status = {
|
|
829
|
-
statusState: parameters.status.statusData.stateText,
|
|
830
|
-
email: parameters.status.statusData.email,
|
|
831
|
-
webSocketUrl: parameters.status.statusData.webSocketChannelUrl,
|
|
832
|
-
webSocketChannelName: parameters.status.statusData.webSocketChannelName,
|
|
833
|
-
webSocketClientType: parameters.status.statusData.webSocketClientType,
|
|
834
|
-
financeInfo: parameters.status.text.info,
|
|
835
|
-
discount: parameters.status.text.info.discount
|
|
836
|
-
? Math.abs(Number.parseFloat(parameters.status.text.info.discount?.value ?? ''))
|
|
837
|
-
: null,
|
|
838
|
-
isCancelUser: parameters.status.isCancelUser,
|
|
839
|
-
postMessageStatus: parameters.status.isCancelUser
|
|
840
|
-
? StatusGroups.troubled
|
|
841
|
-
: parameters.status.group,
|
|
842
|
-
virtualCurrencyAmount: parameters.status.statusData.out,
|
|
843
|
-
backUrlSettings: {
|
|
844
|
-
backUrl: parameters.status.text.backurl,
|
|
845
|
-
backUrlAction: parameters.status.text.backurl_action,
|
|
846
|
-
backUrlCaption: parameters.status.text.backurl_caption,
|
|
847
|
-
returnRegion: parameters.status.return_region,
|
|
848
|
-
},
|
|
849
|
-
additionalBackButton: this.getAdditionalBackButton(parameters.status),
|
|
850
|
-
group: parameters.status.group,
|
|
851
|
-
needToCheck: parameters.status.needToCheck,
|
|
852
|
-
autoRedirect: parameters.status.autoredirect,
|
|
853
|
-
statusMessage: parameters.status.text.state,
|
|
854
|
-
userId: parameters.status.statusData.v1,
|
|
855
|
-
invoice: parameters.status.statusData.invoice,
|
|
856
|
-
pid: parameters.status.statusData.pid,
|
|
857
|
-
projectAmount: this.getProjectAmount(parameters.status),
|
|
858
|
-
titleClass: parameters.status.title_class,
|
|
859
|
-
paymentCountryIso: parameters.status.statusData.payment_country_iso,
|
|
860
|
-
order: parameters.status.text.order,
|
|
861
|
-
};
|
|
862
|
-
if (parameters.form) {
|
|
863
|
-
this.status.userReturnStatus = this.getUserReturnStatus(parameters.form);
|
|
864
|
-
}
|
|
865
|
-
if (this.status.statusState === StatusEnum.done ||
|
|
866
|
-
this.status.statusState === StatusEnum.authorized) {
|
|
867
|
-
this.status.isSuccess = true;
|
|
868
|
-
}
|
|
869
|
-
if (this.status.statusState === StatusEnum.canceled ||
|
|
870
|
-
this.status.isCancelUser) {
|
|
871
|
-
this.status.isCanceled = true;
|
|
872
|
-
}
|
|
873
|
-
}
|
|
874
|
-
getUserReturnStatus(form) {
|
|
875
|
-
const value = form['fix_userReturnStatus']?.value;
|
|
876
|
-
if (value === 'undefined')
|
|
877
|
-
return undefined;
|
|
878
|
-
return value;
|
|
879
|
-
}
|
|
880
|
-
getProjectAmount(status) {
|
|
881
|
-
if (!status.statusData.projectAmount) {
|
|
882
|
-
return;
|
|
883
|
-
}
|
|
884
|
-
const [amount, currency] = status.statusData.projectAmount.split(' ');
|
|
885
|
-
return {
|
|
886
|
-
amount,
|
|
887
|
-
currency,
|
|
888
|
-
};
|
|
889
|
-
}
|
|
890
|
-
getAdditionalBackButton(status) {
|
|
891
|
-
if (!status.text.is_additional_back_url_enabled) {
|
|
892
|
-
return {
|
|
893
|
-
link: '',
|
|
894
|
-
action: '',
|
|
895
|
-
label: '',
|
|
896
|
-
region: '',
|
|
897
|
-
isEnabled: false,
|
|
898
|
-
};
|
|
899
|
-
}
|
|
900
|
-
return {
|
|
901
|
-
link: status.text.additional_back_url_link ?? '',
|
|
902
|
-
action: status.text.additional_back_url_action ?? '',
|
|
903
|
-
label: status.text.additional_back_url_label ?? '',
|
|
904
|
-
region: status.additional_button_return_region ?? '',
|
|
905
|
-
isEnabled: status.text.is_additional_back_url_enabled,
|
|
906
|
-
};
|
|
907
|
-
}
|
|
908
|
-
}
|
|
909
|
-
|
|
910
785
|
class StatusUpdatedAction {
|
|
911
|
-
constructor(statusResponse
|
|
786
|
+
constructor(statusResponse) {
|
|
912
787
|
this.type = 'status_updated';
|
|
913
|
-
let status;
|
|
914
|
-
if (statusResponse instanceof StatusResponse) {
|
|
915
|
-
status = statusResponse.status;
|
|
916
|
-
}
|
|
917
|
-
else {
|
|
918
|
-
status = statusResponse;
|
|
919
|
-
}
|
|
920
788
|
this.data = {
|
|
921
|
-
statusState: status.statusState,
|
|
922
|
-
invoice: status.invoice,
|
|
923
|
-
isSuccess: status.isSuccess,
|
|
924
|
-
isCanceled: status.isCanceled,
|
|
925
|
-
group: status.group,
|
|
926
|
-
isSavePaymentMethodMode,
|
|
927
|
-
savePaymentMethodStatus
|
|
789
|
+
statusState: statusResponse.status.statusState,
|
|
790
|
+
invoice: statusResponse.status.invoice,
|
|
791
|
+
isSuccess: statusResponse.status.isSuccess,
|
|
792
|
+
isCanceled: statusResponse.status.isCanceled,
|
|
793
|
+
group: statusResponse.status.group,
|
|
928
794
|
};
|
|
929
795
|
}
|
|
930
796
|
}
|
|
@@ -1602,7 +1468,7 @@ InitializeService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", ve
|
|
|
1602
1468
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: InitializeService, decorators: [{
|
|
1603
1469
|
type: Injectable,
|
|
1604
1470
|
args: [{
|
|
1605
|
-
providedIn: 'root'
|
|
1471
|
+
providedIn: 'root',
|
|
1606
1472
|
}]
|
|
1607
1473
|
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
1608
1474
|
type: Inject,
|
|
@@ -2960,7 +2826,6 @@ var StatusSearchParam;
|
|
|
2960
2826
|
StatusSearchParam["testPs"] = "fix_testPs";
|
|
2961
2827
|
StatusSearchParam["testXsolla"] = "fix_testXsolla";
|
|
2962
2828
|
StatusSearchParam["userReturnStatus"] = "fix_userReturnStatus";
|
|
2963
|
-
StatusSearchParam["isSavePaymentAccount"] = "isSavePaymentAccount";
|
|
2964
2829
|
})(StatusSearchParam || (StatusSearchParam = {}));
|
|
2965
2830
|
|
|
2966
2831
|
const requiredStatusSearchParams = [
|
|
@@ -3040,15 +2905,15 @@ const statusSearchParamsMap = new Map([
|
|
|
3040
2905
|
converter: numberConverter,
|
|
3041
2906
|
},
|
|
3042
2907
|
],
|
|
3043
|
-
[
|
|
3044
|
-
StatusSearchParam.isSavePaymentAccount,
|
|
3045
|
-
{
|
|
3046
|
-
key: 'isSavePaymentAccount',
|
|
3047
|
-
converter: numberConverter,
|
|
3048
|
-
},
|
|
3049
|
-
],
|
|
3050
2908
|
]);
|
|
3051
2909
|
|
|
2910
|
+
class TerminalError extends AppError {
|
|
2911
|
+
constructor(message, code) {
|
|
2912
|
+
super(message);
|
|
2913
|
+
this.code = code;
|
|
2914
|
+
}
|
|
2915
|
+
}
|
|
2916
|
+
|
|
3052
2917
|
class XpsApiPart {
|
|
3053
2918
|
constructor() {
|
|
3054
2919
|
this.response = new BehaviorSubject(null);
|
|
@@ -3092,6 +2957,118 @@ const statusRequestFactoryProvider = {
|
|
|
3092
2957
|
useValue: (...args) => new StatusRequest(...args),
|
|
3093
2958
|
};
|
|
3094
2959
|
|
|
2960
|
+
var StatusGroups;
|
|
2961
|
+
(function (StatusGroups) {
|
|
2962
|
+
StatusGroups["troubled"] = "troubled";
|
|
2963
|
+
StatusGroups["done"] = "done";
|
|
2964
|
+
StatusGroups["invoice"] = "invoice";
|
|
2965
|
+
})(StatusGroups || (StatusGroups = {}));
|
|
2966
|
+
|
|
2967
|
+
var StatusEnum;
|
|
2968
|
+
(function (StatusEnum) {
|
|
2969
|
+
StatusEnum["created"] = "created";
|
|
2970
|
+
StatusEnum["awaiting"] = "awaiting";
|
|
2971
|
+
StatusEnum["processing"] = "processing";
|
|
2972
|
+
StatusEnum["authorized"] = "authorized";
|
|
2973
|
+
StatusEnum["held"] = "held";
|
|
2974
|
+
StatusEnum["done"] = "done";
|
|
2975
|
+
StatusEnum["error"] = "error";
|
|
2976
|
+
StatusEnum["canceled"] = "canceled";
|
|
2977
|
+
})(StatusEnum || (StatusEnum = {}));
|
|
2978
|
+
|
|
2979
|
+
class StatusResponse {
|
|
2980
|
+
constructor(parameters) {
|
|
2981
|
+
if (parameters.errors?.[0]) {
|
|
2982
|
+
this.error = {
|
|
2983
|
+
code: parameters.errors[0].code.toString(),
|
|
2984
|
+
message: parameters.errors[0].message,
|
|
2985
|
+
};
|
|
2986
|
+
}
|
|
2987
|
+
if (!parameters.status) {
|
|
2988
|
+
throw new TerminalError(this.error?.message ?? '', this.error?.code.toString() ?? '');
|
|
2989
|
+
}
|
|
2990
|
+
this.status = {
|
|
2991
|
+
statusState: parameters.status.statusData.stateText,
|
|
2992
|
+
email: parameters.status.statusData.email,
|
|
2993
|
+
webSocketUrl: parameters.status.statusData.webSocketChannelUrl,
|
|
2994
|
+
webSocketChannelName: parameters.status.statusData.webSocketChannelName,
|
|
2995
|
+
webSocketClientType: parameters.status.statusData.webSocketClientType,
|
|
2996
|
+
financeInfo: parameters.status.text.info,
|
|
2997
|
+
discount: parameters.status.text.info.discount
|
|
2998
|
+
? Math.abs(Number.parseFloat(parameters.status.text.info.discount?.value ?? ''))
|
|
2999
|
+
: null,
|
|
3000
|
+
isCancelUser: parameters.status.isCancelUser,
|
|
3001
|
+
postMessageStatus: parameters.status.isCancelUser
|
|
3002
|
+
? StatusGroups.troubled
|
|
3003
|
+
: parameters.status.group,
|
|
3004
|
+
virtualCurrencyAmount: parameters.status.statusData.out,
|
|
3005
|
+
backUrlSettings: {
|
|
3006
|
+
backUrl: parameters.status.text.backurl,
|
|
3007
|
+
backUrlAction: parameters.status.text.backurl_action,
|
|
3008
|
+
backUrlCaption: parameters.status.text.backurl_caption,
|
|
3009
|
+
returnRegion: parameters.status.return_region,
|
|
3010
|
+
},
|
|
3011
|
+
additionalBackButton: this.getAdditionalBackButton(parameters.status),
|
|
3012
|
+
group: parameters.status.group,
|
|
3013
|
+
needToCheck: parameters.status.needToCheck,
|
|
3014
|
+
autoRedirect: parameters.status.autoredirect,
|
|
3015
|
+
statusMessage: parameters.status.text.state,
|
|
3016
|
+
userId: parameters.status.statusData.v1,
|
|
3017
|
+
invoice: parameters.status.statusData.invoice,
|
|
3018
|
+
pid: parameters.status.statusData.pid,
|
|
3019
|
+
projectAmount: this.getProjectAmount(parameters.status),
|
|
3020
|
+
titleClass: parameters.status.title_class,
|
|
3021
|
+
paymentCountryIso: parameters.status.statusData.payment_country_iso,
|
|
3022
|
+
order: parameters.status.text.order,
|
|
3023
|
+
};
|
|
3024
|
+
if (parameters.form) {
|
|
3025
|
+
this.status.userReturnStatus = this.getUserReturnStatus(parameters.form);
|
|
3026
|
+
}
|
|
3027
|
+
if (this.status.statusState === StatusEnum.done ||
|
|
3028
|
+
this.status.statusState === StatusEnum.authorized) {
|
|
3029
|
+
this.status.isSuccess = true;
|
|
3030
|
+
}
|
|
3031
|
+
if (this.status.statusState === StatusEnum.canceled ||
|
|
3032
|
+
this.status.isCancelUser) {
|
|
3033
|
+
this.status.isCanceled = true;
|
|
3034
|
+
}
|
|
3035
|
+
}
|
|
3036
|
+
getUserReturnStatus(form) {
|
|
3037
|
+
const value = form['fix_userReturnStatus']?.value;
|
|
3038
|
+
if (value === 'undefined')
|
|
3039
|
+
return undefined;
|
|
3040
|
+
return value;
|
|
3041
|
+
}
|
|
3042
|
+
getProjectAmount(status) {
|
|
3043
|
+
if (!status.statusData.projectAmount) {
|
|
3044
|
+
return;
|
|
3045
|
+
}
|
|
3046
|
+
const [amount, currency] = status.statusData.projectAmount.split(' ');
|
|
3047
|
+
return {
|
|
3048
|
+
amount,
|
|
3049
|
+
currency,
|
|
3050
|
+
};
|
|
3051
|
+
}
|
|
3052
|
+
getAdditionalBackButton(status) {
|
|
3053
|
+
if (!status.text.is_additional_back_url_enabled) {
|
|
3054
|
+
return {
|
|
3055
|
+
link: '',
|
|
3056
|
+
action: '',
|
|
3057
|
+
label: '',
|
|
3058
|
+
region: '',
|
|
3059
|
+
isEnabled: false,
|
|
3060
|
+
};
|
|
3061
|
+
}
|
|
3062
|
+
return {
|
|
3063
|
+
link: status.text.additional_back_url_link ?? '',
|
|
3064
|
+
action: status.text.additional_back_url_action ?? '',
|
|
3065
|
+
label: status.text.additional_back_url_label ?? '',
|
|
3066
|
+
region: status.additional_button_return_region ?? '',
|
|
3067
|
+
isEnabled: status.text.is_additional_back_url_enabled,
|
|
3068
|
+
};
|
|
3069
|
+
}
|
|
3070
|
+
}
|
|
3071
|
+
|
|
3095
3072
|
const statusResponseFactoryToken = new InjectionToken('StatusResponse');
|
|
3096
3073
|
const statusResponseFactoryProvider = {
|
|
3097
3074
|
provide: statusResponseFactoryToken,
|
|
@@ -4568,256 +4545,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImpor
|
|
|
4568
4545
|
}]
|
|
4569
4546
|
}], ctorParameters: function () { return [{ type: StatusRequestService }, { type: CheckStatusService }, { type: WebsocketStatusService }]; } });
|
|
4570
4547
|
|
|
4571
|
-
var TitleClass;
|
|
4572
|
-
(function (TitleClass) {
|
|
4573
|
-
TitleClass["done"] = "done";
|
|
4574
|
-
TitleClass["cancel"] = "cancel";
|
|
4575
|
-
TitleClass["cancelUser"] = "canceluser";
|
|
4576
|
-
})(TitleClass || (TitleClass = {}));
|
|
4577
|
-
|
|
4578
|
-
var SavePaymentMethodStatus;
|
|
4579
|
-
(function (SavePaymentMethodStatus) {
|
|
4580
|
-
SavePaymentMethodStatus["success"] = "success";
|
|
4581
|
-
SavePaymentMethodStatus["failed"] = "failed";
|
|
4582
|
-
})(SavePaymentMethodStatus || (SavePaymentMethodStatus = {}));
|
|
4583
|
-
|
|
4584
|
-
class XpsResponseError extends AppError {
|
|
4585
|
-
constructor(message) {
|
|
4586
|
-
super('XPS response failed' + (message ? `: "${message}".` : '.'));
|
|
4587
|
-
}
|
|
4588
|
-
}
|
|
4589
|
-
|
|
4590
|
-
class SavedPaymentAccountChangesService {
|
|
4591
|
-
constructor(settingsService, secureApi) {
|
|
4592
|
-
this.settingsService = settingsService;
|
|
4593
|
-
this.secureApi = secureApi;
|
|
4594
|
-
this.apiRoute = 'savedmethods/newaccountinfo';
|
|
4595
|
-
this.response = new Subject();
|
|
4596
|
-
}
|
|
4597
|
-
get response$() {
|
|
4598
|
-
return this.response.asObservable();
|
|
4599
|
-
}
|
|
4600
|
-
async request(invoice) {
|
|
4601
|
-
const requestParameters = {
|
|
4602
|
-
access_token: this.settingsService.token,
|
|
4603
|
-
invoice_id: invoice,
|
|
4604
|
-
};
|
|
4605
|
-
return lastValueFrom(this.secureApi
|
|
4606
|
-
.post(this.apiRoute, new URLSearchParams(requestParameters), {
|
|
4607
|
-
headers: new HttpHeaders().set('Content-Type', 'application/x-www-form-urlencoded; charset=utf-8'),
|
|
4608
|
-
responseType: 'json',
|
|
4609
|
-
})
|
|
4610
|
-
.pipe(tap((value) => {
|
|
4611
|
-
this.response.next(value);
|
|
4612
|
-
}))).catch((error) => {
|
|
4613
|
-
throw new XpsResponseError(error.message);
|
|
4614
|
-
});
|
|
4615
|
-
}
|
|
4616
|
-
}
|
|
4617
|
-
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 });
|
|
4618
|
-
SavedPaymentAccountChangesService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: SavedPaymentAccountChangesService, providedIn: 'root' });
|
|
4619
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: SavedPaymentAccountChangesService, decorators: [{
|
|
4620
|
-
type: Injectable,
|
|
4621
|
-
args: [{
|
|
4622
|
-
providedIn: 'root'
|
|
4623
|
-
}]
|
|
4624
|
-
}], ctorParameters: function () { return [{ type: SettingsService }, { type: SecureApiClient }]; } });
|
|
4625
|
-
|
|
4626
|
-
class SavePaymentMethodStatusService {
|
|
4627
|
-
constructor(statusRequestService, listenStatusService, savedPaymentAccountChangesService, nextActionService, checkStatusService) {
|
|
4628
|
-
this.statusRequestService = statusRequestService;
|
|
4629
|
-
this.listenStatusService = listenStatusService;
|
|
4630
|
-
this.savedPaymentAccountChangesService = savedPaymentAccountChangesService;
|
|
4631
|
-
this.nextActionService = nextActionService;
|
|
4632
|
-
this.checkStatusService = checkStatusService;
|
|
4633
|
-
}
|
|
4634
|
-
async getStatus(params) {
|
|
4635
|
-
this.statusRequestService.setRequestParams(params);
|
|
4636
|
-
this.statusRequestService.request();
|
|
4637
|
-
const statusResponse = await firstValueFrom(this.statusRequestService.response$);
|
|
4638
|
-
statusResponse.status.isSavePaymentAccount = true;
|
|
4639
|
-
const accountData = await this.getPaymentAccountData(params.invoice);
|
|
4640
|
-
if (this.savingFailedOrCancel(statusResponse?.status) || this.savingSuccessful(accountData, statusResponse?.status)) {
|
|
4641
|
-
return statusResponse.status;
|
|
4642
|
-
}
|
|
4643
|
-
this.checkStatus(params);
|
|
4644
|
-
statusResponse.status.isSavePaymentAccount = true;
|
|
4645
|
-
statusResponse.status.statusState = StatusEnum.processing;
|
|
4646
|
-
return statusResponse.status;
|
|
4647
|
-
}
|
|
4648
|
-
checkStatus(params) {
|
|
4649
|
-
this.startWaitingStatusUpdates(params.invoice);
|
|
4650
|
-
this.statusRequestService.request();
|
|
4651
|
-
}
|
|
4652
|
-
async getStatusOld(params) {
|
|
4653
|
-
console.log('getStatus', params);
|
|
4654
|
-
this.statusRequestService.setRequestParams(params);
|
|
4655
|
-
// this.startWaitingStatusUpdates(params.invoice);
|
|
4656
|
-
this.statusRequestService.request();
|
|
4657
|
-
const statusResponse = await firstValueFrom(this.statusRequestService.response$);
|
|
4658
|
-
this.checkStatusService.setRequestParams(params.invoice);
|
|
4659
|
-
this.checkStatusService.request();
|
|
4660
|
-
const checkStatusResponse = await firstValueFrom(this.checkStatusService.response$);
|
|
4661
|
-
if (!checkStatusResponse.final) {
|
|
4662
|
-
this.startWaitingStatusUpdates(params.invoice);
|
|
4663
|
-
statusResponse.status.isSavePaymentAccount = true;
|
|
4664
|
-
statusResponse.status.statusState = StatusEnum.processing;
|
|
4665
|
-
return statusResponse.status;
|
|
4666
|
-
}
|
|
4667
|
-
// todo: get account
|
|
4668
|
-
const accountData = await this.getPaymentAccountData(params.invoice);
|
|
4669
|
-
if (!this.savingFailedOrCancel(statusResponse?.status) && !this.savingSuccessful(accountData, statusResponse?.status)) {
|
|
4670
|
-
// todo is proccessing
|
|
4671
|
-
this.startWaitingStatusUpdates(params.invoice);
|
|
4672
|
-
statusResponse.status.statusState = StatusEnum.processing;
|
|
4673
|
-
}
|
|
4674
|
-
statusResponse.status.isSavePaymentAccount = true;
|
|
4675
|
-
return statusResponse.status;
|
|
4676
|
-
// this.listenStatusService.listen(params.invoice);
|
|
4677
|
-
// this.statusRequestService.request();
|
|
4678
|
-
// const paramsCheck = {
|
|
4679
|
-
// section: 'getstatus',
|
|
4680
|
-
// action: 'getstatus',
|
|
4681
|
-
// // invoice: params.invoice,
|
|
4682
|
-
// ...params,
|
|
4683
|
-
// access_token: params.token || '8sogPLisB328Snf9M9aChSwkZn4IzOzf_lc_en'
|
|
4684
|
-
// };
|
|
4685
|
-
// // const check = await this.checkStatusService.requestPromise('directpayment', paramsCheck);
|
|
4686
|
-
// // console.log('requestPromise', check);
|
|
4687
|
-
// // todo: get account
|
|
4688
|
-
// // const accountData = await this.getPaymentAccountData(params.invoice);
|
|
4689
|
-
// // this.startWaitingStatusUpdates(params.invoice);
|
|
4690
|
-
// // this.listenStatusService.statusUpdated$
|
|
4691
|
-
// this.startWaitingStatusUpdates(params.invoice);
|
|
4692
|
-
// this.statusRequestService.request();
|
|
4693
|
-
// this.checkStatusService.setRequestParams(params.invoice);
|
|
4694
|
-
// this.checkStatusService.request();
|
|
4695
|
-
// this.checkStatusService.response$.subscribe((resp) => {
|
|
4696
|
-
// console.log('checkSt', resp);
|
|
4697
|
-
// });
|
|
4698
|
-
// const statusResponse = await firstValueFrom(
|
|
4699
|
-
// this.statusRequestService.response$
|
|
4700
|
-
// );
|
|
4701
|
-
// const savingFailedOrCancel = statusResponse.status?.titleClass === TitleClass.cancel || statusResponse.status?.titleClass === TitleClass.cancelUser;
|
|
4702
|
-
// const savingSuccessful = statusResponse.status?.titleClass === TitleClass.done && accountData?.new_account;
|
|
4703
|
-
// if (!accountData) {
|
|
4704
|
-
// this.startWaitingStatusUpdates(params.invoice);
|
|
4705
|
-
// statusResponse.status.statusState = StatusEnum.processing;
|
|
4706
|
-
// }
|
|
4707
|
-
// if (!this.savingFailedOrCancel(statusResponse?.status) && !this.savingSuccessful(accountData, statusResponse?.status)) {
|
|
4708
|
-
// // todo is proccessing
|
|
4709
|
-
//
|
|
4710
|
-
// // this.startWaitingStatusUpdates(params.invoice);
|
|
4711
|
-
// statusResponse.status.statusState = StatusEnum.processing;
|
|
4712
|
-
// }
|
|
4713
|
-
// statusResponse.status.isSavePaymentAccount = true;
|
|
4714
|
-
// return statusResponse.status;
|
|
4715
|
-
// return null;
|
|
4716
|
-
// if (!this.savePaymentMethodStatus) {
|
|
4717
|
-
// statusResponse.status.statusState = StatusEnum.processing;
|
|
4718
|
-
// }
|
|
4719
|
-
// statusResponse.status.isSavePaymentAccount = true;
|
|
4720
|
-
// return statusResponse.status;
|
|
4721
|
-
}
|
|
4722
|
-
savingFailedOrCancel(status) {
|
|
4723
|
-
return status?.titleClass === TitleClass.cancel || status?.titleClass === TitleClass.cancelUser;
|
|
4724
|
-
}
|
|
4725
|
-
savingSuccessful(accountData, status, checkStatus) {
|
|
4726
|
-
return !!(status?.titleClass === TitleClass.done && (accountData?.new_account || checkStatus?.isPaymentAccountAttached));
|
|
4727
|
-
}
|
|
4728
|
-
getPaymentAccountData(invoice) {
|
|
4729
|
-
return this.savedPaymentAccountChangesService
|
|
4730
|
-
.request(invoice);
|
|
4731
|
-
// .then((accountChanges: SavedPaymentAccountChanges) => {
|
|
4732
|
-
// if (accountChanges) {
|
|
4733
|
-
// this.handleSavingStatus(status, accountChanges.new_account);
|
|
4734
|
-
// }
|
|
4735
|
-
// });
|
|
4736
|
-
}
|
|
4737
|
-
startWaitingStatusUpdates(invoice) {
|
|
4738
|
-
if (this.listenStatusSubscription) {
|
|
4739
|
-
this.listenStatusSubscription.unsubscribe();
|
|
4740
|
-
this.listenStatusService.stopListening();
|
|
4741
|
-
}
|
|
4742
|
-
// debugger
|
|
4743
|
-
this.listenStatusService.listen(invoice);
|
|
4744
|
-
this.listenStatusSubscription = this.listenStatusService.statusUpdated$
|
|
4745
|
-
.subscribe((statusSettings) => {
|
|
4746
|
-
// this.checkStatusService.response$.subscribe((res) => {
|
|
4747
|
-
// if (res.final) {
|
|
4748
|
-
// if (statusSettings?.statusResponse.status) {
|
|
4749
|
-
// this.loadNewPaymentAccountData(statusSettings?.statusResponse.status, res)
|
|
4750
|
-
// }
|
|
4751
|
-
// }
|
|
4752
|
-
// });
|
|
4753
|
-
void firstValueFrom(this.checkStatusService.response$).then((checkStatusResponse) => {
|
|
4754
|
-
if (checkStatusResponse.final && statusSettings?.statusResponse.status) {
|
|
4755
|
-
this.loadNewPaymentAccountData(statusSettings?.statusResponse.status, checkStatusResponse);
|
|
4756
|
-
}
|
|
4757
|
-
});
|
|
4758
|
-
// this.checkStatusService.request();
|
|
4759
|
-
// const checkStatusResponse = await firstValueFrom(
|
|
4760
|
-
// this.checkStatusService.response$
|
|
4761
|
-
// );
|
|
4762
|
-
});
|
|
4763
|
-
// this.statusRequestService.request();
|
|
4764
|
-
}
|
|
4765
|
-
loadNewPaymentAccountData(status, checkStatus) {
|
|
4766
|
-
if (!status.invoice) {
|
|
4767
|
-
return;
|
|
4768
|
-
}
|
|
4769
|
-
void this.savedPaymentAccountChangesService
|
|
4770
|
-
.request(status.invoice)
|
|
4771
|
-
.then((accountChanges) => {
|
|
4772
|
-
if (accountChanges) {
|
|
4773
|
-
this.handleSavingStatus(status, accountChanges, checkStatus);
|
|
4774
|
-
}
|
|
4775
|
-
});
|
|
4776
|
-
}
|
|
4777
|
-
handleSavingStatus(status, account, checkStatus) {
|
|
4778
|
-
// const savingFailedOrCancel = status?.titleClass === TitleClass.cancel || status?.titleClass === TitleClass.cancelUser;
|
|
4779
|
-
//
|
|
4780
|
-
// const savingSuccessful = status?.titleClass === TitleClass.done && account;
|
|
4781
|
-
if (this.savingSuccessful(account, status, checkStatus)) {
|
|
4782
|
-
this.savePaymentMethodStatus = SavePaymentMethodStatus.success;
|
|
4783
|
-
}
|
|
4784
|
-
else {
|
|
4785
|
-
this.savePaymentMethodStatus = SavePaymentMethodStatus.failed;
|
|
4786
|
-
}
|
|
4787
|
-
this.listenStatusService.stopListening();
|
|
4788
|
-
this.listenStatusSubscription.unsubscribe();
|
|
4789
|
-
// const paymentAccountWasSaved = status?.titleClass === TitleClass.done && account !== null;
|
|
4790
|
-
const isSavePaymentMethod = true;
|
|
4791
|
-
// this.savePaymentMethodStatus = this.savingFailedOrCancel(status) ? SavePaymentMethodStatus.success : SavePaymentMethodStatus.failed;
|
|
4792
|
-
console.log(status, isSavePaymentMethod, this.savePaymentMethodStatus);
|
|
4793
|
-
this.nextActionService.emitFlowUpdates(new StatusUpdatedAction(status, isSavePaymentMethod, this.savePaymentMethodStatus));
|
|
4794
|
-
}
|
|
4795
|
-
}
|
|
4796
|
-
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 }, { token: CheckStatusService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
4797
|
-
SavePaymentMethodStatusService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: SavePaymentMethodStatusService, providedIn: 'root' });
|
|
4798
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: SavePaymentMethodStatusService, decorators: [{
|
|
4799
|
-
type: Injectable,
|
|
4800
|
-
args: [{
|
|
4801
|
-
providedIn: 'root'
|
|
4802
|
-
}]
|
|
4803
|
-
}], ctorParameters: function () { return [{ type: StatusRequestService }, { type: ListenStatusService }, { type: SavedPaymentAccountChangesService }, { type: NextActionService }, { type: CheckStatusService }]; } });
|
|
4804
|
-
|
|
4805
4548
|
class StatusService {
|
|
4806
|
-
constructor(urlService, statusRequestService, financeDetailsService, listenStatusService, nextActionService
|
|
4549
|
+
constructor(urlService, statusRequestService, financeDetailsService, listenStatusService, nextActionService) {
|
|
4807
4550
|
this.urlService = urlService;
|
|
4808
4551
|
this.statusRequestService = statusRequestService;
|
|
4809
4552
|
this.financeDetailsService = financeDetailsService;
|
|
4810
4553
|
this.listenStatusService = listenStatusService;
|
|
4811
4554
|
this.nextActionService = nextActionService;
|
|
4812
|
-
this.savePaymentMethodStatusService = savePaymentMethodStatusService;
|
|
4813
4555
|
}
|
|
4814
4556
|
async getStatus(params) {
|
|
4815
|
-
// todo: если params.savePaymentMethod, то надо выполнить логику для
|
|
4816
|
-
// account status
|
|
4817
|
-
const isSavePaymentMethodMode = !!params?.isSavePaymentAccount;
|
|
4818
|
-
if (isSavePaymentMethodMode) {
|
|
4819
|
-
return this.savePaymentMethodStatusService.getStatus(params); // todo: saveMethodStatus.getStatus();
|
|
4820
|
-
}
|
|
4821
4557
|
this.statusRequestService.setRequestParams(params);
|
|
4822
4558
|
this.startWaitingStatusUpdates(params.invoice);
|
|
4823
4559
|
this.statusRequestService.request();
|
|
@@ -4827,7 +4563,6 @@ class StatusService {
|
|
|
4827
4563
|
}
|
|
4828
4564
|
async getStatusWithUrlSearchParams(url) {
|
|
4829
4565
|
const searchParams = this.getRequestParamsFromUrl(url);
|
|
4830
|
-
console.log('searchParams', searchParams);
|
|
4831
4566
|
if (!searchParams) {
|
|
4832
4567
|
throw new Error('No required search params to get status');
|
|
4833
4568
|
}
|
|
@@ -4855,14 +4590,14 @@ class StatusService {
|
|
|
4855
4590
|
});
|
|
4856
4591
|
}
|
|
4857
4592
|
}
|
|
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 }
|
|
4593
|
+
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 });
|
|
4859
4594
|
StatusService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: StatusService, providedIn: 'root' });
|
|
4860
4595
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: StatusService, decorators: [{
|
|
4861
4596
|
type: Injectable,
|
|
4862
4597
|
args: [{
|
|
4863
4598
|
providedIn: 'root',
|
|
4864
4599
|
}]
|
|
4865
|
-
}], ctorParameters: function () { return [{ type: UrlService }, { type: StatusRequestService }, { type: FinanceDetailsService }, { type: ListenStatusService }, { type: NextActionService }
|
|
4600
|
+
}], ctorParameters: function () { return [{ type: UrlService }, { type: StatusRequestService }, { type: FinanceDetailsService }, { type: ListenStatusService }, { type: NextActionService }]; } });
|
|
4866
4601
|
|
|
4867
4602
|
class CreditCardStateService extends EmitDataService {
|
|
4868
4603
|
}
|
|
@@ -4887,6 +4622,12 @@ var ThreeDsStatusTypes;
|
|
|
4887
4622
|
ThreeDsStatusTypes["collectDfp"] = "collect_dfp";
|
|
4888
4623
|
})(ThreeDsStatusTypes || (ThreeDsStatusTypes = {}));
|
|
4889
4624
|
|
|
4625
|
+
class XpsResponseError extends AppError {
|
|
4626
|
+
constructor(message) {
|
|
4627
|
+
super('XPS response failed' + (message ? `: "${message}".` : '.'));
|
|
4628
|
+
}
|
|
4629
|
+
}
|
|
4630
|
+
|
|
4890
4631
|
class StatusThreeDsRequest {
|
|
4891
4632
|
constructor(token, threeDsId) {
|
|
4892
4633
|
this.access_token = token;
|
|
@@ -5334,7 +5075,6 @@ class PaymentService {
|
|
|
5334
5075
|
this.destroy$ = new Subject();
|
|
5335
5076
|
this.formDestroy$ = new Subject();
|
|
5336
5077
|
this.formFieldsStatusSubject = new BehaviorSubject(null);
|
|
5337
|
-
this.isSavingMethodMode = false;
|
|
5338
5078
|
}
|
|
5339
5079
|
async initialize(config) {
|
|
5340
5080
|
this.destroy$ = new Subject();
|
|
@@ -5360,14 +5100,9 @@ class PaymentService {
|
|
|
5360
5100
|
this.emitFormFieldsStatus(this.form);
|
|
5361
5101
|
return;
|
|
5362
5102
|
}
|
|
5363
|
-
console.log('this.fields', this.fields);
|
|
5364
|
-
console.log('this.form', this.form);
|
|
5365
|
-
this.isSavingMethodMode = this.fields.some(({ name, value }) => name === 'savePsAccountOnly' && value === "1" /* XpsBoolean.true */);
|
|
5366
5103
|
const submitResponse = await this.submitService.request(this.fields, this.form);
|
|
5367
5104
|
this.data = submitResponse;
|
|
5368
|
-
|
|
5369
|
-
this.emitFinanceDetails(submitResponse.summary);
|
|
5370
|
-
}
|
|
5105
|
+
this.emitFinanceDetails(submitResponse.summary);
|
|
5371
5106
|
this.emitFormMessages(submitResponse.messages);
|
|
5372
5107
|
// Handle 3ds flow
|
|
5373
5108
|
if (submitResponse.currentCommand === XpsCommand.create) {
|
|
@@ -5416,10 +5151,7 @@ class PaymentService {
|
|
|
5416
5151
|
signature: this.data.signature ?? '',
|
|
5417
5152
|
locale: this.data.fields.find((field) => field.name === 'locale')?.value ??
|
|
5418
5153
|
'en',
|
|
5419
|
-
isSavePaymentAccount: this.isSavingMethodMode ? 1 : 0,
|
|
5420
5154
|
};
|
|
5421
|
-
console.log('this.data', this.data);
|
|
5422
|
-
console.log('getStatus', params);
|
|
5423
5155
|
return this.statusService.getStatus(params);
|
|
5424
5156
|
}
|
|
5425
5157
|
getFieldConfig(field) {
|