如何使用codeigniter获取payumoney paygetway中的用户定义字段?

时间:2018-06-14 08:47:21

标签: php codeigniter-2 payment-gateway payumoney

我正在开发一个在线购物应用程序。为了支付getway我使用payumoney。 在那,我在$udf1,$udf2,$udf3,$udf4,$udf5,$udf6,$udf7检查方法中传递用户定义的字段,如PaymentGetway_Controller。我得到$ udf1到$ udf5的价值,           但是在付款成功后没有在状态控制器中获得$ udf6,$ udf7。

下面是我的代码:

public function check()
{
    $amount = $this->input->post('payble_amount');
    $product_info = $this->input->post('product_info');
    $customer_name = $this->input->post('customer_name');
    $customer_emial = $this->input->post('customer_email');
    $customer_mobile = $this->input->post('mobile_number');
    $customer_address = $this->input->post('customer_address');
    $udf1 = $this->input->post('udf1');
    $udf2 = $this->input->post('udf2');
    $udf3 = $this->input->post('udf3');
    $udf4 = $this->input->post('udf4');
    $udf5 = $this->input->post('udf5');
    $udf6 = $this->input->post('udf6');
    $udf7 = $this->input->post('udf7');


        $MERCHANT_KEY = "jFoMrF"; //change  merchant with yours
        $SALT = "L9butXEG";  //change salt with yours 

        $txnid = substr(hash('sha256', mt_rand() . microtime()), 0, 20);

        $udf1 = $udf1;
        $udf2 = $udf2;
        $udf3 = $udf3;
        $udf4 = $udf4;
        $udf5 = $udf5;
        $udf6 = $udf6;
        $udf7 = $udf7;

         $hashstring = $MERCHANT_KEY . '|' . $txnid . '|' . $amount . '|' . $product_info . '|' . $customer_name . '|' . $customer_emial . '|' . $udf1 . '|' . $udf2 . '|' . $udf3 .'|' . $udf4 .'|' . $udf5 . '||||||' . $SALT;
        $hash = strtolower(hash('sha512', $hashstring));
        $success = site_url() . 'Status';  
        $fail = site_url() . 'Status';
        $cancel = site_url() . 'Status';


         $data = array(
            'mkey' => $MERCHANT_KEY,
            'tid' => $txnid,
            'hash' => $hash,
            'amount' => $amount,           
            'name' => $customer_name,
            'productinfo' => $product_info,
            'mailid' => $customer_emial,
            'phoneno' => $customer_mobile,
            'address' => $customer_address,
            'action' => "https://secure.payu.in", //for live change action  https://secure.payu.in
            'sucess' => $success,
            'failure' => $fail,
            'cancel' => $cancel,  
            'udf1' => $udf1,
            'udf2' => $udf2,
            'udf3' => $udf3,
            'udf4' => $udf4,
            'udf5' => $udf5,
            'udf6' => $udf6,
            'udf7' => $udf7         
        );

      $data['menues'] =  $this->user_model->menusubmenudata();
      $data['viewcartdata'] =  $this->user_model->viewcartdata();
      $data['billshiprows'] =  $this->user_model->billshipfetchdata();
      $data['alldata'] = $data;
      $data['template'] = 'confirmation';
      $data['title'] = 'confirmation';
      $this->userlayout($data);        
}



/*Status controller */
public function index() {

   $status = $this->input->post('status');
  if (empty($status)) {
        redirect(site_url().'User/PaymentGetway_Controller/product_form');
    }

    $firstname = $this->input->post('firstname');
    $amount = $this->input->post('amount');
    $txnid = $this->input->post('txnid');
    $posted_hash = $this->input->post('hash');
    $key = $this->input->post('key');
    $productinfo = $this->input->post('productinfo');
    $email = $this->input->post('email');
    $salt = "L9butXEG"; //  Your salt
    $add = $this->input->post('additionalCharges');
    If (isset($add)) {
        $additionalCharges = $this->input->post('additionalCharges');
        $retHashSeq = $additionalCharges . '|' . $salt . '|' . $status . '|||||||||||' . $email . '|' . $firstname . '|' . $productinfo . '|' . $amount . '|' . $txnid . '|' . $key;
    } else {
        $retHashSeq = $salt . '|' . $status . '|||||||||||' . $email . '|' . $firstname . '|' . $productinfo . '|' . $amount . '|' . $txnid . '|' . $key;
    }

      $data['hash'] = hash("sha512", $retHashSeq);
      $data['amount'] = $amount;
      $data['txnid'] = $txnid;
      $data['posted_hash'] = $posted_hash;
      $data['status'] = $status;

      if($status == 'success'){
          $this->load->view('success', $data);   
     }
     else{
          $this->load->view('failure', $data); 
     }
}

0 个答案:

没有答案