Fix crash if gift card does not exist

This commit is contained in:
Raphael Michel
2020-07-17 17:44:01 +02:00
parent 5c1fe6f68c
commit e439b20618

View File

@@ -1062,7 +1062,10 @@ class GiftCardPayment(BasePaymentProvider):
def api_payment_details(self, payment: OrderPayment):
from .models import GiftCard
gc = GiftCard.objects.get(pk=payment.info_data.get('gift_card'))
try:
gc = GiftCard.objects.get(pk=payment.info_data.get('gift_card'))
except GiftCard.DoesNotExist:
return {}
return {
'gift_card': {
'id': gc.pk,