forked from CGM_Public/pretix_original
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'])
|
sale = paypalrestsdk.Sale.find(v['id'])
|
||||||
break
|
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({
|
pp_refund = sale.refund({
|
||||||
"amount": {
|
"amount": {
|
||||||
"total": self.format_price(refund.amount),
|
"total": self.format_price(refund.amount),
|
||||||
|
|||||||
Reference in New Issue
Block a user