Browse Source

fix(core): Make CustomPaymentProcess injectable

Michael Bromley 5 years ago
parent
commit
a0a93528ca

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

@@ -93,6 +93,7 @@ export class ConfigModule implements OnApplicationBootstrap, OnApplicationShutdo
             stockAllocationStrategy,
         } = this.configService.orderOptions;
         const { customFulfillmentProcess } = this.configService.shippingOptions;
+        const { customPaymentProcess } = this.configService.paymentOptions;
         const { entityIdStrategy } = this.configService;
         return [
             ...adminAuthenticationStrategy,
@@ -110,6 +111,7 @@ export class ConfigModule implements OnApplicationBootstrap, OnApplicationShutdo
             orderItemPriceCalculationStrategy,
             ...process,
             ...customFulfillmentProcess,
+            ...customPaymentProcess,
             stockAllocationStrategy,
         ];
     }

+ 2 - 2
packages/core/src/config/config.service.ts

@@ -83,8 +83,8 @@ export class ConfigService implements VendureConfig {
         return this.activeConfig.orderOptions as Required<OrderOptions>;
     }
 
-    get paymentOptions(): PaymentOptions {
-        return this.activeConfig.paymentOptions;
+    get paymentOptions(): Required<PaymentOptions> {
+        return this.activeConfig.paymentOptions as Required<PaymentOptions>;
     }
 
     get taxOptions(): Required<TaxOptions> {

+ 1 - 0
packages/core/src/config/index.ts

@@ -31,6 +31,7 @@ export * from './order/use-guest-strategy';
 export * from './order/use-guest-if-existing-empty-strategy';
 export * from './order/order-item-price-calculation-strategy';
 export * from './order/stock-allocation-strategy';
+export * from './payment/custom-payment-process';
 export * from './payment/dummy-payment-method-handler';
 export * from './payment/example-payment-method-handler';
 export * from './payment/payment-method-handler';

+ 1 - 0
packages/core/src/config/payment/payment-method-handler.ts

@@ -290,6 +290,7 @@ export class PaymentMethodHandler<T extends ConfigArgs = ConfigArgs> extends Con
         );
         return {
             method: this.code,
+            metadata: {},
             ...paymentConfig,
         };
     }

+ 0 - 0
packages/dev-server/vendure.sqlite-shm


+ 0 - 0
packages/dev-server/vendure.sqlite-wal