Quellcode durchsuchen

Merge branch 'master' into minor

Michael Bromley vor 4 Jahren
Ursprung
Commit
f9f2323a00

+ 2 - 2
docs/content/developer-guide/payment-integrations/index.md

@@ -27,7 +27,7 @@ This two-step workflow can also be applied to other non-card forms of payment: e
 Payment integrations are created by defining a new [PaymentMethodHandler]({{< relref "payment-method-handler" >}}) and passing that handler into the [`paymentOptions.paymentMethodHandlers`]({{< relref "payment-options" >}}) array in the VendureConfig.
 
 ```TypeScript
-import { PaymentMethodHandler, VendureConfig, CreatePaymentResult, SettlePaymentResult } from '@vendure/core';
+import { PaymentMethodHandler, VendureConfig, CreatePaymentResult, SettlePaymentResult, SettlePaymentErrorResult } from '@vendure/core';
 import { sdk } from 'payment-provider-sdk';
 
 /**
@@ -80,7 +80,7 @@ const myPaymentIntegration = new PaymentMethodHandler({
   },
 
   /** This is called when the `settlePayment` mutation is executed */
-  settlePayment: async (ctx, order, payment, args): Promise<SettlePaymentResult> => {
+  settlePayment: async (ctx, order, payment, args): Promise<SettlePaymentResult | SettlePaymentErrorResult> => {
     try {
       const result = await sdk.charges.capture({ 
         apiKey: args.apiKey,

+ 6 - 1
packages/core/src/service/services/customer.service.ts

@@ -376,10 +376,15 @@ export class CustomerService {
         if (isGraphQlErrorResult(result)) {
             return result;
         }
-        const customer = await this.findOneByUserId(ctx, result.id);
+        const customer = await this.findOneByUserId(ctx, result.id, false);
         if (!customer) {
             throw new InternalServerError('error.cannot-locate-customer-for-user');
         }
+        if (ctx.channelId) {
+            await this.channelService.assignToChannels(ctx, Customer, customer.id, [
+                ctx.channelId,
+            ]);
+        }
         await this.historyService.createHistoryEntryForCustomer({
             customerId: customer.id,
             ctx,

+ 12 - 2
packages/dev-server/dev-config.ts

@@ -2,7 +2,14 @@
 import { AdminUiPlugin } from '@vendure/admin-ui-plugin';
 import { AssetServerPlugin } from '@vendure/asset-server-plugin';
 import { ADMIN_API_PATH, API_PORT, SHOP_API_PATH } from '@vendure/common/lib/shared-constants';
-import { DefaultJobQueuePlugin, DefaultLogger, DefaultSearchPlugin, dummyPaymentHandler, LogLevel, VendureConfig, } from '@vendure/core';
+import {
+    DefaultJobQueuePlugin,
+    DefaultLogger,
+    DefaultSearchPlugin,
+    dummyPaymentHandler,
+    LogLevel,
+    VendureConfig,
+} from '@vendure/core';
 import { defaultEmailHandlers, EmailPlugin } from '@vendure/email-plugin';
 import path from 'path';
 import { ConnectionOptions } from 'typeorm';
@@ -33,6 +40,9 @@ export const devConfig: VendureConfig = {
         tokenMethod: 'cookie',
         requireVerification: true,
         customPermissions: [],
+        cookieOptions: {
+            secret: 'abc',
+        },
     },
     dbConnectionOptions: {
         synchronize: false,
@@ -44,7 +54,7 @@ export const devConfig: VendureConfig = {
         paymentMethodHandlers: [dummyPaymentHandler],
     },
     customFields: {},
-    logger: new DefaultLogger({level: LogLevel.Info}),
+    logger: new DefaultLogger({ level: LogLevel.Info }),
     importExportOptions: {
         importAssetsDir: path.join(__dirname, 'import-assets'),
     },