|
Welcome,
Guest
|
|
|
Im not sure what is wrong but everything but notifications seem to be working. anyone maybe have an idea why?
$consumer_key = "22MSNQM6h3LSXbpUwCDI57/icsaffdf"; $consumer_secret = "/HiLMAyd6DqGc7yLbdrI4tAdjaY=";// Use the secret from your test //account on demo.pesapal.com. When you are ready to go live make sure you //change the secret to the live account registered on www.pesapal.com! //$statusrequestAPI = 'demo.pesapal.com/api/querypaymentstatus';//change to $statusrequestAPI = 'www.pesapal.com/api/querypaymentstatus';//when you are ready to go live! // Parameters sent to you by PesaPal IPN $pesapalNotification = $_REQUEST['pesapal_notification_type']; $pesapalTrackingId = $_REQUEST['pesapal_transaction_tracking_id']; $pesapal_merchant_reference = $_REQUEST['pesapal_merchant_reference']; $signature_method = new OAuthSignatureMethod_HMAC_SHA1(); if($pesapalNotification=="CHANGE" && $pesapalTrackingId!='') { $token = $params = NULL; $consumer = new OAuthConsumer($consumer_key, $consumer_secret); //get transaction status $request_status = OAuthRequest::from_consumer_and_token($consumer, $token, "GET", $statusrequestAPI, $params); $request_status->set_parameter("pesapal_merchant_reference", $pesapal_merchant_reference); $request_status->set_parameter("pesapal_transaction_tracking_id",$pesapalTrackingId); $request_status->sign_request($signature_method, $consumer, $token); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $request_status); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_HEADER, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); if(defined('CURL_PROXY_REQUIRED')) if (CURL_PROXY_REQUIRED == 'True') { $proxy_tunnel_flag = (defined('CURL_PROXY_TUNNEL_FLAG') && strtoupper(CURL_PROXY_TUNNEL_FLAG) == 'FALSE') ? false : true; curl_setopt ($ch, CURLOPT_HTTPPROXYTUNNEL, $proxy_tunnel_flag); curl_setopt ($ch, CURLOPT_PROXYTYPE, CURLPROXY_HTTP); curl_setopt ($ch, CURLOPT_PROXY, CURL_PROXY_SERVER_DETAILS); } $response = curl_exec($ch); $header_size = curl_getinfo($ch, CURLINFO_HEADER_SIZE); $raw_header = substr($response, 0, $header_size - 4); $headerArray = explode("\r\n\r\n", $raw_header); $header = $headerArray[count($headerArray) - 1]; //transaction status $elements = preg_split("/=/",substr($response, $header_size)); $status = $elements[1]; curl_close ($ch); //UPDATE YOUR DB TABLE WITH NEW STATUS FOR TRANSACTION WITH pesapal_transaction_tracking_id $pesapalTrackingId $this->load->model('userips_model'); if(DB_UPDATE_IS_SUCCESSFUL) { $resp = "pesapal_notification_type=$pesapalNotification&pesapal_transaction_tracking_id=$pesapalTrackingId&pesapal_merchant_reference=$pesapal_merchant_reference"; $query = $this->db->query("update `vp_user_ips` set status = 1 where id = $pesapal_merchant_reference"); $sql = "INSERT INTO `vp_orders`( `id`,`order_id`, `transaction_id`, `status`) VALUES ('',$pesapal_merchant_reference,'$pesapalTrackingId',1)"; $result = $this->db->query($sql); mail('jgitau 'at' gmail.com','testing ipn receiver','Ipn is succesfully working with no issue'); /*ob_start(); echo $resp; ob_flush(); exit;*/ } |
|
|
|
all sorted...i blame it on morning blindness
|
|
|
|