Example #1
0
 public function balance($walletID, $password)
 {
     $this->error = '';
     try {
         $client = new SoapClient(self::BASE_URL);
         $params = array('WalletID' => $walletID, 'SecurityToken' => self::create_security_token($password));
         $webService = $client->Wallet_Get_Balance($params);
         $wsResult = $webService->Wallet_Get_BalanceResult;
         return $wsResult;
     } catch (Exception $e) {
         $this->error = $e;
         return null;
     }
 }
Example #2
0
 /**
  * Вывод баланса
  * @return array['currency'=>'amount']
  */
 public function getBalance()
 {
     try {
         $client = new SoapClient($this->url);
         $obj = new stdClass();
         $obj->WalletID = $this->purse;
         $obj->SecurityToken = $this->token;
         $webService = $client->Wallet_Get_Balance($obj);
         $wsResult = $webService->Wallet_Get_BalanceResult;
         $arr = array();
         foreach ($wsResult->Balance as $ws) {
             $arr[$ws->Currency] = $ws->Amount;
         }
         return $arr;
     } catch (Exception $e) {
         Yii::log('Ошибка в OkPay: ' . $e->getMessage());
     }
 }
 $sha256 = bin2hex(mhash(MHASH_SHA256, $authString));
 $secToken = strtoupper($sha256);
 $client = new SoapClient("https://api.okpay.com/OkPayAPI?wsdl");
 $webService = $client->Get_Date_Time();
 $wsResult = $webService->Get_Date_TimeResult;
 $obj = new stdClass();
 $e = new stdClass();
 $obj->WalletID = $WalletID;
 $obj->SecurityToken = $secToken;
 $obj->Currency = "USD";
 $webService1 = $client->Wallet_Get_Currency_Balance($obj);
 $wsResult1 = $webService1->Wallet_Get_Currency_BalanceResult;
 //print_r($wsResult1);
 $obj->WalletID = $WalletID;
 $obj->SecurityToken = $secToken;
 $webService1 = $client->Wallet_Get_Balance($obj);
 $wsResult1 = $webService1->Wallet_Get_BalanceResult;
 //print_r($wsResult1);
 $obj->WalletID = $WalletID;
 $obj->SecurityToken = $secToken;
 $obj->Currency = "USD";
 $obj->Receiver = $cashout->adr;
 $obj->Amount = $cashout->cash - 0.01;
 $obj->Comment = "Payout from LikesPlanet.com";
 $obj->IsReceiverPaysFees = FALSE;
 $webService1 = $client->Send_Money($obj);
 $wsResult1 = $webService1->Send_MoneyResult;
 print_r($wsResult1->Status);
 if ($wsResult1->Status == "Completed") {
     $cashoutdata0 = mysql_query("SELECT * FROM `cashout` WHERE ( `i` = '{$cashout->i}' ) ");
     $cashoutdata = mysql_fetch_object($cashoutdata0);