From 72ac43a99719e78b27b5226357e2854bea1837cb Mon Sep 17 00:00:00 2001 From: Matejk00 Date: Tue, 17 Sep 2024 16:01:00 +0200 Subject: [PATCH] Pipeline fix --- .../services/opf-endpoints.service.spec.ts | 3 +- .../core/services/opf-endpoints.service.ts | 4 +- .../config/default-opf-api-base-config.ts | 2 +- .../opf/base/opf-api/model/index.ts | 2 - .../model/opf-api-base-endpoints.model.ts | 14 +-- .../opf/base/opf-api/public_api.ts | 1 - .../opf/base/root/config/index.ts | 1 + .../config/opf-api-config.ts} | 2 +- integration-libs/opf/base/root/model/index.ts | 3 + .../model/opf-api-backend-config.model.ts} | 2 +- .../model/opf-api-endpoint.model.ts | 0 .../model/opf-api-endpoints.model.ts} | 2 +- ...f-checkout-billing-address-form.service.ts | 4 +- .../opf-checkout-payment-wrapper.service.ts | 8 +- .../config/default-opf-api-cta-config.ts | 2 +- .../model/opf-api-cta-endpoints.model.ts | 4 +- .../opf/cta/root/opf-cta-root.module.ts | 4 +- .../config/default-opf-api-payment-config.ts | 2 +- .../model/opf-api-payment-endpoints.model.ts | 4 +- ...opf-payment-verification.component.spec.ts | 96 ++++++++++++------- .../opf-payment-verification.component.ts | 16 ++-- 21 files changed, 101 insertions(+), 75 deletions(-) rename integration-libs/opf/base/{opf-api/config/opf-api.config.ts => root/config/opf-api-config.ts} (85%) rename integration-libs/opf/base/{opf-api/model/opf-api-backend.model.ts => root/model/opf-api-backend-config.model.ts} (76%) rename integration-libs/opf/base/{opf-api => root}/model/opf-api-endpoint.model.ts (100%) rename integration-libs/opf/base/{opf-api/config/index.ts => root/model/opf-api-endpoints.model.ts} (77%) diff --git a/integration-libs/opf/base/core/services/opf-endpoints.service.spec.ts b/integration-libs/opf/base/core/services/opf-endpoints.service.spec.ts index 33e76697460..aa4a350f936 100644 --- a/integration-libs/opf/base/core/services/opf-endpoints.service.spec.ts +++ b/integration-libs/opf/base/core/services/opf-endpoints.service.spec.ts @@ -7,8 +7,7 @@ import { TestBed } from '@angular/core/testing'; import { of } from 'rxjs'; import { BaseSiteService, StringTemplate } from '@spartacus/core'; -import { OpfApiConfig } from '@spartacus/opf/base/opf-api'; -import { OpfConfig } from '@spartacus/opf/base/root'; +import { OpfApiConfig, OpfConfig } from '@spartacus/opf/base/root'; import { OpfEndpointsService } from './opf-endpoints.service'; describe('OpfEndpointsService', () => { diff --git a/integration-libs/opf/base/core/services/opf-endpoints.service.ts b/integration-libs/opf/base/core/services/opf-endpoints.service.ts index cd29293e91d..7a516abe1fe 100644 --- a/integration-libs/opf/base/core/services/opf-endpoints.service.ts +++ b/integration-libs/opf/base/core/services/opf-endpoints.service.ts @@ -10,8 +10,8 @@ import { DynamicAttributes, StringTemplate, } from '@spartacus/core'; -import { OpfApiConfig } from '@spartacus/opf/base/opf-api'; -import { OpfConfig } from '@spartacus/opf/base/root'; + +import { OpfApiConfig, OpfConfig } from '@spartacus/opf/base/root'; @Injectable({ providedIn: 'root', diff --git a/integration-libs/opf/base/opf-api/config/default-opf-api-base-config.ts b/integration-libs/opf/base/opf-api/config/default-opf-api-base-config.ts index 8c8c638c0a9..f841251c46b 100644 --- a/integration-libs/opf/base/opf-api/config/default-opf-api-base-config.ts +++ b/integration-libs/opf/base/opf-api/config/default-opf-api-base-config.ts @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { OpfApiConfig } from './opf-api.config'; +import { OpfApiConfig } from '@spartacus/opf/base/root'; export const defaultOpfApiBaseConfig: OpfApiConfig = { backend: { diff --git a/integration-libs/opf/base/opf-api/model/index.ts b/integration-libs/opf/base/opf-api/model/index.ts index 1a65e41af57..e5deeb22770 100644 --- a/integration-libs/opf/base/opf-api/model/index.ts +++ b/integration-libs/opf/base/opf-api/model/index.ts @@ -4,6 +4,4 @@ * SPDX-License-Identifier: Apache-2.0 */ -export * from './opf-api-backend.model'; export * from './opf-api-base-endpoints.model'; -export * from './opf-api-endpoint.model'; diff --git a/integration-libs/opf/base/opf-api/model/opf-api-base-endpoints.model.ts b/integration-libs/opf/base/opf-api/model/opf-api-base-endpoints.model.ts index df452d7dd5e..49a1974bac0 100644 --- a/integration-libs/opf/base/opf-api/model/opf-api-base-endpoints.model.ts +++ b/integration-libs/opf/base/opf-api/model/opf-api-base-endpoints.model.ts @@ -4,11 +4,13 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { OpfApiEndpoint } from './opf-api-endpoint.model'; +import { OpfApiEndpoint } from '@spartacus/opf/base/root'; -export interface OpfApiEndpoints { - /** - * Endpoint to get active payment configurations - */ - getActiveConfigurations?: string | OpfApiEndpoint; +declare module '@spartacus/opf/base/root' { + interface OpfApiEndpoints { + /** + * Endpoint to get active payment configurations + */ + getActiveConfigurations?: string | OpfApiEndpoint; + } } diff --git a/integration-libs/opf/base/opf-api/public_api.ts b/integration-libs/opf/base/opf-api/public_api.ts index beb45449301..f55d858b490 100644 --- a/integration-libs/opf/base/opf-api/public_api.ts +++ b/integration-libs/opf/base/opf-api/public_api.ts @@ -4,6 +4,5 @@ * SPDX-License-Identifier: Apache-2.0 */ -export * from './config/index'; export * from './model/index'; export * from './opf-api-base.module'; diff --git a/integration-libs/opf/base/root/config/index.ts b/integration-libs/opf/base/root/config/index.ts index 0db11745bf4..b491c261115 100644 --- a/integration-libs/opf/base/root/config/index.ts +++ b/integration-libs/opf/base/root/config/index.ts @@ -6,4 +6,5 @@ export * from './constants'; export * from './default-opf-config'; +export * from './opf-api-config'; export * from './opf-config'; diff --git a/integration-libs/opf/base/opf-api/config/opf-api.config.ts b/integration-libs/opf/base/root/config/opf-api-config.ts similarity index 85% rename from integration-libs/opf/base/opf-api/config/opf-api.config.ts rename to integration-libs/opf/base/root/config/opf-api-config.ts index 71eb89a7932..87d77c5a933 100644 --- a/integration-libs/opf/base/opf-api/config/opf-api.config.ts +++ b/integration-libs/opf/base/root/config/opf-api-config.ts @@ -6,7 +6,7 @@ import { Injectable } from '@angular/core'; import { Config } from '@spartacus/core'; -import { OpfApiBackendConfig } from '../model'; +import { OpfApiBackendConfig } from '../model/opf-api-backend-config.model'; @Injectable({ providedIn: 'root', diff --git a/integration-libs/opf/base/root/model/index.ts b/integration-libs/opf/base/root/model/index.ts index dadd00a131d..625d43908ae 100644 --- a/integration-libs/opf/base/root/model/index.ts +++ b/integration-libs/opf/base/root/model/index.ts @@ -5,6 +5,9 @@ */ import './augmented-core.model'; +export * from './opf-api-backend-config.model'; +export * from './opf-api-endpoint.model'; +export * from './opf-api-endpoints.model'; export * from './opf-base.model'; export * from './opf-error-dialog.model'; export * from './opf-metadata-store.model'; diff --git a/integration-libs/opf/base/opf-api/model/opf-api-backend.model.ts b/integration-libs/opf/base/root/model/opf-api-backend-config.model.ts similarity index 76% rename from integration-libs/opf/base/opf-api/model/opf-api-backend.model.ts rename to integration-libs/opf/base/root/model/opf-api-backend-config.model.ts index ab4c7b9bd39..69a32bc27f0 100644 --- a/integration-libs/opf/base/opf-api/model/opf-api-backend.model.ts +++ b/integration-libs/opf/base/root/model/opf-api-backend-config.model.ts @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { OpfApiEndpoints } from './opf-api-base-endpoints.model'; +import { OpfApiEndpoints } from './opf-api-endpoints.model'; export interface OpfApiBackendConfig { opfApi?: { diff --git a/integration-libs/opf/base/opf-api/model/opf-api-endpoint.model.ts b/integration-libs/opf/base/root/model/opf-api-endpoint.model.ts similarity index 100% rename from integration-libs/opf/base/opf-api/model/opf-api-endpoint.model.ts rename to integration-libs/opf/base/root/model/opf-api-endpoint.model.ts diff --git a/integration-libs/opf/base/opf-api/config/index.ts b/integration-libs/opf/base/root/model/opf-api-endpoints.model.ts similarity index 77% rename from integration-libs/opf/base/opf-api/config/index.ts rename to integration-libs/opf/base/root/model/opf-api-endpoints.model.ts index 524a1eb7af8..7edb4bdba3c 100644 --- a/integration-libs/opf/base/opf-api/config/index.ts +++ b/integration-libs/opf/base/root/model/opf-api-endpoints.model.ts @@ -4,4 +4,4 @@ * SPDX-License-Identifier: Apache-2.0 */ -export * from './opf-api.config'; +export interface OpfApiEndpoints {} diff --git a/integration-libs/opf/checkout/components/opf-checkout-billing-address-form/opf-checkout-billing-address-form.service.ts b/integration-libs/opf/checkout/components/opf-checkout-billing-address-form/opf-checkout-billing-address-form.service.ts index b3682b7b19f..976718e7c85 100644 --- a/integration-libs/opf/checkout/components/opf-checkout-billing-address-form/opf-checkout-billing-address-form.service.ts +++ b/integration-libs/opf/checkout/components/opf-checkout-billing-address-form/opf-checkout-billing-address-form.service.ts @@ -58,7 +58,7 @@ export class OpfCheckoutBillingAddressFormService { protected checkoutPaymentService: CheckoutPaymentFacade, protected activeCartService: ActiveCartFacade, protected globalMessageService: GlobalMessageService, - protected opfService: OpfCheckoutPaymentWrapperService + protected opfCheckoutPaymentWrapperService: OpfCheckoutPaymentWrapperService ) {} getCountries(): Observable { @@ -135,7 +135,7 @@ export class OpfCheckoutBillingAddressFormService { this.billingAddressId = billingAddress.id; this.billingAddressSub.next(billingAddress); - this.opfService.reloadPaymentMode(); + this.opfCheckoutPaymentWrapperService.reloadPaymentMode(); } }), catchError((error: HttpErrorModel) => { diff --git a/integration-libs/opf/checkout/components/opf-checkout-payment-wrapper/opf-checkout-payment-wrapper.service.ts b/integration-libs/opf/checkout/components/opf-checkout-payment-wrapper/opf-checkout-payment-wrapper.service.ts index 90f58926c72..b3a16a79ba1 100644 --- a/integration-libs/opf/checkout/components/opf-checkout-payment-wrapper/opf-checkout-payment-wrapper.service.ts +++ b/integration-libs/opf/checkout/components/opf-checkout-payment-wrapper/opf-checkout-payment-wrapper.service.ts @@ -55,7 +55,7 @@ export class OpfCheckoutPaymentWrapperService { }); constructor( - protected opfPaymentService: OpfPaymentFacade, + protected opfPaymentFacade: OpfPaymentFacade, protected opfResourceLoaderService: OpfResourceLoaderService, protected userIdService: UserIdService, protected activeCartService: ActiveCartFacade, @@ -63,7 +63,7 @@ export class OpfCheckoutPaymentWrapperService { protected globalMessageService: GlobalMessageService, protected orderFacade: OrderFacade, protected opfMetadataStoreService: OpfMetadataStoreService, - protected cartAccessCodeService: CartAccessCodeFacade + protected cartAccessCodeFacade: CartAccessCodeFacade ) {} protected executeScriptFromHtml(html: string): void { @@ -112,13 +112,13 @@ export class OpfCheckoutPaymentWrapperService { ), switchMap(([userId, cartId]: [string, string]) => { this.activeCartId = cartId; - return this.cartAccessCodeService.getCartAccessCode(userId, cartId); + return this.cartAccessCodeFacade.getCartAccessCode(userId, cartId); }), filter((response) => Boolean(response?.accessCode)), map(({ accessCode: otpKey }) => this.setPaymentInitiationConfig(otpKey, paymentOptionId) ), - switchMap((params) => this.opfPaymentService.initiatePayment(params)), + switchMap((params) => this.opfPaymentFacade.initiatePayment(params)), tap((paymentOptionConfig: PaymentSessionData | Error) => { if (!(paymentOptionConfig instanceof Error)) { this.storePaymentSessionId(paymentOptionConfig); diff --git a/integration-libs/opf/cta/opf-api/config/default-opf-api-cta-config.ts b/integration-libs/opf/cta/opf-api/config/default-opf-api-cta-config.ts index 9bb96944b15..610dd3b7471 100644 --- a/integration-libs/opf/cta/opf-api/config/default-opf-api-cta-config.ts +++ b/integration-libs/opf/cta/opf-api/config/default-opf-api-cta-config.ts @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { OpfApiConfig } from '@spartacus/opf/base/opf-api'; +import { OpfApiConfig } from '@spartacus/opf/base/root'; export const defaultOpfApiCtaConfig: OpfApiConfig = { backend: { diff --git a/integration-libs/opf/cta/opf-api/model/opf-api-cta-endpoints.model.ts b/integration-libs/opf/cta/opf-api/model/opf-api-cta-endpoints.model.ts index 76632595042..4572db567b3 100644 --- a/integration-libs/opf/cta/opf-api/model/opf-api-cta-endpoints.model.ts +++ b/integration-libs/opf/cta/opf-api/model/opf-api-cta-endpoints.model.ts @@ -4,9 +4,9 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { OpfApiEndpoint } from '@spartacus/opf/base/opf-api'; +import { OpfApiEndpoint } from '@spartacus/opf/base/root'; -declare module '@spartacus/opf/base/opf-api' { +declare module '@spartacus/opf/base/root' { interface OpfApiEndpoints { /** * Endpoint to get CTA (Call To Action) Scripts diff --git a/integration-libs/opf/cta/root/opf-cta-root.module.ts b/integration-libs/opf/cta/root/opf-cta-root.module.ts index d4fccd61ed1..8717a3917ae 100644 --- a/integration-libs/opf/cta/root/opf-cta-root.module.ts +++ b/integration-libs/opf/cta/root/opf-cta-root.module.ts @@ -8,7 +8,7 @@ import { NgModule } from '@angular/core'; import { CmsConfig, provideDefaultConfigFactory } from '@spartacus/core'; import { OPF_CTA_FEATURE } from './feature-name'; -export function defaultOpfBaseCmsComponentsConfig(): CmsConfig { +export function defaultOpfCtaCmsComponentsConfig(): CmsConfig { const config: CmsConfig = { featureModules: { [OPF_CTA_FEATURE]: { @@ -20,6 +20,6 @@ export function defaultOpfBaseCmsComponentsConfig(): CmsConfig { } @NgModule({ - providers: [provideDefaultConfigFactory(defaultOpfBaseCmsComponentsConfig)], + providers: [provideDefaultConfigFactory(defaultOpfCtaCmsComponentsConfig)], }) export class OpfCtaRootModule {} diff --git a/integration-libs/opf/payment/opf-api/config/default-opf-api-payment-config.ts b/integration-libs/opf/payment/opf-api/config/default-opf-api-payment-config.ts index 58aec438647..ab8d9cb6505 100644 --- a/integration-libs/opf/payment/opf-api/config/default-opf-api-payment-config.ts +++ b/integration-libs/opf/payment/opf-api/config/default-opf-api-payment-config.ts @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { OpfApiConfig } from '@spartacus/opf/base/opf-api'; +import { OpfApiConfig } from '@spartacus/opf/base/root'; export const defaultOpfApiPaymentConfig: OpfApiConfig = { backend: { diff --git a/integration-libs/opf/payment/opf-api/model/opf-api-payment-endpoints.model.ts b/integration-libs/opf/payment/opf-api/model/opf-api-payment-endpoints.model.ts index 247509e8759..a0239593558 100644 --- a/integration-libs/opf/payment/opf-api/model/opf-api-payment-endpoints.model.ts +++ b/integration-libs/opf/payment/opf-api/model/opf-api-payment-endpoints.model.ts @@ -4,9 +4,9 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { OpfApiEndpoint } from '@spartacus/opf/base/opf-api'; +import { OpfApiEndpoint } from '@spartacus/opf/base/root'; -declare module '@spartacus/opf/base/opf-api' { +declare module '@spartacus/opf/base/root' { interface OpfApiEndpoints { /** * Endpoint to verify a response from PSP for Full Page Redirect diff --git a/integration-libs/opf/payment/root/components/opf-payment-verification/opf-payment-verification.component.spec.ts b/integration-libs/opf/payment/root/components/opf-payment-verification/opf-payment-verification.component.spec.ts index 94c80a33574..d3d54b02773 100644 --- a/integration-libs/opf/payment/root/components/opf-payment-verification/opf-payment-verification.component.spec.ts +++ b/integration-libs/opf/payment/root/components/opf-payment-verification/opf-payment-verification.component.spec.ts @@ -22,21 +22,24 @@ describe('OpfPaymentVerificationComponent', () => { let component: OpfPaymentVerificationComponent; let fixture: ComponentFixture; let routeMock: jasmine.SpyObj; - let paymentServiceMock: jasmine.SpyObj; + let opfPaymentVerificationServiceMock: jasmine.SpyObj; beforeEach(() => { routeMock = jasmine.createSpyObj('ActivatedRoute', [], { snapshot: { queryParamMap: new Map() }, }); - paymentServiceMock = jasmine.createSpyObj('OpfPaymentVerificationService', [ - 'checkIfProcessingCartIdExist', - 'verifyResultUrl', - 'goToPage', - 'displayError', - 'removeResourcesAndGlobalFunctions', - 'runHostedFieldsPattern', - 'runHostedPagePattern', - ]); + opfPaymentVerificationServiceMock = jasmine.createSpyObj( + 'OpfPaymentVerificationService', + [ + 'checkIfProcessingCartIdExist', + 'verifyResultUrl', + 'goToPage', + 'displayError', + 'removeResourcesAndGlobalFunctions', + 'runHostedFieldsPattern', + 'runHostedPagePattern', + ] + ); TestBed.configureTestingModule({ declarations: [OpfPaymentVerificationComponent, MockSpinnerComponent], @@ -44,7 +47,7 @@ describe('OpfPaymentVerificationComponent', () => { { provide: ActivatedRoute, useValue: routeMock }, { provide: OpfPaymentVerificationService, - useValue: paymentServiceMock, + useValue: opfPaymentVerificationServiceMock, }, ], }); @@ -59,11 +62,11 @@ describe('OpfPaymentVerificationComponent', () => { describe('ngOnInit', () => { it('should call checkIfProcessingCartIdExist', () => { - paymentServiceMock.verifyResultUrl.and.returnValue(of()); + opfPaymentVerificationServiceMock.verifyResultUrl.and.returnValue(of()); component.ngOnInit(); expect( - paymentServiceMock.checkIfProcessingCartIdExist + opfPaymentVerificationServiceMock.checkIfProcessingCartIdExist ).toHaveBeenCalled(); }); @@ -81,19 +84,24 @@ describe('OpfPaymentVerificationComponent', () => { afterRedirectScriptFlag: mockAfterRedirectScriptFlag, }; - paymentServiceMock.verifyResultUrl.and.returnValue(of(mockVerifyResult)); - paymentServiceMock.runHostedFieldsPattern.and.returnValue(of(true)); - paymentServiceMock.runHostedPagePattern.and.returnValue(of(true)); + opfPaymentVerificationServiceMock.verifyResultUrl.and.returnValue( + of(mockVerifyResult) + ); + opfPaymentVerificationServiceMock.runHostedFieldsPattern.and.returnValue( + of(true) + ); + opfPaymentVerificationServiceMock.runHostedPagePattern.and.returnValue( + of(true) + ); component.ngOnInit(); - expect(paymentServiceMock.verifyResultUrl).toHaveBeenCalledWith( - routeMock - ); - expect(paymentServiceMock.runHostedPagePattern).toHaveBeenCalledWith( - mockPaymentSessionId, - mockResponseMap - ); + expect( + opfPaymentVerificationServiceMock.verifyResultUrl + ).toHaveBeenCalledWith(routeMock); + expect( + opfPaymentVerificationServiceMock.runHostedPagePattern + ).toHaveBeenCalledWith(mockPaymentSessionId, mockResponseMap); }); it('should handle error scenario', () => { @@ -105,8 +113,10 @@ describe('OpfPaymentVerificationComponent', () => { afterRedirectScriptFlag: 'false', }; - paymentServiceMock.verifyResultUrl.and.returnValue(of(mockVerifyResult)); - paymentServiceMock.runHostedPagePattern.and.returnValue( + opfPaymentVerificationServiceMock.verifyResultUrl.and.returnValue( + of(mockVerifyResult) + ); + opfPaymentVerificationServiceMock.runHostedPagePattern.and.returnValue( throwError(mockError) ); @@ -124,8 +134,12 @@ describe('OpfPaymentVerificationComponent', () => { afterRedirectScriptFlag: 'false', }; - paymentServiceMock.verifyResultUrl.and.returnValue(of(mockVerifyResult)); - paymentServiceMock.runHostedPagePattern.and.returnValue(of(false)); + opfPaymentVerificationServiceMock.verifyResultUrl.and.returnValue( + of(mockVerifyResult) + ); + opfPaymentVerificationServiceMock.runHostedPagePattern.and.returnValue( + of(false) + ); spyOn(component, 'onError'); @@ -141,14 +155,20 @@ describe('OpfPaymentVerificationComponent', () => { afterRedirectScriptFlag: 'true', }; - paymentServiceMock.verifyResultUrl.and.returnValue( + opfPaymentVerificationServiceMock.verifyResultUrl.and.returnValue( of(mockVerifyResultWithFlag) ); - paymentServiceMock.runHostedFieldsPattern.and.returnValue(of(true)); + opfPaymentVerificationServiceMock.runHostedFieldsPattern.and.returnValue( + of(true) + ); component.ngOnInit(); - expect(paymentServiceMock.runHostedFieldsPattern).toHaveBeenCalled(); - expect(paymentServiceMock.runHostedPagePattern).not.toHaveBeenCalled(); + expect( + opfPaymentVerificationServiceMock.runHostedFieldsPattern + ).toHaveBeenCalled(); + expect( + opfPaymentVerificationServiceMock.runHostedPagePattern + ).not.toHaveBeenCalled(); }); }); @@ -158,8 +178,10 @@ describe('OpfPaymentVerificationComponent', () => { component.onError(mockError); - expect(paymentServiceMock.displayError).toHaveBeenCalledWith(mockError); - expect(paymentServiceMock.goToPage).toHaveBeenCalledWith( + expect( + opfPaymentVerificationServiceMock.displayError + ).toHaveBeenCalledWith(mockError); + expect(opfPaymentVerificationServiceMock.goToPage).toHaveBeenCalledWith( OpfPage.CHECKOUT_REVIEW_PAGE ); }); @@ -173,16 +195,18 @@ describe('OpfPaymentVerificationComponent', () => { afterRedirectScriptFlag: 'true', }; - paymentServiceMock.verifyResultUrl.and.returnValue( + opfPaymentVerificationServiceMock.verifyResultUrl.and.returnValue( of(mockVerifyResultWithFlag) ); - paymentServiceMock.runHostedFieldsPattern.and.returnValue(of(true)); + opfPaymentVerificationServiceMock.runHostedFieldsPattern.and.returnValue( + of(true) + ); component.ngOnInit(); component.ngOnDestroy(); expect( - paymentServiceMock.removeResourcesAndGlobalFunctions + opfPaymentVerificationServiceMock.removeResourcesAndGlobalFunctions ).toHaveBeenCalled(); }); }); diff --git a/integration-libs/opf/payment/root/components/opf-payment-verification/opf-payment-verification.component.ts b/integration-libs/opf/payment/root/components/opf-payment-verification/opf-payment-verification.component.ts index c6b8c3b8a44..2f0980b785c 100644 --- a/integration-libs/opf/payment/root/components/opf-payment-verification/opf-payment-verification.component.ts +++ b/integration-libs/opf/payment/root/components/opf-payment-verification/opf-payment-verification.component.ts @@ -25,14 +25,14 @@ export class OpfPaymentVerificationComponent implements OnInit, OnDestroy { constructor( protected route: ActivatedRoute, - protected paymentService: OpfPaymentVerificationService, + protected opfPaymentVerificationService: OpfPaymentVerificationService, protected vcr: ViewContainerRef ) {} ngOnInit(): void { - this.paymentService.checkIfProcessingCartIdExist(); + this.opfPaymentVerificationService.checkIfProcessingCartIdExist(); - this.subscription = this.paymentService + this.subscription = this.opfPaymentVerificationService .verifyResultUrl(this.route) .pipe( concatMap( @@ -69,14 +69,14 @@ export class OpfPaymentVerificationComponent implements OnInit, OnDestroy { }): Observable { if (afterRedirectScriptFlag === 'true') { this.isHostedFieldPattern = true; - return this.paymentService.runHostedFieldsPattern( + return this.opfPaymentVerificationService.runHostedFieldsPattern( GlobalFunctionsDomain.REDIRECT, paymentSessionId, this.vcr, paramsMap ); } else { - return this.paymentService.runHostedPagePattern( + return this.opfPaymentVerificationService.runHostedPagePattern( paymentSessionId, paramsMap ); @@ -84,8 +84,8 @@ export class OpfPaymentVerificationComponent implements OnInit, OnDestroy { } onError(error: HttpErrorModel | undefined): void { - this.paymentService.displayError(error); - this.paymentService.goToPage(OpfPage.CHECKOUT_REVIEW_PAGE); + this.opfPaymentVerificationService.displayError(error); + this.opfPaymentVerificationService.goToPage(OpfPage.CHECKOUT_REVIEW_PAGE); } ngOnDestroy(): void { @@ -94,7 +94,7 @@ export class OpfPaymentVerificationComponent implements OnInit, OnDestroy { } if (this.isHostedFieldPattern) { - this.paymentService.removeResourcesAndGlobalFunctions(); + this.opfPaymentVerificationService.removeResourcesAndGlobalFunctions(); } } }