/** * @param $data * * @return Bill */ public static function NewBill($data) { $bill = new Bill(); $merchantData = Headers::GetMerchant(); $bill->merchant_id = $merchantData['login']; $bill->bill_id = $data['bill_id']; $bill->user = $data['user']; $bill->amount = $data['amount']; $bill->ccy = $data['ccy']; $bill->comment = isset($data['comment']) ? $data['comment'] : null; $bill->lifetime = isset($data['lifetime']) ? $data['lifetime'] : 0; $bill->pay_source = isset($data['pay_source']) ? $data['pay_source'] : null; $bill->prv_name = isset($data['prv_name']) ? $data['prv_name'] : null; $bill->status = Bill::C_STATUS_WAITING; $bill->save(); return $bill; }
<?php use FintechFab\QiwiGate\Components\Catalog; use FintechFab\QiwiGate\Components\Headers; Route::filter('ff.qiwi.gate.auth.basic', function () { $isSuccess = Headers::CheckAuth(); if (!$isSuccess) { $result = array('response' => array('result_code' => Catalog::C_WRONG_AUTH)); return Response::json($result, Catalog::serverCode(Catalog::C_WRONG_AUTH)); } }); Route::filter('ff.qiwi.gate.checkUser', function () { $routeError = 'qiwiGate_AuthError'; $routeAction = Route::current()->getAction(); $isErrorPage = $routeError == $routeAction['as']; $user = Config::get('ff-qiwi-gate::user_id'); $user = (int) $user; if ($user <= 0) { if (!$isErrorPage) { return Redirect::route($routeError); } } elseif ($isErrorPage) { return Redirect::route('qiwiGate_account'); } });