Skip to content

Commit

Permalink
fix: multiple paypal refund transactions bug (#312)
Browse files Browse the repository at this point in the history
  • Loading branch information
syedsajjadkazmii authored Dec 19, 2024
1 parent e48d83f commit 33d054c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions commerce_coordinator/apps/commercetools/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ def refund_from_paypal_task(
client = CommercetoolsAPIClient()
try:
payment = client.get_payment_by_transaction_interaction_id(paypal_capture_id)
if has_full_refund_transaction(payment):
logger.info(f"PayPal payment.capture.refunded event received, but Payment with ID {payment.id} "
f"already has a refund with id:{refund.id}. Skipping task to add refund transaction.")
return None
updated_payment = client.create_return_payment_transaction(
payment_id=payment.id,
payment_version=payment.version,
Expand Down

0 comments on commit 33d054c

Please sign in to comment.