@xsolla/payment-client-core 0.1.22 → 0.2.0
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/extended-window.interface.mjs +1 -1
- package/esm2020/lib/core/payment/actions/action.interface.mjs +1 -1
- package/esm2020/lib/core/payment/actions/check-status/check-status.action.class.mjs +19 -11
- package/esm2020/lib/core/payment/actions/check-status/check-status.action.type.mjs +1 -1
- package/esm2020/lib/core/payment/actions/next-action.interface.mjs +1 -1
- package/esm2020/lib/core/payment/actions/next-action.service.mjs +12 -13
- package/esm2020/lib/core/payment/actions/next-actions.mjs +15 -13
- package/esm2020/lib/core/payment/actions/redirect/redirect.action.class.mjs +37 -15
- package/esm2020/lib/core/payment/actions/show-errors/show-errors.action.class.mjs +18 -5
- package/esm2020/lib/core/payment/actions/show-fields/show-fields.action.class.mjs +26 -8
- package/esm2020/lib/core/payment/actions/special-button/special-button.action.class.mjs +41 -0
- package/esm2020/lib/core/payment/actions/special-button/special-button.action.type.mjs +2 -0
- package/esm2020/lib/core/payment/actions/status-updated/status-updated.action.class.mjs +26 -11
- package/esm2020/lib/core/payment/actions/three-ds/three-ds.action.class.mjs +19 -4
- package/esm2020/lib/core/payment/initialize/initialize.service.mjs +7 -6
- package/esm2020/lib/core/payment/payment.service.mjs +20 -4
- package/esm2020/lib/core/payment/status/save-payment-method-status/save-payment-method-status.service.mjs +11 -6
- package/esm2020/lib/core/payment/status/status.service.mjs +7 -6
- package/esm2020/lib/core/payment/sync/sync.service.mjs +7 -6
- package/esm2020/lib/core/payment/three-ds/three-ds.service.mjs +10 -8
- package/esm2020/lib/core/payment/xps-checkout.mjs +2 -0
- package/esm2020/lib/core/sdk-payment-systems/google-pay/google-pay-checkout.interface.mjs +2 -0
- package/esm2020/lib/core/sdk-payment-systems/google-pay/google-pay-init-params.interface.mjs +2 -0
- package/esm2020/lib/core/sdk-payment-systems/google-pay/google-pay-library.interface.mjs +2 -0
- package/esm2020/lib/core/sdk-payment-systems/google-pay/google-pay.service.mjs +205 -0
- package/esm2020/lib/core/sdk-payment-systems/payment-systems/payment-system-processing.service.mjs +84 -0
- package/esm2020/lib/core/sdk-payment-systems/sdk-payment-methods.const.mjs +2 -0
- package/esm2020/lib/core/sdk-payment-systems/sdk-payment-systems-initial-data.interface.mjs +2 -0
- package/esm2020/lib/core/sdk-payment-systems/sdk-payment-systems.interface.mjs +2 -0
- package/esm2020/lib/core-library.module.mjs +1 -1
- package/esm2020/lib/core-library.service.mjs +25 -4
- package/fesm2015/xsolla-payment-client-core.mjs +569 -197
- package/fesm2015/xsolla-payment-client-core.mjs.map +1 -1
- package/fesm2020/xsolla-payment-client-core.mjs +560 -194
- package/fesm2020/xsolla-payment-client-core.mjs.map +1 -1
- package/lib/core/extended-window.interface.d.ts +4 -1
- package/lib/core/payment/actions/action.interface.d.ts +7 -0
- package/lib/core/payment/actions/check-status/check-status.action.class.d.ts +8 -5
- package/lib/core/payment/actions/check-status/check-status.action.type.d.ts +1 -10
- package/lib/core/payment/actions/next-action.interface.d.ts +2 -1
- package/lib/core/payment/actions/next-action.service.d.ts +3 -3
- package/lib/core/payment/actions/next-actions.d.ts +4 -4
- package/lib/core/payment/actions/redirect/redirect.action.class.d.ts +12 -6
- package/lib/core/payment/actions/show-errors/show-errors.action.class.d.ts +9 -4
- package/lib/core/payment/actions/show-fields/show-fields.action.class.d.ts +8 -5
- package/lib/core/payment/actions/special-button/special-button.action.class.d.ts +14 -0
- package/lib/core/payment/actions/special-button/special-button.action.type.d.ts +10 -0
- package/lib/core/payment/actions/status-updated/status-updated.action.class.d.ts +12 -5
- package/lib/core/payment/actions/three-ds/three-ds.action.class.d.ts +8 -5
- package/lib/core/payment/initialize/initialize.service.d.ts +3 -1
- package/lib/core/payment/payment.service.d.ts +7 -1
- package/lib/core/payment/status/save-payment-method-status/save-payment-method-status.service.d.ts +3 -1
- package/lib/core/payment/status/status.service.d.ts +3 -1
- package/lib/core/payment/sync/sync.service.d.ts +3 -1
- package/lib/core/payment/three-ds/three-ds.service.d.ts +5 -1
- package/lib/core/payment/xps-checkout.d.ts +17 -0
- package/lib/core/sdk-payment-systems/google-pay/google-pay-checkout.interface.d.ts +17 -0
- package/lib/core/sdk-payment-systems/google-pay/google-pay-init-params.interface.d.ts +4 -0
- package/lib/core/sdk-payment-systems/google-pay/google-pay-library.interface.d.ts +83 -0
- package/lib/core/sdk-payment-systems/google-pay/google-pay.service.d.ts +37 -0
- package/lib/core/sdk-payment-systems/payment-systems/payment-system-processing.service.d.ts +20 -0
- package/lib/core/sdk-payment-systems/sdk-payment-methods.const.d.ts +1 -0
- package/lib/core/sdk-payment-systems/sdk-payment-systems-initial-data.interface.d.ts +6 -0
- package/lib/core/sdk-payment-systems/sdk-payment-systems.interface.d.ts +21 -0
- package/lib/core-library.service.d.ts +7 -1
- package/package.json +1 -1
- package/xsolla-payment-client-core-0.2.0.tgz +0 -0
- package/esm2020/lib/core/payment/actions/action-factory-value.interface.mjs +0 -2
- package/esm2020/lib/core/payment/actions/check-status/check-status.action.token.mjs +0 -14
- package/esm2020/lib/core/payment/actions/redirect/redirect.action.token.mjs +0 -16
- package/esm2020/lib/core/payment/actions/show-errors/show-errors.action.token.mjs +0 -13
- package/esm2020/lib/core/payment/actions/show-fields/show-fields.action.token.mjs +0 -15
- package/esm2020/lib/core/payment/actions/status-updated/status-updated.action.token.mjs +0 -11
- package/esm2020/lib/core/payment/actions/three-ds/three-ds.action.token.mjs +0 -11
- package/lib/core/payment/actions/action-factory-value.interface.d.ts +0 -6
- package/lib/core/payment/actions/check-status/check-status.action.token.d.ts +0 -4
- package/lib/core/payment/actions/redirect/redirect.action.token.d.ts +0 -4
- package/lib/core/payment/actions/show-errors/show-errors.action.token.d.ts +0 -4
- package/lib/core/payment/actions/show-fields/show-fields.action.token.d.ts +0 -4
- package/lib/core/payment/actions/status-updated/status-updated.action.token.d.ts +0 -4
- package/lib/core/payment/actions/three-ds/three-ds.action.token.d.ts +0 -4
- package/xsolla-payment-client-core-0.1.22.tgz +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __awaiter } from 'tslib';
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
3
|
import { InjectionToken, Injectable, Inject, Pipe, isDevMode, NgModule } from '@angular/core';
|
|
4
|
-
import { firstValueFrom, lastValueFrom, map, Subject, BehaviorSubject, filter as filter$1, takeUntil, skip, throwError } from 'rxjs';
|
|
4
|
+
import { firstValueFrom, lastValueFrom, map, Subject, BehaviorSubject, filter as filter$1, takeUntil, skip, take, throwError } from 'rxjs';
|
|
5
5
|
import * as i1 from '@angular/common/http';
|
|
6
6
|
import { HttpParams, HttpHeaders, HttpClientModule, HTTP_INTERCEPTORS } from '@angular/common/http';
|
|
7
7
|
import JSEncrypt from 'jsencrypt';
|
|
@@ -676,15 +676,6 @@ var InputEventName;
|
|
|
676
676
|
InputEventName["focus"] = "focus";
|
|
677
677
|
})(InputEventName || (InputEventName = {}));
|
|
678
678
|
|
|
679
|
-
class ShowErrorsAction {
|
|
680
|
-
constructor(errors) {
|
|
681
|
-
this.type = 'show_errors';
|
|
682
|
-
this.data = {
|
|
683
|
-
errors,
|
|
684
|
-
};
|
|
685
|
-
}
|
|
686
|
-
}
|
|
687
|
-
|
|
688
679
|
const initializeResponseFactoryToken = new InjectionToken('InitializeResponse');
|
|
689
680
|
const initializeResponseFactoryProvider = {
|
|
690
681
|
provide: initializeResponseFactoryToken,
|
|
@@ -773,60 +764,150 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImpor
|
|
|
773
764
|
}] }, { type: SecureApiClient }, { type: SettingsService }, { type: CountryService }];
|
|
774
765
|
} });
|
|
775
766
|
|
|
776
|
-
|
|
777
|
-
|
|
767
|
+
const vkPay = 3496;
|
|
768
|
+
const googlePay = 3431;
|
|
769
|
+
const applePay = 3175;
|
|
770
|
+
const barzahlenPay = 1679;
|
|
771
|
+
const naverPay = 3563;
|
|
772
|
+
const venmoPay = 3636;
|
|
773
|
+
|
|
774
|
+
const pagesRoutes = new Map([
|
|
775
|
+
[vkPay, '/payment/external-pages/vk-pay'],
|
|
776
|
+
[applePay, '/payment/external-pages/apple-pay'],
|
|
777
|
+
[barzahlenPay, '/payment/external-pages/barzahlen-pay'],
|
|
778
|
+
[naverPay, '/payment/external-pages/naver-pay'],
|
|
779
|
+
[venmoPay, '/payment/external-pages/venmo-pay'],
|
|
780
|
+
]);
|
|
781
|
+
|
|
782
|
+
const payStation4Url = 'https://secure.xsolla.com/paystation4';
|
|
783
|
+
const sandboxPayStationUrl = 'https://sandbox-secure.xsolla.com/paystation4';
|
|
784
|
+
|
|
785
|
+
class RedirectActionCreator {
|
|
786
|
+
constructor(settingsService) {
|
|
787
|
+
this.settingsService = settingsService;
|
|
788
|
+
this.type = 'redirect';
|
|
789
|
+
}
|
|
790
|
+
getActionData(submitResponse) {
|
|
791
|
+
return {
|
|
792
|
+
type: this.type,
|
|
793
|
+
data: {
|
|
794
|
+
fields: submitResponse.fields,
|
|
795
|
+
errors: submitResponse.errors,
|
|
796
|
+
messages: submitResponse.messages,
|
|
797
|
+
order: submitResponse.summary,
|
|
798
|
+
invoiceId: submitResponse.fixInvoice,
|
|
799
|
+
redirect: this.getRedirect(submitResponse),
|
|
800
|
+
},
|
|
801
|
+
};
|
|
802
|
+
}
|
|
803
|
+
isSuitable(response) {
|
|
804
|
+
return (response.currentCommand === XpsCommand.account ||
|
|
805
|
+
(response.currentCommand === XpsCommand.checkout &&
|
|
806
|
+
Boolean(response.parameters.checkout)));
|
|
807
|
+
}
|
|
808
|
+
getRedirect(submitResponse) {
|
|
809
|
+
return {
|
|
810
|
+
redirectUrl: this.getRedirectUrl(submitResponse),
|
|
811
|
+
data: submitResponse.parameters.checkout.data,
|
|
812
|
+
};
|
|
813
|
+
}
|
|
814
|
+
getRedirectUrl(submitResponse) {
|
|
815
|
+
var _a, _b;
|
|
816
|
+
const responseRedirectUrl = submitResponse.parameters.checkout.action;
|
|
817
|
+
const pid = (_b = (_a = submitResponse === null || submitResponse === void 0 ? void 0 : submitResponse.fields) === null || _a === void 0 ? void 0 : _a.find(({ name }) => name === 'fix_pid')) === null || _b === void 0 ? void 0 : _b.value;
|
|
818
|
+
if (!pid) {
|
|
819
|
+
return responseRedirectUrl;
|
|
820
|
+
}
|
|
821
|
+
const pagesPath = pagesRoutes.get(Number(pid));
|
|
822
|
+
if (!pagesPath) {
|
|
823
|
+
return responseRedirectUrl;
|
|
824
|
+
}
|
|
825
|
+
return this.preparePagesUrl(pagesPath);
|
|
826
|
+
}
|
|
827
|
+
preparePagesUrl(pagesPath) {
|
|
828
|
+
const isSandbox = this.settingsService.isSandboxMode();
|
|
829
|
+
const token = this.settingsService.token;
|
|
830
|
+
const payStationUrl = isSandbox ? sandboxPayStationUrl : payStation4Url;
|
|
831
|
+
return `${payStationUrl}/en${pagesPath}?token=${token}`;
|
|
832
|
+
}
|
|
833
|
+
}
|
|
834
|
+
RedirectActionCreator.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: RedirectActionCreator, deps: [{ token: SettingsService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
835
|
+
RedirectActionCreator.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: RedirectActionCreator });
|
|
836
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: RedirectActionCreator, decorators: [{
|
|
837
|
+
type: Injectable
|
|
838
|
+
}], ctorParameters: function () { return [{ type: SettingsService }]; } });
|
|
839
|
+
|
|
840
|
+
class ShowFieldsActionCreator {
|
|
841
|
+
constructor() {
|
|
778
842
|
this.type = 'show_fields';
|
|
779
|
-
|
|
843
|
+
}
|
|
844
|
+
getActionData(submitResponse) {
|
|
845
|
+
const data = {
|
|
780
846
|
fields: [],
|
|
781
847
|
errors: [],
|
|
782
848
|
messages: [],
|
|
783
849
|
order: {},
|
|
784
850
|
};
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
851
|
+
data.fields = submitResponse.fields.filter((field) => (field === null || field === void 0 ? void 0 : field.isVisible) === "1" /* XpsBoolean.true */);
|
|
852
|
+
data.errors = submitResponse.errors;
|
|
853
|
+
data.messages = submitResponse.messages;
|
|
854
|
+
data.order = submitResponse.summary;
|
|
855
|
+
return {
|
|
856
|
+
type: this.type,
|
|
857
|
+
data,
|
|
858
|
+
};
|
|
859
|
+
}
|
|
860
|
+
isSuitable(response) {
|
|
861
|
+
return (response.currentCommand === XpsCommand.check ||
|
|
862
|
+
response.currentCommand === XpsCommand.form);
|
|
789
863
|
}
|
|
790
864
|
}
|
|
865
|
+
ShowFieldsActionCreator.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: ShowFieldsActionCreator, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
866
|
+
ShowFieldsActionCreator.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: ShowFieldsActionCreator });
|
|
867
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: ShowFieldsActionCreator, decorators: [{
|
|
868
|
+
type: Injectable
|
|
869
|
+
}] });
|
|
791
870
|
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
provide: showFieldsActionFactoryToken,
|
|
795
|
-
useValue: {
|
|
796
|
-
factory: (...args) => new ShowFieldsAction(...args),
|
|
797
|
-
isSuitable: (response) => {
|
|
798
|
-
return (response.currentCommand === XpsCommand.check ||
|
|
799
|
-
response.currentCommand === XpsCommand.form);
|
|
800
|
-
},
|
|
801
|
-
},
|
|
802
|
-
};
|
|
803
|
-
|
|
804
|
-
class CheckStatusAction {
|
|
805
|
-
constructor(submitResponse) {
|
|
806
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
871
|
+
class CheckStatusActionCreator {
|
|
872
|
+
constructor() {
|
|
807
873
|
this.type = 'check_status';
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
testXsolla: (_e = submitResponse.parameters.form.testXsolla) === null || _e === void 0 ? void 0 : _e.value,
|
|
814
|
-
testProject: (_f = submitResponse.parameters.form.testProject) === null || _f === void 0 ? void 0 : _f.value,
|
|
815
|
-
userReturnStatus: (_g = submitResponse.parameters.form.userReturnStatus) === null || _g === void 0 ? void 0 : _g.value,
|
|
874
|
+
}
|
|
875
|
+
getActionData() {
|
|
876
|
+
return {
|
|
877
|
+
type: this.type,
|
|
878
|
+
data: null,
|
|
816
879
|
};
|
|
817
880
|
}
|
|
881
|
+
isSuitable(response) {
|
|
882
|
+
return response.currentCommand === XpsCommand.status;
|
|
883
|
+
}
|
|
818
884
|
}
|
|
885
|
+
CheckStatusActionCreator.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: CheckStatusActionCreator, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
886
|
+
CheckStatusActionCreator.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: CheckStatusActionCreator });
|
|
887
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: CheckStatusActionCreator, decorators: [{
|
|
888
|
+
type: Injectable
|
|
889
|
+
}] });
|
|
819
890
|
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
}
|
|
891
|
+
class ShowErrorsActionCreator {
|
|
892
|
+
constructor() {
|
|
893
|
+
this.type = 'show_errors';
|
|
894
|
+
}
|
|
895
|
+
getActionData(errors) {
|
|
896
|
+
return {
|
|
897
|
+
type: this.type,
|
|
898
|
+
data: { errors },
|
|
899
|
+
};
|
|
900
|
+
}
|
|
901
|
+
isSuitable(response) {
|
|
902
|
+
var _a;
|
|
903
|
+
return Boolean((_a = response.errors) === null || _a === void 0 ? void 0 : _a.length);
|
|
904
|
+
}
|
|
905
|
+
}
|
|
906
|
+
ShowErrorsActionCreator.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: ShowErrorsActionCreator, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
907
|
+
ShowErrorsActionCreator.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: ShowErrorsActionCreator });
|
|
908
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: ShowErrorsActionCreator, decorators: [{
|
|
909
|
+
type: Injectable
|
|
910
|
+
}] });
|
|
830
911
|
|
|
831
912
|
class TerminalError extends AppError {
|
|
832
913
|
constructor(message, code) {
|
|
@@ -950,9 +1031,11 @@ class StatusResponse {
|
|
|
950
1031
|
}
|
|
951
1032
|
}
|
|
952
1033
|
|
|
953
|
-
class
|
|
954
|
-
constructor(
|
|
1034
|
+
class StatusUpdatedActionCreator {
|
|
1035
|
+
constructor() {
|
|
955
1036
|
this.type = 'status_updated';
|
|
1037
|
+
}
|
|
1038
|
+
getActionData({ statusResponse, isSavePaymentMethodMode, savePaymentMethodStatus, }) {
|
|
956
1039
|
let status;
|
|
957
1040
|
if (statusResponse instanceof StatusResponse) {
|
|
958
1041
|
status = statusResponse.status;
|
|
@@ -960,143 +1043,109 @@ class StatusUpdatedAction {
|
|
|
960
1043
|
else {
|
|
961
1044
|
status = statusResponse;
|
|
962
1045
|
}
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
1046
|
+
return {
|
|
1047
|
+
type: this.type,
|
|
1048
|
+
data: {
|
|
1049
|
+
statusState: status.statusState,
|
|
1050
|
+
invoice: status.invoice,
|
|
1051
|
+
isSuccess: status.isSuccess,
|
|
1052
|
+
isCanceled: status.isCanceled,
|
|
1053
|
+
group: status.group,
|
|
1054
|
+
isSavePaymentMethodMode: Boolean(isSavePaymentMethodMode),
|
|
1055
|
+
savePaymentMethodStatus,
|
|
1056
|
+
},
|
|
971
1057
|
};
|
|
972
1058
|
}
|
|
1059
|
+
isSuitable() {
|
|
1060
|
+
return false;
|
|
1061
|
+
}
|
|
973
1062
|
}
|
|
1063
|
+
StatusUpdatedActionCreator.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: StatusUpdatedActionCreator, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1064
|
+
StatusUpdatedActionCreator.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: StatusUpdatedActionCreator });
|
|
1065
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: StatusUpdatedActionCreator, decorators: [{
|
|
1066
|
+
type: Injectable
|
|
1067
|
+
}] });
|
|
974
1068
|
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
useValue: {
|
|
979
|
-
factory: (...args) => new StatusUpdatedAction(...args),
|
|
980
|
-
isSuitable: () => false,
|
|
981
|
-
},
|
|
982
|
-
};
|
|
983
|
-
|
|
984
|
-
const vkPay = 3496;
|
|
985
|
-
const googlePay = 3431;
|
|
986
|
-
const applePay = 3175;
|
|
987
|
-
const barzahlenPay = 1679;
|
|
988
|
-
const naverPay = 3563;
|
|
989
|
-
const venmoPay = 3636;
|
|
990
|
-
|
|
991
|
-
const pagesRoutes = new Map([
|
|
992
|
-
[vkPay, '/payment/external-pages/vk-pay'],
|
|
993
|
-
[applePay, '/payment/external-pages/apple-pay'],
|
|
994
|
-
[barzahlenPay, '/payment/external-pages/barzahlen-pay'],
|
|
995
|
-
[naverPay, '/payment/external-pages/naver-pay'],
|
|
996
|
-
[venmoPay, '/payment/external-pages/venmo-pay'],
|
|
997
|
-
]);
|
|
998
|
-
|
|
999
|
-
const payStation4Url = 'https://secure.xsolla.com/paystation4';
|
|
1000
|
-
const sandboxPayStationUrl = 'https://sandbox-secure.xsolla.com/paystation4';
|
|
1001
|
-
|
|
1002
|
-
class RedirectAction {
|
|
1003
|
-
constructor(submitResponse, token, isSandbox) {
|
|
1004
|
-
this.type = 'redirect';
|
|
1005
|
-
this.data = {
|
|
1006
|
-
fields: submitResponse.fields,
|
|
1007
|
-
errors: submitResponse.errors,
|
|
1008
|
-
messages: submitResponse.messages,
|
|
1009
|
-
order: submitResponse.summary,
|
|
1010
|
-
invoiceId: submitResponse.fixInvoice,
|
|
1011
|
-
redirect: this.getRedirect(submitResponse, token, isSandbox),
|
|
1012
|
-
};
|
|
1069
|
+
class ThreeDsActionCreator {
|
|
1070
|
+
constructor() {
|
|
1071
|
+
this.type = '3DS';
|
|
1013
1072
|
}
|
|
1014
|
-
|
|
1073
|
+
getActionData(actionData) {
|
|
1015
1074
|
return {
|
|
1016
|
-
|
|
1017
|
-
data:
|
|
1075
|
+
type: this.type,
|
|
1076
|
+
data: actionData,
|
|
1018
1077
|
};
|
|
1019
1078
|
}
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
const responseRedirectUrl = submitResponse.parameters.checkout.action;
|
|
1023
|
-
const pid = (_b = (_a = submitResponse === null || submitResponse === void 0 ? void 0 : submitResponse.fields) === null || _a === void 0 ? void 0 : _a.find(({ name }) => name === 'fix_pid')) === null || _b === void 0 ? void 0 : _b.value;
|
|
1024
|
-
if (!pid) {
|
|
1025
|
-
return responseRedirectUrl;
|
|
1026
|
-
}
|
|
1027
|
-
const pagesPath = pagesRoutes.get(Number(pid));
|
|
1028
|
-
if (!pagesPath) {
|
|
1029
|
-
return responseRedirectUrl;
|
|
1030
|
-
}
|
|
1031
|
-
return this.preparePagesUrl(pagesPath, token, isSandbox);
|
|
1032
|
-
}
|
|
1033
|
-
preparePagesUrl(pagesPath, token, isSandbox) {
|
|
1034
|
-
const payStationUrl = isSandbox ? sandboxPayStationUrl : payStation4Url;
|
|
1035
|
-
return `${payStationUrl}/en${pagesPath}?token=${token}`;
|
|
1079
|
+
isSuitable() {
|
|
1080
|
+
return false;
|
|
1036
1081
|
}
|
|
1037
1082
|
}
|
|
1083
|
+
ThreeDsActionCreator.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: ThreeDsActionCreator, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1084
|
+
ThreeDsActionCreator.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: ThreeDsActionCreator });
|
|
1085
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: ThreeDsActionCreator, decorators: [{
|
|
1086
|
+
type: Injectable
|
|
1087
|
+
}] });
|
|
1038
1088
|
|
|
1039
|
-
const
|
|
1040
|
-
const redirectActionFactoryProvider = {
|
|
1041
|
-
provide: redirectActionFactoryToken,
|
|
1042
|
-
useValue: {
|
|
1043
|
-
factory: (...args) => new RedirectAction(...args),
|
|
1044
|
-
isSuitable: (response) => {
|
|
1045
|
-
return (response.currentCommand === XpsCommand.account ||
|
|
1046
|
-
(response.currentCommand === XpsCommand.checkout &&
|
|
1047
|
-
Boolean(response.parameters.checkout)));
|
|
1048
|
-
},
|
|
1049
|
-
},
|
|
1050
|
-
};
|
|
1051
|
-
|
|
1052
|
-
const showErrorsActionFactoryToken = new InjectionToken('ShowErrorsAction');
|
|
1053
|
-
const showErrorsActionFactoryProvider = {
|
|
1054
|
-
provide: showErrorsActionFactoryToken,
|
|
1055
|
-
useValue: {
|
|
1056
|
-
factory: (...args) => new ShowErrorsAction(...args),
|
|
1057
|
-
isSuitable: (response) => {
|
|
1058
|
-
var _a;
|
|
1059
|
-
return Boolean((_a = response.errors) === null || _a === void 0 ? void 0 : _a.length);
|
|
1060
|
-
},
|
|
1061
|
-
},
|
|
1062
|
-
};
|
|
1089
|
+
const googlePayPid = 3431;
|
|
1063
1090
|
|
|
1064
|
-
class
|
|
1065
|
-
constructor(
|
|
1066
|
-
this.type = '
|
|
1067
|
-
this.
|
|
1091
|
+
class SpecialButtonActionCreator {
|
|
1092
|
+
constructor() {
|
|
1093
|
+
this.type = 'special_button';
|
|
1094
|
+
this.pids = [googlePayPid];
|
|
1095
|
+
this.sdkPaymentMethodsName = new Map([
|
|
1096
|
+
[googlePayPid, 'google-pay'],
|
|
1097
|
+
]);
|
|
1098
|
+
}
|
|
1099
|
+
getActionData(submitResponse) {
|
|
1100
|
+
return {
|
|
1101
|
+
type: this.type,
|
|
1102
|
+
data: {
|
|
1103
|
+
errors: submitResponse.errors,
|
|
1104
|
+
messages: submitResponse.messages,
|
|
1105
|
+
buttonName: this.getPaymentMethodName(submitResponse.pid),
|
|
1106
|
+
},
|
|
1107
|
+
};
|
|
1108
|
+
}
|
|
1109
|
+
isSuitable(response) {
|
|
1110
|
+
return (response.currentCommand === XpsCommand.checkout &&
|
|
1111
|
+
Boolean(response.parameters.checkout) &&
|
|
1112
|
+
this.pids.includes(response.pid));
|
|
1113
|
+
}
|
|
1114
|
+
getPaymentMethodName(pid) {
|
|
1115
|
+
const buttonName = this.sdkPaymentMethodsName.get(pid);
|
|
1116
|
+
if (!buttonName) {
|
|
1117
|
+
throw new Error('Special button not found');
|
|
1118
|
+
}
|
|
1119
|
+
return buttonName;
|
|
1068
1120
|
}
|
|
1069
1121
|
}
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
factory: (...args) => new ThreeDsAction(...args),
|
|
1076
|
-
isSuitable: () => false,
|
|
1077
|
-
},
|
|
1078
|
-
};
|
|
1122
|
+
SpecialButtonActionCreator.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: SpecialButtonActionCreator, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1123
|
+
SpecialButtonActionCreator.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: SpecialButtonActionCreator });
|
|
1124
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: SpecialButtonActionCreator, decorators: [{
|
|
1125
|
+
type: Injectable
|
|
1126
|
+
}] });
|
|
1079
1127
|
|
|
1080
1128
|
const nextActionsToken = new InjectionToken('Action');
|
|
1081
1129
|
const nextActions = [
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1130
|
+
ShowFieldsActionCreator,
|
|
1131
|
+
CheckStatusActionCreator,
|
|
1132
|
+
SpecialButtonActionCreator,
|
|
1133
|
+
RedirectActionCreator,
|
|
1085
1134
|
];
|
|
1086
1135
|
const flowUpdateNextActions = [
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1136
|
+
ShowErrorsActionCreator,
|
|
1137
|
+
StatusUpdatedActionCreator,
|
|
1138
|
+
ThreeDsActionCreator,
|
|
1090
1139
|
];
|
|
1091
1140
|
|
|
1092
1141
|
class NextActionService {
|
|
1093
1142
|
get flowUpdates$() {
|
|
1094
1143
|
return this.flowUpdatesSubject.asObservable();
|
|
1095
1144
|
}
|
|
1096
|
-
constructor(nextActionTokens, injector,
|
|
1145
|
+
constructor(nextActionTokens, injector, showErrorsActionCreator) {
|
|
1097
1146
|
this.nextActionTokens = nextActionTokens;
|
|
1098
1147
|
this.injector = injector;
|
|
1099
|
-
this.
|
|
1148
|
+
this.showErrorsActionCreator = showErrorsActionCreator;
|
|
1100
1149
|
this.flowUpdatesSubject = new Subject();
|
|
1101
1150
|
this.nextActionsList = [];
|
|
1102
1151
|
this.fillNextActionsList();
|
|
@@ -1104,14 +1153,14 @@ class NextActionService {
|
|
|
1104
1153
|
getNextAction(submitResponse) {
|
|
1105
1154
|
var _a;
|
|
1106
1155
|
if ((_a = submitResponse.errors) === null || _a === void 0 ? void 0 : _a.length) {
|
|
1107
|
-
this.emitFlowUpdates(
|
|
1156
|
+
this.emitFlowUpdates(this.showErrorsActionCreator.getActionData(submitResponse.errors));
|
|
1108
1157
|
}
|
|
1109
1158
|
if (!submitResponse.currentCommand) {
|
|
1110
1159
|
return null;
|
|
1111
1160
|
}
|
|
1112
|
-
const
|
|
1113
|
-
if (
|
|
1114
|
-
return
|
|
1161
|
+
const nextAction = this.findNextAction(submitResponse);
|
|
1162
|
+
if (nextAction) {
|
|
1163
|
+
return nextAction.getActionData(submitResponse);
|
|
1115
1164
|
}
|
|
1116
1165
|
throw new Error('Next action is undefined.');
|
|
1117
1166
|
}
|
|
@@ -1120,7 +1169,7 @@ class NextActionService {
|
|
|
1120
1169
|
}
|
|
1121
1170
|
fillNextActionsList() {
|
|
1122
1171
|
this.nextActionTokens.forEach((nextAction) => {
|
|
1123
|
-
const item = this.injector.get(nextAction
|
|
1172
|
+
const item = this.injector.get(nextAction);
|
|
1124
1173
|
this.nextActionsList.push(item);
|
|
1125
1174
|
});
|
|
1126
1175
|
}
|
|
@@ -1131,10 +1180,10 @@ class NextActionService {
|
|
|
1131
1180
|
if (!actionType) {
|
|
1132
1181
|
return;
|
|
1133
1182
|
}
|
|
1134
|
-
return actionType
|
|
1183
|
+
return actionType;
|
|
1135
1184
|
}
|
|
1136
1185
|
}
|
|
1137
|
-
NextActionService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: NextActionService, deps: [{ token: nextActionsToken }, { token: i0.Injector }, { token:
|
|
1186
|
+
NextActionService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: NextActionService, deps: [{ token: nextActionsToken }, { token: i0.Injector }, { token: ShowErrorsActionCreator }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1138
1187
|
NextActionService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: NextActionService, providedIn: 'root' });
|
|
1139
1188
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: NextActionService, decorators: [{
|
|
1140
1189
|
type: Injectable,
|
|
@@ -1145,7 +1194,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImpor
|
|
|
1145
1194
|
return [{ type: undefined, decorators: [{
|
|
1146
1195
|
type: Inject,
|
|
1147
1196
|
args: [nextActionsToken]
|
|
1148
|
-
}] }, { type: i0.Injector }, { type:
|
|
1197
|
+
}] }, { type: i0.Injector }, { type: ShowErrorsActionCreator }];
|
|
1149
1198
|
} });
|
|
1150
1199
|
|
|
1151
1200
|
/* eslint-disable @typescript-eslint/no-magic-numbers */
|
|
@@ -1625,7 +1674,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImpor
|
|
|
1625
1674
|
}], ctorParameters: function () { return [{ type: CreditCardService }]; } });
|
|
1626
1675
|
|
|
1627
1676
|
class InitializeService {
|
|
1628
|
-
constructor(responseFactory, xpsApiService, settingsService, countryService, nextActionService, xpsResponseErrorsMappingService, encryptCreditCardService) {
|
|
1677
|
+
constructor(responseFactory, xpsApiService, settingsService, countryService, nextActionService, xpsResponseErrorsMappingService, encryptCreditCardService, showErrorsActionCreator) {
|
|
1629
1678
|
this.responseFactory = responseFactory;
|
|
1630
1679
|
this.xpsApiService = xpsApiService;
|
|
1631
1680
|
this.settingsService = settingsService;
|
|
@@ -1633,6 +1682,7 @@ class InitializeService {
|
|
|
1633
1682
|
this.nextActionService = nextActionService;
|
|
1634
1683
|
this.xpsResponseErrorsMappingService = xpsResponseErrorsMappingService;
|
|
1635
1684
|
this.encryptCreditCardService = encryptCreditCardService;
|
|
1685
|
+
this.showErrorsActionCreator = showErrorsActionCreator;
|
|
1636
1686
|
// TODO PAYMENTS-15743: replace with new refer id for headless core
|
|
1637
1687
|
this.ps4ReferId = '22';
|
|
1638
1688
|
}
|
|
@@ -1661,7 +1711,7 @@ class InitializeService {
|
|
|
1661
1711
|
const response = this.xpsResponseErrorsMappingService.mapErrors(xpsResponse);
|
|
1662
1712
|
const initializeResponse = this.responseFactory(response);
|
|
1663
1713
|
if ((_b = (_a = initializeResponse.paymentForm) === null || _a === void 0 ? void 0 : _a.errors) === null || _b === void 0 ? void 0 : _b.length) {
|
|
1664
|
-
this.nextActionService.emitFlowUpdates(
|
|
1714
|
+
this.nextActionService.emitFlowUpdates(this.showErrorsActionCreator.getActionData(initializeResponse.paymentForm.errors));
|
|
1665
1715
|
}
|
|
1666
1716
|
if (initializeResponse.paymentForm) {
|
|
1667
1717
|
this.setCreditCardEncryptKey(initializeResponse.paymentForm);
|
|
@@ -1681,7 +1731,7 @@ class InitializeService {
|
|
|
1681
1731
|
this.encryptCreditCardService.setPublicKey(atob(publicKeyField.value));
|
|
1682
1732
|
}
|
|
1683
1733
|
}
|
|
1684
|
-
InitializeService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: InitializeService, deps: [{ token: initializeResponseFactoryToken }, { token: XpsApiService }, { token: SettingsService }, { token: CountryService }, { token: NextActionService }, { token: XpsResponseErrorsMappingService }, { token: EncryptCreditCardService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1734
|
+
InitializeService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: InitializeService, deps: [{ token: initializeResponseFactoryToken }, { token: XpsApiService }, { token: SettingsService }, { token: CountryService }, { token: NextActionService }, { token: XpsResponseErrorsMappingService }, { token: EncryptCreditCardService }, { token: ShowErrorsActionCreator }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1685
1735
|
InitializeService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: InitializeService, providedIn: 'root' });
|
|
1686
1736
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: InitializeService, decorators: [{
|
|
1687
1737
|
type: Injectable,
|
|
@@ -1692,7 +1742,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImpor
|
|
|
1692
1742
|
return [{ type: undefined, decorators: [{
|
|
1693
1743
|
type: Inject,
|
|
1694
1744
|
args: [initializeResponseFactoryToken]
|
|
1695
|
-
}] }, { type: XpsApiService }, { type: SettingsService }, { type: CountryService }, { type: NextActionService }, { type: XpsResponseErrorsMappingService }, { type: EncryptCreditCardService }];
|
|
1745
|
+
}] }, { type: XpsApiService }, { type: SettingsService }, { type: CountryService }, { type: NextActionService }, { type: XpsResponseErrorsMappingService }, { type: EncryptCreditCardService }, { type: ShowErrorsActionCreator }];
|
|
1696
1746
|
} });
|
|
1697
1747
|
|
|
1698
1748
|
class XpsApiPartRequest {
|
|
@@ -1940,7 +1990,7 @@ const syncResponseFactoryProvider = {
|
|
|
1940
1990
|
};
|
|
1941
1991
|
|
|
1942
1992
|
class SyncService extends EmitDataService {
|
|
1943
|
-
constructor(requestFactory, responseFactory, xpsApiService, nextActionService, settingsService, xpsResponseErrorsMappingService, encryptCreditCardService) {
|
|
1993
|
+
constructor(requestFactory, responseFactory, xpsApiService, nextActionService, settingsService, xpsResponseErrorsMappingService, encryptCreditCardService, showErrorsActionCreator) {
|
|
1944
1994
|
super();
|
|
1945
1995
|
this.requestFactory = requestFactory;
|
|
1946
1996
|
this.responseFactory = responseFactory;
|
|
@@ -1949,6 +1999,7 @@ class SyncService extends EmitDataService {
|
|
|
1949
1999
|
this.settingsService = settingsService;
|
|
1950
2000
|
this.xpsResponseErrorsMappingService = xpsResponseErrorsMappingService;
|
|
1951
2001
|
this.encryptCreditCardService = encryptCreditCardService;
|
|
2002
|
+
this.showErrorsActionCreator = showErrorsActionCreator;
|
|
1952
2003
|
this.prevFieldSyncStates = {};
|
|
1953
2004
|
this.form = new UntypedFormGroup({});
|
|
1954
2005
|
this.fields = [];
|
|
@@ -2055,7 +2106,7 @@ class SyncService extends EmitDataService {
|
|
|
2055
2106
|
var _a;
|
|
2056
2107
|
const formErrors = (_a = response.errors) === null || _a === void 0 ? void 0 : _a.filter((error) => !error.element_name);
|
|
2057
2108
|
if (formErrors === null || formErrors === void 0 ? void 0 : formErrors.length) {
|
|
2058
|
-
this.nextActionService.emitFlowUpdates(
|
|
2109
|
+
this.nextActionService.emitFlowUpdates(this.showErrorsActionCreator.getActionData(formErrors));
|
|
2059
2110
|
}
|
|
2060
2111
|
}
|
|
2061
2112
|
resetFieldSyncTimer(field, timerId) {
|
|
@@ -2066,7 +2117,7 @@ class SyncService extends EmitDataService {
|
|
|
2066
2117
|
this.fieldSyncTimers[field.name] = timerId;
|
|
2067
2118
|
}
|
|
2068
2119
|
}
|
|
2069
|
-
SyncService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: SyncService, deps: [{ token: syncRequestFactoryToken }, { token: syncResponseFactoryToken }, { token: XpsApiService }, { token: NextActionService }, { token: SettingsService }, { token: XpsResponseErrorsMappingService }, { token: EncryptCreditCardService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2120
|
+
SyncService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: SyncService, deps: [{ token: syncRequestFactoryToken }, { token: syncResponseFactoryToken }, { token: XpsApiService }, { token: NextActionService }, { token: SettingsService }, { token: XpsResponseErrorsMappingService }, { token: EncryptCreditCardService }, { token: ShowErrorsActionCreator }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2070
2121
|
SyncService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: SyncService, providedIn: 'root' });
|
|
2071
2122
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: SyncService, decorators: [{
|
|
2072
2123
|
type: Injectable,
|
|
@@ -2080,7 +2131,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImpor
|
|
|
2080
2131
|
}] }, { type: undefined, decorators: [{
|
|
2081
2132
|
type: Inject,
|
|
2082
2133
|
args: [syncResponseFactoryToken]
|
|
2083
|
-
}] }, { type: XpsApiService }, { type: NextActionService }, { type: SettingsService }, { type: XpsResponseErrorsMappingService }, { type: EncryptCreditCardService }];
|
|
2134
|
+
}] }, { type: XpsApiService }, { type: NextActionService }, { type: SettingsService }, { type: XpsResponseErrorsMappingService }, { type: EncryptCreditCardService }, { type: ShowErrorsActionCreator }];
|
|
2084
2135
|
} });
|
|
2085
2136
|
|
|
2086
2137
|
class ControlConfig {
|
|
@@ -4817,12 +4868,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImpor
|
|
|
4817
4868
|
}], ctorParameters: function () { return [{ type: SettingsService }, { type: SecureApiClient }]; } });
|
|
4818
4869
|
|
|
4819
4870
|
class SavePaymentMethodStatusService {
|
|
4820
|
-
constructor(statusRequestService, listenStatusService, savedPaymentAccountChangesService, nextActionService, checkStatusService) {
|
|
4871
|
+
constructor(statusRequestService, listenStatusService, savedPaymentAccountChangesService, nextActionService, checkStatusService, statusUpdatedActionCreator) {
|
|
4821
4872
|
this.statusRequestService = statusRequestService;
|
|
4822
4873
|
this.listenStatusService = listenStatusService;
|
|
4823
4874
|
this.savedPaymentAccountChangesService = savedPaymentAccountChangesService;
|
|
4824
4875
|
this.nextActionService = nextActionService;
|
|
4825
4876
|
this.checkStatusService = checkStatusService;
|
|
4877
|
+
this.statusUpdatedActionCreator = statusUpdatedActionCreator;
|
|
4826
4878
|
this.statusChecked = false;
|
|
4827
4879
|
}
|
|
4828
4880
|
getStatus(params) {
|
|
@@ -4910,26 +4962,31 @@ class SavePaymentMethodStatusService {
|
|
|
4910
4962
|
this.listenStatusService.stopListening();
|
|
4911
4963
|
this.listenStatusSubscription.unsubscribe();
|
|
4912
4964
|
const isSavePaymentMethod = true;
|
|
4913
|
-
this.nextActionService.emitFlowUpdates(
|
|
4965
|
+
this.nextActionService.emitFlowUpdates(this.statusUpdatedActionCreator.getActionData({
|
|
4966
|
+
statusResponse: status,
|
|
4967
|
+
isSavePaymentMethodMode: isSavePaymentMethod,
|
|
4968
|
+
savePaymentMethodStatus: this.savePaymentMethodStatus,
|
|
4969
|
+
}));
|
|
4914
4970
|
}
|
|
4915
4971
|
}
|
|
4916
|
-
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 });
|
|
4972
|
+
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 }, { token: StatusUpdatedActionCreator }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
4917
4973
|
SavePaymentMethodStatusService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: SavePaymentMethodStatusService, providedIn: 'root' });
|
|
4918
4974
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: SavePaymentMethodStatusService, decorators: [{
|
|
4919
4975
|
type: Injectable,
|
|
4920
4976
|
args: [{
|
|
4921
4977
|
providedIn: 'root',
|
|
4922
4978
|
}]
|
|
4923
|
-
}], ctorParameters: function () { return [{ type: StatusRequestService }, { type: ListenStatusService }, { type: SavedPaymentAccountChangesService }, { type: NextActionService }, { type: CheckStatusService }]; } });
|
|
4979
|
+
}], ctorParameters: function () { return [{ type: StatusRequestService }, { type: ListenStatusService }, { type: SavedPaymentAccountChangesService }, { type: NextActionService }, { type: CheckStatusService }, { type: StatusUpdatedActionCreator }]; } });
|
|
4924
4980
|
|
|
4925
4981
|
class StatusService {
|
|
4926
|
-
constructor(urlService, statusRequestService, financeDetailsService, listenStatusService, nextActionService, savePaymentMethodStatusService) {
|
|
4982
|
+
constructor(urlService, statusRequestService, financeDetailsService, listenStatusService, nextActionService, savePaymentMethodStatusService, statusUpdatedActionCreator) {
|
|
4927
4983
|
this.urlService = urlService;
|
|
4928
4984
|
this.statusRequestService = statusRequestService;
|
|
4929
4985
|
this.financeDetailsService = financeDetailsService;
|
|
4930
4986
|
this.listenStatusService = listenStatusService;
|
|
4931
4987
|
this.nextActionService = nextActionService;
|
|
4932
4988
|
this.savePaymentMethodStatusService = savePaymentMethodStatusService;
|
|
4989
|
+
this.statusUpdatedActionCreator = statusUpdatedActionCreator;
|
|
4933
4990
|
}
|
|
4934
4991
|
getStatus(params) {
|
|
4935
4992
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -4972,18 +5029,18 @@ class StatusService {
|
|
|
4972
5029
|
.pipe(skip(1))
|
|
4973
5030
|
.subscribe(({ statusResponse }) => {
|
|
4974
5031
|
this.financeDetailsService.emitWithStatus(statusResponse.status);
|
|
4975
|
-
this.nextActionService.emitFlowUpdates(
|
|
5032
|
+
this.nextActionService.emitFlowUpdates(this.statusUpdatedActionCreator.getActionData({ statusResponse }));
|
|
4976
5033
|
});
|
|
4977
5034
|
}
|
|
4978
5035
|
}
|
|
4979
|
-
StatusService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: StatusService, deps: [{ token: UrlService }, { token: StatusRequestService }, { token: FinanceDetailsService }, { token: ListenStatusService }, { token: NextActionService }, { token: SavePaymentMethodStatusService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
5036
|
+
StatusService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: StatusService, deps: [{ token: UrlService }, { token: StatusRequestService }, { token: FinanceDetailsService }, { token: ListenStatusService }, { token: NextActionService }, { token: SavePaymentMethodStatusService }, { token: StatusUpdatedActionCreator }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
4980
5037
|
StatusService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: StatusService, providedIn: 'root' });
|
|
4981
5038
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: StatusService, decorators: [{
|
|
4982
5039
|
type: Injectable,
|
|
4983
5040
|
args: [{
|
|
4984
5041
|
providedIn: 'root',
|
|
4985
5042
|
}]
|
|
4986
|
-
}], ctorParameters: function () { return [{ type: UrlService }, { type: StatusRequestService }, { type: FinanceDetailsService }, { type: ListenStatusService }, { type: NextActionService }, { type: SavePaymentMethodStatusService }]; } });
|
|
5043
|
+
}], ctorParameters: function () { return [{ type: UrlService }, { type: StatusRequestService }, { type: FinanceDetailsService }, { type: ListenStatusService }, { type: NextActionService }, { type: SavePaymentMethodStatusService }, { type: StatusUpdatedActionCreator }]; } });
|
|
4987
5044
|
|
|
4988
5045
|
class CreditCardStateService extends EmitDataService {
|
|
4989
5046
|
}
|
|
@@ -5389,9 +5446,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImpor
|
|
|
5389
5446
|
}], ctorParameters: function () { return [{ type: StatusThreeDsService }, { type: NotifyDfpStatusService }, { type: WebSocketFactory }, { type: DfpCollectService }, { type: ReinsuranceCheckService }]; } });
|
|
5390
5447
|
|
|
5391
5448
|
class ThreeDsService {
|
|
5392
|
-
constructor(threeDs20Service, nextActionService) {
|
|
5449
|
+
constructor(threeDs20Service, nextActionService, checkStatusActionCreator, threeDsActionCreator) {
|
|
5393
5450
|
this.threeDs20Service = threeDs20Service;
|
|
5394
5451
|
this.nextActionService = nextActionService;
|
|
5452
|
+
this.checkStatusActionCreator = checkStatusActionCreator;
|
|
5453
|
+
this.threeDsActionCreator = threeDsActionCreator;
|
|
5395
5454
|
this.statusSubscription = null;
|
|
5396
5455
|
}
|
|
5397
5456
|
checkThreeDs(params) {
|
|
@@ -5405,9 +5464,9 @@ class ThreeDsService {
|
|
|
5405
5464
|
(_a = this.statusSubscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
|
|
5406
5465
|
this.statusSubscription = this.threeDs20Service.statusUpdates$.subscribe((statusUpdate) => {
|
|
5407
5466
|
if (statusUpdate.type === 'complete') {
|
|
5408
|
-
return this.nextActionService.emitFlowUpdates(
|
|
5467
|
+
return this.nextActionService.emitFlowUpdates(this.checkStatusActionCreator.getActionData());
|
|
5409
5468
|
}
|
|
5410
|
-
this.nextActionService.emitFlowUpdates(
|
|
5469
|
+
this.nextActionService.emitFlowUpdates(this.threeDsActionCreator.getActionData(statusUpdate));
|
|
5411
5470
|
});
|
|
5412
5471
|
}
|
|
5413
5472
|
stopChecking() {
|
|
@@ -5415,14 +5474,14 @@ class ThreeDsService {
|
|
|
5415
5474
|
(_a = this.statusSubscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
|
|
5416
5475
|
}
|
|
5417
5476
|
}
|
|
5418
|
-
ThreeDsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: ThreeDsService, deps: [{ token: ThreeDs20Service }, { token: NextActionService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
5477
|
+
ThreeDsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: ThreeDsService, deps: [{ token: ThreeDs20Service }, { token: NextActionService }, { token: CheckStatusActionCreator }, { token: ThreeDsActionCreator }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
5419
5478
|
ThreeDsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: ThreeDsService, providedIn: 'root' });
|
|
5420
5479
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: ThreeDsService, decorators: [{
|
|
5421
5480
|
type: Injectable,
|
|
5422
5481
|
args: [{
|
|
5423
5482
|
providedIn: 'root',
|
|
5424
5483
|
}]
|
|
5425
|
-
}], ctorParameters: function () { return [{ type: ThreeDs20Service }, { type: NextActionService }]; } });
|
|
5484
|
+
}], ctorParameters: function () { return [{ type: ThreeDs20Service }, { type: NextActionService }, { type: CheckStatusActionCreator }, { type: ThreeDsActionCreator }]; } });
|
|
5426
5485
|
|
|
5427
5486
|
class FormMessagesService extends EmitDataService {
|
|
5428
5487
|
constructor(unescapeHtmlPipe) {
|
|
@@ -5450,7 +5509,7 @@ class PaymentService {
|
|
|
5450
5509
|
get formFieldsStatus$() {
|
|
5451
5510
|
return this.formFieldsStatusSubject.asObservable().pipe(filter$1(Boolean));
|
|
5452
5511
|
}
|
|
5453
|
-
constructor(initializeService, submitService, syncService, formService, statusService, financeDetailsService, creditCardStateService, nextActionService, controlConfigService, threeDsService, formMessagesService) {
|
|
5512
|
+
constructor(initializeService, submitService, syncService, formService, statusService, financeDetailsService, creditCardStateService, nextActionService, controlConfigService, threeDsService, formMessagesService, settingsService, countryService) {
|
|
5454
5513
|
this.initializeService = initializeService;
|
|
5455
5514
|
this.submitService = submitService;
|
|
5456
5515
|
this.syncService = syncService;
|
|
@@ -5462,6 +5521,8 @@ class PaymentService {
|
|
|
5462
5521
|
this.controlConfigService = controlConfigService;
|
|
5463
5522
|
this.threeDsService = threeDsService;
|
|
5464
5523
|
this.formMessagesService = formMessagesService;
|
|
5524
|
+
this.settingsService = settingsService;
|
|
5525
|
+
this.countryService = countryService;
|
|
5465
5526
|
this.form = null;
|
|
5466
5527
|
this.data = null;
|
|
5467
5528
|
this.financeDetails = null;
|
|
@@ -5526,6 +5587,18 @@ class PaymentService {
|
|
|
5526
5587
|
}
|
|
5527
5588
|
return (_d = (_c = (_b = this.data) === null || _b === void 0 ? void 0 : _b.paymentForm) === null || _c === void 0 ? void 0 : _c.fields) !== null && _d !== void 0 ? _d : [];
|
|
5528
5589
|
}
|
|
5590
|
+
getInitialDataForSdkPaymentSystems() {
|
|
5591
|
+
if (!isSubmitResponse(this.data)) {
|
|
5592
|
+
throw new Error('Should submit form first');
|
|
5593
|
+
}
|
|
5594
|
+
return {
|
|
5595
|
+
data: this.data.parameters.checkout.data.data,
|
|
5596
|
+
sandbox: this.settingsService.isSandboxMode()
|
|
5597
|
+
? "1" /* XpsBoolean.true */
|
|
5598
|
+
: "0" /* XpsBoolean.false */,
|
|
5599
|
+
country: this.countryService.getCountry(),
|
|
5600
|
+
};
|
|
5601
|
+
}
|
|
5529
5602
|
getPid() {
|
|
5530
5603
|
var _a, _b, _c;
|
|
5531
5604
|
if (this.data instanceof SubmitResponse) {
|
|
@@ -5674,14 +5747,14 @@ class PaymentService {
|
|
|
5674
5747
|
}
|
|
5675
5748
|
}
|
|
5676
5749
|
}
|
|
5677
|
-
PaymentService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: PaymentService, deps: [{ token: InitializeService }, { token: SubmitService }, { token: SyncService }, { token: FormService }, { token: StatusService }, { token: FinanceDetailsService }, { token: CreditCardStateService }, { token: NextActionService }, { token: ControlConfigService }, { token: ThreeDsService }, { token: FormMessagesService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
5750
|
+
PaymentService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: PaymentService, deps: [{ token: InitializeService }, { token: SubmitService }, { token: SyncService }, { token: FormService }, { token: StatusService }, { token: FinanceDetailsService }, { token: CreditCardStateService }, { token: NextActionService }, { token: ControlConfigService }, { token: ThreeDsService }, { token: FormMessagesService }, { token: SettingsService }, { token: CountryService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
5678
5751
|
PaymentService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: PaymentService, providedIn: 'root' });
|
|
5679
5752
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: PaymentService, decorators: [{
|
|
5680
5753
|
type: Injectable,
|
|
5681
5754
|
args: [{
|
|
5682
5755
|
providedIn: 'root',
|
|
5683
5756
|
}]
|
|
5684
|
-
}], ctorParameters: function () { return [{ type: InitializeService }, { type: SubmitService }, { type: SyncService }, { type: FormService }, { type: StatusService }, { type: FinanceDetailsService }, { type: CreditCardStateService }, { type: NextActionService }, { type: ControlConfigService }, { type: ThreeDsService }, { type: FormMessagesService }]; } });
|
|
5757
|
+
}], ctorParameters: function () { return [{ type: InitializeService }, { type: SubmitService }, { type: SyncService }, { type: FormService }, { type: StatusService }, { type: FinanceDetailsService }, { type: CreditCardStateService }, { type: NextActionService }, { type: ControlConfigService }, { type: ThreeDsService }, { type: FormMessagesService }, { type: SettingsService }, { type: CountryService }]; } });
|
|
5685
5758
|
|
|
5686
5759
|
class RefundPolicyService {
|
|
5687
5760
|
constructor(settingsService) {
|
|
@@ -5826,8 +5899,288 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImpor
|
|
|
5826
5899
|
}]
|
|
5827
5900
|
}], ctorParameters: function () { return [{ type: SavedMethodsService }, { type: SettingsService }, { type: SecureApiClient }]; } });
|
|
5828
5901
|
|
|
5902
|
+
class PaymentSystemProcessingService {
|
|
5903
|
+
constructor(window) {
|
|
5904
|
+
this.window = window;
|
|
5905
|
+
this.statusUrl = new BehaviorSubject('');
|
|
5906
|
+
this.initialize = new BehaviorSubject(false);
|
|
5907
|
+
}
|
|
5908
|
+
get initialize$() {
|
|
5909
|
+
return this.initialize.asObservable();
|
|
5910
|
+
}
|
|
5911
|
+
get status$() {
|
|
5912
|
+
return this.statusUrl.asObservable().pipe(filter((status) => !!status));
|
|
5913
|
+
}
|
|
5914
|
+
emitPayment(payment) {
|
|
5915
|
+
this.statusUrl.next(payment);
|
|
5916
|
+
}
|
|
5917
|
+
emitInitialize(isInitialized) {
|
|
5918
|
+
this.initialize.next(isInitialized);
|
|
5919
|
+
}
|
|
5920
|
+
getDecodedCheckout(base64checkoutData) {
|
|
5921
|
+
try {
|
|
5922
|
+
return JSON.parse(atob(base64checkoutData));
|
|
5923
|
+
}
|
|
5924
|
+
catch (error) {
|
|
5925
|
+
throw new AppError('load script service: decode error');
|
|
5926
|
+
}
|
|
5927
|
+
}
|
|
5928
|
+
loadScript(url, onLoad, addScriptCustomAttributes) {
|
|
5929
|
+
this.initialize.next(false);
|
|
5930
|
+
let script = this.window.document.createElement('script');
|
|
5931
|
+
script.async = true;
|
|
5932
|
+
script.src = url;
|
|
5933
|
+
if (addScriptCustomAttributes) {
|
|
5934
|
+
script = addScriptCustomAttributes(script);
|
|
5935
|
+
}
|
|
5936
|
+
this.window.document.body.append(script);
|
|
5937
|
+
script.onload = () => {
|
|
5938
|
+
try {
|
|
5939
|
+
onLoad();
|
|
5940
|
+
}
|
|
5941
|
+
catch (error) {
|
|
5942
|
+
let message = error;
|
|
5943
|
+
if (error instanceof Error) {
|
|
5944
|
+
message = error.message;
|
|
5945
|
+
}
|
|
5946
|
+
throw new AppError(`Pages: error during script onload handler: ${message}, url - ${url}`);
|
|
5947
|
+
}
|
|
5948
|
+
};
|
|
5949
|
+
script.onerror = (event, source, lineno, colno, error) => {
|
|
5950
|
+
const errorMessage = error ? error.message : '';
|
|
5951
|
+
let eventMessage = event;
|
|
5952
|
+
if (typeof event === 'object') {
|
|
5953
|
+
eventMessage = JSON.stringify(event);
|
|
5954
|
+
}
|
|
5955
|
+
throw new AppError(`Pages: error during script onerror handler:
|
|
5956
|
+
url - ${url},
|
|
5957
|
+
event - ${eventMessage},
|
|
5958
|
+
source - ${source !== null && source !== void 0 ? source : ''},
|
|
5959
|
+
lineno - ${lineno !== null && lineno !== void 0 ? lineno : ''},
|
|
5960
|
+
colno - ${colno !== null && colno !== void 0 ? colno : ''},
|
|
5961
|
+
error - ${errorMessage}`);
|
|
5962
|
+
};
|
|
5963
|
+
}
|
|
5964
|
+
isInitialized() {
|
|
5965
|
+
return this.initialize.getValue();
|
|
5966
|
+
}
|
|
5967
|
+
}
|
|
5968
|
+
PaymentSystemProcessingService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: PaymentSystemProcessingService, deps: [{ token: windowToken }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
5969
|
+
PaymentSystemProcessingService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: PaymentSystemProcessingService, providedIn: 'root' });
|
|
5970
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: PaymentSystemProcessingService, decorators: [{
|
|
5971
|
+
type: Injectable,
|
|
5972
|
+
args: [{
|
|
5973
|
+
providedIn: 'root',
|
|
5974
|
+
}]
|
|
5975
|
+
}], ctorParameters: function () {
|
|
5976
|
+
return [{ type: undefined, decorators: [{
|
|
5977
|
+
type: Inject,
|
|
5978
|
+
args: [windowToken]
|
|
5979
|
+
}] }];
|
|
5980
|
+
} });
|
|
5981
|
+
|
|
5982
|
+
class GooglePayService {
|
|
5983
|
+
get libraryWasInitialized() {
|
|
5984
|
+
return !!this.window.google;
|
|
5985
|
+
}
|
|
5986
|
+
get googlePaymentClientWasInitialized() {
|
|
5987
|
+
return !!this.googlePaymentClient;
|
|
5988
|
+
}
|
|
5989
|
+
constructor(window, elkLoggerService, commonPayProcessingService, httpClient, injector) {
|
|
5990
|
+
this.window = window;
|
|
5991
|
+
this.elkLoggerService = elkLoggerService;
|
|
5992
|
+
this.commonPayProcessingService = commonPayProcessingService;
|
|
5993
|
+
this.httpClient = httpClient;
|
|
5994
|
+
this.injector = injector;
|
|
5995
|
+
this.googlePayScriptUrl = 'https://pay.google.com/gp/p/js/pay.js';
|
|
5996
|
+
this.readyToPay = new BehaviorSubject(null);
|
|
5997
|
+
this.checkout = null;
|
|
5998
|
+
this.googlePaymentClient = null;
|
|
5999
|
+
this.commonPayProcessingService.status$.subscribe((path) => {
|
|
6000
|
+
this.sendUserBack(path);
|
|
6001
|
+
});
|
|
6002
|
+
}
|
|
6003
|
+
get readyToPay$() {
|
|
6004
|
+
return this.readyToPay.asObservable();
|
|
6005
|
+
}
|
|
6006
|
+
isReadyToPay() {
|
|
6007
|
+
return this.readyToPay.getValue();
|
|
6008
|
+
}
|
|
6009
|
+
sendUserBack(path) {
|
|
6010
|
+
void this.httpClient.get(path);
|
|
6011
|
+
}
|
|
6012
|
+
initGooglePayLibrary(data) {
|
|
6013
|
+
this.isSandbox = data.isSandbox;
|
|
6014
|
+
this.country = data.country;
|
|
6015
|
+
if (this.libraryWasInitialized && this.googlePaymentClientWasInitialized) {
|
|
6016
|
+
return;
|
|
6017
|
+
}
|
|
6018
|
+
if (this.libraryWasInitialized && !this.googlePaymentClientWasInitialized) {
|
|
6019
|
+
this.setupGooglePayClient();
|
|
6020
|
+
return;
|
|
6021
|
+
}
|
|
6022
|
+
this.commonPayProcessingService.loadScript(this.googlePayScriptUrl, this.onLoadScript.bind(this));
|
|
6023
|
+
this.elkLoggerService.log('Google Pay: loading script is starting', [
|
|
6024
|
+
ErrorTags.GOOGLEPAY,
|
|
6025
|
+
]);
|
|
6026
|
+
}
|
|
6027
|
+
checkPaymentDevice(base64checkoutData) {
|
|
6028
|
+
this.commonPayProcessingService.initialize$
|
|
6029
|
+
.pipe(filter$1(Boolean), take(1))
|
|
6030
|
+
.subscribe(() => {
|
|
6031
|
+
this.checkout =
|
|
6032
|
+
this.commonPayProcessingService.getDecodedCheckout(base64checkoutData);
|
|
6033
|
+
if (!this.checkout || !this.googlePaymentClient) {
|
|
6034
|
+
throw new AppError(`Google Pay: no checkout or google payment client, checkout - ${Boolean(this.checkout).toString()}, client - ${Boolean(this.googlePaymentClient).toString()}`);
|
|
6035
|
+
}
|
|
6036
|
+
const checkoutData = this.checkout.request.form.fields;
|
|
6037
|
+
const isReadyToPayRequest = JSON.parse(checkoutData.isReadyToPayRequest);
|
|
6038
|
+
this.googlePaymentClient
|
|
6039
|
+
.isReadyToPay(isReadyToPayRequest)
|
|
6040
|
+
.then((response) => {
|
|
6041
|
+
var _a, _b;
|
|
6042
|
+
if (response.result && this.googlePaymentClient) {
|
|
6043
|
+
this.googlePaymentClient.prefetchPaymentData(JSON.parse(checkoutData.paymentDataRequest));
|
|
6044
|
+
return this.readyToPay.next(true);
|
|
6045
|
+
}
|
|
6046
|
+
this.readyToPay.next(false);
|
|
6047
|
+
const result = (_b = (_a = response.result) === null || _a === void 0 ? void 0 : _a.toString()) !== null && _b !== void 0 ? _b : '';
|
|
6048
|
+
const isHavePaymentClient = Boolean(this.googlePaymentClient).toString();
|
|
6049
|
+
this.elkLoggerService.log(`Google Pay: possibly no response.result or googlePaymentClient is missing, result - ${result}, isHavePaymentClient - ${isHavePaymentClient}`, [ErrorTags.GOOGLEPAY], {
|
|
6050
|
+
result: response.result,
|
|
6051
|
+
response: response,
|
|
6052
|
+
googlePaymentClient: !!this.googlePaymentClient,
|
|
6053
|
+
});
|
|
6054
|
+
throw new Error();
|
|
6055
|
+
})
|
|
6056
|
+
.catch((error) => {
|
|
6057
|
+
this.readyToPay.next(false);
|
|
6058
|
+
let message = error !== null && error !== void 0 ? error : '';
|
|
6059
|
+
if (error instanceof Error) {
|
|
6060
|
+
message = error.message;
|
|
6061
|
+
}
|
|
6062
|
+
throw new AppError(`Google Pay: device is not ready to pay, ${message}`);
|
|
6063
|
+
});
|
|
6064
|
+
});
|
|
6065
|
+
}
|
|
6066
|
+
proceedCheckout() {
|
|
6067
|
+
var _a, _b;
|
|
6068
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
6069
|
+
if (!this.checkout || !this.googlePaymentClient) {
|
|
6070
|
+
const isHaveCheckout = !!this.checkout;
|
|
6071
|
+
const isHaveClient = !!this.googlePaymentClient;
|
|
6072
|
+
throw new AppError(`Google Pay: no checkout or google payment client, checkout - ${isHaveCheckout.toString()}, client - ${isHaveClient.toString()}`);
|
|
6073
|
+
}
|
|
6074
|
+
const checkoutData = this.checkout.request.form.fields;
|
|
6075
|
+
const paymentDataRequest = JSON.parse(checkoutData.paymentDataRequest);
|
|
6076
|
+
paymentDataRequest.transactionInfo = {
|
|
6077
|
+
currencyCode: checkoutData.currency,
|
|
6078
|
+
totalPriceStatus: 'FINAL',
|
|
6079
|
+
totalPrice: checkoutData.sum,
|
|
6080
|
+
countryCode: this.country,
|
|
6081
|
+
};
|
|
6082
|
+
const checkStatusAction = this.injector
|
|
6083
|
+
.get(CheckStatusActionCreator)
|
|
6084
|
+
.getActionData();
|
|
6085
|
+
try {
|
|
6086
|
+
const paymentData = yield this.googlePaymentClient.loadPaymentData(paymentDataRequest);
|
|
6087
|
+
if (!((_b = (_a = paymentData === null || paymentData === void 0 ? void 0 : paymentData.paymentMethodData) === null || _a === void 0 ? void 0 : _a.tokenizationData) === null || _b === void 0 ? void 0 : _b.token)) {
|
|
6088
|
+
throw new AppError('Google Pay: token is missing');
|
|
6089
|
+
}
|
|
6090
|
+
if (!this.checkout) {
|
|
6091
|
+
throw new AppError('Google Pay: no checkout data in then');
|
|
6092
|
+
}
|
|
6093
|
+
let returnUrl = this.checkout.request.form.fields.returnSuccessUrl;
|
|
6094
|
+
const data = this.checkout.request.form.fields;
|
|
6095
|
+
returnUrl += `&cpf_number=${data.cpf_number}&descriptor=${data.descriptor}&paymentData=${JSON.stringify(paymentData)}`;
|
|
6096
|
+
this.commonPayProcessingService.emitPayment(returnUrl);
|
|
6097
|
+
return checkStatusAction;
|
|
6098
|
+
}
|
|
6099
|
+
catch (error) {
|
|
6100
|
+
this.elkLoggerService.log(`Google Pay: google payment window error. ${JSON.stringify(error)}`, [ErrorTags.GOOGLEPAY], {
|
|
6101
|
+
error: error,
|
|
6102
|
+
});
|
|
6103
|
+
if (!this.checkout) {
|
|
6104
|
+
throw new AppError(`Google Pay: no checkout data`);
|
|
6105
|
+
}
|
|
6106
|
+
const statusCode = error === null || error === void 0 ? void 0 : error.statusCode;
|
|
6107
|
+
const isStatusCanceled = statusCode && this.isCancelledStatus(statusCode);
|
|
6108
|
+
if (isStatusCanceled) {
|
|
6109
|
+
return null;
|
|
6110
|
+
}
|
|
6111
|
+
const returnUrl = this.checkout.request.form.fields.returnFailUrl;
|
|
6112
|
+
this.commonPayProcessingService.emitPayment(returnUrl);
|
|
6113
|
+
return checkStatusAction;
|
|
6114
|
+
}
|
|
6115
|
+
});
|
|
6116
|
+
}
|
|
6117
|
+
createButton(onClickHandler) {
|
|
6118
|
+
if (!this.checkout || !this.googlePaymentClient) {
|
|
6119
|
+
return null;
|
|
6120
|
+
}
|
|
6121
|
+
const checkoutData = this.checkout.request.form.fields;
|
|
6122
|
+
const paymentDataRequest = JSON.parse(checkoutData.paymentDataRequest);
|
|
6123
|
+
return this.googlePaymentClient.createButton({
|
|
6124
|
+
onClick: onClickHandler,
|
|
6125
|
+
allowedPaymentMethods: paymentDataRequest.allowedPaymentMethods,
|
|
6126
|
+
buttonSizeMode: 'fill',
|
|
6127
|
+
buttonType: 'buy',
|
|
6128
|
+
buttonColor: 'white',
|
|
6129
|
+
});
|
|
6130
|
+
}
|
|
6131
|
+
setupGooglePayClient() {
|
|
6132
|
+
if (!this.window.google) {
|
|
6133
|
+
return;
|
|
6134
|
+
}
|
|
6135
|
+
const environment = this.isSandbox ? 'TEST' : 'PRODUCTION';
|
|
6136
|
+
this.googlePaymentClient =
|
|
6137
|
+
new this.window.google.payments.api.PaymentsClient({
|
|
6138
|
+
environment,
|
|
6139
|
+
});
|
|
6140
|
+
this.elkLoggerService.log(`Google Pay: payments client is initialized, paymentsClient - ${Boolean(this.googlePaymentClient).toString()}`, [ErrorTags.GOOGLEPAY], { environment: environment, initialized: !!this.googlePaymentClient });
|
|
6141
|
+
}
|
|
6142
|
+
onLoadScript() {
|
|
6143
|
+
if (!this.window.google) {
|
|
6144
|
+
const retryTimeout = 1000;
|
|
6145
|
+
setTimeout(() => {
|
|
6146
|
+
const isAvailableGoogleClient = !!this.window.google;
|
|
6147
|
+
if (!isAvailableGoogleClient) {
|
|
6148
|
+
this.elkLoggerService.log('Google Pay: google library is missing', [
|
|
6149
|
+
ErrorTags.GOOGLEPAY,
|
|
6150
|
+
]);
|
|
6151
|
+
}
|
|
6152
|
+
else {
|
|
6153
|
+
this.setupGooglePayClient();
|
|
6154
|
+
this.commonPayProcessingService.emitInitialize(true);
|
|
6155
|
+
}
|
|
6156
|
+
}, retryTimeout);
|
|
6157
|
+
throw new AppError('Google Pay: google library now is available');
|
|
6158
|
+
}
|
|
6159
|
+
else {
|
|
6160
|
+
this.setupGooglePayClient();
|
|
6161
|
+
this.commonPayProcessingService.emitInitialize(true);
|
|
6162
|
+
}
|
|
6163
|
+
}
|
|
6164
|
+
isCancelledStatus(statusCode) {
|
|
6165
|
+
return statusCode.toLowerCase() === 'canceled';
|
|
6166
|
+
}
|
|
6167
|
+
}
|
|
6168
|
+
GooglePayService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: GooglePayService, deps: [{ token: windowToken }, { token: ElkLoggerService }, { token: PaymentSystemProcessingService }, { token: i1.HttpClient }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
6169
|
+
GooglePayService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: GooglePayService, providedIn: 'root' });
|
|
6170
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: GooglePayService, decorators: [{
|
|
6171
|
+
type: Injectable,
|
|
6172
|
+
args: [{
|
|
6173
|
+
providedIn: 'root',
|
|
6174
|
+
}]
|
|
6175
|
+
}], ctorParameters: function () {
|
|
6176
|
+
return [{ type: undefined, decorators: [{
|
|
6177
|
+
type: Inject,
|
|
6178
|
+
args: [windowToken]
|
|
6179
|
+
}] }, { type: ElkLoggerService }, { type: PaymentSystemProcessingService }, { type: i1.HttpClient }, { type: i0.Injector }];
|
|
6180
|
+
} });
|
|
6181
|
+
|
|
5829
6182
|
class CoreLibraryService {
|
|
5830
|
-
constructor(settingsService, countryService, paymentMethodsService, savedMethodsService, userBalanceService, paymentConfigService, paymentService, deviceFingerPrintService, financeDetailsService, legalService, statusService, nextActionService, creditCardService, creditCardStateService, formMessagesService, editSavedMethodsService) {
|
|
6183
|
+
constructor(settingsService, countryService, paymentMethodsService, savedMethodsService, userBalanceService, paymentConfigService, paymentService, deviceFingerPrintService, financeDetailsService, legalService, statusService, nextActionService, creditCardService, creditCardStateService, formMessagesService, editSavedMethodsService, googlePayService, commonPayProcessingService) {
|
|
5831
6184
|
this.settingsService = settingsService;
|
|
5832
6185
|
this.countryService = countryService;
|
|
5833
6186
|
this.paymentMethodsService = paymentMethodsService;
|
|
@@ -5844,6 +6197,8 @@ class CoreLibraryService {
|
|
|
5844
6197
|
this.creditCardStateService = creditCardStateService;
|
|
5845
6198
|
this.formMessagesService = formMessagesService;
|
|
5846
6199
|
this.editSavedMethodsService = editSavedMethodsService;
|
|
6200
|
+
this.googlePayService = googlePayService;
|
|
6201
|
+
this.commonPayProcessingService = commonPayProcessingService;
|
|
5847
6202
|
this.paymentMethods = {
|
|
5848
6203
|
getList: (isSaveMethodMode) => __awaiter(this, void 0, void 0, function* () { return this.paymentMethodsService.getList(isSaveMethodMode); }),
|
|
5849
6204
|
getQuickMethods: () => __awaiter(this, void 0, void 0, function* () { return this.paymentMethodsService.getQuickMethods(); }),
|
|
@@ -5851,6 +6206,23 @@ class CoreLibraryService {
|
|
|
5851
6206
|
getUserBalance: () => __awaiter(this, void 0, void 0, function* () { return this.userBalanceService.getUserBalance(); }),
|
|
5852
6207
|
deleteSavedMethod: (id, type) => __awaiter(this, void 0, void 0, function* () { return this.editSavedMethodsService.deleteSavedMethodRequest(id, type); }),
|
|
5853
6208
|
};
|
|
6209
|
+
this.sdkPaymentSystems = {
|
|
6210
|
+
commonPayProcessingService: {
|
|
6211
|
+
initialize$: this.commonPayProcessingService.initialize$,
|
|
6212
|
+
isInitialized: () => this.commonPayProcessingService.isInitialized(),
|
|
6213
|
+
status$: this.commonPayProcessingService.status$,
|
|
6214
|
+
},
|
|
6215
|
+
googlePay: {
|
|
6216
|
+
readyToPay$: this.googlePayService.readyToPay$,
|
|
6217
|
+
isReadyToPay: () => this.googlePayService.isReadyToPay(),
|
|
6218
|
+
initGooglePayLibrary: (params) => this.googlePayService.initGooglePayLibrary(params),
|
|
6219
|
+
checkPaymentDevice: (base64checkoutData) => this.googlePayService.checkPaymentDevice(base64checkoutData),
|
|
6220
|
+
proceedCheckout: () => __awaiter(this, void 0, void 0, function* () { return this.googlePayService.proceedCheckout(); }),
|
|
6221
|
+
createButton: (onClickHandler) => this.googlePayService.createButton(onClickHandler),
|
|
6222
|
+
sendUserBack: (path) => this.googlePayService.sendUserBack(path),
|
|
6223
|
+
},
|
|
6224
|
+
getInitialData: () => this.paymentService.getInitialDataForSdkPaymentSystems(),
|
|
6225
|
+
};
|
|
5854
6226
|
}
|
|
5855
6227
|
init(configuration) {
|
|
5856
6228
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -5919,14 +6291,14 @@ class CoreLibraryService {
|
|
|
5919
6291
|
return this.userBalanceService.getUserBalanceValue();
|
|
5920
6292
|
}
|
|
5921
6293
|
}
|
|
5922
|
-
CoreLibraryService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: CoreLibraryService, deps: [{ token: SettingsService }, { token: CountryService }, { token: PaymentMethodsService }, { token: SavedMethodsService }, { token: UserBalanceService }, { token: PaymentConfigService }, { token: PaymentService }, { token: DeviceFingerPrintService }, { token: FinanceDetailsService }, { token: LegalService }, { token: StatusService }, { token: NextActionService }, { token: CreditCardService }, { token: CreditCardStateService }, { token: FormMessagesService }, { token: EditSavedMethodsService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
6294
|
+
CoreLibraryService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: CoreLibraryService, deps: [{ token: SettingsService }, { token: CountryService }, { token: PaymentMethodsService }, { token: SavedMethodsService }, { token: UserBalanceService }, { token: PaymentConfigService }, { token: PaymentService }, { token: DeviceFingerPrintService }, { token: FinanceDetailsService }, { token: LegalService }, { token: StatusService }, { token: NextActionService }, { token: CreditCardService }, { token: CreditCardStateService }, { token: FormMessagesService }, { token: EditSavedMethodsService }, { token: GooglePayService }, { token: PaymentSystemProcessingService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
5923
6295
|
CoreLibraryService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: CoreLibraryService, providedIn: 'root' });
|
|
5924
6296
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: CoreLibraryService, decorators: [{
|
|
5925
6297
|
type: Injectable,
|
|
5926
6298
|
args: [{
|
|
5927
6299
|
providedIn: 'root',
|
|
5928
6300
|
}]
|
|
5929
|
-
}], ctorParameters: function () { return [{ type: SettingsService }, { type: CountryService }, { type: PaymentMethodsService }, { type: SavedMethodsService }, { type: UserBalanceService }, { type: PaymentConfigService }, { type: PaymentService }, { type: DeviceFingerPrintService }, { type: FinanceDetailsService }, { type: LegalService }, { type: StatusService }, { type: NextActionService }, { type: CreditCardService }, { type: CreditCardStateService }, { type: FormMessagesService }, { type: EditSavedMethodsService }]; } });
|
|
6301
|
+
}], ctorParameters: function () { return [{ type: SettingsService }, { type: CountryService }, { type: PaymentMethodsService }, { type: SavedMethodsService }, { type: UserBalanceService }, { type: PaymentConfigService }, { type: PaymentService }, { type: DeviceFingerPrintService }, { type: FinanceDetailsService }, { type: LegalService }, { type: StatusService }, { type: NextActionService }, { type: CreditCardService }, { type: CreditCardStateService }, { type: FormMessagesService }, { type: EditSavedMethodsService }, { type: GooglePayService }, { type: PaymentSystemProcessingService }]; } });
|
|
5930
6302
|
|
|
5931
6303
|
class HttpError extends AppError {
|
|
5932
6304
|
constructor(error, req) {
|