Welcome Guest, Not a member yet? Register   Sign In
custom library not load
#3

(06-12-2016, 06: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/'.$result->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


Messages In This Thread
custom library not load - by webgooy - 06-12-2016, 02:14 AM
RE: custom library not load - by Wouter60 - 06-12-2016, 06:16 AM
RE: custom library not load - by webgooy - 06-12-2016, 06:49 AM
RE: custom library not load - by albertleao - 06-12-2016, 09:30 PM
RE: custom library not load - by Bhavesh - 06-12-2016, 10:30 PM



Theme © iAndrew 2016 - Forum software by © MyBB