diff --git a/.env b/.env deleted file mode 100755 index d0fe98e8..00000000 --- a/.env +++ /dev/null @@ -1,190 +0,0 @@ -#-------------------------------------------------------------------- -# Example Environment Configuration file -# -# This file can be used as a starting point for your own -# custom .env files, and contains most of the possible settings -# available in a default install. -# -# By default, all of the settings are commented out. If you want -# to override the setting, you must un-comment it by removing the '#' -# at the beginning of the line. -#-------------------------------------------------------------------- - -#-------------------------------------------------------------------- -# ENVIRONMENT -#-------------------------------------------------------------------- - -CI_ENVIRONMENT = development - -#-------------------------------------------------------------------- -# APP -#-------------------------------------------------------------------- - -# app.baseURL = '' -# If you have trouble with `.`, you could also use `_`. -# app_baseURL = '' -# app.forceGlobalSecureRequests = false -# app.CSPEnabled = false - -#-------------------------------------------------------------------- -# DATABASE -#-------------------------------------------------------------------- - - database.default.hostname = 119.18.54.85 - database.default.database = venbaehn_bbbooks - database.default.username = venbaehn_bbooks - database.default.password = '(B$j&KrV@F9f' - database.default.DBDriver = MySQLi - database.default.DBPrefix = - database.default.port = 3306 - - database.tests.hostname = 119.18.54.85 - database.tests.database = venbaehn_bbbooks - database.tests.username = venbaehn_bbooks - database.tests.password ='(B$j&KrV@F9f' - database.tests.DBDriver = MySQLi - database.tests.DBPrefix = - database.tests.port = 3306 - -#-------------------------------------------------------------------- -# CONTENT SECURITY POLICY -#-------------------------------------------------------------------- - -# contentsecuritypolicy.reportOnly = false -# contentsecuritypolicy.defaultSrc = 'none' -# contentsecuritypolicy.scriptSrc = 'self' -# contentsecuritypolicy.styleSrc = 'self' -# contentsecuritypolicy.imageSrc = 'self' -# contentsecuritypolicy.baseURI = null -# contentsecuritypolicy.childSrc = null -# contentsecuritypolicy.connectSrc = 'self' -# contentsecuritypolicy.fontSrc = null -# contentsecuritypolicy.formAction = null -# contentsecuritypolicy.frameAncestors = null -# contentsecuritypolicy.frameSrc = null -# contentsecuritypolicy.mediaSrc = null -# contentsecuritypolicy.objectSrc = null -# contentsecuritypolicy.pluginTypes = null -# contentsecuritypolicy.reportURI = null -# contentsecuritypolicy.sandbox = false -# contentsecuritypolicy.upgradeInsecureRequests = false -# contentsecuritypolicy.styleNonceTag = '{csp-style-nonce}' -# contentsecuritypolicy.scriptNonceTag = '{csp-script-nonce}' -# contentsecuritypolicy.autoNonce = true - -#-------------------------------------------------------------------- -# COOKIE -#-------------------------------------------------------------------- - -# cookie.prefix = '' -# cookie.expires = 0 -# cookie.path = '/' -# cookie.domain = '' -# cookie.secure = false -# cookie.httponly = false -# cookie.samesite = 'Lax' -# cookie.raw = false - -#-------------------------------------------------------------------- -# ENCRYPTION -#-------------------------------------------------------------------- - -# encryption.key = -# encryption.driver = OpenSSL -# encryption.blockSize = 16 -# encryption.digest = SHA512 - -#-------------------------------------------------------------------- -# HONEYPOT -#-------------------------------------------------------------------- - -# honeypot.hidden = 'true' -# honeypot.label = 'Fill This Field' -# honeypot.name = 'honeypot' -# honeypot.template = '' -# honeypot.container = '
' - -#-------------------------------------------------------------------- -# SECURITY -#-------------------------------------------------------------------- - -# security.csrfProtection = 'cookie' -# security.tokenRandomize = false -# security.tokenName = 'csrf_token_name' -# security.headerName = 'X-CSRF-TOKEN' -# security.cookieName = 'csrf_cookie_name' -# security.expires = 7200 -# security.regenerate = true -# security.redirect = false -# security.samesite = 'Lax' - -#-------------------------------------------------------------------- -# SESSION -#-------------------------------------------------------------------- - -# session.driver = 'CodeIgniter\Session\Handlers\FileHandler' -# session.cookieName = 'ci_session' -# session.expiration = 7200 -# session.savePath = null -# session.matchIP = false -# session.timeToUpdate = 300 -# session.regenerateDestroy = false - -#-------------------------------------------------------------------- -# LOGGER -#-------------------------------------------------------------------- - -# logger.threshold = 4 - -#-------------------------------------------------------------------- -# CURLRequest -#-------------------------------------------------------------------- - -# curlrequest.shareOptions = true -APP_TIMEZONE = 'Asia/Kolkata' - -#-------------------------------------------------------------------- -# Whatsapp Access Token And Instance ID -#-------------------------------------------------------------------- -# for Live Don't delete it -# 1st Account -# WAAI_TOKEN = '6582950cb468b' -# WAAI_INSTANCE = '6582F04394D59' -# 2nd Account -# WAAI_TOKEN = '6568739969f28' -# WAAI_INSTANCE = '656876690A9FD' - -app.debug = true; -# for Testing Purpose -# 4th Account - Dummy Account by sanjeev created on 10th april 24 Testing purpose -# Dummy Office Mail ID - venba.it.chennai@venbainfotech.com -# (UN - venba.it.chennai PWD - venba.it.chennai) -WAAI_INSTANCE = '661621B29BDEE' -WAAI_TOKEN = '66162101e2f1d' - -# 3rd Account - Dummy Account by sanjeev created on 14th dec Testing purpose -# Office Mail ID - sanjeev.p@venbainfotech.com -# (UN - Venba V1 PWD - Krish12345) -# WAAI_TOKEN = '657af9bf8cad1' -# WAAI_INSTANCE = '657AFA5A01B21' - -# 2nd Account - Dummy Account by sanjeev -# WAAI_TOKEN = '65685e954bcf6' -# WAAI_INSTANCE = '656863C54F90C' - -# 1st Account - Dummy Account by krishanan sir -# WAAI_TOKEN = '652548474f4e4' -# WAAI_INSTANCE = '65254894E4A88' - -#-------------------------------------------------------------------- -# Email Host Name,User,Passcode And Port -#-------------------------------------------------------------------- -SMTP_HOST = 'smtp.sendgrid.net' -SMTP_USER = 'apikey' -SMTP_PASS = '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' -SMTP_PORT = '587' - -#---------------------------------------------------------------------- -# New Whatsapp Access Token -#---------------------------------------------------------------------- -# whatsAppToken = 'EAARGyzEtu2kBO1mK3ILZAvZCd8D3QNpHo2uU5SWZBXbZC3eNL9hFpZA5WebolazilZA0RfU0zdu6gNZAW1yGCYiXFgZBC1YQfZBErv0QKAYQAT9wMOTy2f0C3m4ZAK8ZCwt3mGlURfa6m2uUCyNK4qEUy2Evx7scd8aanXLFr8MJUbVNJP8BPPSpUJW4A0dZAaci56lrPGnw0hV7jV9ISGmDLNYZD'; \ No newline at end of file diff --git a/app/Config/Constants.php b/app/Config/Constants.php index 35d458d9..b81ff2d9 100755 --- a/app/Config/Constants.php +++ b/app/Config/Constants.php @@ -129,26 +129,24 @@ define('SEND_WAAI_URL', 'https://waai.in/api/send'); define('SEND_WAAI_GROUP_URL', 'https://waai.in/api/send_group'); define('EXPIRAY_NOTIFY_TEMPLATE_EMAIL','EXPIRAY_NOTIFY_TEMPLATE_EMAIL'); define('EXPIRAY_NOTIFY_TEMPLATE_WHATSAPP','EXPIRAY_NOTIFY_TEMPLATE_WHATSAPP'); - -define('PAYTM_ENVIRONMENT', 'TEST'); // PROD +define('PAYTM_ENVIRONMENT', 'PROD'); // PROD //Change this constant's value with Merchant key received from Paytm. -define('PAYTM_MERCHANT_KEY', 'wmy4JaBcar3nK97G'); +//define('PAYTM_MERCHANT_KEY', '-'); //Change this constant's value with MID (Merchant ID) received from Paytm. -define('PAYTM_MERCHANT_MID', 'VWJbeA80075161016380'); +//define('PAYTM_MERCHANT_MID',$_SERVER['Merchant_ID']); //Change this constant's value with Website name received from Paytm. - -define('PAYTM_MERCHANT_WEBSITE', 'WEBSTAGING'); -$PAYTM_STATUS_QUERY_NEW_URL='https://securegw-stage.paytm.in/merchant-status/getTxnStatus'; -$PAYTM_TXN_URL='https://securegw-stage.paytm.in/theia/processTransaction'; +//define('PAYTM_MERCHANT_WEBSITE', 'DEFAULT'); if (PAYTM_ENVIRONMENT == 'PROD') { - $PAYTM_STATUS_QUERY_NEW_URL='https://securegw.paytm.in/merchant-status/getTxnStatus'; - $PAYTM_TXN_URL='https://securegw.paytm.in/theia/processTransaction'; + define('PAYTM_STATUS_QUERY_NEW_URL', 'https://securegw.paytm.in/merchant-status/getTxnStatus'); + define('PAYTM_TXN_URL', 'https://securegw.paytm.in/theia/processTransaction'); +} else { + define('PAYTM_STATUS_QUERY_NEW_URL', 'https://securegw-stage.paytm.in/merchant-status/getTxnStatus'); + define('PAYTM_TXN_URL', 'https://securegw-stage.paytm.in/theia/processTransaction'); } define('PAYTM_REFUND_URL', ''); -define('PAYTM_STATUS_QUERY_URL', $PAYTM_STATUS_QUERY_NEW_URL); -define('PAYTM_STATUS_QUERY_NEW_URL', $PAYTM_STATUS_QUERY_NEW_URL); -define('PAYTM_TXN_URL', $PAYTM_TXN_URL); +define('PAYTM_STATUS_QUERY_URL', PAYTM_STATUS_QUERY_NEW_URL); + diff --git a/app/Config/Routes.php b/app/Config/Routes.php index a5679922..ab3447ce 100755 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -190,9 +190,11 @@ $routes->post('qucik_add_addresses', 'Customer::qucik_add_addresses'); #Payment Routes $routes->match(['get','post'],'/subscription_renewal','Payment::index/'); -$routes->match(['get','post'],'/payer','Payment::iniatepay/'); $routes->match(['get','post'],'/pay','Payment::pay/'); $routes->match(['get','post'],'/tresponse','Payment::tresponse/'); +$routes->match(['get','post'],'/response','Payment::response/'); +$routes->get('/payment_failure', 'Payment::payment_failure'); +$routes->get('/payment_success','Payment::payment_success'); $routes->match(['get','post'],'/subscription_renewal/(:any)','Payment::index/$1'); // $routes->group("api", function ($routes) { diff --git a/app/Controllers/BaseController.php b/app/Controllers/BaseController.php index be20e9b2..808d7a6f 100755 --- a/app/Controllers/BaseController.php +++ b/app/Controllers/BaseController.php @@ -65,7 +65,7 @@ abstract class BaseController extends Controller echo "This is a command-line request."; // echo $requestedRoute; } else { - if ($requestedRoute !== '/login' && $requestedRoute !== '/authenticate'&& $requestedRoute !== '/pay' && $requestedRoute !== '/auth_confirm_mail' && $requestedRoute !== '/auth_reset_password' && $requestedRoute !== 'auth_reset_password_save' && $requestedRoute !== '/subscription_renewal'&& $requestedRoute !== '/tresponse' && strpos($requestedRoute, '/subscription_renewal/') === false && $uri->getSegment(1) != 'getExpCustomerDetail'&& $uri->getSegment(1) != 'download_invoice_pdf') { + if ($requestedRoute !== '/login' && $requestedRoute !== '/authenticate'&& $requestedRoute !== '/pay' && $requestedRoute !== '/auth_confirm_mail' && $requestedRoute !== '/auth_reset_password' && $requestedRoute !== 'auth_reset_password_save' && $requestedRoute !== '/subscription_renewal'&& $requestedRoute !== '/tresponse' && strpos($requestedRoute, '/subscription_renewal/') === false && $requestedRoute !== '/payment_failure'&& $requestedRoute !== '/payment_success' && $uri->getSegment(1) != 'getExpCustomerDetail'&& $uri->getSegment(1) != 'download_invoice_pdf') { $this->authData = $this->session_log(); } } diff --git a/app/Controllers/Payment.php b/app/Controllers/Payment.php index a1dc3174..03cee08c 100644 --- a/app/Controllers/Payment.php +++ b/app/Controllers/Payment.php @@ -3,6 +3,7 @@ namespace App\Controllers; use App\Models\CustomerModel; +use App\Models\InvoiceModel; use App\Models\SchemeModel; use App\Models\SubscriptionModel; use paytmpg\pg\request\InitiateTransactionRequestBody; @@ -58,71 +59,77 @@ class Payment extends BaseController } } - public function iniatepay(){ - return view('pay'); - } + public function pay() - { - $userAgent = $_SERVER['HTTP_USER_AGENT']; - if (preg_match('/mobile/i', $userAgent)) { - // Mobile device detected - $payment_method = "mobile"; - } else { - // Desktop device detected - $payment_method = 'website' ; - } - $checkSum = ""; - $paramList = array(); - $CUST_ID = $this->request->getPost("CustomerID"); - $ORDER_ID = uniqid($CUST_ID . "_"); - $INDUSTRY_TYPE_ID = "Retail"; - $CHANNEL_ID = ($payment_method == "mobile") ? "WAP" : "WEB"; - $TXN_AMOUNT = $this->request->getPost("amount"); +{ + $userAgent = $_SERVER['HTTP_USER_AGENT']; + $payment_method = preg_match('/mobile/i', $userAgent) ? "mobile" : 'website'; - // Create an array having all required parameters for creating checksum. - $paramList["MID"] = PAYTM_MERCHANT_MID; - $paramList["ORDER_ID"] = $ORDER_ID; - $paramList["CUST_ID"] = $CUST_ID; - $paramList["INDUSTRY_TYPE_ID"] = $INDUSTRY_TYPE_ID; - $paramList["CHANNEL_ID"] = $CHANNEL_ID; - $paramList["TXN_AMOUNT"] = $TXN_AMOUNT; - $paramList["WEBSITE"] = PAYTM_MERCHANT_WEBSITE; - $paramList["CALLBACK_URL"] = base_url('tresponse'); - + $paramList = array(); + $CUST_ID = (string) $this->request->getPost("CustomerID"); + $ORDER_ID = (string) uniqid($CUST_ID . "_"); + $CHANNEL_ID = ($payment_method == "mobile") ? (string) env('Channel_ID_Mobile') : (string) env('Channel_ID_WEB'); + $TXN_AMOUNT = (string) $this->request->getPost("amount"); - //Here checksum string will return by getChecksumFromArray() function. - $data['checkSum'] = getChecksumFromArray($paramList, PAYTM_MERCHANT_KEY); - $data['paramList'] = $paramList; - //print_r($paramList);die(); - return view('/tresponse', $data); - } + $paramList["MID"] = (string) env('Merchant_ID'); + $paramList["ORDER_ID"] = $ORDER_ID; + $paramList["CUST_ID"] = $CUST_ID; + $paramList["INDUSTRY_TYPE_ID"] = env('Industry_Type'); + $paramList["CHANNEL_ID"] = $CHANNEL_ID; + $paramList["TXN_AMOUNT"] = $TXN_AMOUNT; + $paramList["WEBSITE"] = (string) env('Website'); + $paramList["CALLBACK_URL"] = (string) base_url('tresponse'); - public function tresponse() { - $paytmChecksum = ""; - $paramList = array(); - $isValidChecksum = "FALSE"; - $paramList = $_POST; - $paytmChecksum = isset($_POST["CHECKSUMHASH"]) ? $_POST["CHECKSUMHASH"] : ""; + $checkSum = getChecksumFromArray($paramList, env('Merchant_Key')); + + $data['checkSum'] = $checkSum; + $data['paramList'] = $paramList; + $decryptedChecksum = verifychecksum_e($data['paramList'], env('Merchant_Key'),$data['checkSum']); + log_message('error',json_encode($data['paramList'])); + return view('/tresponse', $data); +} + +public function tresponse() { + $paytmChecksum = ""; + $paramList = $_POST; + print_r($paramList); + $isValidChecksum = "FALSE"; + $paramList = $_POST; + $paytmChecksum = isset($_POST["CHECKSUMHASH"]) ? $_POST["CHECKSUMHASH"] : ""; + $result['receivedFromPaytm'] = $paramList; + // Verify checksum + $isValidChecksum = verifychecksum_e($paramList, env('Merchant_Key'), $paytmChecksum); + + if ($isValidChecksum == "TRUE") { + //echo "Checksum matched.| From : | @@ -70,8 +88,38 @@ = $value->mobile_no ? "Mobile : " . $value->mobile_no . " ." : "" ?> +======= + +