bugfix: route stickness precedences (transaction in the same intent)
This commit is contained in:
@@ -446,3 +446,79 @@ def test_contestation_action_calculates_totals_only_for_items_actually_contested
|
||||
assert [x["itemName"] for x in result["not_contested_items"]] == ["Outro VAS"]
|
||||
assert result["contested_invoice_amount_open"] == "14.99"
|
||||
assert result["contested_invoice_amount"] == "14.99"
|
||||
|
||||
|
||||
def test_validate_contestation_items_reconhece_vas_por_type_do_billing_analysis() -> None:
|
||||
items = [
|
||||
{
|
||||
"item_name": "TIM Fashion Mensal",
|
||||
"claimed_amount": "10",
|
||||
"validated_amount": "10",
|
||||
}
|
||||
]
|
||||
invoice = {
|
||||
"currentInvoice": [
|
||||
{
|
||||
"type": "servicos_contratados_de_parceiros",
|
||||
"desc": "Serviços de valor adicionado",
|
||||
"value": "76.98",
|
||||
"items": [
|
||||
{
|
||||
"type": "servicos_contratados_de_parceiros",
|
||||
"desc": "TIM Fashion Mensal",
|
||||
"value": "10.0",
|
||||
"contestable": True,
|
||||
}
|
||||
],
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
validated, validation_log, error = validate_contestation_items(items, invoice)
|
||||
|
||||
assert error is None
|
||||
assert validation_log[-1]["status"] == "aprovado"
|
||||
assert validation_log[-1]["secao_vas"] is True
|
||||
assert validation_log[-1]["item_fatura_resolvido"] == "TIM Fashion Mensal"
|
||||
assert validation_log[-1]["tipo_fatura"] == "servicos_contratados_de_parceiros"
|
||||
assert validated[0]["validated_amount"] == "10"
|
||||
|
||||
|
||||
def test_validate_contestation_items_prefere_evidencia_vas_quando_item_aparece_em_multiplas_visoes() -> None:
|
||||
items = [
|
||||
{
|
||||
"item_name": "TIM Fashion Mensal",
|
||||
"claimed_amount": "10",
|
||||
"validated_amount": "10",
|
||||
}
|
||||
]
|
||||
invoice = {
|
||||
"invoiceVariation": [
|
||||
{
|
||||
"desc": "TIM Fashion Mensal",
|
||||
"value": "10.0",
|
||||
}
|
||||
],
|
||||
"currentInvoice": [
|
||||
{
|
||||
"type": "servicos_contratados_de_parceiros",
|
||||
"desc": "Serviços de valor adicionado",
|
||||
"value": "76.98",
|
||||
"items": [
|
||||
{
|
||||
"type": "servicos_contratados_de_parceiros",
|
||||
"desc": "TIM Fashion Mensal",
|
||||
"value": "10.0",
|
||||
"contestable": True,
|
||||
}
|
||||
],
|
||||
}
|
||||
],
|
||||
}
|
||||
|
||||
_, validation_log, error = validate_contestation_items(items, invoice)
|
||||
|
||||
assert error is None
|
||||
assert validation_log[-1]["status"] == "aprovado"
|
||||
assert validation_log[-1]["secao_vas"] is True
|
||||
assert validation_log[-1]["tipo_fatura"] == "servicos_contratados_de_parceiros"
|
||||
|
||||
Reference in New Issue
Block a user