From d3c498151b16f6acbe3128db23aab06449dd693b Mon Sep 17 00:00:00 2001 From: "Leftovers.today" <139936478+LeftoversTodayAppAdmin@users.noreply.github.com> Date: Tue, 15 Oct 2024 23:15:08 -0700 Subject: [PATCH] =?UTF-8?q?Revert=20"fix(payments-plugin):=20Use=20default?= =?UTF-8?q?=20channel=20in=20Stripe=20webhook=20calls=20to=20=E2=80=A6"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 84341115ae55032a567e6419eeacde432b7f4ff8. --- .../payments-plugin/src/stripe/stripe.controller.ts | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/packages/payments-plugin/src/stripe/stripe.controller.ts b/packages/payments-plugin/src/stripe/stripe.controller.ts index 2b59cc7c5f..0c80a5d512 100644 --- a/packages/payments-plugin/src/stripe/stripe.controller.ts +++ b/packages/payments-plugin/src/stripe/stripe.controller.ts @@ -1,6 +1,5 @@ import { Controller, Headers, HttpStatus, Post, Req, Res } from '@nestjs/common'; import type { PaymentMethod, RequestContext } from '@vendure/core'; -import { ChannelService } from '@vendure/core'; import { InternalServerError, LanguageCode, @@ -32,7 +31,6 @@ export class StripeController { private stripeService: StripeService, private requestContextService: RequestContextService, private connection: TransactionalConnection, - private channelService: ChannelService, ) {} @Post('stripe') @@ -59,7 +57,7 @@ export class StripeController { const { metadata: { channelToken, orderCode, orderId } = {} } = paymentIntent; const outerCtx = await this.createContext(channelToken, request); - await this.connection.withTransaction(outerCtx, async (ctx: RequestContext) => { + await this.connection.withTransaction(outerCtx, async ctx => { const order = await this.orderService.findOneByCode(ctx, orderCode); if (!order) { @@ -92,13 +90,8 @@ export class StripeController { } if (order.state !== 'ArrangingPayment') { - // Orders can switch channels (e.g., global to UK store), causing lookups by the original - // channel to fail. Using a default channel avoids "entity-with-id-not-found" errors. - // See https://github.com/vendure-ecommerce/vendure/issues/3072 - const defaultChannel = await this.channelService.getDefaultChannel(ctx); - const ctxWithDefaultChannel = await this.createContext(defaultChannel.token, request); const transitionToStateResult = await this.orderService.transitionToState( - ctxWithDefaultChannel, + ctx, orderId, 'ArrangingPayment', );