diff --git a/docs/guides/migrations.md b/docs/guides/migrations.md index 4623dc4cc6..52c10056c6 100644 --- a/docs/guides/migrations.md +++ b/docs/guides/migrations.md @@ -18,6 +18,9 @@ Previously it has been used to determine whether the 'privatecustomers' or the ' Now the 'privatecustomers' REST resource is the new standard for b2c users. If your ICM doesn't support the new standard the method `getCustomerRestResource` of the [`app.facade`](../../src/app/core/facades/app.facade.ts) has to be adapted. +With ICM 12.2.0, 11.11.1 or 7.10.41.3 the ICM server itself provides an OCI punchout URL (Pipeline) that works better for the OCI punchout functions `BACKGROUND_SEARCH` and `VALIDATE` than the similar now deprecated functionality in the PWA. +For that reason the provided OCI Punchout URL is now pointing to the ICM pipeline `ViewOCICatalogPWA-Start` that handles the different functionalities and redirects to the PWA (configured as _External Base URL_ in ICM) only for catalog browsing and the detail function. + ## From 5.1 to 5.2 > [!NOTE] diff --git a/src/app/core/store/core/configuration/configuration.selectors.ts b/src/app/core/store/core/configuration/configuration.selectors.ts index 9bf67912a8..c9c31c9acc 100644 --- a/src/app/core/store/core/configuration/configuration.selectors.ts +++ b/src/app/core/store/core/configuration/configuration.selectors.ts @@ -22,7 +22,7 @@ export const getICMServerURL = createSelector(getConfigurationState, state => state.baseURL && state.server ? `${ssrBaseUrl || state.baseURL}/${state.server}` : undefined ); -export const getICMServerWebURL = createSelector(getConfigurationState, state => +const getICMServerWebURL = createSelector(getConfigurationState, state => state.baseURL && state.serverWeb ? `${ssrBaseUrl || state.baseURL}/${state.serverWeb}` : undefined ); diff --git a/src/app/extensions/punchout/identity-provider/punchout-identity-provider.spec.ts b/src/app/extensions/punchout/identity-provider/punchout-identity-provider.spec.ts index 49672e6cc8..e59ca92b07 100644 --- a/src/app/extensions/punchout/identity-provider/punchout-identity-provider.spec.ts +++ b/src/app/extensions/punchout/identity-provider/punchout-identity-provider.spec.ts @@ -1,3 +1,4 @@ +/* eslint-disable etc/no-deprecated */ import { TestBed, fakeAsync, tick } from '@angular/core/testing'; import { ActivatedRouteSnapshot, Params, Router, UrlTree, convertToParamMap } from '@angular/router'; import { MockStore, provideMockStore } from '@ngrx/store/testing'; diff --git a/src/app/extensions/punchout/identity-provider/punchout-identity-provider.ts b/src/app/extensions/punchout/identity-provider/punchout-identity-provider.ts index 39007e09cd..0ffc9e2f7c 100644 --- a/src/app/extensions/punchout/identity-provider/punchout-identity-provider.ts +++ b/src/app/extensions/punchout/identity-provider/punchout-identity-provider.ts @@ -1,3 +1,4 @@ +/* eslint-disable etc/no-deprecated */ import { HttpEvent, HttpHandler, HttpRequest } from '@angular/common/http'; import { Injectable } from '@angular/core'; import { ActivatedRouteSnapshot, Router, UrlTree } from '@angular/router'; @@ -176,7 +177,7 @@ export class PunchoutIdentityProvider implements IdentityProvider { if (route.queryParamMap.get('FUNCTION') === 'DETAIL' && route.queryParamMap.get('PRODUCTID')) { return of(this.router.parseUrl(`/product/${route.queryParamMap.get('PRODUCTID')}`)); - // Validation of Products + // Validation of Products - @deprecated This functionality should be handled by the ICM pipeline `ViewOCICatalogPWA-Start`. } else if (route.queryParamMap.get('FUNCTION') === 'VALIDATE' && route.queryParamMap.get('PRODUCTID')) { return this.punchoutService .getOciPunchoutProductData(route.queryParamMap.get('PRODUCTID'), route.queryParamMap.get('QUANTITY') || '1') @@ -185,7 +186,7 @@ export class PunchoutIdentityProvider implements IdentityProvider { map(() => false) ); - // Background Search + // Background Search - @deprecated: is now handled by the ICM ViewOCICatalogPWA-Start pipeline } else if (route.queryParamMap.get('FUNCTION') === 'BACKGROUND_SEARCH' && route.queryParamMap.get('SEARCHSTRING')) { return this.punchoutService.getOciPunchoutSearchData(route.queryParamMap.get('SEARCHSTRING')).pipe( tap(data => this.punchoutService.submitOciPunchoutData(data, false)), diff --git a/src/app/extensions/punchout/pages/account-punchout/account-punchout-page.component.html b/src/app/extensions/punchout/pages/account-punchout/account-punchout-page.component.html index be6702c23c..571a034e16 100644 --- a/src/app/extensions/punchout/pages/account-punchout/account-punchout-page.component.html +++ b/src/app/extensions/punchout/pages/account-punchout/account-punchout-page.component.html @@ -80,7 +80,7 @@

{{ 'account.punchout.oci.info.url.helptext' | translate }}

-

{{ ociPunchoutUrl }}

+

{{ ociPunchoutUrl$ | async }}

diff --git a/src/app/extensions/punchout/pages/account-punchout/account-punchout-page.component.spec.ts b/src/app/extensions/punchout/pages/account-punchout/account-punchout-page.component.spec.ts index 65c68dba83..daa8fd0e13 100644 --- a/src/app/extensions/punchout/pages/account-punchout/account-punchout-page.component.spec.ts +++ b/src/app/extensions/punchout/pages/account-punchout/account-punchout-page.component.spec.ts @@ -63,6 +63,9 @@ describe('Account Punchout Page Component', () => { when(punchoutFacade.punchoutUsersByRoute$()).thenReturn(of(users)); when(punchoutFacade.selectedPunchoutType$).thenReturn(of('oci')); when(appFacade.getRestEndpoint$).thenReturn(of('https://myBaseServerURL/INTERSHOP/rest/WFS/myChannel/rest')); + when(appFacade.getPipelineEndpoint$).thenReturn( + of('https://myBaseServerURL/INTERSHOP/web/WFS/myChannel/en_US/rest/USD') + ); when(punchoutFacade.punchoutLoading$).thenReturn(of(false)); }); @@ -114,4 +117,15 @@ describe('Account Punchout Page Component', () => { done(); }); }); + + it('should determine oci punchout url on init', done => { + fixture.detectChanges(); + + component.ociPunchoutUrl$.subscribe(url => { + expect(url).toMatchInlineSnapshot( + `"https://myBaseServerURL/INTERSHOP/web/WFS/myChannel/en_US/rest/USD/ViewOCICatalogPWA-Start?USERNAME=&PASSWORD=&HOOK_URL="` + ); + done(); + }); + }); }); diff --git a/src/app/extensions/punchout/pages/account-punchout/account-punchout-page.component.ts b/src/app/extensions/punchout/pages/account-punchout/account-punchout-page.component.ts index c59866a676..0799122bb9 100644 --- a/src/app/extensions/punchout/pages/account-punchout/account-punchout-page.component.ts +++ b/src/app/extensions/punchout/pages/account-punchout/account-punchout-page.component.ts @@ -21,8 +21,8 @@ export class AccountPunchoutPageComponent implements OnInit { loading$: Observable; error$: Observable; - ociPunchoutUrl = `${window.location.origin}/punchout?USERNAME=&PASSWORD=&HOOK_URL=`; cxmlPunchoutUrl$: Observable; + ociPunchoutUrl$: Observable; constructor( private accountFacade: AccountFacade, @@ -42,6 +42,9 @@ export class AccountPunchoutPageComponent implements OnInit { withLatestFrom(this.accountFacade.customer$), map(([url, customer]) => `${url}/customers/${customer?.customerNo}/punchouts/cxml1.2/setuprequest`) ); + this.ociPunchoutUrl$ = this.appFacade.getPipelineEndpoint$.pipe( + map(url => `${url}/ViewOCICatalogPWA-Start?USERNAME=&PASSWORD=&HOOK_URL=`) + ); } deleteUser(user: PunchoutUser) { diff --git a/src/app/extensions/punchout/services/punchout/punchout.service.ts b/src/app/extensions/punchout/services/punchout/punchout.service.ts index 2504e69ff4..719ee5260a 100644 --- a/src/app/extensions/punchout/services/punchout/punchout.service.ts +++ b/src/app/extensions/punchout/services/punchout/punchout.service.ts @@ -391,6 +391,8 @@ export class PunchoutService { * * @param productId The product id (SKU) of the product to validate. * @param quantity The quantity for the validation (default: '1'). + * + * @deprecated This functionality should be handled by the ICM pipeline `ViewOCICatalogPWA-Start`. */ getOciPunchoutProductData(productId: string, quantity = '1'): Observable[]> { if (!productId) { @@ -420,6 +422,8 @@ export class PunchoutService { * Gets a JSON object with the necessary OCI punchout data for the background search. * * @param searchString The search string to search punchout products. + * + * @deprecated This functionality should be handled by the ICM pipeline `ViewOCICatalogPWA-Start`. */ getOciPunchoutSearchData(searchString: string): Observable[]> { if (!searchString) {