mirror of
https://github.com/pretix/pretix.git
synced 2026-05-03 14:54:04 +00:00
PayPal refunds: Actively fetch sale ID if not known (#2134)
Co-authored-by: Martin Gross <gross@rami.io>
This commit is contained in:
@@ -533,6 +533,14 @@ class Paypal(BasePaymentProvider):
|
||||
sale = paypalrestsdk.Sale.find(v['id'])
|
||||
break
|
||||
|
||||
if not sale:
|
||||
pp_payment = paypalrestsdk.Payment.find(refund.payment.info_data['id'])
|
||||
for res in pp_payment.transactions[0].related_resources:
|
||||
for k, v in res.to_dict().items():
|
||||
if k == 'sale':
|
||||
sale = paypalrestsdk.Sale.find(v['id'])
|
||||
break
|
||||
|
||||
pp_refund = sale.refund({
|
||||
"amount": {
|
||||
"total": self.format_price(refund.amount),
|
||||
|
||||
Reference in New Issue
Block a user