示例#1
0
def test_ignore_canceled(env, job):
    process_banktransfers(job, [{
        'payer': 'Karla Kundin',
        'reference': 'Bestellung DUMMY6789Z',
        'date': '2016-01-26',
        'amount': '23.00'
    }])
    env[3].refresh_from_db()
    assert env[3].status == Order.STATUS_CANCELED
示例#2
0
def test_end_comma(env, job):
    process_banktransfers(job, [{
        'payer': 'Karla Kundin',
        'reference': 'Bestellung DUMMY12345,NEXTLINE',
        'amount': '23.00',
        'date': '2016-01-26',
    }])
    env[2].refresh_from_db()
    assert env[2].status == Order.STATUS_PAID
示例#3
0
def test_mark_paid_organizer(env, orga_job):
    process_banktransfers(orga_job, [{
        'payer': 'Karla Kundin',
        'reference': 'Bestellung DUMMY-1234S',
        'date': '2016-01-26',
        'amount': '23.00'
    }])
    env[2].refresh_from_db()
    assert env[2].status == Order.STATUS_PAID
示例#4
0
def test_check_amount(env, job):
    process_banktransfers(job, [{
        'payer': 'Karla Kundin',
        'reference': 'Bestellung DUMMY1Z3AS',
        'date': '2016-01-26',
        'amount': '23.50'
    }])
    env[2].refresh_from_db()
    assert env[2].status == Order.STATUS_PENDING
示例#5
0
def test_autocorrection(env, job):
    process_banktransfers(env[0].pk, job, [{
        'payer': 'Karla Kundin',
        'reference': 'Bestellung DUMMY12345',
        'amount': '23.00',
        'date': '2016-01-26',
    }])
    env[2].refresh_from_db()
    assert env[2].status == Order.STATUS_PAID
示例#6
0
def test_keep_unmatched(env, orga_job):
    process_banktransfers(orga_job, [{
        'payer': 'Karla Kundin',
        'reference': 'No useful reference',
        'date': '2016-01-26',
        'amount': '23.00'
    }])
    job = BankImportJob.objects.last()
    t = job.transactions.last()
    assert t.state == BankTransaction.STATE_NOMATCH
示例#7
0
def test_mark_paid_organizer_dash_in_slug(env, orga_job):
    env[0].slug = "foo-bar"
    env[0].save()
    process_banktransfers(orga_job, [{
        'payer': 'Karla Kundin',
        'reference': 'Bestellung FOO-BAR-1234S',
        'date': '2016-01-26',
        'amount': '23.00'
    }])
    env[2].refresh_from_db()
    assert env[2].status == Order.STATUS_PAID
示例#8
0
def test_mark_paid_organizer_varying_order_code_length(env, orga_job):
    env[2].code = "123412341234"
    env[2].save()
    process_banktransfers(orga_job, [{
        'payer': 'Karla Kundin',
        'reference': 'Bestellung DUMMY-123412341234',
        'date': '2016-01-26',
        'amount': '23.00'
    }])
    env[2].refresh_from_db()
    assert env[2].status == Order.STATUS_PAID
示例#9
0
def test_huge_amount(env, job):
    env[2].total = Decimal('23000.00')
    env[2].save()
    process_banktransfers(job, [{
        'payer': 'Karla Kundin',
        'reference': 'Bestellung DUMMY12345',
        'amount': '23.000,00',
        'date': '2016-01-26',
    }])
    env[2].refresh_from_db()
    assert env[2].status == Order.STATUS_PAID
示例#10
0
def test_mark_paid(env, job):
    djmail.outbox = []
    process_banktransfers(job, [{
        'payer': 'Karla Kundin',
        'reference': 'Bestellung DUMMY1234S',
        'date': '2016-01-26',
        'amount': '23.00'
    }])
    env[2].refresh_from_db()
    assert env[2].status == Order.STATUS_PAID
    assert len(djmail.outbox) == 1
    assert djmail.outbox[0].subject == 'Payment received for your order: 1Z3AS'
示例#11
0
def test_wrong_event_organizer(env, orga_job):
    Event.objects.create(
        organizer=env[0].organizer, name='Wrong', slug='wrong',
        date_from=now(), plugins='pretix.plugins.banktransfer'
    )
    process_banktransfers(orga_job, [{
        'payer': 'Karla Kundin',
        'reference': 'Bestellung WRONG-1234S',
        'date': '2016-01-26',
        'amount': '23.00'
    }])
    env[2].refresh_from_db()
    assert env[2].status == Order.STATUS_PENDING
示例#12
0
def test_overpaid(env, job):
    process_banktransfers(job, [{
        'payer': 'Karla Kundin',
        'reference': 'Bestellung DUMMY1Z3AS',
        'date': '2016-01-26',
        'amount': '23.50'
    }])
    env[2].refresh_from_db()
    assert env[2].status == Order.STATUS_PAID
    p = env[2].payments.last()
    assert p.amount == Decimal('23.50')
    assert p.state == OrderPayment.PAYMENT_STATE_CONFIRMED
    assert env[2].pending_sum == Decimal('-0.50')
示例#13
0
def test_underpaid(env, job):
    djmail.outbox = []
    process_banktransfers(job, [{
        'payer': 'Karla Kundin',
        'reference': 'Bestellung DUMMY1Z3AS',
        'date': '2016-01-26',
        'amount': '22.50'
    }])
    env[2].refresh_from_db()
    assert env[2].status == Order.STATUS_PENDING
    p = env[2].payments.last()
    assert p.amount == Decimal('22.50')
    assert p.state == OrderPayment.PAYMENT_STATE_CONFIRMED
    assert env[2].pending_sum == Decimal('0.50')

    assert len(djmail.outbox) == 1
    assert djmail.outbox[0].subject == 'Your order received an incomplete payment: 1Z3AS'
示例#14
0
def test_in_parts(env, job):
    process_banktransfers(job, [{
        'payer': 'Karla Kundin',
        'reference': 'Bestellung DUMMY1Z3AS',
        'date': '2016-01-26',
        'amount': '10.00'
    }])
    process_banktransfers(job, [{
        'payer': 'Karla Kundin',
        'reference': 'Bestellung DUMMY1Z3AS',
        'date': '2016-01-26',
        'amount': '13.00'
    }])
    env[2].refresh_from_db()
    assert env[2].status == Order.STATUS_PAID
    assert env[2].payments.count() == 2
    assert env[2].pending_sum == Decimal('0.00')
示例#15
0
def test_pending_paypal_replace_fee_missing(env, job):
    env[0].settings.set('payment_banktransfer__fee_abs', '1.00')
    fee = env[2].fees.create(fee_type=OrderFee.FEE_TYPE_PAYMENT,
                             value=Decimal('2.00'))
    env[2].total += Decimal('2.00')
    env[2].save()
    env[2].payments.create(provider='paypal',
                           state=OrderPayment.PAYMENT_STATE_PENDING,
                           fee=fee,
                           amount=env[2].total)
    process_banktransfers(job, [{
        'payer': 'Karla Kundin',
        'reference': 'Bestellung DUMMY1234S',
        'date': '2016-01-26',
        'amount': '23.00'
    }])
    env[2].refresh_from_db()
    assert env[2].status == Order.STATUS_PENDING
    assert env[2].fees.count() == 1
    assert env[2].fees.last().value == Decimal('1.00')
    assert env[2].total == Decimal('24.00')
示例#16
0
def test_pending_paypal_drop_fee(env, job):
    fee = env[2].fees.create(fee_type=OrderFee.FEE_TYPE_PAYMENT,
                             value=Decimal('2.00'))
    env[2].total += Decimal('2.00')
    env[2].save()
    p = env[2].payments.create(provider='paypal',
                               state=OrderPayment.PAYMENT_STATE_PENDING,
                               fee=fee,
                               amount=env[2].total)
    process_banktransfers(job, [{
        'payer': 'Karla Kundin',
        'reference': 'Bestellung DUMMY1234S',
        'date': '2016-01-26',
        'amount': '23.00'
    }])
    env[2].refresh_from_db()
    assert env[2].status == Order.STATUS_PAID
    assert env[2].fees.count() == 0
    assert env[2].total == Decimal('23.00')
    p.refresh_from_db()
    assert p.state == OrderPayment.PAYMENT_STATE_CANCELED
示例#17
0
def test_split_payment_mismatch(env, orga_job):
    o4 = Order.objects.create(code='99999',
                              event=env[0],
                              status=Order.STATUS_PENDING,
                              datetime=now(),
                              expires=now() + timedelta(days=10),
                              total=12)
    process_banktransfers(orga_job, [{
        'payer': 'Karla Kundin',
        'reference': 'Bestellungen DUMMY-1Z3AS DUMMY-99999',
        'date': '2016-01-26',
        'amount': '36.00'
    }])
    with scopes_disabled():
        job = BankImportJob.objects.last()
        t = job.transactions.last()
        assert t.state == BankTransaction.STATE_NOMATCH
        env[2].refresh_from_db()
        assert env[2].status == Order.STATUS_PENDING
        o4.refresh_from_db()
        assert o4.status == Order.STATUS_PENDING