Skip to content

Commit

Permalink
The same goes for refunds of course
Browse files Browse the repository at this point in the history
  • Loading branch information
Daverball committed Feb 11, 2025
1 parent 0fd8e79 commit 58b8030
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/onegov/pay/models/payment_providers/worldline_saferpay.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,12 +340,13 @@ def refund(self, tx: SaferpayTransaction) -> SaferpayTransaction | None:
)
self.raise_for_status(res)
refund_tx = SaferpayTransaction.model_validate_json(res.content)
try:
# try to capture but if we can't don't stress about it
# they can try to manually capture it
self.capture(refund_tx, 'REFUND')
except Exception:
log.exception('Failed to capture Saferpay refund')
if refund_tx.status == 'AUTHORIZED':
try:

Check warning on line 344 in src/onegov/pay/models/payment_providers/worldline_saferpay.py

View check run for this annotation

Codecov / codecov/patch

src/onegov/pay/models/payment_providers/worldline_saferpay.py#L341-L344

Added lines #L341 - L344 were not covered by tests
# try to capture but if we can't don't stress about it
# they can try to manually capture it
self.capture(refund_tx, 'REFUND')
except Exception:
log.exception('Failed to capture Saferpay refund')
return refund_tx
elif tx.status == 'CANCELED':

Check warning on line 351 in src/onegov/pay/models/payment_providers/worldline_saferpay.py

View check run for this annotation

Codecov / codecov/patch

src/onegov/pay/models/payment_providers/worldline_saferpay.py#L347-L351

Added lines #L347 - L351 were not covered by tests
# transaction is already canceled
Expand Down

0 comments on commit 58b8030

Please sign in to comment.