@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.
Files changed (88) hide show
  1. package/esm2020/lib/core/extended-window.interface.mjs +1 -1
  2. package/esm2020/lib/core/payment/actions/action.interface.mjs +1 -1
  3. package/esm2020/lib/core/payment/actions/check-status/check-status.action.class.mjs +19 -11
  4. package/esm2020/lib/core/payment/actions/check-status/check-status.action.type.mjs +1 -1
  5. package/esm2020/lib/core/payment/actions/next-action.interface.mjs +1 -1
  6. package/esm2020/lib/core/payment/actions/next-action.service.mjs +12 -11
  7. package/esm2020/lib/core/payment/actions/next-actions.mjs +15 -13
  8. package/esm2020/lib/core/payment/actions/redirect/pay-station4-url.const.mjs +3 -0
  9. package/esm2020/lib/core/payment/actions/redirect/ps4-pages/pages-payment-methods-id.const.mjs +7 -0
  10. package/esm2020/lib/core/payment/actions/redirect/ps4-pages/pages-routes.const.mjs +9 -0
  11. package/esm2020/lib/core/payment/actions/redirect/redirect.action.class.mjs +51 -11
  12. package/esm2020/lib/core/payment/actions/show-errors/show-errors.action.class.mjs +18 -5
  13. package/esm2020/lib/core/payment/actions/show-fields/show-fields.action.class.mjs +26 -8
  14. package/esm2020/lib/core/payment/actions/special-button/special-button.action.class.mjs +41 -0
  15. package/esm2020/lib/core/payment/actions/special-button/special-button.action.type.mjs +2 -0
  16. package/esm2020/lib/core/payment/actions/status-updated/status-updated.action.class.mjs +26 -11
  17. package/esm2020/lib/core/payment/actions/three-ds/three-ds.action.class.mjs +19 -4
  18. package/esm2020/lib/core/payment/initialize/initialize.service.mjs +7 -6
  19. package/esm2020/lib/core/payment/payment.service.mjs +20 -4
  20. package/esm2020/lib/core/payment/status/save-payment-method-status/save-payment-method-status.service.mjs +11 -6
  21. package/esm2020/lib/core/payment/status/status.service.mjs +7 -6
  22. package/esm2020/lib/core/payment/sync/sync.service.mjs +7 -6
  23. package/esm2020/lib/core/payment/three-ds/three-ds.service.mjs +10 -8
  24. package/esm2020/lib/core/payment/xps-checkout.mjs +2 -0
  25. package/esm2020/lib/core/sdk-payment-systems/google-pay/google-pay-checkout.interface.mjs +2 -0
  26. package/esm2020/lib/core/sdk-payment-systems/google-pay/google-pay-init-params.interface.mjs +2 -0
  27. package/esm2020/lib/core/sdk-payment-systems/google-pay/google-pay-library.interface.mjs +2 -0
  28. package/esm2020/lib/core/sdk-payment-systems/google-pay/google-pay.service.mjs +205 -0
  29. package/esm2020/lib/core/sdk-payment-systems/payment-systems/payment-system-processing.service.mjs +84 -0
  30. package/esm2020/lib/core/sdk-payment-systems/sdk-payment-methods.const.mjs +2 -0
  31. package/esm2020/lib/core/sdk-payment-systems/sdk-payment-systems-initial-data.interface.mjs +2 -0
  32. package/esm2020/lib/core/sdk-payment-systems/sdk-payment-systems.interface.mjs +2 -0
  33. package/esm2020/lib/core-library.module.mjs +1 -1
  34. package/esm2020/lib/core-library.service.mjs +25 -4
  35. package/fesm2015/xsolla-payment-client-core.mjs +570 -162
  36. package/fesm2015/xsolla-payment-client-core.mjs.map +1 -1
  37. package/fesm2020/xsolla-payment-client-core.mjs +561 -160
  38. package/fesm2020/xsolla-payment-client-core.mjs.map +1 -1
  39. package/lib/core/extended-window.interface.d.ts +4 -1
  40. package/lib/core/payment/actions/action.interface.d.ts +7 -0
  41. package/lib/core/payment/actions/check-status/check-status.action.class.d.ts +8 -5
  42. package/lib/core/payment/actions/check-status/check-status.action.type.d.ts +1 -10
  43. package/lib/core/payment/actions/next-action.interface.d.ts +2 -1
  44. package/lib/core/payment/actions/next-action.service.d.ts +3 -1
  45. package/lib/core/payment/actions/next-actions.d.ts +4 -4
  46. package/lib/core/payment/actions/redirect/pay-station4-url.const.d.ts +2 -0
  47. package/lib/core/payment/actions/redirect/ps4-pages/pages-payment-methods-id.const.d.ts +6 -0
  48. package/lib/core/payment/actions/redirect/ps4-pages/pages-routes.const.d.ts +1 -0
  49. package/lib/core/payment/actions/redirect/redirect.action.class.d.ts +14 -6
  50. package/lib/core/payment/actions/show-errors/show-errors.action.class.d.ts +9 -4
  51. package/lib/core/payment/actions/show-fields/show-fields.action.class.d.ts +8 -5
  52. package/lib/core/payment/actions/special-button/special-button.action.class.d.ts +14 -0
  53. package/lib/core/payment/actions/special-button/special-button.action.type.d.ts +10 -0
  54. package/lib/core/payment/actions/status-updated/status-updated.action.class.d.ts +12 -5
  55. package/lib/core/payment/actions/three-ds/three-ds.action.class.d.ts +8 -5
  56. package/lib/core/payment/initialize/initialize.service.d.ts +3 -1
  57. package/lib/core/payment/payment.service.d.ts +7 -1
  58. package/lib/core/payment/status/save-payment-method-status/save-payment-method-status.service.d.ts +3 -1
  59. package/lib/core/payment/status/status.service.d.ts +3 -1
  60. package/lib/core/payment/sync/sync.service.d.ts +3 -1
  61. package/lib/core/payment/three-ds/three-ds.service.d.ts +5 -1
  62. package/lib/core/payment/xps-checkout.d.ts +17 -0
  63. package/lib/core/sdk-payment-systems/google-pay/google-pay-checkout.interface.d.ts +17 -0
  64. package/lib/core/sdk-payment-systems/google-pay/google-pay-init-params.interface.d.ts +4 -0
  65. package/lib/core/sdk-payment-systems/google-pay/google-pay-library.interface.d.ts +83 -0
  66. package/lib/core/sdk-payment-systems/google-pay/google-pay.service.d.ts +37 -0
  67. package/lib/core/sdk-payment-systems/payment-systems/payment-system-processing.service.d.ts +20 -0
  68. package/lib/core/sdk-payment-systems/sdk-payment-methods.const.d.ts +1 -0
  69. package/lib/core/sdk-payment-systems/sdk-payment-systems-initial-data.interface.d.ts +6 -0
  70. package/lib/core/sdk-payment-systems/sdk-payment-systems.interface.d.ts +21 -0
  71. package/lib/core-library.service.d.ts +7 -1
  72. package/package.json +1 -1
  73. package/xsolla-payment-client-core-0.2.0.tgz +0 -0
  74. package/esm2020/lib/core/payment/actions/action-factory-value.interface.mjs +0 -2
  75. package/esm2020/lib/core/payment/actions/check-status/check-status.action.token.mjs +0 -14
  76. package/esm2020/lib/core/payment/actions/redirect/redirect.action.token.mjs +0 -16
  77. package/esm2020/lib/core/payment/actions/show-errors/show-errors.action.token.mjs +0 -13
  78. package/esm2020/lib/core/payment/actions/show-fields/show-fields.action.token.mjs +0 -15
  79. package/esm2020/lib/core/payment/actions/status-updated/status-updated.action.token.mjs +0 -11
  80. package/esm2020/lib/core/payment/actions/three-ds/three-ds.action.token.mjs +0 -11
  81. package/lib/core/payment/actions/action-factory-value.interface.d.ts +0 -6
  82. package/lib/core/payment/actions/check-status/check-status.action.token.d.ts +0 -4
  83. package/lib/core/payment/actions/redirect/redirect.action.token.d.ts +0 -4
  84. package/lib/core/payment/actions/show-errors/show-errors.action.token.d.ts +0 -4
  85. package/lib/core/payment/actions/show-fields/show-fields.action.token.d.ts +0 -4
  86. package/lib/core/payment/actions/status-updated/status-updated.action.token.d.ts +0 -4
  87. package/lib/core/payment/actions/three-ds/three-ds.action.token.d.ts +0 -4
  88. package/xsolla-payment-client-core-0.1.21.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
- class ShowFieldsAction {
777
- constructor(submitResponse) {
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
- this.data = {
843
+ }
844
+ getActionData(submitResponse) {
845
+ const data = {
780
846
  fields: [],
781
847
  errors: [],
782
848
  messages: [],
783
849
  order: {},
784
850
  };
785
- this.data.fields = submitResponse.fields.filter((field) => (field === null || field === void 0 ? void 0 : field.isVisible) === "1" /* XpsBoolean.true */);
786
- this.data.errors = submitResponse.errors;
787
- this.data.messages = submitResponse.messages;
788
- this.data.order = submitResponse.summary;
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
- const showFieldsActionFactoryToken = new InjectionToken('ShowFieldsAction');
793
- const showFieldsActionFactoryProvider = {
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
- this.data = {
809
- invoice: parseInt((_a = submitResponse.parameters.form.fix_invoice) === null || _a === void 0 ? void 0 : _a.value),
810
- signature: (_b = submitResponse.parameters.form.signature) === null || _b === void 0 ? void 0 : _b.value,
811
- locale: (_c = submitResponse.parameters.form.locale) === null || _c === void 0 ? void 0 : _c.value,
812
- testPs: (_d = submitResponse.parameters.form.testPs) === null || _d === void 0 ? void 0 : _d.value,
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
- const checkStatusActionFactoryToken = new InjectionToken('CheckStatusAction');
821
- const checkStatusActionFactoryProvider = {
822
- provide: checkStatusActionFactoryToken,
823
- useValue: {
824
- factory: (...args) => new CheckStatusAction(...args),
825
- isSuitable: (response) => {
826
- return response.currentCommand === XpsCommand.status;
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 StatusUpdatedAction {
954
- constructor(statusResponse, isSavePaymentMethodMode = false, savePaymentMethodStatus) {
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,107 +1043,109 @@ class StatusUpdatedAction {
960
1043
  else {
961
1044
  status = statusResponse;
962
1045
  }
963
- this.data = {
964
- statusState: status.statusState,
965
- invoice: status.invoice,
966
- isSuccess: status.isSuccess,
967
- isCanceled: status.isCanceled,
968
- group: status.group,
969
- isSavePaymentMethodMode,
970
- savePaymentMethodStatus,
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
- const statusUpdatedActionFactoryToken = new InjectionToken('StatusUpdatedAction');
976
- const statusUpdatedActionFactoryProvider = {
977
- provide: statusUpdatedActionFactoryToken,
978
- useValue: {
979
- factory: (...args) => new StatusUpdatedAction(...args),
980
- isSuitable: () => false,
981
- },
982
- };
983
-
984
- class RedirectAction {
985
- constructor(submitResponse) {
986
- this.type = 'redirect';
987
- this.data = {
988
- fields: submitResponse.fields,
989
- errors: submitResponse.errors,
990
- messages: submitResponse.messages,
991
- order: submitResponse.summary,
992
- invoiceId: submitResponse.fixInvoice,
993
- redirect: this.getRedirect(submitResponse),
994
- };
1069
+ class ThreeDsActionCreator {
1070
+ constructor() {
1071
+ this.type = '3DS';
995
1072
  }
996
- getRedirect(submitResponse) {
1073
+ getActionData(actionData) {
997
1074
  return {
998
- redirectUrl: submitResponse.parameters.checkout.action,
999
- data: submitResponse.parameters.checkout.data,
1075
+ type: this.type,
1076
+ data: actionData,
1000
1077
  };
1001
1078
  }
1079
+ isSuitable() {
1080
+ return false;
1081
+ }
1002
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
+ }] });
1003
1088
 
1004
- const redirectActionFactoryToken = new InjectionToken('RedirectAction');
1005
- const redirectActionFactoryProvider = {
1006
- provide: redirectActionFactoryToken,
1007
- useValue: {
1008
- factory: (...args) => new RedirectAction(...args),
1009
- isSuitable: (response) => {
1010
- return (response.currentCommand === XpsCommand.account ||
1011
- (response.currentCommand === XpsCommand.checkout &&
1012
- Boolean(response.parameters.checkout)));
1013
- },
1014
- },
1015
- };
1016
-
1017
- const showErrorsActionFactoryToken = new InjectionToken('ShowErrorsAction');
1018
- const showErrorsActionFactoryProvider = {
1019
- provide: showErrorsActionFactoryToken,
1020
- useValue: {
1021
- factory: (...args) => new ShowErrorsAction(...args),
1022
- isSuitable: (response) => {
1023
- var _a;
1024
- return Boolean((_a = response.errors) === null || _a === void 0 ? void 0 : _a.length);
1025
- },
1026
- },
1027
- };
1089
+ const googlePayPid = 3431;
1028
1090
 
1029
- class ThreeDsAction {
1030
- constructor(statusUpdate) {
1031
- this.type = '3DS';
1032
- this.data = statusUpdate;
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;
1033
1120
  }
1034
1121
  }
1035
-
1036
- const threeDsActionFactoryToken = new InjectionToken('ThreeDsAction');
1037
- const threeDsActionFactoryProvider = {
1038
- provide: threeDsActionFactoryToken,
1039
- useValue: {
1040
- factory: (...args) => new ThreeDsAction(...args),
1041
- isSuitable: () => false,
1042
- },
1043
- };
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
+ }] });
1044
1127
 
1045
1128
  const nextActionsToken = new InjectionToken('Action');
1046
1129
  const nextActions = [
1047
- showFieldsActionFactoryProvider,
1048
- checkStatusActionFactoryProvider,
1049
- redirectActionFactoryProvider,
1130
+ ShowFieldsActionCreator,
1131
+ CheckStatusActionCreator,
1132
+ SpecialButtonActionCreator,
1133
+ RedirectActionCreator,
1050
1134
  ];
1051
1135
  const flowUpdateNextActions = [
1052
- statusUpdatedActionFactoryProvider,
1053
- showErrorsActionFactoryProvider,
1054
- threeDsActionFactoryProvider,
1136
+ ShowErrorsActionCreator,
1137
+ StatusUpdatedActionCreator,
1138
+ ThreeDsActionCreator,
1055
1139
  ];
1056
1140
 
1057
1141
  class NextActionService {
1058
1142
  get flowUpdates$() {
1059
1143
  return this.flowUpdatesSubject.asObservable();
1060
1144
  }
1061
- constructor(nextActionTokens, injector) {
1145
+ constructor(nextActionTokens, injector, showErrorsActionCreator) {
1062
1146
  this.nextActionTokens = nextActionTokens;
1063
1147
  this.injector = injector;
1148
+ this.showErrorsActionCreator = showErrorsActionCreator;
1064
1149
  this.flowUpdatesSubject = new Subject();
1065
1150
  this.nextActionsList = [];
1066
1151
  this.fillNextActionsList();
@@ -1068,14 +1153,14 @@ class NextActionService {
1068
1153
  getNextAction(submitResponse) {
1069
1154
  var _a;
1070
1155
  if ((_a = submitResponse.errors) === null || _a === void 0 ? void 0 : _a.length) {
1071
- this.emitFlowUpdates(new ShowErrorsAction(submitResponse.errors));
1156
+ this.emitFlowUpdates(this.showErrorsActionCreator.getActionData(submitResponse.errors));
1072
1157
  }
1073
1158
  if (!submitResponse.currentCommand) {
1074
1159
  return null;
1075
1160
  }
1076
- const nextActionFactory = this.findNextAction(submitResponse);
1077
- if (nextActionFactory) {
1078
- return nextActionFactory(submitResponse);
1161
+ const nextAction = this.findNextAction(submitResponse);
1162
+ if (nextAction) {
1163
+ return nextAction.getActionData(submitResponse);
1079
1164
  }
1080
1165
  throw new Error('Next action is undefined.');
1081
1166
  }
@@ -1084,7 +1169,7 @@ class NextActionService {
1084
1169
  }
1085
1170
  fillNextActionsList() {
1086
1171
  this.nextActionTokens.forEach((nextAction) => {
1087
- const item = this.injector.get(nextAction.provide);
1172
+ const item = this.injector.get(nextAction);
1088
1173
  this.nextActionsList.push(item);
1089
1174
  });
1090
1175
  }
@@ -1095,10 +1180,10 @@ class NextActionService {
1095
1180
  if (!actionType) {
1096
1181
  return;
1097
1182
  }
1098
- return actionType.factory;
1183
+ return actionType;
1099
1184
  }
1100
1185
  }
1101
- 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 });
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 });
1102
1187
  NextActionService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: NextActionService, providedIn: 'root' });
1103
1188
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: NextActionService, decorators: [{
1104
1189
  type: Injectable,
@@ -1109,7 +1194,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImpor
1109
1194
  return [{ type: undefined, decorators: [{
1110
1195
  type: Inject,
1111
1196
  args: [nextActionsToken]
1112
- }] }, { type: i0.Injector }];
1197
+ }] }, { type: i0.Injector }, { type: ShowErrorsActionCreator }];
1113
1198
  } });
1114
1199
 
1115
1200
  /* eslint-disable @typescript-eslint/no-magic-numbers */
@@ -1589,7 +1674,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImpor
1589
1674
  }], ctorParameters: function () { return [{ type: CreditCardService }]; } });
1590
1675
 
1591
1676
  class InitializeService {
1592
- constructor(responseFactory, xpsApiService, settingsService, countryService, nextActionService, xpsResponseErrorsMappingService, encryptCreditCardService) {
1677
+ constructor(responseFactory, xpsApiService, settingsService, countryService, nextActionService, xpsResponseErrorsMappingService, encryptCreditCardService, showErrorsActionCreator) {
1593
1678
  this.responseFactory = responseFactory;
1594
1679
  this.xpsApiService = xpsApiService;
1595
1680
  this.settingsService = settingsService;
@@ -1597,6 +1682,7 @@ class InitializeService {
1597
1682
  this.nextActionService = nextActionService;
1598
1683
  this.xpsResponseErrorsMappingService = xpsResponseErrorsMappingService;
1599
1684
  this.encryptCreditCardService = encryptCreditCardService;
1685
+ this.showErrorsActionCreator = showErrorsActionCreator;
1600
1686
  // TODO PAYMENTS-15743: replace with new refer id for headless core
1601
1687
  this.ps4ReferId = '22';
1602
1688
  }
@@ -1625,7 +1711,7 @@ class InitializeService {
1625
1711
  const response = this.xpsResponseErrorsMappingService.mapErrors(xpsResponse);
1626
1712
  const initializeResponse = this.responseFactory(response);
1627
1713
  if ((_b = (_a = initializeResponse.paymentForm) === null || _a === void 0 ? void 0 : _a.errors) === null || _b === void 0 ? void 0 : _b.length) {
1628
- this.nextActionService.emitFlowUpdates(new ShowErrorsAction(initializeResponse.paymentForm.errors));
1714
+ this.nextActionService.emitFlowUpdates(this.showErrorsActionCreator.getActionData(initializeResponse.paymentForm.errors));
1629
1715
  }
1630
1716
  if (initializeResponse.paymentForm) {
1631
1717
  this.setCreditCardEncryptKey(initializeResponse.paymentForm);
@@ -1645,7 +1731,7 @@ class InitializeService {
1645
1731
  this.encryptCreditCardService.setPublicKey(atob(publicKeyField.value));
1646
1732
  }
1647
1733
  }
1648
- 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 });
1649
1735
  InitializeService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: InitializeService, providedIn: 'root' });
1650
1736
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: InitializeService, decorators: [{
1651
1737
  type: Injectable,
@@ -1656,7 +1742,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImpor
1656
1742
  return [{ type: undefined, decorators: [{
1657
1743
  type: Inject,
1658
1744
  args: [initializeResponseFactoryToken]
1659
- }] }, { 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 }];
1660
1746
  } });
1661
1747
 
1662
1748
  class XpsApiPartRequest {
@@ -1904,7 +1990,7 @@ const syncResponseFactoryProvider = {
1904
1990
  };
1905
1991
 
1906
1992
  class SyncService extends EmitDataService {
1907
- constructor(requestFactory, responseFactory, xpsApiService, nextActionService, settingsService, xpsResponseErrorsMappingService, encryptCreditCardService) {
1993
+ constructor(requestFactory, responseFactory, xpsApiService, nextActionService, settingsService, xpsResponseErrorsMappingService, encryptCreditCardService, showErrorsActionCreator) {
1908
1994
  super();
1909
1995
  this.requestFactory = requestFactory;
1910
1996
  this.responseFactory = responseFactory;
@@ -1913,6 +1999,7 @@ class SyncService extends EmitDataService {
1913
1999
  this.settingsService = settingsService;
1914
2000
  this.xpsResponseErrorsMappingService = xpsResponseErrorsMappingService;
1915
2001
  this.encryptCreditCardService = encryptCreditCardService;
2002
+ this.showErrorsActionCreator = showErrorsActionCreator;
1916
2003
  this.prevFieldSyncStates = {};
1917
2004
  this.form = new UntypedFormGroup({});
1918
2005
  this.fields = [];
@@ -2019,7 +2106,7 @@ class SyncService extends EmitDataService {
2019
2106
  var _a;
2020
2107
  const formErrors = (_a = response.errors) === null || _a === void 0 ? void 0 : _a.filter((error) => !error.element_name);
2021
2108
  if (formErrors === null || formErrors === void 0 ? void 0 : formErrors.length) {
2022
- this.nextActionService.emitFlowUpdates(new ShowErrorsAction(formErrors));
2109
+ this.nextActionService.emitFlowUpdates(this.showErrorsActionCreator.getActionData(formErrors));
2023
2110
  }
2024
2111
  }
2025
2112
  resetFieldSyncTimer(field, timerId) {
@@ -2030,7 +2117,7 @@ class SyncService extends EmitDataService {
2030
2117
  this.fieldSyncTimers[field.name] = timerId;
2031
2118
  }
2032
2119
  }
2033
- 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 });
2034
2121
  SyncService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: SyncService, providedIn: 'root' });
2035
2122
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: SyncService, decorators: [{
2036
2123
  type: Injectable,
@@ -2044,7 +2131,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImpor
2044
2131
  }] }, { type: undefined, decorators: [{
2045
2132
  type: Inject,
2046
2133
  args: [syncResponseFactoryToken]
2047
- }] }, { type: XpsApiService }, { type: NextActionService }, { type: SettingsService }, { type: XpsResponseErrorsMappingService }, { type: EncryptCreditCardService }];
2134
+ }] }, { type: XpsApiService }, { type: NextActionService }, { type: SettingsService }, { type: XpsResponseErrorsMappingService }, { type: EncryptCreditCardService }, { type: ShowErrorsActionCreator }];
2048
2135
  } });
2049
2136
 
2050
2137
  class ControlConfig {
@@ -4781,12 +4868,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImpor
4781
4868
  }], ctorParameters: function () { return [{ type: SettingsService }, { type: SecureApiClient }]; } });
4782
4869
 
4783
4870
  class SavePaymentMethodStatusService {
4784
- constructor(statusRequestService, listenStatusService, savedPaymentAccountChangesService, nextActionService, checkStatusService) {
4871
+ constructor(statusRequestService, listenStatusService, savedPaymentAccountChangesService, nextActionService, checkStatusService, statusUpdatedActionCreator) {
4785
4872
  this.statusRequestService = statusRequestService;
4786
4873
  this.listenStatusService = listenStatusService;
4787
4874
  this.savedPaymentAccountChangesService = savedPaymentAccountChangesService;
4788
4875
  this.nextActionService = nextActionService;
4789
4876
  this.checkStatusService = checkStatusService;
4877
+ this.statusUpdatedActionCreator = statusUpdatedActionCreator;
4790
4878
  this.statusChecked = false;
4791
4879
  }
4792
4880
  getStatus(params) {
@@ -4874,26 +4962,31 @@ class SavePaymentMethodStatusService {
4874
4962
  this.listenStatusService.stopListening();
4875
4963
  this.listenStatusSubscription.unsubscribe();
4876
4964
  const isSavePaymentMethod = true;
4877
- this.nextActionService.emitFlowUpdates(new StatusUpdatedAction(status, isSavePaymentMethod, this.savePaymentMethodStatus));
4965
+ this.nextActionService.emitFlowUpdates(this.statusUpdatedActionCreator.getActionData({
4966
+ statusResponse: status,
4967
+ isSavePaymentMethodMode: isSavePaymentMethod,
4968
+ savePaymentMethodStatus: this.savePaymentMethodStatus,
4969
+ }));
4878
4970
  }
4879
4971
  }
4880
- 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 });
4881
4973
  SavePaymentMethodStatusService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: SavePaymentMethodStatusService, providedIn: 'root' });
4882
4974
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: SavePaymentMethodStatusService, decorators: [{
4883
4975
  type: Injectable,
4884
4976
  args: [{
4885
4977
  providedIn: 'root',
4886
4978
  }]
4887
- }], 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 }]; } });
4888
4980
 
4889
4981
  class StatusService {
4890
- constructor(urlService, statusRequestService, financeDetailsService, listenStatusService, nextActionService, savePaymentMethodStatusService) {
4982
+ constructor(urlService, statusRequestService, financeDetailsService, listenStatusService, nextActionService, savePaymentMethodStatusService, statusUpdatedActionCreator) {
4891
4983
  this.urlService = urlService;
4892
4984
  this.statusRequestService = statusRequestService;
4893
4985
  this.financeDetailsService = financeDetailsService;
4894
4986
  this.listenStatusService = listenStatusService;
4895
4987
  this.nextActionService = nextActionService;
4896
4988
  this.savePaymentMethodStatusService = savePaymentMethodStatusService;
4989
+ this.statusUpdatedActionCreator = statusUpdatedActionCreator;
4897
4990
  }
4898
4991
  getStatus(params) {
4899
4992
  return __awaiter(this, void 0, void 0, function* () {
@@ -4936,18 +5029,18 @@ class StatusService {
4936
5029
  .pipe(skip(1))
4937
5030
  .subscribe(({ statusResponse }) => {
4938
5031
  this.financeDetailsService.emitWithStatus(statusResponse.status);
4939
- this.nextActionService.emitFlowUpdates(new StatusUpdatedAction(statusResponse));
5032
+ this.nextActionService.emitFlowUpdates(this.statusUpdatedActionCreator.getActionData({ statusResponse }));
4940
5033
  });
4941
5034
  }
4942
5035
  }
4943
- 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 });
4944
5037
  StatusService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: StatusService, providedIn: 'root' });
4945
5038
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: StatusService, decorators: [{
4946
5039
  type: Injectable,
4947
5040
  args: [{
4948
5041
  providedIn: 'root',
4949
5042
  }]
4950
- }], 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 }]; } });
4951
5044
 
4952
5045
  class CreditCardStateService extends EmitDataService {
4953
5046
  }
@@ -5353,9 +5446,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImpor
5353
5446
  }], ctorParameters: function () { return [{ type: StatusThreeDsService }, { type: NotifyDfpStatusService }, { type: WebSocketFactory }, { type: DfpCollectService }, { type: ReinsuranceCheckService }]; } });
5354
5447
 
5355
5448
  class ThreeDsService {
5356
- constructor(threeDs20Service, nextActionService) {
5449
+ constructor(threeDs20Service, nextActionService, checkStatusActionCreator, threeDsActionCreator) {
5357
5450
  this.threeDs20Service = threeDs20Service;
5358
5451
  this.nextActionService = nextActionService;
5452
+ this.checkStatusActionCreator = checkStatusActionCreator;
5453
+ this.threeDsActionCreator = threeDsActionCreator;
5359
5454
  this.statusSubscription = null;
5360
5455
  }
5361
5456
  checkThreeDs(params) {
@@ -5369,9 +5464,9 @@ class ThreeDsService {
5369
5464
  (_a = this.statusSubscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
5370
5465
  this.statusSubscription = this.threeDs20Service.statusUpdates$.subscribe((statusUpdate) => {
5371
5466
  if (statusUpdate.type === 'complete') {
5372
- return this.nextActionService.emitFlowUpdates(new CheckStatusAction(params));
5467
+ return this.nextActionService.emitFlowUpdates(this.checkStatusActionCreator.getActionData());
5373
5468
  }
5374
- this.nextActionService.emitFlowUpdates(new ThreeDsAction(statusUpdate));
5469
+ this.nextActionService.emitFlowUpdates(this.threeDsActionCreator.getActionData(statusUpdate));
5375
5470
  });
5376
5471
  }
5377
5472
  stopChecking() {
@@ -5379,14 +5474,14 @@ class ThreeDsService {
5379
5474
  (_a = this.statusSubscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
5380
5475
  }
5381
5476
  }
5382
- 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 });
5383
5478
  ThreeDsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: ThreeDsService, providedIn: 'root' });
5384
5479
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: ThreeDsService, decorators: [{
5385
5480
  type: Injectable,
5386
5481
  args: [{
5387
5482
  providedIn: 'root',
5388
5483
  }]
5389
- }], ctorParameters: function () { return [{ type: ThreeDs20Service }, { type: NextActionService }]; } });
5484
+ }], ctorParameters: function () { return [{ type: ThreeDs20Service }, { type: NextActionService }, { type: CheckStatusActionCreator }, { type: ThreeDsActionCreator }]; } });
5390
5485
 
5391
5486
  class FormMessagesService extends EmitDataService {
5392
5487
  constructor(unescapeHtmlPipe) {
@@ -5414,7 +5509,7 @@ class PaymentService {
5414
5509
  get formFieldsStatus$() {
5415
5510
  return this.formFieldsStatusSubject.asObservable().pipe(filter$1(Boolean));
5416
5511
  }
5417
- 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) {
5418
5513
  this.initializeService = initializeService;
5419
5514
  this.submitService = submitService;
5420
5515
  this.syncService = syncService;
@@ -5426,6 +5521,8 @@ class PaymentService {
5426
5521
  this.controlConfigService = controlConfigService;
5427
5522
  this.threeDsService = threeDsService;
5428
5523
  this.formMessagesService = formMessagesService;
5524
+ this.settingsService = settingsService;
5525
+ this.countryService = countryService;
5429
5526
  this.form = null;
5430
5527
  this.data = null;
5431
5528
  this.financeDetails = null;
@@ -5490,6 +5587,18 @@ class PaymentService {
5490
5587
  }
5491
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 : [];
5492
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
+ }
5493
5602
  getPid() {
5494
5603
  var _a, _b, _c;
5495
5604
  if (this.data instanceof SubmitResponse) {
@@ -5638,14 +5747,14 @@ class PaymentService {
5638
5747
  }
5639
5748
  }
5640
5749
  }
5641
- 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 });
5642
5751
  PaymentService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: PaymentService, providedIn: 'root' });
5643
5752
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: PaymentService, decorators: [{
5644
5753
  type: Injectable,
5645
5754
  args: [{
5646
5755
  providedIn: 'root',
5647
5756
  }]
5648
- }], 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 }]; } });
5649
5758
 
5650
5759
  class RefundPolicyService {
5651
5760
  constructor(settingsService) {
@@ -5790,8 +5899,288 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImpor
5790
5899
  }]
5791
5900
  }], ctorParameters: function () { return [{ type: SavedMethodsService }, { type: SettingsService }, { type: SecureApiClient }]; } });
5792
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
+
5793
6182
  class CoreLibraryService {
5794
- 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) {
5795
6184
  this.settingsService = settingsService;
5796
6185
  this.countryService = countryService;
5797
6186
  this.paymentMethodsService = paymentMethodsService;
@@ -5808,6 +6197,8 @@ class CoreLibraryService {
5808
6197
  this.creditCardStateService = creditCardStateService;
5809
6198
  this.formMessagesService = formMessagesService;
5810
6199
  this.editSavedMethodsService = editSavedMethodsService;
6200
+ this.googlePayService = googlePayService;
6201
+ this.commonPayProcessingService = commonPayProcessingService;
5811
6202
  this.paymentMethods = {
5812
6203
  getList: (isSaveMethodMode) => __awaiter(this, void 0, void 0, function* () { return this.paymentMethodsService.getList(isSaveMethodMode); }),
5813
6204
  getQuickMethods: () => __awaiter(this, void 0, void 0, function* () { return this.paymentMethodsService.getQuickMethods(); }),
@@ -5815,6 +6206,23 @@ class CoreLibraryService {
5815
6206
  getUserBalance: () => __awaiter(this, void 0, void 0, function* () { return this.userBalanceService.getUserBalance(); }),
5816
6207
  deleteSavedMethod: (id, type) => __awaiter(this, void 0, void 0, function* () { return this.editSavedMethodsService.deleteSavedMethodRequest(id, type); }),
5817
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
+ };
5818
6226
  }
5819
6227
  init(configuration) {
5820
6228
  return __awaiter(this, void 0, void 0, function* () {
@@ -5883,14 +6291,14 @@ class CoreLibraryService {
5883
6291
  return this.userBalanceService.getUserBalanceValue();
5884
6292
  }
5885
6293
  }
5886
- 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 });
5887
6295
  CoreLibraryService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: CoreLibraryService, providedIn: 'root' });
5888
6296
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: CoreLibraryService, decorators: [{
5889
6297
  type: Injectable,
5890
6298
  args: [{
5891
6299
  providedIn: 'root',
5892
6300
  }]
5893
- }], 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 }]; } });
5894
6302
 
5895
6303
  class HttpError extends AppError {
5896
6304
  constructor(error, req) {