Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(payments-plugin): prevent false positive logging #3195

Merged
merged 4 commits into from
Nov 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions packages/payments-plugin/src/mollie/mollie.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,12 @@ export class MollieService {
`Unable to find order ${mollieOrder.orderNumber}, unable to process Mollie order ${mollieOrder.id}`,
);
}
if (mollieOrder.status === OrderStatus.expired) {
// Expired is fine, a customer can retry the payment later
return;
}
if (order.orderPlacedAt) {
// Verify if the Vendure order isn't already paid for, and log if so
const paymentWithSameTransactionId = order.payments.find(
p => p.transactionId === mollieOrder.id && p.state === 'Settled',
);
Expand Down Expand Up @@ -293,10 +298,6 @@ export class MollieService {
return;
}
const amount = amountToCents(mollieOrder.amount);
if (mollieOrder.status === OrderStatus.expired) {
// Expired is fine, a customer can retry the payment later
return;
}
if (mollieOrder.status === OrderStatus.paid) {
// Paid is only used by 1-step payments without Authorized state. This will settle immediately
await this.addPayment(ctx, order, amount, mollieOrder, paymentMethod.code, 'Settled');
Expand Down
Loading