public function testCreateMultisig() { $wallet = new Wallet($this->config); $add = json_decode($wallet->getNewAddress(''), true)['result']; $info = json_decode($this->api->createMultiSig(1, [$add]), true); $this->assertArrayHasKey('redeemScript', $info['result']); }
public function wallet() { $wallet = Wallet::where('user_id', '=', $this->id)->get(); if (count($wallet) != 0) { $wallet = $wallet->first(); } else { $wallet = new Wallet(); $wallet->user_id = $this->id; $wallet->account_id = $this->account_id; $wallet->save(); } return $wallet; }
function actionIndex() { $this->layout = '//layouts/none'; //header('Content-type: application/json'); $null_wallets = Wallet::model()->findAllByAttributes(array('wallet_address' => null)); foreach ($null_wallets as $null_wallet) { // CoinAddress::set_debug(true); // optional - show debugging messages // CoinAddress::set_reuse_keys(true); // optional - use same key for all addresses $newcoin = CoinAddress::bitcoin(); Yii::log("Created new address for {$newcoin['public_hex']}", "info"); $new_wallet = new SecureWallet(); $new_wallet->wallet_address = $newcoin['public']; $new_wallet->private_key = $newcoin['private']; $new_wallet->save(); $null_wallet->wallet_address = $new_wallet->wallet_address; $null_wallet->save(); } echo CJSON::encode(array('status' => 'ok')); Yii::app()->end(); }
public function getWalletType($market_id) { //get info market $market_default = Market::find($market_id); if (isset($market_default->id)) { $wallet_from = $market_default->wallet_from; $wallet_to = $market_default->wallet_to; $wallet = new Wallet(); $from = $wallet->getType($wallet_from); $to = $wallet->getType($wallet_to); return array('id' => $market_id, 'wallet_from' => $from, 'wallet_to' => $to); } return array(); }
/** * @param $userId * @return Wallet * @throws \HttpException */ public function getUserWallet($userId) { $labels = implode(',', $this->generateLabels($userId)); $result = $this->_blockio->get_address_balance(['labels' => $labels]); $wallet = Wallet::instantiate($result->data); return $wallet; }
public function withdraw() { //retrieve POST value $param = Input::only('credits', 'account_id'); $rules = array('credits' => 'required|numeric|min:1,max:1000000', 'account_id' => 'exists:acl_users,id'); //custom error messaging $messages = array(); $validator = Validator::make($param, $rules, $messages); if ($validator->passes()) { $retrieve = Wallet::where('account_id', $param['account_id'])->first(); if (!empty($retrieve)) { if ($retrieve->credits >= $param['credits']) { try { $update = $retrieve->decrement('credits', $param['credits']); if ($update == 1) { $fundin = array('wallet_id' => $retrieve->id, 'onbehalf' => Auth::user()->id, 'credits' => $param['credits'], 'description' => 'Withdraw credits', 'fundtype' => 'fundout'); $funds = Fundinout::create($fundin); } } catch (Exception $e) { return false; } $message = 'Credit has been successfully withdraw.'; return Redirect::action('player.index')->with('success', $message); } else { return Redirect::action('player.index')->with('error', 'Insufficient credits!'); } } else { return Redirect::action('player.index')->with('error', 'Insufficient credits!'); } } else { $messages = $validator->messages(); return Redirect::action('player.index')->with('error', $messages->all()); } }
public function deposit() { //retrieve POST value $param = Input::only('credits', 'account_id'); $rules = array('credits' => 'required|numeric|min:1,max:1000000', 'account_id' => 'exists:acl_users,id'); $messages = array('buyer_id.exists' => 'Buyer id is not valid.', 'merchant_id.exists' => 'Merchant id is not valid'); $validator = Validator::make($param, $rules, $messages); if ($validator->passes()) { $retrieve = Wallet::where('account_id', $param['account_id'])->first(); $credits = array('account_id' => $param['account_id'], 'credits' => $param['credits']); if (!empty($retrieve)) { try { $update = $retrieve->increment('credits', $param['credits']); if ($update == 1) { $fundin = array('wallet_id' => $retrieve->id, 'onbehalf' => Auth::user()->id, 'credits' => $param['credits'], 'description' => 'Deposit credits', 'fundtype' => 'fundin'); $funds = Fundinout::create($fundin); } } catch (Exception $e) { return false; } } else { $add_credits = Wallet::create($credits); $fundin = array('wallet_id' => $add_credits->id, 'onbehalf' => Auth::user()->id, 'credits' => $param['credits'], 'description' => 'Deposit credits', 'fundtype' => 'fundin'); $funds = Fundinout::create($fundin); } $message = 'Credit has been successfully added.'; return Redirect::action('roulette.index')->with('success', $message); } else { $messages = $validator->messages(); return Redirect::action('roulette.index')->with('error', $messages->all()); } }
public function getType($wallet_id) { $type = Wallet::where('id', '=', $wallet_id)->select('type')->first(); if (isset($type->type)) { return $type->type; } else { return ''; } }
public function beforeDelete() { if ($this->id) { $wallets = Wallet::getList(['where' => ['currency_id', $this->id]]); foreach ($wallets as $wallet) { $wallet->delete(); } } }
public function lastNullPrice($typeID) { //Get the last Null buy price $criteria = new CDbCriteria(); $criteria->condition = 'typeID=:typeID AND (characterID = 2) AND stationID = 60014899 AND transactionType = "buy"'; $criteria->params = array(':typeID' => $typeID); $criteria->order = 'transactionDateTime DESC'; //Run the query $lastNull = Wallet::Model()->find($criteria); return $lastNull->price; }
public function actionCreate() { $sock = stream_socket_client('unix:///tmp/addr_server_socket', $errno, $errstr); fwrite($sock, "request_addr\n"); $data = fread($sock, 4096) . "\n"; fclose($sock); if ($data != "") { $data = json_decode($data); } else { $this->redirect(Yii::t('urls', '/wallets')); } $user = Yii::app()->user->data(); $wallets = $user->wallets; $new_wallet = new Wallet(); $new_wallet->id_user = $user->id; $new_wallet->wallet_address = $data->{'multiaddr'}; $new_wallet->privatekey = $data->{'key1'}; $new_wallet->save(); $this->render('created', array('wallets' => $wallets, 'data' => $data)); }
/** * Конструктор класса необходимо задать ИД пользователя. * * @param int $uid ИД пользователя */ public function __construct($uid = null) { parent::__construct($uid); // Если есть код авторизации все гуд if ($this->getAccessToken() !== false) { $this->api = new API_Webmoney(null, $this->getAccessToken()); } else { $this->api = new API_Webmoney(); } $this->log = new log('wallet/webmoney-' . SERVER . '-%d%m%Y.log', 'a', '%d.%m.%Y %H:%M:%S : '); }
public function addTradeHistory($trade_history) { $this->seller_id = $trade_history['seller_id']; $this->buyer_id = $trade_history['buyer_id']; $this->amount = $trade_history['amount']; $this->price = $trade_history['price']; $this->market_id = $trade_history['market_id']; $this->type = $trade_history['type']; $this->fee_buy = $trade_history['fee_buy']; $this->fee_sell = $trade_history['fee_sell']; $this->save(); if ($this->id) { require_once app_path() . '/libraries/Pusher.php'; $setting = new Setting(); $pusher_app_id = $setting->getSetting('pusher_app_id', ''); $pusher_app_key = $setting->getSetting('pusher_app_key', ''); $pusher_app_secret = $setting->getSetting('pusher_app_secret', ''); if ($pusher_app_id != '' && $pusher_app_key != '' && $pusher_app_secret != '') { $pusher = new Pusher($pusher_app_key, $pusher_app_secret, $pusher_app_id); $wallet = new Wallet(); $market = Market::where('id', $this->market_id)->first(); $from = strtoupper($wallet->getType($market->wallet_from)); $to = strtoupper($wallet->getType($market->wallet_to)); $message = array('channel' => 'trade.' . $this->market_id, 'trade' => array('timestamp' => strtotime($this->created_at), 'datetime' => date("Y-m-d H:i:s T", strtotime($this->created_at)), 'marketid' => $this->market_id, 'marketname' => $from . '/' . $to, 'amount' => sprintf("%.8f", $this->amount), 'price' => sprintf("%.8f", $this->price), 'total' => sprintf("%.8f", $this->amount * $this->price), 'type' => $this->type)); $pusher->trigger('trade.' . $this->market_id, 'message', $message); } if (!$setting->getSetting('disable_points', 0)) { //Cong point cho nguoi mua va nguoi da gioi thieu ho $points = new PointsController(); if ($this->fee_buy > 0) { $points->addPointsTrade($this->buyer_id, $this->fee_buy, $this->id, $market->wallet_to); } //Cong point cho nguoi ban va nguoi da gioi thieu ho if ($this->fee_sell > 0) { $points->addPointsTrade($this->seller_id, $this->fee_sell, $this->id, $market->wallet_to); } } } return $this->id; }
public function beforeSave() { if ($this->pk()) { $cur = Wallet::get($this->pk()); if ($cur->amount != $this->amount) { $history = new Wallet\History(); $history->wallet_id = $this->pk(); $history->old = $cur->amount; $history->new = $this->amount; $history->amount = $this->amount - $cur->amount; $history->save(); } } }
/** * Store a newly created resource in storage. * * @return Response */ public function store() { if (ACL::checkUserPermission('bet.roulette') == false) { return Redirect::action('dashboard'); } $param = Input::only('bettype', 'betnumber', 'amount', 'game_id'); $retrieve = Wallet::where('account_id', Auth::user()->id)->first(); $bet_type = array('straight', 'split', 'line', 'square', 'basket', 'doublestreet'); if ($retrieve->credits >= $param['amount']) { if (Input::has('betnumber')) { if (count($param['betnumber']) >= 0 && count($param['betnumber']) <= 6) { $retrieve = Wallet::where('account_id', Auth::user()->id)->first(); $index = count($param['betnumber']) - 1; try { $update = $retrieve->decrement('credits', (double) $param['amount']); $fundinout = array('wallet_id' => $retrieve->id, 'onbehalf' => Auth::user()->id, 'credits' => $param['amount'], 'description' => 'Bet on Roulette amount of $' . (double) $param['amount'], 'fundtype' => 'bet'); $fundout = Fundinout::create($fundinout); $bet = array('player_id' => Auth::user()->id, 'channel_id' => $param['game_id'], 'bet_number' => implode(',', $param['betnumber']), 'bet_amount' => $param['amount'], 'bet_type' => $bet_type[$index]); Gamebets::create($bet); $message = 'Bet has been successfully place.'; return Redirect::action('bet.roulette')->with('success', $message); } catch (Exception $e) { return false; } } else { return Redirect::action('bet.roulette')->with('error', 'You can only place maximum of 6 number.'); } } if (Input::has('bettype')) { $param = Input::only('bettype', 'amount', 'game_id'); $retrieve = Wallet::where('account_id', Auth::user()->id)->first(); try { $update = $retrieve->decrement('credits', (double) $param['amount']); $fundinout = array('wallet_id' => $retrieve->id, 'onbehalf' => Auth::user()->id, 'credits' => $param['amount'], 'description' => 'Bet on Roulette amount of $' . (double) $param['amount'], 'fundtype' => 'bet'); $fundout = Fundinout::create($fundinout); $bet = array('player_id' => Auth::user()->id, 'channel_id' => $param['game_id'], 'bet_number' => $param['bettype'], 'bet_amount' => $param['amount'], 'bet_type' => $param['bettype']); Gamebets::create($bet); $message = 'Bet has been successfully place.'; return Redirect::action('bet.roulette')->with('success', $message); } catch (Exception $e) { return false; } } } else { return Redirect::action('bet.roulette')->with('error', 'Insufficient credits!'); } }
public function lastJitaPrice($typeID, $days, $walletID) { //Grab the characters from the db $members = $this->getMembersAsArray($this->getUsersGroup($walletID)); $sqlarray = '(' . implode(',', $members) . ')'; //Get the last Jita buy price $criteria = new CDbCriteria(); $criteria->condition = 'typeID=:typeID AND characterID IN ' . $sqlarray . ' AND stationID = 60003760 AND transactionType = "buy" AND personal = 0'; $criteria->params = array(':typeID' => $typeID); $criteria->order = 'transactionDateTime DESC'; //Run the query $lastJita = Wallet::Model()->find($criteria); if (!empty($lastJita)) { return $lastJita->price; } else { return 0; } }
<label class="b-radio__label b-radio__label_fontsize_15" for="wallet<?php echo $wallet['type']; ?> "> <?php echo WalletTypes::getNameWallet($wallet['type']); ?> <?php if ($wallet['access_token'] != '') { ?> <span id="walletInfo<?php echo $wallet['type']; ?> "> <span class="b-fon b-fon_bg_f2 b-fon_pad_2_5 b-fon__border_radius_3 b-layout__txt b-layout__txt_fontsize_15"><?php echo Wallet::secureString($wallet['wallet']); ?> </span> <a href="javascript:void(0)" class="b-button b-button_admin_del b-button_top_-3 removeWallet"></a> </span> <?php } //if ?> </label> </div> <?php } //foreach ?> <?php
$http = true; } else { $http = false; } // Important !!! session_set_cookie_params(0, "/", $_SERVER["SERVER_NAME"], $http, TRUE); } } else { echo "Please Confirm Your Email!"; } } else { echo "Incorrect Password!"; } } else { echo "Username Not Found!"; } } catch (PDOException $e) { echo $e->getMessage(); } } } if (!empty($_POST["Username"]) && !empty($_POST["Password"])) { $wallet = new Wallet($con); $username = $_POST["Username"]; $password = $_POST["Password"]; echo $wallet->Wallet_login($username, $password); } elseif (empty($_POST["Username"])) { echo "Please Enter Username!"; } elseif (empty($_POST["Password"])) { echo "Please Enter Password!"; }
class Edy { public function payEdy() { echo 'sharyyyyyyyyyyyyyyn' . '<BR />'; } } // 継承 // 利用したいクラスのサブクラスを作成してインターフェースを実装する class Wallet extends Waon implements CashPayment { public function payWhatEver() { $this->payWaon() . '<br />'; } } // 移譲 // 利用したいクラスのインスタンスを生成し、そのインスタンスを他クラスから利用することで実現される。 class Wallet2 extends Edy implements CashPayment { public $edy; public function payWhatEver() { $this->edy = new Edy(); $this->edy->payEdy() . '<br />'; } } $waon = new Wallet(); $waon->payWhatEver(); $edy = new Wallet2(); $edy->payWhatEver();
/** * Fetch the balance of a wallet. This should be used as an estimate only and will include unconfirmed transactions and possibly double spends. * * @param string $wallet_id Wallet Identifier used to Login * @param string $main_password Your Main My wallet password * @return string */ public static function GetWalletBalance($wallet_id, $main_password) { $instance = new Wallet(); return $instance->getBalance($wallet_id, $main_password); }
public function lastSalePrice($typeID) { //Get the last sale price $criteria = new CDbCriteria(); $criteria->condition = 'typeID=:typeID AND transactionType = "sell"'; $criteria->params = array(':typeID' => $typeID); $criteria->order = 'transactionDateTime DESC'; //Run query $lastSale = Wallet::Model()->find($criteria); return $lastSale->price; }
public function testRegularGame() { $wallet = new Wallet(1000, 100); $cards = array(new Card(new Rank(4)), new Card(new Rank(8)), new Card(new Rank(3)), new Card(new Rank(Rank::QUEEN)), new Card(new Rank(5)), new Card(new Rank(Rank::ACE)), new Card(new Rank(3))); $game = new BlackjackGame(new TestDeck($cards)); $game->start(); $this->assertTrue($game->getState() == State::PLAYING); $game->hitUser(); $this->assertTrue($game->getState() == State::PLAYING_ACTIVE); $game->userStands(); $this->assertTrue($game->getState() == State::DEALER_WIN); $this->assertTrue($game->getDealerHand()->getScore() == 18); $this->assertTrue($game->getUserHand()->getScore() == 16); $wallet->reconcile($game); $this->assertTrue($wallet->getMoney() == 900); $wallet->reconcile($game); $this->assertTrue($wallet->getMoney() == 900); $cards = array(); for ($i = 0; $i < 100; $i++) { array_push($cards, new Card(new Rank(Rank::ACE))); } $game = new BlackjackGame(new TestDeck($cards)); $game->start(); $this->assertTrue($game->getState() == State::OFFER_INSURANCE); $game->buyInsurance(false); $this->assertTrue($game->getState() == State::PLAYING); $game->hitUser(); // 3 $this->assertTrue($game->getState() == State::PLAYING_ACTIVE); $game->hitUser(); // 4 $game->hitUser(); // 5 $game->hitUser(); // 6 $game->hitUser(); // 7 $game->hitUser(); // 8 $game->hitUser(); // 9 $game->hitUser(); // 10 $game->hitUser(); // 11/21 $game->userStands(); $this->assertTrue($game->getState() == State::USER_WIN); $this->assertTrue($game->getDealerHand()->getScore() == 17); $this->assertTrue($game->getUserHand()->getScore() == 21); $wallet->reconcile($game); $this->assertTrue($wallet->getMoney() == 1000); $wallet->reconcile($game); $this->assertTrue($wallet->getMoney() == 1000); }
<br /> <div id="width-keeper"> <section class="message-box left"> <b class="title-point">Server Load(main):</b></br> <table id="page"> <?php $var_load = sys_getloadavg(); foreach ($var_load as $key => $value) { echo "<tr><td>" . $key . " : " . $value . "</tr><td>"; } ?> </table> </section> </div> <br /> <div id="width-keeper"> <aside class="message-box right"> <b class="title-point">MySQL Load:</b></br> <table id="page"> <?php $mysqlload = explode(" ", mysql_stat()); foreach ($mysqlload as $key => $value) { echo "<tr><td>" . $key . " : " . $value . "<td></tr>"; } ?> </table> </aside> </div> <br />
$chk = $this->con->prepare("UPDATE users SET Code=:code WHERE Username=:User"); $chk_if = $chk->execute(array(":code" => Null, ":User" => $username)); if ($chk_if) { echo "Thanks password has been reset please login now"; } else { echo "ERROR! Reload Page!"; } } else { echo "Password is not match!"; } } else { echo "Enter Minimum 6 Characters In Password!"; } } else { echo "Invalid Password Recovery link!"; } } } $wallet = new Wallet($con); if (!empty($_POST["Password"]) && !empty($_POST["Cpassword"]) && !empty($_POST["Code"])) { $code = $_POST["Code"]; $password = $_POST["Password"]; $confirm_password = $_POST["Cpassword"]; echo $wallet->Reset_password($code, $password, $confirm_password); } elseif (empty($_POST["Password"])) { echo "Please Enter Password"; } elseif (empty($_POST["Cpassword"])) { echo "Please Enter Confirm Password"; } elseif (empty($_POST["Code"])) { echo "ERROR! Reload Page!"; }
public function getWalletById($walletId) { $walletModel = new Wallet(); $return_wallet = $walletModel->find('all', array('conditions' => array('Wallet.id' => $walletId))); return $return_wallet; }
/** * Автооплата услуги * * @param $sum * @return bool|mixed */ public function payment($sum) { $this->createOrder($sum); $this->api->getAccessData('autopay'); $result = $this->api->register($sum, $this->orderNumber, $this->account->id); if ($result['orderId'] != '') { walletAlpha::updateOrder($this->orderNumber, array('order_id' => $result['orderId'], 'state' => walletAlpha::STATE_NEW)); $payment = $this->api->paymentOrderBinding($result['orderId']); switch ($payment['errorCode']) { case API_AlphaBank::STATUS_SUCCESS: $status = $this->api->getOrderStatus($result['orderId']); $update = array('pan' => $status['Pan'], 'expiration' => $status['expiration'], 'cardholder_name' => $status['cardholderName'], 'ip' => $status['Ip'], 'binding_id' => Wallet::des()->encrypt($status['bindingId'])); $update['state'] = $this->deposit($this->account, $this->account->id, $status, $this->data['wallet'], $this->orderNumber, $sum); $this->updateOrder($this->orderNumber, $update); break; default: // Ошибка оплаты ob_start(); var_dump($result); var_dump($payment); $content = ob_get_clean(); $this->log->writeln("FAIL Payment:\naccount:{$this->account->id}\n"); $this->log->write("Request:\n " . $this->api->last_request->getBody()); $this->log->write("Result:\n {$content}"); return false; break; } } else { ob_start(); var_dump($result); $content = ob_get_clean(); $this->log->writeln("FAIL Payment:\naccount:{$this->account->id}\n"); $this->log->write("Request:\n " . $this->api->last_request->getBody()); $this->log->write("Result:\n {$content}"); return false; //error } }
}); }); </script> <?php } } } } } catch (PDOEXception $error) { echo $error->getMessage(); } } } $hash = Clean($_GET["hash"]); $id = Clean($_GET["id"]); $wallet = new Wallet($con, $coin); echo $wallet->confirm_email($hash, $id); } ?> <!DOCTYPE html> <html > <?php echo $header->get_index(); ?> <header> <ul> <li><a href="index.php">Home</li></a> <li><a href="reg.php">Create Wallet</li></a> <li><a href="login.php">Wallet Login</li></a> </ul><br /> </header><br />
<?php if (isDepositDisabled()) { echo 'Deposits are currently disabled.'; } else { if (!isUserLoggedIn()) { echo '<meta http-equiv="refresh" content="0; URL=access_denied.php">'; } else { $account = $loggedInUser->display_username; $id = mysql_real_escape_string($_GET["id"]); $wallet = new Wallet($id); echo "<h3>Your deposit address is: </h3>"; $address = $wallet->GetDepositAddress($account); echo $address; } }
public function getBalanceAmountWithoutTds($user_id) { require_once 'Ewallet.php'; $obj_ewallet = new Wallet(); $balance_amount = $obj_ewallet->getBalanceAmountWithoutTds($_SESSION['user_id']); return $balance_amount; }
/** * @return \yii\db\ActiveQuery */ public function getWallet() { return $this->hasOne(Wallet::className(), ['id' => 'wallet_id']); }