@xsolla/payment-client-core 0.1.21 → 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 -11
- package/esm2020/lib/core/payment/actions/next-actions.mjs +15 -13
- package/esm2020/lib/core/payment/actions/redirect/pay-station4-url.const.mjs +3 -0
- package/esm2020/lib/core/payment/actions/redirect/ps4-pages/pages-payment-methods-id.const.mjs +7 -0
- package/esm2020/lib/core/payment/actions/redirect/ps4-pages/pages-routes.const.mjs +9 -0
- package/esm2020/lib/core/payment/actions/redirect/redirect.action.class.mjs +51 -11
- 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 +570 -162
- package/fesm2015/xsolla-payment-client-core.mjs.map +1 -1
- package/fesm2020/xsolla-payment-client-core.mjs +561 -160
- 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 -1
- package/lib/core/payment/actions/next-actions.d.ts +4 -4
- package/lib/core/payment/actions/redirect/pay-station4-url.const.d.ts +2 -0
- package/lib/core/payment/actions/redirect/ps4-pages/pages-payment-methods-id.const.d.ts +6 -0
- package/lib/core/payment/actions/redirect/ps4-pages/pages-routes.const.d.ts +1 -0
- package/lib/core/payment/actions/redirect/redirect.action.class.d.ts +14 -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.21.tgz +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { InjectionToken, Injectable, Inject, Pipe, isDevMode, NgModule } from '@angular/core';
|
|
3
|
-
import { firstValueFrom, lastValueFrom, map, Subject, BehaviorSubject, filter as filter$1, takeUntil, skip, throwError } from 'rxjs';
|
|
3
|
+
import { firstValueFrom, lastValueFrom, map, Subject, BehaviorSubject, filter as filter$1, takeUntil, skip, take, throwError } from 'rxjs';
|
|
4
4
|
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';
|
|
@@ -648,15 +648,6 @@ var InputEventName;
|
|
|
648
648
|
InputEventName["focus"] = "focus";
|
|
649
649
|
})(InputEventName || (InputEventName = {}));
|
|
650
650
|
|
|
651
|
-
class ShowErrorsAction {
|
|
652
|
-
constructor(errors) {
|
|
653
|
-
this.type = 'show_errors';
|
|
654
|
-
this.data = {
|
|
655
|
-
errors,
|
|
656
|
-
};
|
|
657
|
-
}
|
|
658
|
-
}
|
|
659
|
-
|
|
660
651
|
const initializeResponseFactoryToken = new InjectionToken('InitializeResponse');
|
|
661
652
|
const initializeResponseFactoryProvider = {
|
|
662
653
|
provide: initializeResponseFactoryToken,
|
|
@@ -748,59 +739,148 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImpor
|
|
|
748
739
|
args: [windowToken]
|
|
749
740
|
}] }, { type: SecureApiClient }, { type: SettingsService }, { type: CountryService }]; } });
|
|
750
741
|
|
|
751
|
-
|
|
752
|
-
|
|
742
|
+
const vkPay = 3496;
|
|
743
|
+
const googlePay = 3431;
|
|
744
|
+
const applePay = 3175;
|
|
745
|
+
const barzahlenPay = 1679;
|
|
746
|
+
const naverPay = 3563;
|
|
747
|
+
const venmoPay = 3636;
|
|
748
|
+
|
|
749
|
+
const pagesRoutes = new Map([
|
|
750
|
+
[vkPay, '/payment/external-pages/vk-pay'],
|
|
751
|
+
[applePay, '/payment/external-pages/apple-pay'],
|
|
752
|
+
[barzahlenPay, '/payment/external-pages/barzahlen-pay'],
|
|
753
|
+
[naverPay, '/payment/external-pages/naver-pay'],
|
|
754
|
+
[venmoPay, '/payment/external-pages/venmo-pay'],
|
|
755
|
+
]);
|
|
756
|
+
|
|
757
|
+
const payStation4Url = 'https://secure.xsolla.com/paystation4';
|
|
758
|
+
const sandboxPayStationUrl = 'https://sandbox-secure.xsolla.com/paystation4';
|
|
759
|
+
|
|
760
|
+
class RedirectActionCreator {
|
|
761
|
+
constructor(settingsService) {
|
|
762
|
+
this.settingsService = settingsService;
|
|
763
|
+
this.type = 'redirect';
|
|
764
|
+
}
|
|
765
|
+
getActionData(submitResponse) {
|
|
766
|
+
return {
|
|
767
|
+
type: this.type,
|
|
768
|
+
data: {
|
|
769
|
+
fields: submitResponse.fields,
|
|
770
|
+
errors: submitResponse.errors,
|
|
771
|
+
messages: submitResponse.messages,
|
|
772
|
+
order: submitResponse.summary,
|
|
773
|
+
invoiceId: submitResponse.fixInvoice,
|
|
774
|
+
redirect: this.getRedirect(submitResponse),
|
|
775
|
+
},
|
|
776
|
+
};
|
|
777
|
+
}
|
|
778
|
+
isSuitable(response) {
|
|
779
|
+
return (response.currentCommand === XpsCommand.account ||
|
|
780
|
+
(response.currentCommand === XpsCommand.checkout &&
|
|
781
|
+
Boolean(response.parameters.checkout)));
|
|
782
|
+
}
|
|
783
|
+
getRedirect(submitResponse) {
|
|
784
|
+
return {
|
|
785
|
+
redirectUrl: this.getRedirectUrl(submitResponse),
|
|
786
|
+
data: submitResponse.parameters.checkout.data,
|
|
787
|
+
};
|
|
788
|
+
}
|
|
789
|
+
getRedirectUrl(submitResponse) {
|
|
790
|
+
const responseRedirectUrl = submitResponse.parameters.checkout.action;
|
|
791
|
+
const pid = submitResponse?.fields?.find(({ name }) => name === 'fix_pid')?.value;
|
|
792
|
+
if (!pid) {
|
|
793
|
+
return responseRedirectUrl;
|
|
794
|
+
}
|
|
795
|
+
const pagesPath = pagesRoutes.get(Number(pid));
|
|
796
|
+
if (!pagesPath) {
|
|
797
|
+
return responseRedirectUrl;
|
|
798
|
+
}
|
|
799
|
+
return this.preparePagesUrl(pagesPath);
|
|
800
|
+
}
|
|
801
|
+
preparePagesUrl(pagesPath) {
|
|
802
|
+
const isSandbox = this.settingsService.isSandboxMode();
|
|
803
|
+
const token = this.settingsService.token;
|
|
804
|
+
const payStationUrl = isSandbox ? sandboxPayStationUrl : payStation4Url;
|
|
805
|
+
return `${payStationUrl}/en${pagesPath}?token=${token}`;
|
|
806
|
+
}
|
|
807
|
+
}
|
|
808
|
+
RedirectActionCreator.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: RedirectActionCreator, deps: [{ token: SettingsService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
809
|
+
RedirectActionCreator.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: RedirectActionCreator });
|
|
810
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: RedirectActionCreator, decorators: [{
|
|
811
|
+
type: Injectable
|
|
812
|
+
}], ctorParameters: function () { return [{ type: SettingsService }]; } });
|
|
813
|
+
|
|
814
|
+
class ShowFieldsActionCreator {
|
|
815
|
+
constructor() {
|
|
753
816
|
this.type = 'show_fields';
|
|
754
|
-
|
|
817
|
+
}
|
|
818
|
+
getActionData(submitResponse) {
|
|
819
|
+
const data = {
|
|
755
820
|
fields: [],
|
|
756
821
|
errors: [],
|
|
757
822
|
messages: [],
|
|
758
823
|
order: {},
|
|
759
824
|
};
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
825
|
+
data.fields = submitResponse.fields.filter((field) => field?.isVisible === "1" /* XpsBoolean.true */);
|
|
826
|
+
data.errors = submitResponse.errors;
|
|
827
|
+
data.messages = submitResponse.messages;
|
|
828
|
+
data.order = submitResponse.summary;
|
|
829
|
+
return {
|
|
830
|
+
type: this.type,
|
|
831
|
+
data,
|
|
832
|
+
};
|
|
833
|
+
}
|
|
834
|
+
isSuitable(response) {
|
|
835
|
+
return (response.currentCommand === XpsCommand.check ||
|
|
836
|
+
response.currentCommand === XpsCommand.form);
|
|
764
837
|
}
|
|
765
838
|
}
|
|
839
|
+
ShowFieldsActionCreator.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: ShowFieldsActionCreator, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
840
|
+
ShowFieldsActionCreator.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: ShowFieldsActionCreator });
|
|
841
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: ShowFieldsActionCreator, decorators: [{
|
|
842
|
+
type: Injectable
|
|
843
|
+
}] });
|
|
766
844
|
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
provide: showFieldsActionFactoryToken,
|
|
770
|
-
useValue: {
|
|
771
|
-
factory: (...args) => new ShowFieldsAction(...args),
|
|
772
|
-
isSuitable: (response) => {
|
|
773
|
-
return (response.currentCommand === XpsCommand.check ||
|
|
774
|
-
response.currentCommand === XpsCommand.form);
|
|
775
|
-
},
|
|
776
|
-
},
|
|
777
|
-
};
|
|
778
|
-
|
|
779
|
-
class CheckStatusAction {
|
|
780
|
-
constructor(submitResponse) {
|
|
845
|
+
class CheckStatusActionCreator {
|
|
846
|
+
constructor() {
|
|
781
847
|
this.type = 'check_status';
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
testXsolla: submitResponse.parameters.form.testXsolla?.value,
|
|
788
|
-
testProject: submitResponse.parameters.form.testProject?.value,
|
|
789
|
-
userReturnStatus: submitResponse.parameters.form.userReturnStatus?.value,
|
|
848
|
+
}
|
|
849
|
+
getActionData() {
|
|
850
|
+
return {
|
|
851
|
+
type: this.type,
|
|
852
|
+
data: null,
|
|
790
853
|
};
|
|
791
854
|
}
|
|
855
|
+
isSuitable(response) {
|
|
856
|
+
return response.currentCommand === XpsCommand.status;
|
|
857
|
+
}
|
|
792
858
|
}
|
|
859
|
+
CheckStatusActionCreator.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: CheckStatusActionCreator, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
860
|
+
CheckStatusActionCreator.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: CheckStatusActionCreator });
|
|
861
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: CheckStatusActionCreator, decorators: [{
|
|
862
|
+
type: Injectable
|
|
863
|
+
}] });
|
|
793
864
|
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
}
|
|
865
|
+
class ShowErrorsActionCreator {
|
|
866
|
+
constructor() {
|
|
867
|
+
this.type = 'show_errors';
|
|
868
|
+
}
|
|
869
|
+
getActionData(errors) {
|
|
870
|
+
return {
|
|
871
|
+
type: this.type,
|
|
872
|
+
data: { errors },
|
|
873
|
+
};
|
|
874
|
+
}
|
|
875
|
+
isSuitable(response) {
|
|
876
|
+
return Boolean(response.errors?.length);
|
|
877
|
+
}
|
|
878
|
+
}
|
|
879
|
+
ShowErrorsActionCreator.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: ShowErrorsActionCreator, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
880
|
+
ShowErrorsActionCreator.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: ShowErrorsActionCreator });
|
|
881
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: ShowErrorsActionCreator, decorators: [{
|
|
882
|
+
type: Injectable
|
|
883
|
+
}] });
|
|
804
884
|
|
|
805
885
|
class TerminalError extends AppError {
|
|
806
886
|
constructor(message, code) {
|
|
@@ -921,9 +1001,11 @@ class StatusResponse {
|
|
|
921
1001
|
}
|
|
922
1002
|
}
|
|
923
1003
|
|
|
924
|
-
class
|
|
925
|
-
constructor(
|
|
1004
|
+
class StatusUpdatedActionCreator {
|
|
1005
|
+
constructor() {
|
|
926
1006
|
this.type = 'status_updated';
|
|
1007
|
+
}
|
|
1008
|
+
getActionData({ statusResponse, isSavePaymentMethodMode, savePaymentMethodStatus, }) {
|
|
927
1009
|
let status;
|
|
928
1010
|
if (statusResponse instanceof StatusResponse) {
|
|
929
1011
|
status = statusResponse.status;
|
|
@@ -931,120 +1013,123 @@ class StatusUpdatedAction {
|
|
|
931
1013
|
else {
|
|
932
1014
|
status = statusResponse;
|
|
933
1015
|
}
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
1016
|
+
return {
|
|
1017
|
+
type: this.type,
|
|
1018
|
+
data: {
|
|
1019
|
+
statusState: status.statusState,
|
|
1020
|
+
invoice: status.invoice,
|
|
1021
|
+
isSuccess: status.isSuccess,
|
|
1022
|
+
isCanceled: status.isCanceled,
|
|
1023
|
+
group: status.group,
|
|
1024
|
+
isSavePaymentMethodMode: Boolean(isSavePaymentMethodMode),
|
|
1025
|
+
savePaymentMethodStatus,
|
|
1026
|
+
},
|
|
942
1027
|
};
|
|
943
1028
|
}
|
|
1029
|
+
isSuitable() {
|
|
1030
|
+
return false;
|
|
1031
|
+
}
|
|
944
1032
|
}
|
|
1033
|
+
StatusUpdatedActionCreator.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: StatusUpdatedActionCreator, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1034
|
+
StatusUpdatedActionCreator.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: StatusUpdatedActionCreator });
|
|
1035
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: StatusUpdatedActionCreator, decorators: [{
|
|
1036
|
+
type: Injectable
|
|
1037
|
+
}] });
|
|
945
1038
|
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
useValue: {
|
|
950
|
-
factory: (...args) => new StatusUpdatedAction(...args),
|
|
951
|
-
isSuitable: () => false,
|
|
952
|
-
},
|
|
953
|
-
};
|
|
954
|
-
|
|
955
|
-
class RedirectAction {
|
|
956
|
-
constructor(submitResponse) {
|
|
957
|
-
this.type = 'redirect';
|
|
958
|
-
this.data = {
|
|
959
|
-
fields: submitResponse.fields,
|
|
960
|
-
errors: submitResponse.errors,
|
|
961
|
-
messages: submitResponse.messages,
|
|
962
|
-
order: submitResponse.summary,
|
|
963
|
-
invoiceId: submitResponse.fixInvoice,
|
|
964
|
-
redirect: this.getRedirect(submitResponse),
|
|
965
|
-
};
|
|
1039
|
+
class ThreeDsActionCreator {
|
|
1040
|
+
constructor() {
|
|
1041
|
+
this.type = '3DS';
|
|
966
1042
|
}
|
|
967
|
-
|
|
1043
|
+
getActionData(actionData) {
|
|
968
1044
|
return {
|
|
969
|
-
|
|
970
|
-
data:
|
|
1045
|
+
type: this.type,
|
|
1046
|
+
data: actionData,
|
|
971
1047
|
};
|
|
972
1048
|
}
|
|
1049
|
+
isSuitable() {
|
|
1050
|
+
return false;
|
|
1051
|
+
}
|
|
973
1052
|
}
|
|
1053
|
+
ThreeDsActionCreator.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: ThreeDsActionCreator, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1054
|
+
ThreeDsActionCreator.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: ThreeDsActionCreator });
|
|
1055
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: ThreeDsActionCreator, decorators: [{
|
|
1056
|
+
type: Injectable
|
|
1057
|
+
}] });
|
|
974
1058
|
|
|
975
|
-
const
|
|
976
|
-
const redirectActionFactoryProvider = {
|
|
977
|
-
provide: redirectActionFactoryToken,
|
|
978
|
-
useValue: {
|
|
979
|
-
factory: (...args) => new RedirectAction(...args),
|
|
980
|
-
isSuitable: (response) => {
|
|
981
|
-
return (response.currentCommand === XpsCommand.account ||
|
|
982
|
-
(response.currentCommand === XpsCommand.checkout &&
|
|
983
|
-
Boolean(response.parameters.checkout)));
|
|
984
|
-
},
|
|
985
|
-
},
|
|
986
|
-
};
|
|
1059
|
+
const googlePayPid = 3431;
|
|
987
1060
|
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1061
|
+
class SpecialButtonActionCreator {
|
|
1062
|
+
constructor() {
|
|
1063
|
+
this.type = 'special_button';
|
|
1064
|
+
this.pids = [googlePayPid];
|
|
1065
|
+
this.sdkPaymentMethodsName = new Map([
|
|
1066
|
+
[googlePayPid, 'google-pay'],
|
|
1067
|
+
]);
|
|
1068
|
+
}
|
|
1069
|
+
getActionData(submitResponse) {
|
|
1070
|
+
return {
|
|
1071
|
+
type: this.type,
|
|
1072
|
+
data: {
|
|
1073
|
+
errors: submitResponse.errors,
|
|
1074
|
+
messages: submitResponse.messages,
|
|
1075
|
+
buttonName: this.getPaymentMethodName(submitResponse.pid),
|
|
1076
|
+
},
|
|
1077
|
+
};
|
|
1078
|
+
}
|
|
1079
|
+
isSuitable(response) {
|
|
1080
|
+
return (response.currentCommand === XpsCommand.checkout &&
|
|
1081
|
+
Boolean(response.parameters.checkout) &&
|
|
1082
|
+
this.pids.includes(response.pid));
|
|
1083
|
+
}
|
|
1084
|
+
getPaymentMethodName(pid) {
|
|
1085
|
+
const buttonName = this.sdkPaymentMethodsName.get(pid);
|
|
1086
|
+
if (!buttonName) {
|
|
1087
|
+
throw new Error('Special button not found');
|
|
1088
|
+
}
|
|
1089
|
+
return buttonName;
|
|
1003
1090
|
}
|
|
1004
1091
|
}
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
factory: (...args) => new ThreeDsAction(...args),
|
|
1011
|
-
isSuitable: () => false,
|
|
1012
|
-
},
|
|
1013
|
-
};
|
|
1092
|
+
SpecialButtonActionCreator.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: SpecialButtonActionCreator, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1093
|
+
SpecialButtonActionCreator.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: SpecialButtonActionCreator });
|
|
1094
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: SpecialButtonActionCreator, decorators: [{
|
|
1095
|
+
type: Injectable
|
|
1096
|
+
}] });
|
|
1014
1097
|
|
|
1015
1098
|
const nextActionsToken = new InjectionToken('Action');
|
|
1016
1099
|
const nextActions = [
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1100
|
+
ShowFieldsActionCreator,
|
|
1101
|
+
CheckStatusActionCreator,
|
|
1102
|
+
SpecialButtonActionCreator,
|
|
1103
|
+
RedirectActionCreator,
|
|
1020
1104
|
];
|
|
1021
1105
|
const flowUpdateNextActions = [
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1106
|
+
ShowErrorsActionCreator,
|
|
1107
|
+
StatusUpdatedActionCreator,
|
|
1108
|
+
ThreeDsActionCreator,
|
|
1025
1109
|
];
|
|
1026
1110
|
|
|
1027
1111
|
class NextActionService {
|
|
1028
1112
|
get flowUpdates$() {
|
|
1029
1113
|
return this.flowUpdatesSubject.asObservable();
|
|
1030
1114
|
}
|
|
1031
|
-
constructor(nextActionTokens, injector) {
|
|
1115
|
+
constructor(nextActionTokens, injector, showErrorsActionCreator) {
|
|
1032
1116
|
this.nextActionTokens = nextActionTokens;
|
|
1033
1117
|
this.injector = injector;
|
|
1118
|
+
this.showErrorsActionCreator = showErrorsActionCreator;
|
|
1034
1119
|
this.flowUpdatesSubject = new Subject();
|
|
1035
1120
|
this.nextActionsList = [];
|
|
1036
1121
|
this.fillNextActionsList();
|
|
1037
1122
|
}
|
|
1038
1123
|
getNextAction(submitResponse) {
|
|
1039
1124
|
if (submitResponse.errors?.length) {
|
|
1040
|
-
this.emitFlowUpdates(
|
|
1125
|
+
this.emitFlowUpdates(this.showErrorsActionCreator.getActionData(submitResponse.errors));
|
|
1041
1126
|
}
|
|
1042
1127
|
if (!submitResponse.currentCommand) {
|
|
1043
1128
|
return null;
|
|
1044
1129
|
}
|
|
1045
|
-
const
|
|
1046
|
-
if (
|
|
1047
|
-
return
|
|
1130
|
+
const nextAction = this.findNextAction(submitResponse);
|
|
1131
|
+
if (nextAction) {
|
|
1132
|
+
return nextAction.getActionData(submitResponse);
|
|
1048
1133
|
}
|
|
1049
1134
|
throw new Error('Next action is undefined.');
|
|
1050
1135
|
}
|
|
@@ -1053,7 +1138,7 @@ class NextActionService {
|
|
|
1053
1138
|
}
|
|
1054
1139
|
fillNextActionsList() {
|
|
1055
1140
|
this.nextActionTokens.forEach((nextAction) => {
|
|
1056
|
-
const item = this.injector.get(nextAction
|
|
1141
|
+
const item = this.injector.get(nextAction);
|
|
1057
1142
|
this.nextActionsList.push(item);
|
|
1058
1143
|
});
|
|
1059
1144
|
}
|
|
@@ -1064,10 +1149,10 @@ class NextActionService {
|
|
|
1064
1149
|
if (!actionType) {
|
|
1065
1150
|
return;
|
|
1066
1151
|
}
|
|
1067
|
-
return actionType
|
|
1152
|
+
return actionType;
|
|
1068
1153
|
}
|
|
1069
1154
|
}
|
|
1070
|
-
NextActionService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: NextActionService, deps: [{ token: nextActionsToken }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1155
|
+
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 });
|
|
1071
1156
|
NextActionService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: NextActionService, providedIn: 'root' });
|
|
1072
1157
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: NextActionService, decorators: [{
|
|
1073
1158
|
type: Injectable,
|
|
@@ -1077,7 +1162,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImpor
|
|
|
1077
1162
|
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
1078
1163
|
type: Inject,
|
|
1079
1164
|
args: [nextActionsToken]
|
|
1080
|
-
}] }, { type: i0.Injector }]; } });
|
|
1165
|
+
}] }, { type: i0.Injector }, { type: ShowErrorsActionCreator }]; } });
|
|
1081
1166
|
|
|
1082
1167
|
/* eslint-disable @typescript-eslint/no-magic-numbers */
|
|
1083
1168
|
const cardNumberSanctionErrorCodes = [
|
|
@@ -1562,7 +1647,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImpor
|
|
|
1562
1647
|
}], ctorParameters: function () { return [{ type: CreditCardService }]; } });
|
|
1563
1648
|
|
|
1564
1649
|
class InitializeService {
|
|
1565
|
-
constructor(responseFactory, xpsApiService, settingsService, countryService, nextActionService, xpsResponseErrorsMappingService, encryptCreditCardService) {
|
|
1650
|
+
constructor(responseFactory, xpsApiService, settingsService, countryService, nextActionService, xpsResponseErrorsMappingService, encryptCreditCardService, showErrorsActionCreator) {
|
|
1566
1651
|
this.responseFactory = responseFactory;
|
|
1567
1652
|
this.xpsApiService = xpsApiService;
|
|
1568
1653
|
this.settingsService = settingsService;
|
|
@@ -1570,6 +1655,7 @@ class InitializeService {
|
|
|
1570
1655
|
this.nextActionService = nextActionService;
|
|
1571
1656
|
this.xpsResponseErrorsMappingService = xpsResponseErrorsMappingService;
|
|
1572
1657
|
this.encryptCreditCardService = encryptCreditCardService;
|
|
1658
|
+
this.showErrorsActionCreator = showErrorsActionCreator;
|
|
1573
1659
|
// TODO PAYMENTS-15743: replace with new refer id for headless core
|
|
1574
1660
|
this.ps4ReferId = '22';
|
|
1575
1661
|
}
|
|
@@ -1596,7 +1682,7 @@ class InitializeService {
|
|
|
1596
1682
|
const response = this.xpsResponseErrorsMappingService.mapErrors(xpsResponse);
|
|
1597
1683
|
const initializeResponse = this.responseFactory(response);
|
|
1598
1684
|
if (initializeResponse.paymentForm?.errors?.length) {
|
|
1599
|
-
this.nextActionService.emitFlowUpdates(
|
|
1685
|
+
this.nextActionService.emitFlowUpdates(this.showErrorsActionCreator.getActionData(initializeResponse.paymentForm.errors));
|
|
1600
1686
|
}
|
|
1601
1687
|
if (initializeResponse.paymentForm) {
|
|
1602
1688
|
this.setCreditCardEncryptKey(initializeResponse.paymentForm);
|
|
@@ -1615,7 +1701,7 @@ class InitializeService {
|
|
|
1615
1701
|
this.encryptCreditCardService.setPublicKey(atob(publicKeyField.value));
|
|
1616
1702
|
}
|
|
1617
1703
|
}
|
|
1618
|
-
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 });
|
|
1704
|
+
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 });
|
|
1619
1705
|
InitializeService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: InitializeService, providedIn: 'root' });
|
|
1620
1706
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: InitializeService, decorators: [{
|
|
1621
1707
|
type: Injectable,
|
|
@@ -1625,7 +1711,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImpor
|
|
|
1625
1711
|
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
1626
1712
|
type: Inject,
|
|
1627
1713
|
args: [initializeResponseFactoryToken]
|
|
1628
|
-
}] }, { type: XpsApiService }, { type: SettingsService }, { type: CountryService }, { type: NextActionService }, { type: XpsResponseErrorsMappingService }, { type: EncryptCreditCardService }]; } });
|
|
1714
|
+
}] }, { type: XpsApiService }, { type: SettingsService }, { type: CountryService }, { type: NextActionService }, { type: XpsResponseErrorsMappingService }, { type: EncryptCreditCardService }, { type: ShowErrorsActionCreator }]; } });
|
|
1629
1715
|
|
|
1630
1716
|
class XpsApiPartRequest {
|
|
1631
1717
|
addXpsParameters(parameters) {
|
|
@@ -1860,7 +1946,7 @@ const syncResponseFactoryProvider = {
|
|
|
1860
1946
|
};
|
|
1861
1947
|
|
|
1862
1948
|
class SyncService extends EmitDataService {
|
|
1863
|
-
constructor(requestFactory, responseFactory, xpsApiService, nextActionService, settingsService, xpsResponseErrorsMappingService, encryptCreditCardService) {
|
|
1949
|
+
constructor(requestFactory, responseFactory, xpsApiService, nextActionService, settingsService, xpsResponseErrorsMappingService, encryptCreditCardService, showErrorsActionCreator) {
|
|
1864
1950
|
super();
|
|
1865
1951
|
this.requestFactory = requestFactory;
|
|
1866
1952
|
this.responseFactory = responseFactory;
|
|
@@ -1869,6 +1955,7 @@ class SyncService extends EmitDataService {
|
|
|
1869
1955
|
this.settingsService = settingsService;
|
|
1870
1956
|
this.xpsResponseErrorsMappingService = xpsResponseErrorsMappingService;
|
|
1871
1957
|
this.encryptCreditCardService = encryptCreditCardService;
|
|
1958
|
+
this.showErrorsActionCreator = showErrorsActionCreator;
|
|
1872
1959
|
this.prevFieldSyncStates = {};
|
|
1873
1960
|
this.form = new UntypedFormGroup({});
|
|
1874
1961
|
this.fields = [];
|
|
@@ -1966,7 +2053,7 @@ class SyncService extends EmitDataService {
|
|
|
1966
2053
|
emitFormErrors(response) {
|
|
1967
2054
|
const formErrors = response.errors?.filter((error) => !error.element_name);
|
|
1968
2055
|
if (formErrors?.length) {
|
|
1969
|
-
this.nextActionService.emitFlowUpdates(
|
|
2056
|
+
this.nextActionService.emitFlowUpdates(this.showErrorsActionCreator.getActionData(formErrors));
|
|
1970
2057
|
}
|
|
1971
2058
|
}
|
|
1972
2059
|
resetFieldSyncTimer(field, timerId) {
|
|
@@ -1977,7 +2064,7 @@ class SyncService extends EmitDataService {
|
|
|
1977
2064
|
this.fieldSyncTimers[field.name] = timerId;
|
|
1978
2065
|
}
|
|
1979
2066
|
}
|
|
1980
|
-
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 });
|
|
2067
|
+
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 });
|
|
1981
2068
|
SyncService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: SyncService, providedIn: 'root' });
|
|
1982
2069
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: SyncService, decorators: [{
|
|
1983
2070
|
type: Injectable,
|
|
@@ -1990,7 +2077,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImpor
|
|
|
1990
2077
|
}] }, { type: undefined, decorators: [{
|
|
1991
2078
|
type: Inject,
|
|
1992
2079
|
args: [syncResponseFactoryToken]
|
|
1993
|
-
}] }, { type: XpsApiService }, { type: NextActionService }, { type: SettingsService }, { type: XpsResponseErrorsMappingService }, { type: EncryptCreditCardService }]; } });
|
|
2080
|
+
}] }, { type: XpsApiService }, { type: NextActionService }, { type: SettingsService }, { type: XpsResponseErrorsMappingService }, { type: EncryptCreditCardService }, { type: ShowErrorsActionCreator }]; } });
|
|
1994
2081
|
|
|
1995
2082
|
class ControlConfig {
|
|
1996
2083
|
constructor() {
|
|
@@ -4666,12 +4753,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImpor
|
|
|
4666
4753
|
}], ctorParameters: function () { return [{ type: SettingsService }, { type: SecureApiClient }]; } });
|
|
4667
4754
|
|
|
4668
4755
|
class SavePaymentMethodStatusService {
|
|
4669
|
-
constructor(statusRequestService, listenStatusService, savedPaymentAccountChangesService, nextActionService, checkStatusService) {
|
|
4756
|
+
constructor(statusRequestService, listenStatusService, savedPaymentAccountChangesService, nextActionService, checkStatusService, statusUpdatedActionCreator) {
|
|
4670
4757
|
this.statusRequestService = statusRequestService;
|
|
4671
4758
|
this.listenStatusService = listenStatusService;
|
|
4672
4759
|
this.savedPaymentAccountChangesService = savedPaymentAccountChangesService;
|
|
4673
4760
|
this.nextActionService = nextActionService;
|
|
4674
4761
|
this.checkStatusService = checkStatusService;
|
|
4762
|
+
this.statusUpdatedActionCreator = statusUpdatedActionCreator;
|
|
4675
4763
|
this.statusChecked = false;
|
|
4676
4764
|
}
|
|
4677
4765
|
async getStatus(params) {
|
|
@@ -4757,26 +4845,31 @@ class SavePaymentMethodStatusService {
|
|
|
4757
4845
|
this.listenStatusService.stopListening();
|
|
4758
4846
|
this.listenStatusSubscription.unsubscribe();
|
|
4759
4847
|
const isSavePaymentMethod = true;
|
|
4760
|
-
this.nextActionService.emitFlowUpdates(
|
|
4848
|
+
this.nextActionService.emitFlowUpdates(this.statusUpdatedActionCreator.getActionData({
|
|
4849
|
+
statusResponse: status,
|
|
4850
|
+
isSavePaymentMethodMode: isSavePaymentMethod,
|
|
4851
|
+
savePaymentMethodStatus: this.savePaymentMethodStatus,
|
|
4852
|
+
}));
|
|
4761
4853
|
}
|
|
4762
4854
|
}
|
|
4763
|
-
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 });
|
|
4855
|
+
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 });
|
|
4764
4856
|
SavePaymentMethodStatusService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: SavePaymentMethodStatusService, providedIn: 'root' });
|
|
4765
4857
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: SavePaymentMethodStatusService, decorators: [{
|
|
4766
4858
|
type: Injectable,
|
|
4767
4859
|
args: [{
|
|
4768
4860
|
providedIn: 'root',
|
|
4769
4861
|
}]
|
|
4770
|
-
}], ctorParameters: function () { return [{ type: StatusRequestService }, { type: ListenStatusService }, { type: SavedPaymentAccountChangesService }, { type: NextActionService }, { type: CheckStatusService }]; } });
|
|
4862
|
+
}], ctorParameters: function () { return [{ type: StatusRequestService }, { type: ListenStatusService }, { type: SavedPaymentAccountChangesService }, { type: NextActionService }, { type: CheckStatusService }, { type: StatusUpdatedActionCreator }]; } });
|
|
4771
4863
|
|
|
4772
4864
|
class StatusService {
|
|
4773
|
-
constructor(urlService, statusRequestService, financeDetailsService, listenStatusService, nextActionService, savePaymentMethodStatusService) {
|
|
4865
|
+
constructor(urlService, statusRequestService, financeDetailsService, listenStatusService, nextActionService, savePaymentMethodStatusService, statusUpdatedActionCreator) {
|
|
4774
4866
|
this.urlService = urlService;
|
|
4775
4867
|
this.statusRequestService = statusRequestService;
|
|
4776
4868
|
this.financeDetailsService = financeDetailsService;
|
|
4777
4869
|
this.listenStatusService = listenStatusService;
|
|
4778
4870
|
this.nextActionService = nextActionService;
|
|
4779
4871
|
this.savePaymentMethodStatusService = savePaymentMethodStatusService;
|
|
4872
|
+
this.statusUpdatedActionCreator = statusUpdatedActionCreator;
|
|
4780
4873
|
}
|
|
4781
4874
|
async getStatus(params) {
|
|
4782
4875
|
const isSavePaymentMethodMode = params?.isSavePaymentAccount === "1" /* XpsBoolean.true */;
|
|
@@ -4815,18 +4908,18 @@ class StatusService {
|
|
|
4815
4908
|
.pipe(skip(1))
|
|
4816
4909
|
.subscribe(({ statusResponse }) => {
|
|
4817
4910
|
this.financeDetailsService.emitWithStatus(statusResponse.status);
|
|
4818
|
-
this.nextActionService.emitFlowUpdates(
|
|
4911
|
+
this.nextActionService.emitFlowUpdates(this.statusUpdatedActionCreator.getActionData({ statusResponse }));
|
|
4819
4912
|
});
|
|
4820
4913
|
}
|
|
4821
4914
|
}
|
|
4822
|
-
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 });
|
|
4915
|
+
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 });
|
|
4823
4916
|
StatusService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: StatusService, providedIn: 'root' });
|
|
4824
4917
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: StatusService, decorators: [{
|
|
4825
4918
|
type: Injectable,
|
|
4826
4919
|
args: [{
|
|
4827
4920
|
providedIn: 'root',
|
|
4828
4921
|
}]
|
|
4829
|
-
}], ctorParameters: function () { return [{ type: UrlService }, { type: StatusRequestService }, { type: FinanceDetailsService }, { type: ListenStatusService }, { type: NextActionService }, { type: SavePaymentMethodStatusService }]; } });
|
|
4922
|
+
}], ctorParameters: function () { return [{ type: UrlService }, { type: StatusRequestService }, { type: FinanceDetailsService }, { type: ListenStatusService }, { type: NextActionService }, { type: SavePaymentMethodStatusService }, { type: StatusUpdatedActionCreator }]; } });
|
|
4830
4923
|
|
|
4831
4924
|
class CreditCardStateService extends EmitDataService {
|
|
4832
4925
|
}
|
|
@@ -5219,9 +5312,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImpor
|
|
|
5219
5312
|
}], ctorParameters: function () { return [{ type: StatusThreeDsService }, { type: NotifyDfpStatusService }, { type: WebSocketFactory }, { type: DfpCollectService }, { type: ReinsuranceCheckService }]; } });
|
|
5220
5313
|
|
|
5221
5314
|
class ThreeDsService {
|
|
5222
|
-
constructor(threeDs20Service, nextActionService) {
|
|
5315
|
+
constructor(threeDs20Service, nextActionService, checkStatusActionCreator, threeDsActionCreator) {
|
|
5223
5316
|
this.threeDs20Service = threeDs20Service;
|
|
5224
5317
|
this.nextActionService = nextActionService;
|
|
5318
|
+
this.checkStatusActionCreator = checkStatusActionCreator;
|
|
5319
|
+
this.threeDsActionCreator = threeDsActionCreator;
|
|
5225
5320
|
this.statusSubscription = null;
|
|
5226
5321
|
}
|
|
5227
5322
|
checkThreeDs(params) {
|
|
@@ -5234,23 +5329,23 @@ class ThreeDsService {
|
|
|
5234
5329
|
this.statusSubscription?.unsubscribe();
|
|
5235
5330
|
this.statusSubscription = this.threeDs20Service.statusUpdates$.subscribe((statusUpdate) => {
|
|
5236
5331
|
if (statusUpdate.type === 'complete') {
|
|
5237
|
-
return this.nextActionService.emitFlowUpdates(
|
|
5332
|
+
return this.nextActionService.emitFlowUpdates(this.checkStatusActionCreator.getActionData());
|
|
5238
5333
|
}
|
|
5239
|
-
this.nextActionService.emitFlowUpdates(
|
|
5334
|
+
this.nextActionService.emitFlowUpdates(this.threeDsActionCreator.getActionData(statusUpdate));
|
|
5240
5335
|
});
|
|
5241
5336
|
}
|
|
5242
5337
|
stopChecking() {
|
|
5243
5338
|
this.statusSubscription?.unsubscribe();
|
|
5244
5339
|
}
|
|
5245
5340
|
}
|
|
5246
|
-
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 });
|
|
5341
|
+
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 });
|
|
5247
5342
|
ThreeDsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: ThreeDsService, providedIn: 'root' });
|
|
5248
5343
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: ThreeDsService, decorators: [{
|
|
5249
5344
|
type: Injectable,
|
|
5250
5345
|
args: [{
|
|
5251
5346
|
providedIn: 'root',
|
|
5252
5347
|
}]
|
|
5253
|
-
}], ctorParameters: function () { return [{ type: ThreeDs20Service }, { type: NextActionService }]; } });
|
|
5348
|
+
}], ctorParameters: function () { return [{ type: ThreeDs20Service }, { type: NextActionService }, { type: CheckStatusActionCreator }, { type: ThreeDsActionCreator }]; } });
|
|
5254
5349
|
|
|
5255
5350
|
class FormMessagesService extends EmitDataService {
|
|
5256
5351
|
constructor(unescapeHtmlPipe) {
|
|
@@ -5278,7 +5373,7 @@ class PaymentService {
|
|
|
5278
5373
|
get formFieldsStatus$() {
|
|
5279
5374
|
return this.formFieldsStatusSubject.asObservable().pipe(filter$1(Boolean));
|
|
5280
5375
|
}
|
|
5281
|
-
constructor(initializeService, submitService, syncService, formService, statusService, financeDetailsService, creditCardStateService, nextActionService, controlConfigService, threeDsService, formMessagesService) {
|
|
5376
|
+
constructor(initializeService, submitService, syncService, formService, statusService, financeDetailsService, creditCardStateService, nextActionService, controlConfigService, threeDsService, formMessagesService, settingsService, countryService) {
|
|
5282
5377
|
this.initializeService = initializeService;
|
|
5283
5378
|
this.submitService = submitService;
|
|
5284
5379
|
this.syncService = syncService;
|
|
@@ -5290,6 +5385,8 @@ class PaymentService {
|
|
|
5290
5385
|
this.controlConfigService = controlConfigService;
|
|
5291
5386
|
this.threeDsService = threeDsService;
|
|
5292
5387
|
this.formMessagesService = formMessagesService;
|
|
5388
|
+
this.settingsService = settingsService;
|
|
5389
|
+
this.countryService = countryService;
|
|
5293
5390
|
this.form = null;
|
|
5294
5391
|
this.data = null;
|
|
5295
5392
|
this.financeDetails = null;
|
|
@@ -5348,6 +5445,18 @@ class PaymentService {
|
|
|
5348
5445
|
}
|
|
5349
5446
|
return this.data?.paymentForm?.fields ?? [];
|
|
5350
5447
|
}
|
|
5448
|
+
getInitialDataForSdkPaymentSystems() {
|
|
5449
|
+
if (!isSubmitResponse(this.data)) {
|
|
5450
|
+
throw new Error('Should submit form first');
|
|
5451
|
+
}
|
|
5452
|
+
return {
|
|
5453
|
+
data: this.data.parameters.checkout.data.data,
|
|
5454
|
+
sandbox: this.settingsService.isSandboxMode()
|
|
5455
|
+
? "1" /* XpsBoolean.true */
|
|
5456
|
+
: "0" /* XpsBoolean.false */,
|
|
5457
|
+
country: this.countryService.getCountry(),
|
|
5458
|
+
};
|
|
5459
|
+
}
|
|
5351
5460
|
getPid() {
|
|
5352
5461
|
if (this.data instanceof SubmitResponse) {
|
|
5353
5462
|
return (Number(this.data.fields.find((field) => field.name === 'fix_pid')?.value) || null);
|
|
@@ -5489,14 +5598,14 @@ class PaymentService {
|
|
|
5489
5598
|
}
|
|
5490
5599
|
}
|
|
5491
5600
|
}
|
|
5492
|
-
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 });
|
|
5601
|
+
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 });
|
|
5493
5602
|
PaymentService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: PaymentService, providedIn: 'root' });
|
|
5494
5603
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: PaymentService, decorators: [{
|
|
5495
5604
|
type: Injectable,
|
|
5496
5605
|
args: [{
|
|
5497
5606
|
providedIn: 'root',
|
|
5498
5607
|
}]
|
|
5499
|
-
}], 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 }]; } });
|
|
5608
|
+
}], 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 }]; } });
|
|
5500
5609
|
|
|
5501
5610
|
class RefundPolicyService {
|
|
5502
5611
|
constructor(settingsService) {
|
|
@@ -5636,8 +5745,281 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImpor
|
|
|
5636
5745
|
}]
|
|
5637
5746
|
}], ctorParameters: function () { return [{ type: SavedMethodsService }, { type: SettingsService }, { type: SecureApiClient }]; } });
|
|
5638
5747
|
|
|
5748
|
+
class PaymentSystemProcessingService {
|
|
5749
|
+
constructor(window) {
|
|
5750
|
+
this.window = window;
|
|
5751
|
+
this.statusUrl = new BehaviorSubject('');
|
|
5752
|
+
this.initialize = new BehaviorSubject(false);
|
|
5753
|
+
}
|
|
5754
|
+
get initialize$() {
|
|
5755
|
+
return this.initialize.asObservable();
|
|
5756
|
+
}
|
|
5757
|
+
get status$() {
|
|
5758
|
+
return this.statusUrl.asObservable().pipe(filter((status) => !!status));
|
|
5759
|
+
}
|
|
5760
|
+
emitPayment(payment) {
|
|
5761
|
+
this.statusUrl.next(payment);
|
|
5762
|
+
}
|
|
5763
|
+
emitInitialize(isInitialized) {
|
|
5764
|
+
this.initialize.next(isInitialized);
|
|
5765
|
+
}
|
|
5766
|
+
getDecodedCheckout(base64checkoutData) {
|
|
5767
|
+
try {
|
|
5768
|
+
return JSON.parse(atob(base64checkoutData));
|
|
5769
|
+
}
|
|
5770
|
+
catch (error) {
|
|
5771
|
+
throw new AppError('load script service: decode error');
|
|
5772
|
+
}
|
|
5773
|
+
}
|
|
5774
|
+
loadScript(url, onLoad, addScriptCustomAttributes) {
|
|
5775
|
+
this.initialize.next(false);
|
|
5776
|
+
let script = this.window.document.createElement('script');
|
|
5777
|
+
script.async = true;
|
|
5778
|
+
script.src = url;
|
|
5779
|
+
if (addScriptCustomAttributes) {
|
|
5780
|
+
script = addScriptCustomAttributes(script);
|
|
5781
|
+
}
|
|
5782
|
+
this.window.document.body.append(script);
|
|
5783
|
+
script.onload = () => {
|
|
5784
|
+
try {
|
|
5785
|
+
onLoad();
|
|
5786
|
+
}
|
|
5787
|
+
catch (error) {
|
|
5788
|
+
let message = error;
|
|
5789
|
+
if (error instanceof Error) {
|
|
5790
|
+
message = error.message;
|
|
5791
|
+
}
|
|
5792
|
+
throw new AppError(`Pages: error during script onload handler: ${message}, url - ${url}`);
|
|
5793
|
+
}
|
|
5794
|
+
};
|
|
5795
|
+
script.onerror = (event, source, lineno, colno, error) => {
|
|
5796
|
+
const errorMessage = error ? error.message : '';
|
|
5797
|
+
let eventMessage = event;
|
|
5798
|
+
if (typeof event === 'object') {
|
|
5799
|
+
eventMessage = JSON.stringify(event);
|
|
5800
|
+
}
|
|
5801
|
+
throw new AppError(`Pages: error during script onerror handler:
|
|
5802
|
+
url - ${url},
|
|
5803
|
+
event - ${eventMessage},
|
|
5804
|
+
source - ${source ?? ''},
|
|
5805
|
+
lineno - ${lineno ?? ''},
|
|
5806
|
+
colno - ${colno ?? ''},
|
|
5807
|
+
error - ${errorMessage}`);
|
|
5808
|
+
};
|
|
5809
|
+
}
|
|
5810
|
+
isInitialized() {
|
|
5811
|
+
return this.initialize.getValue();
|
|
5812
|
+
}
|
|
5813
|
+
}
|
|
5814
|
+
PaymentSystemProcessingService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: PaymentSystemProcessingService, deps: [{ token: windowToken }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
5815
|
+
PaymentSystemProcessingService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: PaymentSystemProcessingService, providedIn: 'root' });
|
|
5816
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: PaymentSystemProcessingService, decorators: [{
|
|
5817
|
+
type: Injectable,
|
|
5818
|
+
args: [{
|
|
5819
|
+
providedIn: 'root',
|
|
5820
|
+
}]
|
|
5821
|
+
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
5822
|
+
type: Inject,
|
|
5823
|
+
args: [windowToken]
|
|
5824
|
+
}] }]; } });
|
|
5825
|
+
|
|
5826
|
+
class GooglePayService {
|
|
5827
|
+
get libraryWasInitialized() {
|
|
5828
|
+
return !!this.window.google;
|
|
5829
|
+
}
|
|
5830
|
+
get googlePaymentClientWasInitialized() {
|
|
5831
|
+
return !!this.googlePaymentClient;
|
|
5832
|
+
}
|
|
5833
|
+
constructor(window, elkLoggerService, commonPayProcessingService, httpClient, injector) {
|
|
5834
|
+
this.window = window;
|
|
5835
|
+
this.elkLoggerService = elkLoggerService;
|
|
5836
|
+
this.commonPayProcessingService = commonPayProcessingService;
|
|
5837
|
+
this.httpClient = httpClient;
|
|
5838
|
+
this.injector = injector;
|
|
5839
|
+
this.googlePayScriptUrl = 'https://pay.google.com/gp/p/js/pay.js';
|
|
5840
|
+
this.readyToPay = new BehaviorSubject(null);
|
|
5841
|
+
this.checkout = null;
|
|
5842
|
+
this.googlePaymentClient = null;
|
|
5843
|
+
this.commonPayProcessingService.status$.subscribe((path) => {
|
|
5844
|
+
this.sendUserBack(path);
|
|
5845
|
+
});
|
|
5846
|
+
}
|
|
5847
|
+
get readyToPay$() {
|
|
5848
|
+
return this.readyToPay.asObservable();
|
|
5849
|
+
}
|
|
5850
|
+
isReadyToPay() {
|
|
5851
|
+
return this.readyToPay.getValue();
|
|
5852
|
+
}
|
|
5853
|
+
sendUserBack(path) {
|
|
5854
|
+
void this.httpClient.get(path);
|
|
5855
|
+
}
|
|
5856
|
+
initGooglePayLibrary(data) {
|
|
5857
|
+
this.isSandbox = data.isSandbox;
|
|
5858
|
+
this.country = data.country;
|
|
5859
|
+
if (this.libraryWasInitialized && this.googlePaymentClientWasInitialized) {
|
|
5860
|
+
return;
|
|
5861
|
+
}
|
|
5862
|
+
if (this.libraryWasInitialized && !this.googlePaymentClientWasInitialized) {
|
|
5863
|
+
this.setupGooglePayClient();
|
|
5864
|
+
return;
|
|
5865
|
+
}
|
|
5866
|
+
this.commonPayProcessingService.loadScript(this.googlePayScriptUrl, this.onLoadScript.bind(this));
|
|
5867
|
+
this.elkLoggerService.log('Google Pay: loading script is starting', [
|
|
5868
|
+
ErrorTags.GOOGLEPAY,
|
|
5869
|
+
]);
|
|
5870
|
+
}
|
|
5871
|
+
checkPaymentDevice(base64checkoutData) {
|
|
5872
|
+
this.commonPayProcessingService.initialize$
|
|
5873
|
+
.pipe(filter$1(Boolean), take(1))
|
|
5874
|
+
.subscribe(() => {
|
|
5875
|
+
this.checkout =
|
|
5876
|
+
this.commonPayProcessingService.getDecodedCheckout(base64checkoutData);
|
|
5877
|
+
if (!this.checkout || !this.googlePaymentClient) {
|
|
5878
|
+
throw new AppError(`Google Pay: no checkout or google payment client, checkout - ${Boolean(this.checkout).toString()}, client - ${Boolean(this.googlePaymentClient).toString()}`);
|
|
5879
|
+
}
|
|
5880
|
+
const checkoutData = this.checkout.request.form.fields;
|
|
5881
|
+
const isReadyToPayRequest = JSON.parse(checkoutData.isReadyToPayRequest);
|
|
5882
|
+
this.googlePaymentClient
|
|
5883
|
+
.isReadyToPay(isReadyToPayRequest)
|
|
5884
|
+
.then((response) => {
|
|
5885
|
+
if (response.result && this.googlePaymentClient) {
|
|
5886
|
+
this.googlePaymentClient.prefetchPaymentData(JSON.parse(checkoutData.paymentDataRequest));
|
|
5887
|
+
return this.readyToPay.next(true);
|
|
5888
|
+
}
|
|
5889
|
+
this.readyToPay.next(false);
|
|
5890
|
+
const result = response.result?.toString() ?? '';
|
|
5891
|
+
const isHavePaymentClient = Boolean(this.googlePaymentClient).toString();
|
|
5892
|
+
this.elkLoggerService.log(`Google Pay: possibly no response.result or googlePaymentClient is missing, result - ${result}, isHavePaymentClient - ${isHavePaymentClient}`, [ErrorTags.GOOGLEPAY], {
|
|
5893
|
+
result: response.result,
|
|
5894
|
+
response: response,
|
|
5895
|
+
googlePaymentClient: !!this.googlePaymentClient,
|
|
5896
|
+
});
|
|
5897
|
+
throw new Error();
|
|
5898
|
+
})
|
|
5899
|
+
.catch((error) => {
|
|
5900
|
+
this.readyToPay.next(false);
|
|
5901
|
+
let message = error ?? '';
|
|
5902
|
+
if (error instanceof Error) {
|
|
5903
|
+
message = error.message;
|
|
5904
|
+
}
|
|
5905
|
+
throw new AppError(`Google Pay: device is not ready to pay, ${message}`);
|
|
5906
|
+
});
|
|
5907
|
+
});
|
|
5908
|
+
}
|
|
5909
|
+
async proceedCheckout() {
|
|
5910
|
+
if (!this.checkout || !this.googlePaymentClient) {
|
|
5911
|
+
const isHaveCheckout = !!this.checkout;
|
|
5912
|
+
const isHaveClient = !!this.googlePaymentClient;
|
|
5913
|
+
throw new AppError(`Google Pay: no checkout or google payment client, checkout - ${isHaveCheckout.toString()}, client - ${isHaveClient.toString()}`);
|
|
5914
|
+
}
|
|
5915
|
+
const checkoutData = this.checkout.request.form.fields;
|
|
5916
|
+
const paymentDataRequest = JSON.parse(checkoutData.paymentDataRequest);
|
|
5917
|
+
paymentDataRequest.transactionInfo = {
|
|
5918
|
+
currencyCode: checkoutData.currency,
|
|
5919
|
+
totalPriceStatus: 'FINAL',
|
|
5920
|
+
totalPrice: checkoutData.sum,
|
|
5921
|
+
countryCode: this.country,
|
|
5922
|
+
};
|
|
5923
|
+
const checkStatusAction = this.injector
|
|
5924
|
+
.get(CheckStatusActionCreator)
|
|
5925
|
+
.getActionData();
|
|
5926
|
+
try {
|
|
5927
|
+
const paymentData = await this.googlePaymentClient.loadPaymentData(paymentDataRequest);
|
|
5928
|
+
if (!paymentData?.paymentMethodData?.tokenizationData?.token) {
|
|
5929
|
+
throw new AppError('Google Pay: token is missing');
|
|
5930
|
+
}
|
|
5931
|
+
if (!this.checkout) {
|
|
5932
|
+
throw new AppError('Google Pay: no checkout data in then');
|
|
5933
|
+
}
|
|
5934
|
+
let returnUrl = this.checkout.request.form.fields.returnSuccessUrl;
|
|
5935
|
+
const data = this.checkout.request.form.fields;
|
|
5936
|
+
returnUrl += `&cpf_number=${data.cpf_number}&descriptor=${data.descriptor}&paymentData=${JSON.stringify(paymentData)}`;
|
|
5937
|
+
this.commonPayProcessingService.emitPayment(returnUrl);
|
|
5938
|
+
return checkStatusAction;
|
|
5939
|
+
}
|
|
5940
|
+
catch (error) {
|
|
5941
|
+
this.elkLoggerService.log(`Google Pay: google payment window error. ${JSON.stringify(error)}`, [ErrorTags.GOOGLEPAY], {
|
|
5942
|
+
error: error,
|
|
5943
|
+
});
|
|
5944
|
+
if (!this.checkout) {
|
|
5945
|
+
throw new AppError(`Google Pay: no checkout data`);
|
|
5946
|
+
}
|
|
5947
|
+
const statusCode = error
|
|
5948
|
+
?.statusCode;
|
|
5949
|
+
const isStatusCanceled = statusCode && this.isCancelledStatus(statusCode);
|
|
5950
|
+
if (isStatusCanceled) {
|
|
5951
|
+
return null;
|
|
5952
|
+
}
|
|
5953
|
+
const returnUrl = this.checkout.request.form.fields.returnFailUrl;
|
|
5954
|
+
this.commonPayProcessingService.emitPayment(returnUrl);
|
|
5955
|
+
return checkStatusAction;
|
|
5956
|
+
}
|
|
5957
|
+
}
|
|
5958
|
+
createButton(onClickHandler) {
|
|
5959
|
+
if (!this.checkout || !this.googlePaymentClient) {
|
|
5960
|
+
return null;
|
|
5961
|
+
}
|
|
5962
|
+
const checkoutData = this.checkout.request.form.fields;
|
|
5963
|
+
const paymentDataRequest = JSON.parse(checkoutData.paymentDataRequest);
|
|
5964
|
+
return this.googlePaymentClient.createButton({
|
|
5965
|
+
onClick: onClickHandler,
|
|
5966
|
+
allowedPaymentMethods: paymentDataRequest.allowedPaymentMethods,
|
|
5967
|
+
buttonSizeMode: 'fill',
|
|
5968
|
+
buttonType: 'buy',
|
|
5969
|
+
buttonColor: 'white',
|
|
5970
|
+
});
|
|
5971
|
+
}
|
|
5972
|
+
setupGooglePayClient() {
|
|
5973
|
+
if (!this.window.google) {
|
|
5974
|
+
return;
|
|
5975
|
+
}
|
|
5976
|
+
const environment = this.isSandbox ? 'TEST' : 'PRODUCTION';
|
|
5977
|
+
this.googlePaymentClient =
|
|
5978
|
+
new this.window.google.payments.api.PaymentsClient({
|
|
5979
|
+
environment,
|
|
5980
|
+
});
|
|
5981
|
+
this.elkLoggerService.log(`Google Pay: payments client is initialized, paymentsClient - ${Boolean(this.googlePaymentClient).toString()}`, [ErrorTags.GOOGLEPAY], { environment: environment, initialized: !!this.googlePaymentClient });
|
|
5982
|
+
}
|
|
5983
|
+
onLoadScript() {
|
|
5984
|
+
if (!this.window.google) {
|
|
5985
|
+
const retryTimeout = 1000;
|
|
5986
|
+
setTimeout(() => {
|
|
5987
|
+
const isAvailableGoogleClient = !!this.window.google;
|
|
5988
|
+
if (!isAvailableGoogleClient) {
|
|
5989
|
+
this.elkLoggerService.log('Google Pay: google library is missing', [
|
|
5990
|
+
ErrorTags.GOOGLEPAY,
|
|
5991
|
+
]);
|
|
5992
|
+
}
|
|
5993
|
+
else {
|
|
5994
|
+
this.setupGooglePayClient();
|
|
5995
|
+
this.commonPayProcessingService.emitInitialize(true);
|
|
5996
|
+
}
|
|
5997
|
+
}, retryTimeout);
|
|
5998
|
+
throw new AppError('Google Pay: google library now is available');
|
|
5999
|
+
}
|
|
6000
|
+
else {
|
|
6001
|
+
this.setupGooglePayClient();
|
|
6002
|
+
this.commonPayProcessingService.emitInitialize(true);
|
|
6003
|
+
}
|
|
6004
|
+
}
|
|
6005
|
+
isCancelledStatus(statusCode) {
|
|
6006
|
+
return statusCode.toLowerCase() === 'canceled';
|
|
6007
|
+
}
|
|
6008
|
+
}
|
|
6009
|
+
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 });
|
|
6010
|
+
GooglePayService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: GooglePayService, providedIn: 'root' });
|
|
6011
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: GooglePayService, decorators: [{
|
|
6012
|
+
type: Injectable,
|
|
6013
|
+
args: [{
|
|
6014
|
+
providedIn: 'root',
|
|
6015
|
+
}]
|
|
6016
|
+
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
6017
|
+
type: Inject,
|
|
6018
|
+
args: [windowToken]
|
|
6019
|
+
}] }, { type: ElkLoggerService }, { type: PaymentSystemProcessingService }, { type: i1.HttpClient }, { type: i0.Injector }]; } });
|
|
6020
|
+
|
|
5639
6021
|
class CoreLibraryService {
|
|
5640
|
-
constructor(settingsService, countryService, paymentMethodsService, savedMethodsService, userBalanceService, paymentConfigService, paymentService, deviceFingerPrintService, financeDetailsService, legalService, statusService, nextActionService, creditCardService, creditCardStateService, formMessagesService, editSavedMethodsService) {
|
|
6022
|
+
constructor(settingsService, countryService, paymentMethodsService, savedMethodsService, userBalanceService, paymentConfigService, paymentService, deviceFingerPrintService, financeDetailsService, legalService, statusService, nextActionService, creditCardService, creditCardStateService, formMessagesService, editSavedMethodsService, googlePayService, commonPayProcessingService) {
|
|
5641
6023
|
this.settingsService = settingsService;
|
|
5642
6024
|
this.countryService = countryService;
|
|
5643
6025
|
this.paymentMethodsService = paymentMethodsService;
|
|
@@ -5654,6 +6036,8 @@ class CoreLibraryService {
|
|
|
5654
6036
|
this.creditCardStateService = creditCardStateService;
|
|
5655
6037
|
this.formMessagesService = formMessagesService;
|
|
5656
6038
|
this.editSavedMethodsService = editSavedMethodsService;
|
|
6039
|
+
this.googlePayService = googlePayService;
|
|
6040
|
+
this.commonPayProcessingService = commonPayProcessingService;
|
|
5657
6041
|
this.paymentMethods = {
|
|
5658
6042
|
getList: async (isSaveMethodMode) => this.paymentMethodsService.getList(isSaveMethodMode),
|
|
5659
6043
|
getQuickMethods: async () => this.paymentMethodsService.getQuickMethods(),
|
|
@@ -5661,6 +6045,23 @@ class CoreLibraryService {
|
|
|
5661
6045
|
getUserBalance: async () => this.userBalanceService.getUserBalance(),
|
|
5662
6046
|
deleteSavedMethod: async (id, type) => this.editSavedMethodsService.deleteSavedMethodRequest(id, type),
|
|
5663
6047
|
};
|
|
6048
|
+
this.sdkPaymentSystems = {
|
|
6049
|
+
commonPayProcessingService: {
|
|
6050
|
+
initialize$: this.commonPayProcessingService.initialize$,
|
|
6051
|
+
isInitialized: () => this.commonPayProcessingService.isInitialized(),
|
|
6052
|
+
status$: this.commonPayProcessingService.status$,
|
|
6053
|
+
},
|
|
6054
|
+
googlePay: {
|
|
6055
|
+
readyToPay$: this.googlePayService.readyToPay$,
|
|
6056
|
+
isReadyToPay: () => this.googlePayService.isReadyToPay(),
|
|
6057
|
+
initGooglePayLibrary: (params) => this.googlePayService.initGooglePayLibrary(params),
|
|
6058
|
+
checkPaymentDevice: (base64checkoutData) => this.googlePayService.checkPaymentDevice(base64checkoutData),
|
|
6059
|
+
proceedCheckout: async () => this.googlePayService.proceedCheckout(),
|
|
6060
|
+
createButton: (onClickHandler) => this.googlePayService.createButton(onClickHandler),
|
|
6061
|
+
sendUserBack: (path) => this.googlePayService.sendUserBack(path),
|
|
6062
|
+
},
|
|
6063
|
+
getInitialData: () => this.paymentService.getInitialDataForSdkPaymentSystems(),
|
|
6064
|
+
};
|
|
5664
6065
|
}
|
|
5665
6066
|
async init(configuration) {
|
|
5666
6067
|
await this.settingsService.init(configuration);
|
|
@@ -5725,14 +6126,14 @@ class CoreLibraryService {
|
|
|
5725
6126
|
return this.userBalanceService.getUserBalanceValue();
|
|
5726
6127
|
}
|
|
5727
6128
|
}
|
|
5728
|
-
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 });
|
|
6129
|
+
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 });
|
|
5729
6130
|
CoreLibraryService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: CoreLibraryService, providedIn: 'root' });
|
|
5730
6131
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: CoreLibraryService, decorators: [{
|
|
5731
6132
|
type: Injectable,
|
|
5732
6133
|
args: [{
|
|
5733
6134
|
providedIn: 'root',
|
|
5734
6135
|
}]
|
|
5735
|
-
}], 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 }]; } });
|
|
6136
|
+
}], 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 }]; } });
|
|
5736
6137
|
|
|
5737
6138
|
class HttpError extends AppError {
|
|
5738
6139
|
constructor(error, req) {
|