mirror of
https://github.com/pretix/pretix.git
synced 2026-05-04 15:04:03 +00:00
Bank transfer: Allow using external IDs for deduplication (#3803)
* Bank transfer: Allow using external IDs for deduplication * Do not use empty string in nullable field
This commit is contained in:
@@ -75,6 +75,7 @@ RES_JOB = {
|
||||
'checksum': '',
|
||||
'iban': '',
|
||||
'bic': '',
|
||||
'external_id': None,
|
||||
'amount': '0.00',
|
||||
'date': 'unknown',
|
||||
'state': 'error',
|
||||
|
||||
@@ -693,3 +693,66 @@ def test_refund_handling_pending_refund(env, orga_job, orga_job2):
|
||||
r.refresh_from_db()
|
||||
assert env[2].payments.count() == 1
|
||||
assert r.state == OrderRefund.REFUND_STATE_DONE
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_ignore_by_checksum(env, job):
|
||||
process_banktransfers(job, [{
|
||||
'payer': 'Karla Kundin',
|
||||
'reference': 'Bestellung DUMMY6789Z',
|
||||
'date': '2016-01-26',
|
||||
'amount': '23.00'
|
||||
}])
|
||||
with scopes_disabled():
|
||||
assert BankTransaction.objects.count() == 1
|
||||
|
||||
process_banktransfers(job, [{
|
||||
'payer': 'Karla Kundin',
|
||||
'reference': 'Bestellung DUMMY6789Z',
|
||||
'date': '2016-01-26',
|
||||
'amount': '23.00'
|
||||
}])
|
||||
with scopes_disabled():
|
||||
assert BankTransaction.objects.count() == 1
|
||||
|
||||
process_banktransfers(job, [{
|
||||
'payer': 'Karla Kundin',
|
||||
'reference': 'Bestellung DUMMY6789Z',
|
||||
'date': '2016-01-27',
|
||||
'amount': '23.00'
|
||||
}])
|
||||
with scopes_disabled():
|
||||
assert BankTransaction.objects.count() == 2
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_ignore_by_external_id(env, job):
|
||||
process_banktransfers(job, [{
|
||||
'payer': 'Karla Kundin',
|
||||
'reference': 'Bestellung DUMMY6789Z',
|
||||
'external_id': 'abcd12345',
|
||||
'date': '2016-01-26',
|
||||
'amount': '23.00'
|
||||
}])
|
||||
with scopes_disabled():
|
||||
assert BankTransaction.objects.count() == 1
|
||||
|
||||
process_banktransfers(job, [{
|
||||
'payer': 'Karla Kundin',
|
||||
'reference': 'Completely different reference because banks are weird',
|
||||
'external_id': 'abcd12345',
|
||||
'date': '2016-01-26',
|
||||
'amount': '23.00'
|
||||
}])
|
||||
with scopes_disabled():
|
||||
assert BankTransaction.objects.count() == 1
|
||||
|
||||
process_banktransfers(job, [{
|
||||
'payer': 'Karla Kundin',
|
||||
'reference': 'Same ID with different amount because banks are weird',
|
||||
'external_id': 'abcd12345',
|
||||
'date': '2016-01-26',
|
||||
'amount': '24.00'
|
||||
}])
|
||||
with scopes_disabled():
|
||||
assert BankTransaction.objects.count() == 2
|
||||
|
||||
Reference in New Issue
Block a user