Files
App-Estoque-LiberiKids/testar-parcelas.sh
2025-11-29 21:31:52 -03:00

38 lines
1.2 KiB
Bash
Executable File
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/bash
echo "🔍 Testando Sistema de Parcelas..."
echo ""
# Buscar última venda
echo "📊 Última venda:"
VENDA_ID=$(curl -s http://localhost:5000/api/vendas | jq -r '.[0].id')
VENDA_TIPO=$(curl -s http://localhost:5000/api/vendas | jq -r '.[0].tipo_pagamento')
VENDA_DATA=$(curl -s http://localhost:5000/api/vendas | jq -r '.[0].data_venda')
echo " ID: $VENDA_ID"
echo " Tipo: $VENDA_TIPO"
echo " Data: $VENDA_DATA"
echo ""
if [ "$VENDA_TIPO" = "parcelado" ]; then
echo "💳 Buscando parcelas..."
PARCELAS=$(curl -s http://localhost:5000/api/vendas/$VENDA_ID/parcelas)
QTDE=$(echo $PARCELAS | jq 'length')
if [ "$QTDE" -gt 0 ]; then
echo "✅ SUCESSO! $QTDE parcelas encontradas:"
echo $PARCELAS | jq '.[] | " - Parcela \(.numero_parcela): R$ \(.valor) - Vence: \(.data_vencimento) - Status: \(.status)"'
else
echo "❌ ERRO: Venda parcelada sem parcelas!"
echo "⚠️ Esta venda foi criada ANTES da tabela existir"
echo "📝 Solução: Delete esta venda e crie uma NOVA"
fi
else
echo " Última venda é à vista"
echo "📝 Crie uma venda PARCELADA para testar o sistema"
fi
echo ""
echo "Data correta esperada: 18/10/2025"
echo "Data da venda: $VENDA_DATA"