mirror of
https://github.com/pretix/pretix.git
synced 2026-05-03 14:54:04 +00:00
* Refs #99 -- Fix stripe support for zero-decimal currencies * Add new money formatting method * Force decimal places in many places * Locale-aware currency rendering * Fix currencies in more places * More currency fixes
This commit is contained in:
@@ -77,6 +77,36 @@ def test_perform_success(env, factory, monkeypatch):
|
||||
assert order.status == Order.STATUS_PAID
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_perform_success_zero_decimal_currency(env, factory, monkeypatch):
|
||||
event, order = env
|
||||
event.currency = 'JPY'
|
||||
event.save()
|
||||
|
||||
def charge_create(**kwargs):
|
||||
assert kwargs['amount'] == 13
|
||||
assert kwargs['currency'] == 'jpy'
|
||||
assert kwargs['source'] == 'tok_189fTT2eZvKYlo2CvJKzEzeu'
|
||||
c = MockedCharge()
|
||||
c.status = 'succeeded'
|
||||
c.paid = True
|
||||
return c
|
||||
|
||||
monkeypatch.setattr("stripe.Charge.create", charge_create)
|
||||
prov = StripeCC(event)
|
||||
req = factory.post('/', {
|
||||
'stripe_token': 'tok_189fTT2eZvKYlo2CvJKzEzeu',
|
||||
'stripe_last4': '4242',
|
||||
'stripe_brand': 'Visa'
|
||||
})
|
||||
req.session = {}
|
||||
prov.checkout_prepare(req, {})
|
||||
assert 'payment_stripe_token' in req.session
|
||||
prov.payment_perform(req, order)
|
||||
order.refresh_from_db()
|
||||
assert order.status == Order.STATUS_PAID
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_perform_card_error(env, factory, monkeypatch):
|
||||
event, order = env
|
||||
|
||||
Reference in New Issue
Block a user