Skip to content

Commit

Permalink
fix(payments-plugin): Improve Mollie ignore order states (#2670)
Browse files Browse the repository at this point in the history
  • Loading branch information
martijnvdbrug authored Feb 14, 2024
1 parent cce90d6 commit f02fc56
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion packages/payments-plugin/src/mollie/mollie.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
Logger,
Order,
OrderService,
OrderState,
OrderStateTransitionError,
PaymentMethod,
PaymentMethodService,
Expand Down Expand Up @@ -226,7 +227,15 @@ export class MollieService {
`Unable to find order ${mollieOrder.orderNumber}, unable to process Mollie order ${mollieOrder.id}`,
);
}
if (order.state === 'PaymentSettled' || order.state === 'Shipped' || order.state === 'Delivered') {
const statesThatRequireAction: OrderState[] = [
'AddingItems',
'ArrangingPayment',
'ArrangingAdditionalPayment',
'PaymentAuthorized',
'Draft',
];
if (!statesThatRequireAction.includes(order.state)) {
// If order is not in one of these states, we don't need to handle the Mollie webhook
Logger.info(
`Order ${order.code} is already '${order.state}', no need for handling Mollie status '${mollieOrder.status}'`,
loggerCtx,
Expand Down

0 comments on commit f02fc56

Please sign in to comment.