مشکل درگاه پرداخت زرین پال
سلام دوستان
میخواستم درباره درگاه پرداخت زرین پال سوال کنم. یک کتابخخانه خود زرین پال ایجاد کرده. من اونو برای درگاه پرداخت میخواستم استفاده کنم ولی متاسفانه چون اطلاع زیادی از برنامه نویسی ندارم نمیتونم ویرایشش کنم.
این کتابخانه زرین پال هست:
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Zarinpal {
private $merchant_id;
private $authority;
private $error;
private $ref_id;
private $url;
private $wsdl_url = 'https://www.zarinpal.com/pg/services/WebGate/wsdl';
private $pay_url = 'https://www.zarinpal.com/pg/StartPay/';
public function __construct($params)
{
$this->merchant_id = $params['merchant_id'];
}
public function request($amount, $desc, $callback, $email = '', $mobile = '')
{
$params = [
'MerchantID' => $this->merchant_id,
'Amount' => $amount,
'Description' => $desc,
'CallbackURL' => $callback
];
if ($email)
$params['Email'] = $email;
if ($mobile)
$params['Mobile'] = $mobile;
$client = new SoapClient($this->wsdl_url, [
'encoding' => 'UTF-8'
]);
$result = $client->PaymentRequest($params);
if ($result->Status !== 100)
{
$this->error = $result->Status;
return FALSE;
}
$this->authority = $result->Authority;
$this->url = $this->pay_url.$this->authority;
return TRUE;
}
public function redirect()
{
if ( ! function_exists('redirect'))
{
$CI =& get_instance();
$CI->load->helper('url');
}
redirect($this->url);
}
public function verify($amount, $authority)
{
$params = [
'MerchantID' => $this->merchant_id,
'Amount' => $amount,
'Authority' => $authority
];
$client = new SoapClient($this->wsdl_url, [
'encoding' => 'UTF-8'
]);
$result = $client->PaymentVerification($params);
if ($result->Status !== 100)
{
$this->error = $result->Status;
return FALSE;
}
$this->ref_id = $result->RefID;
return TRUE;
}
public function sandbox()
{
$this->wsdl_url = 'https://sandbox.zarinpal.com/pg/services/WebGate/wsdl';
$this->pay_url = 'https://sandbox.zarinpal.com/pg/StartPay/';
}
public function get_authority()
{
return $this->authority;
}
public function get_error()
{
return $this->error;
}
public function get_ref_id()
{
return $this->ref_id;
}
}
الا من این کنترل رو ایجاد کردم ولی برای پرداخت به سمت زرین پال نمیره. یعنی هیچ اتفاقی نمیافته.
public function zarinpal_payment($project_id = ''){
$this->load->library('zarinpal');
$title = $this->db->get_where('project', array('project_id' => $project_id))->row()->title;
$amount = $this->db->get_where('project' , array('project_id' => $project_id))->row()->amount;
$email = $this->db->get_where('client',array('client_id' => $this->session->userdata('user_id')))->row()->email;
$mobile = $this->db->get_where('client',array('client_id' => $this->session->userdata('user_id')))->row()->phone;
$config = array(
'MerchantID' => '',
'Amount' => $amount,
'Description' => $title,
'Email' => $email,
'Mobile' => $mobile,
'CallbackURL' => site_url('payment/zarinpal_verify')
);
$this->zarinpal->PaymentRequest($config);
}
نقل قول: مشکل درگاه درپاخت زرین پال
سلام
این متدی که توی کنترلر فراخوانی کردی توی کتابخونش اصلا وجود نداره PaymentRequest
اول باید اینو فراخوانی کنی
request($amount, $desc, $callback, $email = '', $mobile = '')