add support to milti transaction

This commit is contained in:
2026-01-13 03:18:05 -03:00
parent ad23e9aa51
commit da10a36a1d
11 changed files with 287 additions and 56 deletions

View File

@@ -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,