From 99d93bf68a43a8ca64d4656e2c3603563bf1239d Mon Sep 17 00:00:00 2001 From: kevinowino869 Date: Sun, 30 Mar 2025 13:06:09 +0200 Subject: [PATCH] Update modMpesapay.class.php Signed-off-by: kevinowino869 --- modMpesapay.class.php | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/modMpesapay.class.php b/modMpesapay.class.php index e7576d0..2098708 100644 --- a/modMpesapay.class.php +++ b/modMpesapay.class.php @@ -1,23 +1,43 @@ db = $db; + $this->numero = 104900; $this->rights_class = 'mpesapay'; $this->family = 'payment'; $this->name = "M-Pesa Payment Module"; $this->description = "Accept M-Pesa payments in Dolibarr."; $this->version = '1.0.0'; + + $this->const = array( + array('MPESAPAY_PAYBILL', 'chaine', '', 'M-Pesa Paybill Number', 0, 'current', 1), + array('MPESAPAY_PASSKEY', 'chaine', '', 'M-Pesa Passkey', 0, 'current', 1) + ); + $this->module_parts = array('hooks' => array('invoicecard', 'payment')); + + $this->config_page_url = "mpesapay_setup.php"; + $this->dirs = array('/mpesapay'); + $this->picto = 'payment'; + } + + // Generate Payment URL + function generatePaymentUrl($invoiceId) + { + $token = base64_encode(hash('sha256', $invoiceId . time())); + return DOL_URL_ROOT . "/custom/mpesapay/payment.php?invoice_id={$invoiceId}&token={$token}"; } } -?> \ No newline at end of file +?>