Calling onPaymentNotification() with $_POST

  • Posts: 2
  • Thank you received: 0
10 years 8 months ago #149554

-- url of the page with the problem -- : http://http://www.qwerty.webion.pl/Joomla323/
-- HikaShop version -- : 2.3.0
-- Joomla version -- : 3.2
-- PHP version -- : 5.3
-- Browser(s) name and version -- : Chrome 33.0.1750.154

Hi,

I would like to ask is there a chance to call onPaymentNotification() with params in $_POST. My payment gateway sends CSV params by POST. This is my code:

function onPaymentNotification(&$statuses)
	{
	if (!empty($_POST)) {
              if(empty($_POST['json']) || !$this->check_ip()){
                   exit;
        }
        $data = json_decode(stripcslashes($_POST['json']), true);
        $ret = array();

        foreach($data as $entry)
        {
          if(isset($entry['account']))
          {
            $ret[] = array(
              'account' => $entry['account'],
              'transfer' => $entry['transfer'],
              'return' => 1
            );
            //`account` `control` `transfer` `time` `amount` `guarantee` `title` `status`
            if($entry['status'] != '2'){
            	$this->modifyOrder($order_id, $this->payment_params->verified_status, true, true);
				return true; 
            }
            else{
            	$this->modifyOrder($order_id, $this->payment_params->invalid_status, true, true); 
				return false;            
            }
          }
          echo json_encode($ret);
        }
      }
      exit;
}

Thank you in advance,
JU

Please Log in or Create an account to join the conversation.

  • Posts: 12953
  • Thank you received: 1778
10 years 8 months ago #149559

Hello,
Sure :).

Please Log in or Create an account to join the conversation.

  • Posts: 2
  • Thank you received: 0
10 years 8 months ago #149674

Could you tell me what's wrong with my code then? If I'm using direct link to call onPaymentNotification() without POST it works (before first if I print simple echo and i can see this), but when i do it with POST params it returns page name. Link i'm using is:

MY_PAGE/index.php?notif_payment=NAME&option=com_hikashop&ctrl=checkout&task=notify&tmpl=component&lang=LANGUAGE

Please Log in or Create an account to join the conversation.

  • Posts: 12953
  • Thank you received: 1778
10 years 8 months ago #149677

You should debug your code using the php var_dump function, also note that it won't be displayed on the "onPaymentNotification()" link but through your payment log.
You'll be able to check your payment log file through "Hikashop->System->Configuration->Main" by using the "See the report" button of your Payment log file option.

Please Log in or Create an account to join the conversation.

Time to create page: 0.068 seconds
Powered by Kunena Forum