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

fix: multiple paypal refund transactions bug #312

Merged
merged 2 commits into from
Dec 19, 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
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 @@
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

Check failure on line 94 in commerce_coordinator/apps/commercetools/tasks.py

View workflow job for this annotation

GitHub Actions / tests (ubuntu-20.04, 3.12, django42)

Missing coverage

Missing coverage on lines 91-94
updated_payment = client.create_return_payment_transaction(
payment_id=payment.id,
payment_version=payment.version,
Expand Down
Loading