forked from CGM_Public/pretix_original
Banktransfer: Notify incomplete payments after manual assignment (Z#23241009)
This commit is contained in:
@@ -73,7 +73,9 @@ from pretix.plugins.banktransfer.payment import BankTransfer
|
||||
from pretix.plugins.banktransfer.refund_export import (
|
||||
build_sepa_xml, get_refund_export_csv,
|
||||
)
|
||||
from pretix.plugins.banktransfer.tasks import process_banktransfers
|
||||
from pretix.plugins.banktransfer.tasks import (
|
||||
notify_incomplete_payment, process_banktransfers,
|
||||
)
|
||||
|
||||
logger = logging.getLogger('pretix.plugins.banktransfer')
|
||||
|
||||
@@ -165,6 +167,11 @@ class ActionView(View):
|
||||
provider='banktransfer',
|
||||
state__in=(OrderPayment.PAYMENT_STATE_CREATED, OrderPayment.PAYMENT_STATE_PENDING),
|
||||
).update(state=OrderPayment.PAYMENT_STATE_CANCELED)
|
||||
|
||||
trans.order.refresh_from_db()
|
||||
if trans.order.pending_sum > Decimal('0.00') and trans.order.status == Order.STATUS_PENDING:
|
||||
notify_incomplete_payment(trans.order)
|
||||
|
||||
return JsonResponse({
|
||||
'status': 'ok',
|
||||
})
|
||||
|
||||
@@ -50,6 +50,7 @@ def env():
|
||||
datetime=now(), expires=now() + timedelta(days=10),
|
||||
total=23,
|
||||
sales_channel=o.sales_channels.get(identifier="web"),
|
||||
email='dummy@dummy.dummy'
|
||||
)
|
||||
o2 = Order.objects.create(
|
||||
code='6789Z', event=event,
|
||||
@@ -129,7 +130,7 @@ def test_assign_order_unknown(env, client):
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_assign_order_amount_incorrect(env, client):
|
||||
def test_assign_order_amount_incorrect(env, client, mailoutbox):
|
||||
job = BankImportJob.objects.create(event=env[0])
|
||||
trans = BankTransaction.objects.create(event=env[0], import_job=job, payer='Foo',
|
||||
state=BankTransaction.STATE_NOMATCH,
|
||||
@@ -141,6 +142,7 @@ def test_assign_order_amount_incorrect(env, client):
|
||||
assert r['status'] == 'ok'
|
||||
trans.refresh_from_db()
|
||||
assert trans.state == BankTransaction.STATE_VALID
|
||||
assert len(mailoutbox) == 1
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
|
||||
Reference in New Issue
Block a user