Skip to content

Commit fb2de27

Browse files
committed
fix(pagarme-v5): Double check pending transaction status to cancel by expiration
1 parent 0449b33 commit fb2de27

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

packages/apps/pagarme-v5/src/pagarme-cancel-expireds.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ export const cancelExpiredOrders = async () => {
3131
return app?.intermediator?.code === 'pagarme';
3232
});
3333
if (!transaction) return;
34+
if (transaction.status?.current !== 'pending') return;
3435
const transactionDate = transaction.created_at && new Date(transaction.created_at);
3536
if (!transactionDate) return;
3637
const paymentMethod = transaction.payment_method.code;
@@ -43,6 +44,7 @@ export const cancelExpiredOrders = async () => {
4344
} else {
4445
return;
4546
}
47+
logger.info(`Canceling order ${_id}`, { transaction });
4648
api.post(`orders/${_id}/payments_history`, {
4749
transaction_id: transaction._id,
4850
date_time: new Date().toISOString(),

0 commit comments

Comments
 (0)