From d2c99e86b4caecea926b35d0dd2a9e6dd502cb39 Mon Sep 17 00:00:00 2001 From: twotalesanimation <80506065+twotalesanimation@users.noreply.github.com> Date: Mon, 15 Dec 2025 10:18:25 +0200 Subject: [PATCH] mostly complete payment system --- assets/images/logos/ikhokha.png | Bin 0 -> 5465 bytes src/api/ikhokha_webhook.php | 2 +- src/config/functions.php | 85 +++++++++++++- src/pages/bookings/bookings.php | 5 +- src/pages/bookings/driver_training.php | 5 +- src/pages/bookings/trip-details.php | 115 ++++++++++--------- src/pages/memberships/membership_payment.php | 63 +++++----- src/pages/memberships/renew_membership.php | 17 ++- src/pages/other/bush_mechanics.php | 5 +- src/pages/other/indemnity.php | 4 +- src/pages/other/rescue_recovery.php | 6 +- src/processors/process_application.php | 8 +- src/processors/process_course_booking.php | 4 +- src/processors/process_signature.php | 6 +- src/processors/process_trip_booking.php | 6 +- 15 files changed, 223 insertions(+), 108 deletions(-) create mode 100644 assets/images/logos/ikhokha.png diff --git a/assets/images/logos/ikhokha.png b/assets/images/logos/ikhokha.png new file mode 100644 index 0000000000000000000000000000000000000000..32f6fc3fbc7179aa4d377337cdb63663f061473c GIT binary patch literal 5465 zcmV-f6{hNmP)003nO0{{R3j78z<0002MP)t-s|Ns9T z9UK460{{R3|H}aR`S}_e7!eT;7Z()-1ON;S2$GVLXlQ53%E}cL6aV3dr>Cas>gxaF zf<;9{t*xxz-`{n0bnx)-|NZnjIyq2KPxbZn|M}zC*x2Xi=SxdUEG#OAhlYK9eE->3 zSy@<_nV7=D!eU}!BO@VIRaF1|@s5s;w6wD@FfKkmJkrwA|MblN);0h4+5gx_|I#4; z+-d*ty8r8<|K^kb++hFJL;vck|J`^0@WcP)hX3AWcqqE2000zJNkl33J*y z5P&fP`2ZX!_Zc8yoCE@-3C-F5|9|yt1Gc1H`M@UW>##HLbtc%dtk05Gdq}xl268ue z+-%-|yl(SP+vnY57DZmtg}f(){OjhsYj%~nYZ=P-uHW6e;1`R@8(B(^xpnbWa)oWgam7iY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1Uat{OlWRY5uqE@;~EV`n_KJ^}Nx2pwe0aweD|vcU!} zy0@1uy02>%BH#MEE7YGqHyMmoNM3~t=8=6zwc%Y>_{>rj zjl4{>mpDF&(7^}A+ui!NA$wLcr5-mE#$wjb3wY(#^h@V#1mnQSnH7|{w&eXj`@n0%maaZW<^dq3Pl z?BmFj$@rcKy0a`}U*1(GSy^iASF54>Lgs3-U}C3wo!d&U$F+}fE8bgNa2J?1TFK=# zK{xaA40JR6jO-D=?YhwueqVP3D}cs3+8UgV7ugNd;tzTNU+QSOl2zDyoI!fbEs||M z&j`KPcrbL;JKVu-L2;ZMmKEJlO;-$}pb3A@fL875y5U@+5~all&x|HEF*NEqvME6_ ziQ1E~XRPurFl;=%EZ4SrnhthiqpD697BcvFQY+j0lD$JKx?nUIm8q_3)IECA7GBJ{ zKD3GZ9TFrLyV6sMGYWbaXjq`#s9LA6!mhq(5OY2;|uJM7SQd)G0;hyFr zJBp;)m>y0VQeD}f-DCHr@Svi{vrvao(!3P=ZBHZ{MHM{>FJgZc{>!0s`8QLHy5LYw zZCPq9Zm+Lrv*+}D6xKb@mrmga#Ty9P7tJVmw z$z%QuBRn|8>whi%kY@g$O6Mwj>;;hKc#*$MHm)ZHGp(O4-~CD#iI%(f_xG3QpHF#- zVW`h^`C*;mi`Zn)w*Uvw_ybind_param('s', $localPaymentId); $upd->execute(); $upd->close(); - sendAdminNotification('4WDCSA.co.za - New Membership Application - '.getFullName($user_id) , 'A new member has signed up, '.getFullName($user_id)); + sendAdminNotification('4WDCSA.co.za - Membership Payment Received - '.getFullName($user_id) , 'A Membership Payment has been received from '.getFullName($user_id)); } } diff --git a/src/config/functions.php b/src/config/functions.php index e51f42bb..ab95e405 100644 --- a/src/config/functions.php +++ b/src/config/functions.php @@ -1456,7 +1456,7 @@ function getInitialSurname($user_id) if ($stmt->fetch()) { $initial = strtoupper(substr($first_name, 0, 1)); - return $initial . ". " . $last_name; + return $initial . "." . $last_name; } else { return null; } @@ -1467,6 +1467,89 @@ function getInitialSurname($user_id) } } +function generatePaymentRef(string $type, ?int $course_trip_id, int $user_id): string +{ + $conn = openDatabaseConnection(); + + // 1. Normalize type + $type = strtoupper($type); + + // 2. Build prefix + switch ($type) { + case 'SUBS': + $year = (int)date('Y'); + $month = (int)date('n'); + + // If December, subscriptions are for next year + if ($month === 12) { + $year++; + } + + $prefix = "SUBS_" . $year; + break; + + case 'COURSE': + if (!$course_trip_id) { + throw new Exception("course_trip_id is required for COURSE payments"); + } + + $stmt = $conn->prepare( + "SELECT code FROM courses WHERE course_id = ?" + ); + $stmt->bind_param("i", $course_trip_id); + $stmt->execute(); + $stmt->bind_result($code); + + if (!$stmt->fetch()) { + throw new Exception("Invalid course_id: {$course_trip_id}"); + } + + $stmt->close(); + $prefix = "COURSE_" . strtoupper($code); + break; + + case 'TRIP': + if (!$course_trip_id) { + throw new Exception("course_trip_id is required for TRIP payments"); + } + + $stmt = $conn->prepare( + "SELECT trip_code FROM trips WHERE trip_id = ?" + ); + $stmt->bind_param("i", $course_trip_id); + $stmt->execute(); + $stmt->bind_result($trip_code); + + if (!$stmt->fetch()) { + throw new Exception("Invalid trip_id: {$course_trip_id}"); + } + + $stmt->close(); + $prefix = "TRIP_" . strtoupper($trip_code); + break; + + default: + throw new Exception("Unknown payment type: {$type}"); + } + + // 3. Get user initials + surname + $namePart = strtoupper(getInitialSurname($user_id)); + + if (!$namePart) { + throw new Exception("User not found for user_id: {$user_id}"); + } + + // 4. Add short entropy (trimmed for aesthetics) + $entropy = substr(shortEntropy(), -3); + + return "{$prefix}_{$namePart}_{$entropy}"; +} + +function shortEntropy(): string { + return strtoupper(base_convert((string)(microtime(true) * 1000), 10, 36)); +} + + function getLastName($user_id) { $conn = openDatabaseConnection(); diff --git a/src/pages/bookings/bookings.php b/src/pages/bookings/bookings.php index 9e215473..02406bb9 100644 --- a/src/pages/bookings/bookings.php +++ b/src/pages/bookings/bookings.php @@ -114,6 +114,7 @@ $user_id = $_SESSION['user_id']; // Loop through each row while ($row = $result->fetch_assoc()) { $booking_id = $row['booking_id']; + $payment_id = $row['payment_id']; $booking_type = $row['booking_type']; $from_date = $row['from_date']; $to_date = $row['to_date']; @@ -267,8 +268,8 @@ $user_id = $_SESSION['user_id']; num_rows == 0) { $button_text = "No booking dates available"; @@ -189,8 +189,9 @@ $page_id = 'driver_training'; + Secure Payment Badges diff --git a/src/pages/bookings/trip-details.php b/src/pages/bookings/trip-details.php index 54071272..3e4e39d5 100644 --- a/src/pages/bookings/trip-details.php +++ b/src/pages/bookings/trip-details.php @@ -205,30 +205,30 @@ include_once(dirname(dirname(dirname(__DIR__))) . '/header.php'); - - - - - - -
- -
- + + + + + + +
+ +
+ @@ -296,8 +296,8 @@ include_once(dirname(dirname(dirname(__DIR__))) . '/header.php'); - - + +
-
- New Membership Payment: - Membership Start Date: ' . $membership_start_date . '
Membership Renewal Date: ' . $membership_end_date . ''; ?> +
+ New Membership Payment: + Membership Start Date: ' . $membership_start_date . '
Membership Renewal Date: ' . $membership_end_date . ''; ?> +
+ + +
Payment Details:
+

Amount: R

+

Reference:

+ + Pay Now with iKhokha + + +
+

You will be redirected to iKhokha's Secure payment gateway.

- - -
Payment Details:
-

Amount: R

-

Reference:

- - Pay Now with iKhokha - - -

You will be redirected to iKhokha's Secure Payment Gateway.

- -

Please upload your proof of payment below.

-
Payment Details:
-

The Four Wheel Drive Club of Southern Africa
FNB
Account Number: 58810022334
Branch code: 250655
Reference:
Amount: R

- - Submit Proof of Payment - - - + Secure Payment Badges + +

Please upload your proof of payment below.

+
Payment Details:
+

The Four Wheel Drive Club of Southern Africa
FNB
Account Number: 58810022334
Branch code: 250655
Reference:
Amount: R

+ + Submit Proof of Payment + + +
@@ -132,4 +143,4 @@ if ($payment_id) {
- + \ No newline at end of file diff --git a/src/pages/memberships/renew_membership.php b/src/pages/memberships/renew_membership.php index 80dd9a68..8a01d5de 100644 --- a/src/pages/memberships/renew_membership.php +++ b/src/pages/memberships/renew_membership.php @@ -11,8 +11,20 @@ if (isset($_SESSION['user_id'])) { exit(); // Stop further script execution } +//if membership_fees payment_status is PENDING RENEWAL, redirect to membership_details.php +$stmt = $conn->prepare("SELECT payment_status FROM membership_fees WHERE user_id = ? LIMIT 1"); +$stmt->bind_param("i", $user_id); +$stmt->execute(); +$stmt->bind_result($payment_status); +$stmt->fetch(); +$stmt->close(); -$payment_id = uniqid(); +if ($payment_status === 'PENDING RENEWAL') { + header("Location: membership_details.php"); + exit(); +} + +$payment_id = generatePaymentRef('SUBS', null, $user_id); $payment_amount = getPriceByDescription('membership_fees'); $payment_date = date('Y-m-d'); $renewal_period_end = getMembershipEndDate($user_id); @@ -65,8 +77,9 @@ if ($stmt->execute()) { $publicRef = $publicRef ?? bin2hex(random_bytes(16)); $resp = createIkhokhaPayment($payment_id, $payment_amount, $description, $publicRef); $paylink = $resp['paylinkUrl'] ?? $resp['paylinkURL'] ?? $resp['paylink_url'] ?? null; + $token = encryptData($payment_id, $_ENV['SALT']); if ($paylink) { - header('Location: membership_payment?payment_id=' . $payment_id); + header('Location: membership_payment?token=' . $token); exit(); } else { header("Location: membership_details"); diff --git a/src/pages/other/bush_mechanics.php b/src/pages/other/bush_mechanics.php index 431dfb86..19e47008 100644 --- a/src/pages/other/bush_mechanics.php +++ b/src/pages/other/bush_mechanics.php @@ -156,7 +156,7 @@ $page_id = 'bush_mechanics'; num_rows == 0) { $button_text = "No booking dates available"; @@ -168,8 +168,9 @@ $page_id = 'bush_mechanics'; + Secure Payment Badges diff --git a/src/pages/other/indemnity.php b/src/pages/other/indemnity.php index 3fc42185..ba49c32f 100644 --- a/src/pages/other/indemnity.php +++ b/src/pages/other/indemnity.php @@ -107,14 +107,14 @@ if (isset($_SESSION['user_id'])) { if (response.status === 'success') { // If provider returned a direct paylink, go there immediately if (response.paylinkUrl) { - window.location.href = 'membership_payment.php?payment_id=' + encodeURIComponent(response.payment_id); + window.location.href = 'membership_payment?token=' + encodeURIComponent(response.token); return; } // If we have a payment_id, redirect to membership_payment with it // if (response.payment_id) { // setTimeout(function() { - // window.location.href = 'membership_payment.php?payment_id=' + encodeURIComponent(response.payment_id); + // window.location.href = 'membership_payment.php?payment_id=' + encodeURIComponent(response.token); // }, 800); // return; // } diff --git a/src/pages/other/rescue_recovery.php b/src/pages/other/rescue_recovery.php index 85c12514..3fd83f12 100644 --- a/src/pages/other/rescue_recovery.php +++ b/src/pages/other/rescue_recovery.php @@ -154,7 +154,7 @@ $page_id = 'rescue_recovery'; num_rows == 0) { $button_text = "No booking dates available"; @@ -165,9 +165,11 @@ $page_id = 'rescue_recovery'; + + Secure Payment Badges diff --git a/src/processors/process_application.php b/src/processors/process_application.php index d4045c4b..e8d65c6d 100644 --- a/src/processors/process_application.php +++ b/src/processors/process_application.php @@ -6,7 +6,7 @@ require_once($rootPath . "/src/config/connection.php"); require_once($rootPath . "/src/config/functions.php"); $user_id = isset($_SESSION['user_id']) ? $_SESSION['user_id'] : null; -$payment_id = uniqid(); +$payment_id = generatePaymentRef('SUBS', null, $user_id); $status = 'AWAITING PAYMENT'; // If current month is December, attribute the membership year to the next year $currentYear = intval(date('Y')); @@ -210,9 +210,9 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { ->format('Y-m-d'); } - $stmt = $conn->prepare("INSERT INTO membership_fees (user_id, payment_amount, payment_date, membership_start_date, membership_end_date, payment_status, payment_id) - VALUES (?, ?, ?, ?, ?, 'AWAITING PAYMENT', ?)"); - $stmt->bind_param("idssss", $user_id, $payment_amount, $payment_date, $membership_start_date, $membership_end_date, $payment_id); + $stmt = $conn->prepare("INSERT INTO membership_fees (user_id, payment_amount, payment_date, membership_start_date, membership_end_date, renewal_period_end, payment_status, payment_id) + VALUES (?, ?, ?, ?, ?, ?, 'AWAITING PAYMENT', ?)"); + $stmt->bind_param("idsssss", $user_id, $payment_amount, $payment_date, $membership_start_date, $membership_end_date, $membership_end_date, $payment_id); if ($stmt->execute()) { // Commit the transaction diff --git a/src/processors/process_course_booking.php b/src/processors/process_course_booking.php index 7d2af6f0..27d20a86 100644 --- a/src/processors/process_course_booking.php +++ b/src/processors/process_course_booking.php @@ -93,11 +93,11 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { $status = "AWAITING PAYMENT"; $type = 'course'; - $payment_id = uniqid(); + $payment_id = generatePaymentRef('COURSE', $course_id, $user_id); $publicRef = bin2hex(random_bytes(16)); $num_vehicles = 1; $discountAmount = 0; - $eft_id = strtoupper("COURSE ".date("m-d", strtotime($date))." ".getInitialSurname($user_id)); + $eft_id = $payment_id; $notes = ""; if ($pending_member){ $notes = "Membership Payment pending at time of booking. Please confirm payment has been received."; diff --git a/src/processors/process_signature.php b/src/processors/process_signature.php index 7f1eaef9..cc02df88 100644 --- a/src/processors/process_signature.php +++ b/src/processors/process_signature.php @@ -77,7 +77,7 @@ if (isset($_POST['signature'])) { if ($mf && isset($mf['payment_amount'])) { $amount = floatval($mf['payment_amount']); // Use existing payment_id or generate one - $payment_id = $mf['payment_id'] ?? uniqid('mem_', true); + $payment_id = $mf['payment_id'] ?? generatePaymentRef('SUBS', null, $user_id);; if (empty($mf['payment_id'])) { // Persist generated payment_id back to membership_fees @@ -128,6 +128,7 @@ if (isset($_POST['signature'])) { $paylink = $resp['paylinkUrl'] ?? $resp['paylinkURL'] ?? $resp['paylink_url'] ?? null; // After creating paylink, update paymentStatus to AWAITING PAYMENT $paymentStatus = $paylink ? 'AWAITING PAYMENT' : $paymentStatus; + $token = encryptData($payment_id, $_ENV['SALT']); } catch (Exception $e) { // Log but do not fail signature save error_log('iKhokha create error: ' . $e->getMessage()); @@ -140,7 +141,8 @@ if (isset($_POST['signature'])) { $response = [ 'status' => 'success', 'message' => 'Signature saved successfully!', - 'paymentStatus' => $paymentStatus + 'paymentStatus' => $paymentStatus, + 'token' => $token ?? null ]; if (!empty($paylink)) { $response['paylinkUrl'] = $paylink; diff --git a/src/processors/process_trip_booking.php b/src/processors/process_trip_booking.php index 5391d7e5..83b97929 100644 --- a/src/processors/process_trip_booking.php +++ b/src/processors/process_trip_booking.php @@ -105,10 +105,10 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { $status = "AWAITING PAYMENT"; $description = $trip_name; $type = 'trip'; - $payment_id = uniqid(); + $payment_id = generatePaymentRef('TRIP', $trip_id, $user_id); $publicRef = bin2hex(random_bytes(16)); // $eft_id = strtoupper(base_convert(time(), 10, 36)); // Convert timestamp to base36 - $eft_id = strtoupper($trip_code." ".getInitialSurname($user_id)); + // $eft_id = strtoupper($trip_code." ".getInitialSurname($user_id)); // Insert booking into the database @@ -147,7 +147,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { // Send invoice and admin notification // sendInvoice(getEmail($user_id), getFullName($user_id), $eft_id, formatCurrency($payment_amount), $description); - sendAdminNotification('New Trip Booking - '.getFullName($user_id), getFullName($user_id).' has booked for '.$description); + // sendAdminNotification('New Trip Booking - '.getFullName($user_id), getFullName($user_id).' has booked for '.$description); // Redirect to payment link if available $paylink = $resp['paylinkUrl'] ?? $resp['paylinkURL'] ?? $resp['paylink_url'] ?? null;