 <?php

$itemID = get_id(2);

require_once ROOT_PATH.'/zipmarket/apps/users/models/deposit.class.php';
$cms = new deposit();

try
{
    ini_set("soap.wsdl_cache_enabled", "0");
    $client = new SoapClient('http://www.zarinpal.com/WebserviceGateway/wsdl', array('encoding'=>'UTF-8'));
}
catch (SoapFault $ex)
{
    die('System Error1: constructor error');
}

$au      = isset($_REQUEST['au'])    ? $_REQUEST['au']    : '';
$Price   = isset($_REQUEST['Price']) ? $_REQUEST['Price'] : '';
$OrderID = isset($_REQUEST['oID'])   ? $_REQUEST['oID']   : '';

$order_info = $cms->get($OrderID);

if($order_info)
{
    $merchant = $meta['zarinpal_merchant'];
    $res = $client->PaymentVerification($merchant, $au, $Price);
    if ($res == '1')
    {
        $cms->depositIsPay($OrderID);
        refresh('http://' . $config['domain'] . '/' . $languageURL . 'users/deposit/success/' . $OrderID . '/');
    }
    else
    {
        refresh('http://' . $config['domain'] . '/' . $languageURL . 'payments/msg/?zarin_error=' . $res);
    }
}

refresh('http://' . $config['domain'] . '/' . $languageURL . 'users/deposit/'); 