feat: add total field to purchases and update related logic for payment processing
This commit is contained in:
@@ -55,9 +55,11 @@ class PurchaseController extends Controller
|
||||
{
|
||||
$compra = $this->resolveScopedPurchase($tenant, $request->user()->id, $compra);
|
||||
$method = $request->validated('method');
|
||||
$totalAmount = $compra->calculateCurrentTotalAmount();
|
||||
|
||||
$compra->update([
|
||||
'payment_method' => $method,
|
||||
'total' => $totalAmount,
|
||||
]);
|
||||
|
||||
if ($method === 'transfer') {
|
||||
@@ -89,9 +91,9 @@ class PurchaseController extends Controller
|
||||
$telepagosService->forTenant($tenant->codigo);
|
||||
|
||||
try {
|
||||
Log::info("Generating QR for purchase ID: {$compra->id}, amount: {$compra->getTotalAmount()}");
|
||||
Log::info("Generating QR for purchase ID: {$compra->id}, amount: {$totalAmount}");
|
||||
$qrResponse = $telepagosService->generateQr(
|
||||
$compra->getTotalAmount(),
|
||||
$totalAmount,
|
||||
'Compra',
|
||||
"Compra #{$compra->id}"
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user