Skip to content

Commit

Permalink
fix: fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
aht007 committed Dec 13, 2024
1 parent 8f8a4a8 commit 42d4730
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
3 changes: 1 addition & 2 deletions commerce_coordinator/apps/commercetools/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ def refund_from_stripe_task(
Celery task for a refund registered in Stripe dashboard and need to create
refund payment transaction record via Commercetools API.
"""
# Celery serializes stripe_refund to a dict, so we need to explictly convert it back to a Refund object
client = CommercetoolsAPIClient()
try:
payment = client.get_payment_by_key(payment_intent_id)
Expand All @@ -72,7 +71,7 @@ def refund_from_stripe_task(
return updated_payment
except CommercetoolsError as err:
logger.error(f"Unable to create refund transaction for payment [ {payment.id} ] "
f"on Stripe refund {stripe_refund.id} "
f"on Stripe refund {stripe_refund['id']} "
f"with error {err.errors} and correlation id {err.correlation_id}")
return None

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,7 @@ def test_create_refund_transaction_exception(self):

expected_message = (
f"[CommercetoolsError] Unable to create refund payment transaction for "
f"payment mock_payment_id and stripe refund {mock_stripe_refund.id} "
f"payment mock_payment_id and refund {mock_stripe_refund.id} "
f"- Correlation ID: {exception.correlation_id}, Details: {exception.errors}"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def test_correct_arguments_passed(self, mock_client):
mock_client().create_return_payment_transaction.assert_called_once_with(
payment_id=mock_payment.id,
payment_version=mock_payment.version,
stripe_refund=mock_stripe_refund
refund=mock_stripe_refund
)

def test_full_refund_already_exists(self, mock_client):
Expand Down

0 comments on commit 42d4730

Please sign in to comment.