Selaa lähdekoodia

fix(core): Make CustomFulfillmentProcess injectable

Michael Bromley 5 vuotta sitten
vanhempi
sitoutus
8bce2b4391

+ 5 - 0
packages/core/e2e/fulfillment-process.e2e-spec.ts

@@ -163,6 +163,11 @@ describe('Fulfillment process', () => {
     });
     });
 
 
     describe('CustomFulfillmentProcess', () => {
     describe('CustomFulfillmentProcess', () => {
+        it('is injectable', () => {
+            expect(initSpy).toHaveBeenCalled();
+            expect(initSpy.mock.calls[0][0]).toBe('default');
+        });
+
         it('replaced transition target', async () => {
         it('replaced transition target', async () => {
             const { order } = await adminClient.query<
             const { order } = await adminClient.query<
                 GetOrderFulfillments.Query,
                 GetOrderFulfillments.Query,

+ 2 - 0
packages/core/src/config/config.module.ts

@@ -92,6 +92,7 @@ export class ConfigModule implements OnApplicationBootstrap, OnApplicationShutdo
             orderCodeStrategy,
             orderCodeStrategy,
             stockAllocationStrategy,
             stockAllocationStrategy,
         } = this.configService.orderOptions;
         } = this.configService.orderOptions;
+        const { customFulfillmentProcess } = this.configService.shippingOptions;
         const { entityIdStrategy } = this.configService;
         const { entityIdStrategy } = this.configService;
         return [
         return [
             ...adminAuthenticationStrategy,
             ...adminAuthenticationStrategy,
@@ -108,6 +109,7 @@ export class ConfigModule implements OnApplicationBootstrap, OnApplicationShutdo
             productVariantPriceCalculationStrategy,
             productVariantPriceCalculationStrategy,
             orderItemPriceCalculationStrategy,
             orderItemPriceCalculationStrategy,
             ...process,
             ...process,
+            ...customFulfillmentProcess,
             stockAllocationStrategy,
             stockAllocationStrategy,
         ];
         ];
     }
     }