<?php

$itemID = get_id(2);

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

$Status = isset($_REQUEST['status'])?$_REQUEST['status']:'';
$Refnumber = isset($_REQUEST['refnumber'])?$_REQUEST['refnumber']:'';
$Resnumber = isset($_REQUEST['resnumber'])?$_REQUEST['resnumber']:'';
$OrderID = isset($_REQUEST['oID'])   ? $_REQUEST['oID']   : '';

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

if($order_info)
{
	if ($Status == 100)
		{
			require_once ROOT_PATH.'/zipmarket/apps/payments/nusoap.php';
			$ParspalPin 	= trim($meta['parspal_merchant']);
			$pass		= $meta['parspal_pass'];
			$amount		= round($order_info['price']);
			$soapclient = new nusoap_client('http://merchant.parspal.com/WebService.asmx?wsdl','wsdl');
			$params = array(
							'MerchantID' => $ParspalPin,
							'Password' =>$pass,
							'Price' => $amount,
							'RefNum' =>$Refnumber
							) ;
			$res = $soapclient->call('verifyPayment', $params);
			$Status =$res['verifyPaymentResult']['ResultStatus']; 
				if (strtolower($Status)=='success')//-- موفقیت آمیز
				{
					$cms->depositIsPay($OrderID);
					refresh('http://' . $config['domain'] . '/' . $languageURL . 'users/deposit/success/' . $OrderID . '/');
				}else
				{
					refresh('http://' . $config['domain'] . '/' . $languageURL . 'payments/msg/?parspal_error=' . $res);
				}

		}
}

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