Refactor invoice creation in webhooks to include accounthierarchy field. Update SQL statements in both PayPal and Mollie webhooks for consistency.

This commit is contained in:
“VeLiTi”
2026-01-30 15:44:04 +01:00
parent 9d33b37b8b
commit 0bec809940
10 changed files with 39 additions and 21 deletions

View File

@@ -204,8 +204,8 @@ try {
if (!$existing_invoice) {
// Create invoice
$sql = 'INSERT INTO invoice (txn_id, payment_status, payment_amount, shipping_amount, discount_amount, tax_amount, created)
VALUES (?, ?, ?, ?, ?, ?, ?)';
$sql = 'INSERT INTO invoice (txn_id, payment_status, payment_amount, shipping_amount, discount_amount, tax_amount, created,accounthierarchy)
VALUES (?, ?, ?, ?, ?, ?, ?,?)';
$stmt = $pdo->prepare($sql);
$stmt->execute([
$transaction['txn_id'],
@@ -214,7 +214,8 @@ try {
$transaction['shipping_amount'] ?? 0.00,
$transaction['discount_amount'] ?? 0.00,
$transaction['tax_amount'] ?? 0.00,
date('Y-m-d H:i:s')
date('Y-m-d H:i:s'),
'{"salesid":"21-Total Safety Solutions B.V.","soldto":""}'
]);
$invoice_id = $pdo->lastInsertId();
} else {