Allow to create a new gift card when refunding

This commit is contained in:
Raphael Michel
2019-11-28 10:13:39 +01:00
parent 46d4d97c13
commit 5462e256ac
5 changed files with 105 additions and 5 deletions

View File

@@ -1149,7 +1149,7 @@ class GiftCardPayment(BasePaymentProvider):
@transaction.atomic()
def execute_refund(self, refund: OrderRefund):
from .models import GiftCard
gc = GiftCard.objects.get(pk=refund.payment.info_data.get('gift_card'))
gc = GiftCard.objects.get(pk=refund.info_data.get('gift_card') or refund.payment.info_data.get('gift_card'))
trans = gc.transactions.create(
value=refund.amount,
order=refund.order,