public function createPayout($game, $fulfilled) { $faker = Faker::create(); $characters = Character::all()->toArray(); if ($fulfilled) { $character = $faker->randomElement($characters); } else { $character = null; } $payout = new Payout(); $payout->winner_id = $game->winner_id; $payout->fulfiller_id = $character['id']; $payout->fulfilled = $fulfilled; $payout->save(); $game->payout()->associate($payout); $game->save(); }
<?php require_once '../../class/Auth.php'; $sess_obj = new Auth(); require dirname(__FILE__) . "/class-excel-xml.inc.php"; require_once '../../class/Payout.php'; require_once '../../class/ToolTip.php'; $obj_payout = new Payout(); $get_profile = new ToolTip(); require_once '../../class/Validation.php'; $obj_sponser = new Validation(); if ($_GET["from"] and $_GET["to"]) { $from_date = $_GET["from"]; $to_date = $_GET["to"]; $from_date = $_GET["from"] . " 00:00:00"; $to_date = $_GET["to"] . " 23:59:59"; $obj_payout->getActivation($from_date, $to_date, 'yes'); $count = count($obj_payout->actiavtion_details); //echo "From: $from_date To: $to_date"; if ($count >= 1) { $doc[1][0] = "No"; $doc[1][1] = "Username"; $doc[1][2] = "Name"; $doc[1][3] = "Referral UserID"; $doc[1][4] = "Referral Full Name"; $doc[1][5] = "Mobile No"; $doc[1][6] = "Email"; $count = $count + 2; $j = 0; $k = 0; for ($i = 2; $i < $count; $i++) {
<?php require_once "../../class/Auth.php"; $sess_obj = new Auth(); $sess_obj->checkAdminLoged(); // include the php-excel class require dirname(__FILE__) . "/class-excel-xml.inc.php"; require_once '../../class/Payout.php'; $obj_payout = new Payout(); if ($_GET["from"] and $_GET["to"]) { $from_date = $_GET["from"]; $to_date = $_GET["to"]; //echo "From: $from_date To: $to_date"; $obj_payout->getTotalPayout($from_date, $to_date); //print_r($obj_payout->all_payout_details); $count = count($obj_payout->all_payout_details); if ($count >= 1) { $doc[1][0] = "No"; $doc[1][1] = "Username"; $doc[1][2] = "Left Count"; $doc[1][3] = "Right Count"; $doc[1][4] = "Total Leg"; $doc[1][5] = "Total amount"; $doc[1][6] = "TDS"; $doc[1][7] = "Service Charge"; $doc[1][8] = "Amount Payable"; $count = $count + 2; $j = 0; for ($i = 2; $i < $count; $i++) { $doc[$i][0] = $j + 1; $doc[$i][1] = $obj_payout->all_payout_details["detail{$j}"]["user_name"];
/** * Search through all fulfilled, unverified Payouts and check them against the list of transactions. * * @return void */ protected function verifyPayouts() { $payouts = Payout::unverified()->get(); $transactions = new Collection($this->transactions); foreach ($payouts as $payout) { $output = 'Verifying Payout #' . $payout->id . "\n"; foreach ($transactions as $transaction) { // Check the amount, winner and fulfiller all match // Any one of these being off will cause it to not verify. In future I might want to make this more // robust and check to see if a different fulfiller submitted it. if ($payout->prizes['isk'] == $transaction->amount * -1 && $transaction->ownerID2 == $payout->winner_id && $transaction->ownerID1 == $payout->fulfiller_id) { // Mark as verified $payout->verified = true; $payout->save(); // Log output $output .= 'Payout #: ' . $payout->id . "\n"; $output .= 'Amount Expected: ' . $payout->prizes['isk'] . "\n"; $output .= 'Amount Sent: ' . $transaction->amount * -1 . "\n"; $output .= 'Winner: ' . $payout->winner->name . "\n"; $output .= 'Fulfiller: ' . $payout->fulfiller->name . "\n"; } } } Log::info($output); echo $output; }
return $this->sqlError('E0049'); } /** * Mark a payout as processed * @param id int Payout ID * @return boolean bool True or False **/ public function setProcessed($id) { $stmt = $this->mysqli->prepare("UPDATE {$this->table} SET completed = 1 WHERE id = ? LIMIT 1"); if ($stmt && $stmt->bind_param('i', $id) && $stmt->execute()) { return true; } return $this->sqlError('E0051'); } public function setProcessed_mm($id) { $stmt = $this->mysqli->prepare("UPDATE {$this->table_mm} SET completed = 1 WHERE id = ? LIMIT 1"); if ($stmt && $stmt->bind_param('i', $id) && $stmt->execute()) { return true; } return $this->sqlError('E0051'); } } $oPayout = new Payout(); $oPayout->setDebug($debug); $oPayout->setLog($log); $oPayout->setMysql($mysqli); $oPayout->setConfig($config); $oPayout->setToken($oToken); $oPayout->setErrorCodes($aErrorCodes);
/** * Mark the payout as fulfilled and record who did it. * * @param int $id * @return Response */ public function fulfill($id) { $payout = Payout::findOrFail($id); $payout->fulfilled = true; $payout->fulfiller_id = Auth::id(); if ($payout->save()) { Session::flash('success', 'Payout #' . $payout->id . ' marked as fulfilled!'); return Redirect::back(); } Session::flash('danger', 'Could not mark Payout as fulfilled.'); return Redirect::back(); }