• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
custom library not load

#1
hi
i create custom library for payment gateway but when load in my controller  show me blank page.

function  invoice(){
           
           
           
            
           $invoice_id=$this->input->post('invoice_id');
           $amount=$this->input->post('amount');
           $Description=$this->input->post('Description');
           $MerchantID='xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx';
           $CallbackURL='url';
           $Mobile='09126015062';
           $[email protected]';
         
           
           $this->load->library('mylibrary');
           $this->mylibrary->request($MerchantID,$amount,$Description,$CallbackURL,$Mobile,$Email);
           
    
     $student_profile         = $this->db->get_where('student', array(
         'student_id' => $this->session->userdata('student_id')
        ))->row();
        $student_id              = $student_profile->student_id;
        $page_data['invoices']   = $this->db->get_where('invoice', array(
            'student_id' => $student_id
        ))->result_array();
        $page_data['page_name']  = 'mypal';
        $page_data['page_title'] = get_phrase('manage_invoice/payment');
        $this->load->view('index', $page_data);
        
    }      

i found when load  library this problem happens.

please help me what wrong in this code
Reply

#2
There is nothing wrong with this piece of code in your controller. Check the library itself for syntax errors.
Reply

#3
(06-12-2016, 07:16 AM)Wouter60 Wrote: There is nothing wrong with this piece of code in your controller. Check the library itself for syntax errors.

thanks for your answer and please help me to find syntax errors in my library
this is my library


<?php

defined('BASEPATH') or exit('No direct script access allowed');

/*
 * CodeIgniter ZarinPal getway library
 *
 * @author              Mahdi Majidzadeh (http://restro.ir)
 * @license             GNU Public License 2.0
 * @package             ZarinPal
 */



class Myclass
{
    private $url;
    private $ERR;
    private $authority;
    private $refid;

    public function request($merchant_id, $amount, $desc, $call_back, $mobile = null, $email = null)
    {
       $client = new SoapClient('https://de.zarinpal.com/pg/services/WebGate/wsdl', array('encoding' => 'UTF-8'));
    
    $result = $client->PaymentRequest(
                        array(
                                'MerchantID'     => $MerchantID,
                                'Amount'     => $Amount,
                                'Description'     => $Description,
                                'Email'     => $Email,
                                'Mobile'     => $Mobile,
                                'CallbackURL'     => $CallbackURL
                            )
    );
    
    //Redirect to URL You can do it also by creating a form
    if($result->Status == 100)
    {
        Header('Location: https://www.zarinpal.com/pg/StartPay/'.&...>Authority);
    } else {
        echo'ERR: '.$result->Status;
    }
       
    }
}
    public function verify(){
        $MerchantID = 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX';
        $Amount = 1000; //Amount will be based on Toman
        $Authority = $_GET['Authority'];
    
    if($_GET['Status'] == 'OK'){
        // URL also Can be https://ir.zarinpal.com/pg/services/WebGate/wsdl
        $client = new SoapClient('https://de.zarinpal.com/pg/services/WebGate/wsdl', array('encoding' => 'UTF-8'));
        
        $result = $client->PaymentVerification(
                              array(
                                    'MerchantID'     => $MerchantID,
                                    'Authority'      => $Authority,
                                    'Amount'     => $Amount
                                )
        );
        
        if($result->Status == 100){
            echo 'Transation success. RefID:'. $result->RefID;
        } else {
            echo 'Transation failed. Status:'. $result->Status;
        }

    } else {
        echo 'Transaction canceled by user';
    }
    }
   
}
Reply

#4
Check your apache logs files for errors so you can see the line number if there is a syntax error
Codeigniter is simply one of the tools you need to learn to be a successful developer. Always add more tools to your coding arsenal!
Reply

#5
Hi

You added one extra  } in your code
Please remove } top of the public function verify() function
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2017 MyBB Group.