fix(core-flows): capture before order created (#9980)
What: When `autocapture` is enabled, the webhook is processed before the order was created. The payment processing workflows were merged into a single one FIXES: SUP-118, SUP-9 https://github.com/medusajs/medusa/issues/9998
This commit is contained in:
@@ -1,7 +1,4 @@
|
||||
import {
|
||||
onPaymentProcessedWorkflow,
|
||||
processPaymentWorkflow,
|
||||
} from "@medusajs/core-flows"
|
||||
import { processPaymentWorkflow } from "@medusajs/core-flows"
|
||||
import {
|
||||
IPaymentModuleService,
|
||||
ProviderWebhookPayload,
|
||||
@@ -29,7 +26,7 @@ export default async function paymentWebhookhandler({
|
||||
const input = event.data
|
||||
|
||||
if (
|
||||
(input.payload.rawData as unknown as SerializedBuffer).type === "Buffer"
|
||||
(input.payload?.rawData as unknown as SerializedBuffer)?.type === "Buffer"
|
||||
) {
|
||||
input.payload.rawData = Buffer.from(
|
||||
(input.payload.rawData as unknown as SerializedBuffer).data
|
||||
@@ -49,11 +46,6 @@ export default async function paymentWebhookhandler({
|
||||
await processPaymentWorkflow(container).run({
|
||||
input: processedEvent,
|
||||
})
|
||||
|
||||
// We process the intended side effects of payment processing separately.
|
||||
await onPaymentProcessedWorkflow(container).run({
|
||||
input: processedEvent,
|
||||
})
|
||||
}
|
||||
|
||||
export const config: SubscriberConfig = {
|
||||
|
||||
Reference in New Issue
Block a user