PPv2: Fix processing of purchase_units without payments

This commit is contained in:
Martin Gross
2026-02-20 16:50:34 +01:00
parent 6d8a9854f9
commit 028a41f3e4

View File

@@ -791,6 +791,7 @@ class PaypalMethod(BasePaymentProvider):
any_captures = False any_captures = False
all_captures_completed = True all_captures_completed = True
for purchaseunit in pp_captured_order.purchase_units: for purchaseunit in pp_captured_order.purchase_units:
if hasattr(purchaseunit, 'payments'):
for capture in purchaseunit.payments.captures: for capture in purchaseunit.payments.captures:
try: try:
ReferencedPayPalObject.objects.get_or_create(order=payment.order, payment=payment, reference=capture.id) ReferencedPayPalObject.objects.get_or_create(order=payment.order, payment=payment, reference=capture.id)