add support to milti transaction
This commit is contained in:
@@ -2,7 +2,7 @@ from decimal import Decimal
|
||||
|
||||
import requests
|
||||
from aws_lambda_powertools.utilities.typing.lambda_context import LambdaContext
|
||||
from layercake.dynamodb import DynamoDBPersistenceLayer, KeyPair
|
||||
from layercake.dynamodb import DynamoDBPersistenceLayer, KeyPair, SortKey, TransactKey
|
||||
|
||||
import events.payments.create_invoice as app
|
||||
|
||||
@@ -89,3 +89,37 @@ def test_create_bank_slip_pix(
|
||||
invoice['pix']['qrcode_text']
|
||||
== 'http://faturas.iugu.com/iugu_pix/970cb579-c396-4e59-a323-ce61ae04f7bc-196c/test/pay'
|
||||
)
|
||||
|
||||
|
||||
def test_create_credit_card(
|
||||
monkeypatch,
|
||||
dynamodb_seeds,
|
||||
dynamodb_persistence_layer: DynamoDBPersistenceLayer,
|
||||
lambda_context: LambdaContext,
|
||||
):
|
||||
monkeypatch.setattr(
|
||||
requests,
|
||||
'post',
|
||||
lambda *args, **kwargs: MockResponse(
|
||||
'tests/samples/iugu_invoice_credit_card.json'
|
||||
),
|
||||
)
|
||||
|
||||
assert app.lambda_handler(_event('CREDIT_CARD'), lambda_context) # type: ignore
|
||||
|
||||
invoice = dynamodb_persistence_layer.collection.get_items(
|
||||
TransactKey(order_id)
|
||||
+ SortKey('0')
|
||||
+ SortKey('INVOICE')
|
||||
+ SortKey('TRANSACTION')
|
||||
)
|
||||
print(invoice)
|
||||
|
||||
# assert (
|
||||
# invoice['pix']['qrcode_text']
|
||||
# == 'http://faturas.iugu.com/iugu_pix/970cb579-c396-4e59-a323-ce61ae04f7bc-196c/test/pay'
|
||||
# )
|
||||
# assert (
|
||||
# invoice['pix']['qrcode_text']
|
||||
# == 'http://faturas.iugu.com/iugu_pix/970cb579-c396-4e59-a323-ce61ae04f7bc-196c/test/pay'
|
||||
# )
|
||||
|
||||
Reference in New Issue
Block a user