add support to milti transaction
This commit is contained in:
@@ -35,6 +35,7 @@ event = {
|
||||
'unit_price': 100,
|
||||
},
|
||||
],
|
||||
'discount': -10,
|
||||
}
|
||||
|
||||
|
||||
@@ -53,27 +54,6 @@ class MockResponse:
|
||||
def raise_for_status(): ...
|
||||
|
||||
|
||||
def test_create_invoice_pix(monkeypatch):
|
||||
monkeypatch.setattr(
|
||||
requests,
|
||||
'post',
|
||||
lambda *args, **kwargs: MockResponse('tests/samples/iugu_invoice_pix.json'),
|
||||
)
|
||||
|
||||
order = Order(
|
||||
id=str(uuid4()),
|
||||
payment_method='PIX', # type: ignore
|
||||
**event,
|
||||
)
|
||||
invoice = iugu.create_invoice(order, postback_url='http://localhost')
|
||||
|
||||
assert invoice['id'] == '970CB579C3964E59A323CE61AE04F7BC'
|
||||
assert (
|
||||
invoice['pix']['qrcode_text']
|
||||
== 'http://faturas.iugu.com/iugu_pix/970cb579-c396-4e59-a323-ce61ae04f7bc-196c/test/pay'
|
||||
)
|
||||
|
||||
|
||||
def test_create_invoice_bank_slip(monkeypatch):
|
||||
monkeypatch.setattr(
|
||||
requests,
|
||||
@@ -97,6 +77,27 @@ def test_create_invoice_bank_slip(monkeypatch):
|
||||
)
|
||||
|
||||
|
||||
def test_create_invoice_pix(monkeypatch):
|
||||
monkeypatch.setattr(
|
||||
requests,
|
||||
'post',
|
||||
lambda *args, **kwargs: MockResponse('tests/samples/iugu_invoice_pix.json'),
|
||||
)
|
||||
|
||||
order = Order(
|
||||
id=str(uuid4()),
|
||||
payment_method='PIX', # type: ignore
|
||||
**event,
|
||||
)
|
||||
invoice = iugu.create_invoice(order, postback_url='http://localhost')
|
||||
|
||||
assert invoice['id'] == '970CB579C3964E59A323CE61AE04F7BC'
|
||||
assert (
|
||||
invoice['pix']['qrcode_text']
|
||||
== 'http://faturas.iugu.com/iugu_pix/970cb579-c396-4e59-a323-ce61ae04f7bc-196c/test/pay'
|
||||
)
|
||||
|
||||
|
||||
def test_payment_token(monkeypatch):
|
||||
monkeypatch.setattr(
|
||||
requests,
|
||||
|
||||
Reference in New Issue
Block a user