mirror of
https://github.com/pretix/pretix.git
synced 2026-05-05 15:14:04 +00:00
Bank Transfer: Fix weird error code on duplicate match (Z#23164140) (#4428)
This commit is contained in:
@@ -162,6 +162,21 @@ def _handle_transaction(trans: BankTransaction, matches: tuple, event: Event = N
|
||||
else:
|
||||
trans.order = orders[0]
|
||||
|
||||
if len(orders) > 1:
|
||||
# Multi-match! Can we split this automatically?
|
||||
order_pending_sum = sum(o.pending_sum for o in orders)
|
||||
if order_pending_sum != trans.amount:
|
||||
# we can't :( this needs to be dealt with by a human
|
||||
trans.state = BankTransaction.STATE_NOMATCH
|
||||
trans.message = gettext_noop('Automatic split to multiple orders not possible.')
|
||||
trans.save()
|
||||
return
|
||||
|
||||
# we can!
|
||||
splits = [(o, o.pending_sum) for o in orders]
|
||||
else:
|
||||
splits = [(orders[0], trans.amount)]
|
||||
|
||||
for o in orders:
|
||||
if o.status == Order.STATUS_PAID and o.pending_sum <= Decimal('0.00'):
|
||||
trans.state = BankTransaction.STATE_DUPLICATE
|
||||
@@ -179,21 +194,6 @@ def _handle_transaction(trans: BankTransaction, matches: tuple, event: Event = N
|
||||
trans.save()
|
||||
return
|
||||
|
||||
if len(orders) > 1:
|
||||
# Multi-match! Can we split this automatically?
|
||||
order_pending_sum = sum(o.pending_sum for o in orders)
|
||||
if order_pending_sum != trans.amount:
|
||||
# we can't :( this needs to be dealt with by a human
|
||||
trans.state = BankTransaction.STATE_NOMATCH
|
||||
trans.message = gettext_noop('Automatic split to multiple orders not possible.')
|
||||
trans.save()
|
||||
return
|
||||
|
||||
# we can!
|
||||
splits = [(o, o.pending_sum) for o in orders]
|
||||
else:
|
||||
splits = [(orders[0], trans.amount)]
|
||||
|
||||
trans.state = BankTransaction.STATE_VALID
|
||||
for order, amount in splits:
|
||||
info_data = {
|
||||
|
||||
Reference in New Issue
Block a user