From aa28b64212e202fab523a8b6dc65a3663ce93171 Mon Sep 17 00:00:00 2001 From: Jacky Ng Date: Tue, 27 Aug 2024 21:07:06 -0500 Subject: [PATCH] fix: replace pi with txn id --- commerce_coordinator/apps/commercetools/clients.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/commerce_coordinator/apps/commercetools/clients.py b/commerce_coordinator/apps/commercetools/clients.py index 3ff4881fe..568dfbf08 100644 --- a/commerce_coordinator/apps/commercetools/clients.py +++ b/commerce_coordinator/apps/commercetools/clients.py @@ -401,20 +401,20 @@ def update_return_payment_state_after_successful_refund(self, order_id: str, if not payment_intent_id: payment_intent_id = '' logger.info(f'Creating return for order - payment_intent_id: {payment_intent_id}') + + payment = self.get_payment_by_key(payment_intent_id) + logger.info(f"Payment found: {payment}") + order = self.get_order_by_id(order_id=order_id) + transaction_id = find_refund_transaction(order, amount_in_cents) update_transaction_id_action = OrderSetReturnItemCustomTypeAction( return_item_id=return_line_item_return_id, type=CTTypeResourceIdentifier( key='returnItemCustomType', ), fields=CTFieldContainer({ - 'transactionId': payment_intent_id + 'transactionId': transaction_id }) ) - payment = self.get_payment_by_key(payment_intent_id) - logger.info(f"Payment found: {payment}") - order = self.get_order_by_id(order_id=order_id) - transaction_id = find_refund_transaction(order, amount_in_cents) - return_transaction_return_item_action = PaymentSetTransactionCustomTypeAction( transaction_id=transaction_id, type=CTTypeResourceIdentifier(key='transactionCustomType'),