+
diff --git a/projects/requisition-management/src/app/pages/requisition-detail/requisition-detail-page.component.spec.ts b/projects/requisition-management/src/app/pages/requisition-detail/requisition-detail-page.component.spec.ts
index f03f173ca7..e07c7c85e4 100644
--- a/projects/requisition-management/src/app/pages/requisition-detail/requisition-detail-page.component.spec.ts
+++ b/projects/requisition-management/src/app/pages/requisition-detail/requisition-detail-page.component.spec.ts
@@ -2,12 +2,12 @@ import { ComponentFixture, TestBed } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { FaIconComponent } from '@fortawesome/angular-fontawesome';
import { TranslateModule } from '@ngx-translate/core';
-import { MockComponent, MockDirective } from 'ng-mocks';
+import { MockComponent, MockDirective, MockPipe } from 'ng-mocks';
import { of } from 'rxjs';
import { instance, mock, when } from 'ts-mockito';
import { AuthorizationToggleDirective } from 'ish-core/directives/authorization-toggle.directive';
-import { FeatureToggleModule } from 'ish-core/feature-toggle.module';
+import { ServerSettingPipe } from 'ish-core/pipes/server-setting.pipe';
import { findAllCustomElements } from 'ish-core/utils/dev/html-query-utils';
import { AddressComponent } from 'ish-shared/components/address/address/address.component';
import { BasketCostSummaryComponent } from 'ish-shared/components/basket/basket-cost-summary/basket-cost-summary.component';
@@ -34,7 +34,7 @@ describe('Requisition Detail Page Component', () => {
context = mock(RequisitionContextFacade);
await TestBed.configureTestingModule({
- imports: [FeatureToggleModule.forTesting('messageToMerchant'), RouterTestingModule, TranslateModule.forRoot()],
+ imports: [RouterTestingModule, TranslateModule.forRoot()],
declarations: [
MockComponent(AddressComponent),
MockComponent(BasketCostSummaryComponent),
@@ -47,6 +47,7 @@ describe('Requisition Detail Page Component', () => {
MockComponent(RequisitionRejectDialogComponent),
MockComponent(RequisitionSummaryComponent),
MockDirective(AuthorizationToggleDirective),
+ MockPipe(ServerSettingPipe, path => path === 'shipping.messageToMerchant'),
RequisitionDetailPageComponent,
],
})
diff --git a/src/app/core/core.module.ts b/src/app/core/core.module.ts
index 62416b3801..33f70302c4 100644
--- a/src/app/core/core.module.ts
+++ b/src/app/core/core.module.ts
@@ -30,6 +30,8 @@ import { DefaultErrorHandler } from './utils/default-error-handler';
StateManagementModule,
],
providers: [
+ // include the ICMCompatibilityInterceptor to add support for REST API changes (e.g. messageToMerchant)
+ // { provide: HTTP_INTERCEPTORS, useClass: ICMCompatibilityInterceptor, multi: true },
{ provide: HTTP_INTERCEPTORS, useClass: PGIDChangeInterceptor, multi: true },
{ provide: HTTP_INTERCEPTORS, useClass: ICMErrorMapperInterceptor, multi: true },
{
diff --git a/src/app/core/interceptors/icm-compatibility.interceptor.ts b/src/app/core/interceptors/icm-compatibility.interceptor.ts
new file mode 100644
index 0000000000..787894fe3f
--- /dev/null
+++ b/src/app/core/interceptors/icm-compatibility.interceptor.ts
@@ -0,0 +1,31 @@
+import { HttpEvent, HttpHandler, HttpInterceptor, HttpRequest, HttpResponse } from '@angular/common/http';
+import { Injectable } from '@angular/core';
+import { Observable, map, withLatestFrom } from 'rxjs';
+
+import { FeatureToggleService } from 'ish-core/feature-toggle.module';
+
+// not-dead-code
+/**
+ * provides a compatibility layer for REST API changes in newer ICM versions
+ * please enable the interceptor in the `core.module.ts` if needed
+ * e.g. `messageToMerchant` is no longer an environment feature toggle in ICM 11 but controlled by the configurations call
+ */
+@Injectable()
+export class ICMCompatibilityInterceptor implements HttpInterceptor {
+ constructor(private featureToggleService: FeatureToggleService) {}
+
+ intercept(req: HttpRequest
, next: HttpHandler): Observable> {
+ if (req.url.endsWith('/configurations') && req instanceof HttpRequest) {
+ return next.handle(req).pipe(
+ withLatestFrom(this.featureToggleService.enabled$('messageToMerchant')),
+ map(([event, messageToMerchant]) => {
+ if (event instanceof HttpResponse && messageToMerchant && event.body?.data?.shipping) {
+ event.body.data.shipping.messageToMerchant = true;
+ }
+ return event;
+ })
+ );
+ }
+ return next.handle(req);
+ }
+}
diff --git a/src/app/pages/account-order/account-order/account-order.component.html b/src/app/pages/account-order/account-order/account-order.component.html
index 7297728ad3..7875209b73 100644
--- a/src/app/pages/account-order/account-order/account-order.component.html
+++ b/src/app/pages/account-order/account-order/account-order.component.html
@@ -48,7 +48,7 @@ {{ 'account.orderdetails.heading.default' | translate }}
-