I successfully set up a Mollie Payment provider, and I implemented the getWebhookActionAndData as follow:
switch (status) {
case PaymentStatus.authorized:
return {
action: PaymentActions.AUTHORIZED,
data: baseData,
};
case PaymentStatus.paid:
return {
action: PaymentActions.SUCCESSFUL,
data: baseData,
};
case PaymentStatus.expired:
case PaymentStatus.failed:
return {
action: PaymentActions.FAILED,
data: baseData,
};
case PaymentStatus.canceled:
return {
action: PaymentActions.CANCELED,
data: baseData,
};
case PaymentStatus.pending:
return {
action: PaymentActions.PENDING,
data: baseData,
};
case PaymentStatus.open:
return {
action: PaymentActions.REQUIRES_MORE,
data: baseData,
};
default:
return {
action: PaymentActions.NOT_SUPPORTED,
data: baseData,
};
}
For the authorized and captured states everything works great. But for failed and cancelled, this function runs just fine, but Medusa just ignores the result?
I already found the source code that handles the return value of this function here: https://github.com/medusajs/medusa/blob/2e65f7ffc0fa360bbd211d41fac8384c240848cc/packages/medusa/src/subscribers/payment-webhook.ts#L38
And it specifically ignores everything but the authorized or captured states...
How are you supposed to show errors in the UI when the webhook call is ignored for errors and cancel states?