Przelewy24 po poprawkach
This commit is contained in:
parent
88f3bf5bcc
commit
138c42dccb
167
debug_price.log
167
debug_price.log
@ -10836,3 +10836,170 @@ Product price query executed. Found: {"price_net":"233.20","price_gross":"286.84
|
||||
Found product price. Net: 233.2, Gross: 286.84
|
||||
FINAL: Returning Net: 233.2, Gross: 286.84
|
||||
---
|
||||
---
|
||||
START getEffectivePrice for product 1, client 1
|
||||
Client price query executed. Found: {"price_net":"837.40","price_gross":"1030.00"}
|
||||
Found client price. Net: 837.4, Gross: 1030
|
||||
FINAL: Returning Net: 837.4, Gross: 1030
|
||||
---
|
||||
---
|
||||
START getEffectivePrice for product 2, client 1
|
||||
Client price query executed. Found: {"price_net":"1056.91","price_gross":"1300.00"}
|
||||
Found client price. Net: 1056.91, Gross: 1300
|
||||
FINAL: Returning Net: 1056.91, Gross: 1300
|
||||
---
|
||||
---
|
||||
START getEffectivePrice for product 3, client 1
|
||||
Client price query executed. Found: {"price_net":"32.52","price_gross":"40.00"}
|
||||
Found client price. Net: 32.52, Gross: 40
|
||||
FINAL: Returning Net: 32.52, Gross: 40
|
||||
---
|
||||
---
|
||||
START getEffectivePrice for product 4, client 1
|
||||
Client price query executed. Found: No
|
||||
Client price not found or not set, falling back to product price.
|
||||
Product price query executed. Found: {"price_net":"9.95","price_gross":"12.24"}
|
||||
Found product price. Net: 9.95, Gross: 12.24
|
||||
FINAL: Returning Net: 9.95, Gross: 12.24
|
||||
---
|
||||
---
|
||||
START getEffectivePrice for product 5, client 1
|
||||
Client price query executed. Found: No
|
||||
Client price not found or not set, falling back to product price.
|
||||
Product price query executed. Found: {"price_net":"68.00","price_gross":"83.64"}
|
||||
Found product price. Net: 68, Gross: 83.64
|
||||
FINAL: Returning Net: 68, Gross: 83.64
|
||||
---
|
||||
---
|
||||
START getEffectivePrice for product 6, client 1
|
||||
Client price query executed. Found: No
|
||||
Client price not found or not set, falling back to product price.
|
||||
Product price query executed. Found: {"price_net":"171.60","price_gross":"211.07"}
|
||||
Found product price. Net: 171.6, Gross: 211.07
|
||||
FINAL: Returning Net: 171.6, Gross: 211.07
|
||||
---
|
||||
---
|
||||
START getEffectivePrice for product 7, client 1
|
||||
Client price query executed. Found: No
|
||||
Client price not found or not set, falling back to product price.
|
||||
Product price query executed. Found: {"price_net":"233.20","price_gross":"286.84"}
|
||||
Found product price. Net: 233.2, Gross: 286.84
|
||||
FINAL: Returning Net: 233.2, Gross: 286.84
|
||||
---
|
||||
---
|
||||
START getEffectivePrice for product 2, client 1
|
||||
Client price query executed. Found: {"price_net":"1056.91","price_gross":"1300.00"}
|
||||
Found client price. Net: 1056.91, Gross: 1300
|
||||
FINAL: Returning Net: 1056.91, Gross: 1300
|
||||
---
|
||||
---
|
||||
START getEffectivePrice for product 3, client 1
|
||||
Client price query executed. Found: {"price_net":"32.52","price_gross":"40.00"}
|
||||
Found client price. Net: 32.52, Gross: 40
|
||||
FINAL: Returning Net: 32.52, Gross: 40
|
||||
---
|
||||
---
|
||||
START getEffectivePrice for product 4, client 1
|
||||
Client price query executed. Found: No
|
||||
Client price not found or not set, falling back to product price.
|
||||
Product price query executed. Found: {"price_net":"9.95","price_gross":"12.24"}
|
||||
Found product price. Net: 9.95, Gross: 12.24
|
||||
FINAL: Returning Net: 9.95, Gross: 12.24
|
||||
---
|
||||
---
|
||||
START getEffectivePrice for product 5, client 1
|
||||
Client price query executed. Found: No
|
||||
Client price not found or not set, falling back to product price.
|
||||
Product price query executed. Found: {"price_net":"68.00","price_gross":"83.64"}
|
||||
Found product price. Net: 68, Gross: 83.64
|
||||
FINAL: Returning Net: 68, Gross: 83.64
|
||||
---
|
||||
---
|
||||
START getEffectivePrice for product 6, client 1
|
||||
Client price query executed. Found: No
|
||||
Client price not found or not set, falling back to product price.
|
||||
Product price query executed. Found: {"price_net":"171.60","price_gross":"211.07"}
|
||||
Found product price. Net: 171.6, Gross: 211.07
|
||||
FINAL: Returning Net: 171.6, Gross: 211.07
|
||||
---
|
||||
---
|
||||
START getEffectivePrice for product 7, client 1
|
||||
Client price query executed. Found: No
|
||||
Client price not found or not set, falling back to product price.
|
||||
Product price query executed. Found: {"price_net":"233.20","price_gross":"286.84"}
|
||||
Found product price. Net: 233.2, Gross: 286.84
|
||||
FINAL: Returning Net: 233.2, Gross: 286.84
|
||||
---
|
||||
---
|
||||
START getEffectivePrice for product 2, client 1
|
||||
Client price query executed. Found: {"price_net":"1056.91","price_gross":"1300.00"}
|
||||
Found client price. Net: 1056.91, Gross: 1300
|
||||
FINAL: Returning Net: 1056.91, Gross: 1300
|
||||
---
|
||||
---
|
||||
START getEffectivePrice for product 2, client 1
|
||||
Client price query executed. Found: {"price_net":"1056.91","price_gross":"1300.00"}
|
||||
Found client price. Net: 1056.91, Gross: 1300
|
||||
FINAL: Returning Net: 1056.91, Gross: 1300
|
||||
---
|
||||
---
|
||||
START getEffectivePrice for product 2, client 1
|
||||
Client price query executed. Found: {"price_net":"1056.91","price_gross":"1300.00"}
|
||||
Found client price. Net: 1056.91, Gross: 1300
|
||||
FINAL: Returning Net: 1056.91, Gross: 1300
|
||||
---
|
||||
---
|
||||
START getEffectivePrice for product 1, client
|
||||
Client price not found or not set, falling back to product price.
|
||||
Product price query executed. Found: {"price_net":"1111.00","price_gross":"1366.53"}
|
||||
Found product price. Net: 1111, Gross: 1366.53
|
||||
FINAL: Returning Net: 1111, Gross: 1366.53
|
||||
---
|
||||
---
|
||||
START getEffectivePrice for product 2, client
|
||||
Client price not found or not set, falling back to product price.
|
||||
Product price query executed. Found: {"price_net":"1318.05","price_gross":"1621.20"}
|
||||
Found product price. Net: 1318.05, Gross: 1621.2
|
||||
FINAL: Returning Net: 1318.05, Gross: 1621.2
|
||||
---
|
||||
---
|
||||
START getEffectivePrice for product 3, client
|
||||
Client price not found or not set, falling back to product price.
|
||||
Product price query executed. Found: {"price_net":"9.95","price_gross":"12.24"}
|
||||
Found product price. Net: 9.95, Gross: 12.24
|
||||
FINAL: Returning Net: 9.95, Gross: 12.24
|
||||
---
|
||||
---
|
||||
START getEffectivePrice for product 4, client
|
||||
Client price not found or not set, falling back to product price.
|
||||
Product price query executed. Found: {"price_net":"9.95","price_gross":"12.24"}
|
||||
Found product price. Net: 9.95, Gross: 12.24
|
||||
FINAL: Returning Net: 9.95, Gross: 12.24
|
||||
---
|
||||
---
|
||||
START getEffectivePrice for product 5, client
|
||||
Client price not found or not set, falling back to product price.
|
||||
Product price query executed. Found: {"price_net":"68.00","price_gross":"83.64"}
|
||||
Found product price. Net: 68, Gross: 83.64
|
||||
FINAL: Returning Net: 68, Gross: 83.64
|
||||
---
|
||||
---
|
||||
START getEffectivePrice for product 6, client
|
||||
Client price not found or not set, falling back to product price.
|
||||
Product price query executed. Found: {"price_net":"171.60","price_gross":"211.07"}
|
||||
Found product price. Net: 171.6, Gross: 211.07
|
||||
FINAL: Returning Net: 171.6, Gross: 211.07
|
||||
---
|
||||
---
|
||||
START getEffectivePrice for product 7, client
|
||||
Client price not found or not set, falling back to product price.
|
||||
Product price query executed. Found: {"price_net":"233.20","price_gross":"286.84"}
|
||||
Found product price. Net: 233.2, Gross: 286.84
|
||||
FINAL: Returning Net: 233.2, Gross: 286.84
|
||||
---
|
||||
---
|
||||
START getEffectivePrice for product 2, client 1
|
||||
Client price query executed. Found: {"price_net":"1056.91","price_gross":"1300.00"}
|
||||
Found client price. Net: 1056.91, Gross: 1300
|
||||
FINAL: Returning Net: 1056.91, Gross: 1300
|
||||
---
|
||||
|
||||
@ -109,8 +109,6 @@ try {
|
||||
]);
|
||||
}
|
||||
|
||||
$pdo->commit();
|
||||
|
||||
// Handle Przelewy24 payment
|
||||
if ($_POST['payment_method'] === 'przelewy24') {
|
||||
require_once 'includes/Przelewy24.php';
|
||||
@ -122,7 +120,7 @@ try {
|
||||
// Update order with the session ID
|
||||
$stmt = $pdo->prepare('UPDATE orders SET p24_session_id = ? WHERE id = ?');
|
||||
$stmt->execute([$p24_session_id, $order_id]);
|
||||
|
||||
|
||||
$user_id = $_SESSION['user_id'] ?? null;
|
||||
$stmt = $pdo->prepare('SELECT email, name FROM users WHERE id = ?');
|
||||
$stmt->execute([$user_id]);
|
||||
@ -143,17 +141,31 @@ try {
|
||||
|
||||
if (isset($response['data']['token'])) {
|
||||
$token = $response['data']['token'];
|
||||
|
||||
// update order with p24_order_id
|
||||
$stmt = $pdo->prepare("UPDATE orders SET p24_order_id = ? WHERE id = ?");
|
||||
$stmt->execute([$token, $order_id]);
|
||||
|
||||
$pdo->commit();
|
||||
|
||||
$redirect_url = $p24->getRedirectUrl($token);
|
||||
header('Location: ' . $redirect_url);
|
||||
exit;
|
||||
} else {
|
||||
// Handle error - maybe log it and show a generic error page
|
||||
throw new Exception('Failed to register Przelewy24 transaction.');
|
||||
$pdo->rollBack();
|
||||
$error_message = 'There is no active transaction';
|
||||
if (!empty($response['errors'])) {
|
||||
$error_message = '';
|
||||
foreach ($response['errors'] as $field => $error) {
|
||||
$error_message .= "$field: $error<br>";
|
||||
}
|
||||
} elseif (isset($response['error'])) {
|
||||
$error_message = $response['error'];
|
||||
}
|
||||
redirect_with_error('checkout.php', 'Błąd podczas przetwarzania zamówienia: ' . $error_message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 5. Commit the transaction
|
||||
$pdo->commit();
|
||||
|
||||
// 6. Send email notifications
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user