Example #1
9
function back_from_bank($Amount, $config, $transids, $lang)
{
    if ($_GET['Status'] == 'OK') {
        $client = new SoapClient('https://de.zarinpal.com/pg/services/WebGate/wsdl', array('encoding' => 'UTF-8'));
        $result = $client->PaymentVerification(array('MerchantID' => $config['merchent_code'], 'Authority' => $_GET['Authority'], 'Amount' => $Amount / 10));
        $tracking_code = $result->RefID;
        $result = $result->Status;
        if ($result == 100) {
            $show['Status'] = 1;
            $show['massage'] = $lang['Successful']['back'];
            $show['trans_id1'] = $tracking_code;
            $show['trans_id2'] = $_GET['Authority'];
        } else {
            $show['Status'] = 0;
            $show['massage'] = $lang['error'][$result];
            $show['trans_id1'] = $tracking_code;
            $show['trans_id2'] = $_GET['Authority'];
        }
    } else {
        $show['Status'] = 0;
        $show['massage'] = $lang['error']['not_back'];
        $show['trans_id1'] = $tracking_code;
        $show['trans_id2'] = $_GET['Authority'];
    }
    return $show;
}
 /**
  * verify driver.
  *
  * @param $inputs
  *
  * @return array
  */
 public function verify($inputs)
 {
     $client = new \SoapClient($this->wsdlAddress, ['encoding' => 'UTF-8']);
     $result = $client->PaymentVerification($inputs);
     if ($result->Status == 100) {
         return ['Status' => 'success', 'RefID' => $result->RefID];
     } else {
         return ['Status' => 'error', 'error' => $result->Status];
     }
 }
Example #3
0
 /**
  * verify driver
  *
  * @param $inputs
  * @return array
  */
 public function verify($inputs, $debug)
 {
     $this->debug = $debug;
     $client = new \SoapClient($this->setWsdlAddress(), array('encoding' => 'UTF-8'));
     $result = $client->PaymentVerification($inputs);
     dd($result);
     if ($result->Status == 100) {
         return ['Status' => 'success', 'RefID' => $result->RefID];
     } else {
         return ['Status' => 'error', 'error' => $result->Status];
     }
 }
Example #4
0
 public function zarinpalreturnback()
 {
     $donate_zarinpal = $this->config->item('donate_zarinpal');
     $MerchantID = $donate_zarinpal["MerchantID"];
     $Amount = $this->session->userdata('Amount');
     $Authority = $this->input->get("Authority");
     $status = $this->input->get("Status");
     $this->session->unset_userdata('Amount');
     if ($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;
             $this->fields['message_id'] = $result->RefID;
             $this->fields['custom'] = $user_id = $this->user->getId();
             $this->fields['points'] = $this->getDpAmount($Amount);
             $this->fields['timestamp'] = time();
             $this->fields['converted_price'] = $Amount;
             $this->fields['currency'] = $this->config->item('donation_currency_sign');
             $this->fields['price'] = $Amount;
             $this->fields['country'] = 'SE';
             $this->db->query("UPDATE `account_data` SET `dp` = `dp` + ? WHERE `id` = ?", array($this->fields['points'], $this->fields['custom']));
             $this->updateMonthlyIncome($Amount);
             $this->db->insert("paygol_logs", $this->fields);
             redirect($this->template->page_url . "ucp");
             exit;
             //die('success');
         } else {
             echo 'Transation failed. Status:' . $result->Status;
             exit;
         }
     } else {
         echo 'Transaction canceled by user';
         exit;
     }
 }
Example #5
0
 public function doVerifyTransaction(array $options = array())
 {
     $this->setOptions($options);
     $this->_checkRequiredOptions(array('referenceId', 'merchantCode'));
     try {
         $soapClient = new SoapClient($this->getWSDL());
         $invoice = Model_Invoice::id($this->getInvoiceId());
         $pin = $this->_config['merchantCode'];
         $au = $this->_config['referenceId'];
         $amount = $invoice->price;
         $status = 1;
         $res = $soapClient->PaymentVerification($pin, $au, $amount, $status);
     } catch (SoapFault $e) {
         $this->log($e->getMessage());
         throw new Exception('SOAP Exception: ' . $e->getMessage());
     }
     if ($res == 1) {
         return 1;
     } else {
         return $res;
     }
     // VerifyError
 }