public function isSuccesful() { foreach ((array) $_REQUEST as $ixField => $fieldValue) { $this->responseFields[$ixField] = $fieldValue; } $sSignatureBase = sprintf("%03s", $this->responseFields['ver']) . sprintf("%-10s", $this->responseFields['id']) . sprintf("%012s", $this->responseFields['ecuno']) . sprintf("%06s", $this->responseFields['receipt_no']) . sprintf("%012s", $this->responseFields['eamount']) . sprintf("%3s", $this->responseFields['cur']) . $this->responseFields['respcode'] . $this->responseFields['datetime'] . $this->mb_sprintf("%-40s", $this->responseFields['msgdata']) . $this->mb_sprintf("%-40s", $this->responseFields['actiontext']); function hex2str($hex) { $str = ''; for ($i = 0; $i < strlen($hex); $i += 2) { $str .= chr(hexdec(substr($hex, $i, 2))); } return $str; } $mac = hex2str($this->responseFields['mac']); $flKey = openssl_get_publickey(\Configuration::where('code', '=', 'estcard/pubkey')->first()->value); if (!openssl_verify($sSignatureBase, $mac, $flKey)) { // invalidSignature return false; } if ($this->responseFields['receipt_no'] == 00) { # Payment was cancelled return false; } if ($this->responseFields['respcode'] == 00) { # Payment success return true; } }
/** * Execute the console command. * * @return void */ public function fire() { $this->line('Welcome to the job cron.'); $auto_close = Configuration::where('key', 'auto_close')->first(); if ($auto_close['value']) { $auto_close_time = Configuration::where('key', 'auto_close_time')->first(); $diff_time = date("Y-m-d H:i:s", time() - $auto_close_time['value'] * 60 * 60); $jobs = Job::where('status', '=', '1')->where('invalid', '=', '0')->where('start_time', '<', $diff_time)->get(); foreach ($jobs as $job) { Job::where('id', $job->id)->update(array('status' => 2)); } } $this->line('Done !'); }
public function beerOfTheDay() { $dateInDatabase = Configuration::where('name', '=', 'beer_of_the_day_modification_date')->first(); $date = Carbon::createFromFormat("Y-m-d", "{$dateInDatabase->value}"); $now = Carbon::now(); $difference = $now->diffInDays($date); if ($difference >= 1) { $dateInDatabase->value = $now->format('Y-m-d'); $dateInDatabase->save(); $beer = $this->generateRandomBeer(); $selectedBeer = new Configuration(); $selectedBeer->name = "beer_id"; $selectedBeer->value = $beer->beer_id; $selectedBeer->save(); } else { $beer = Beer::find(Configuration::where('name', '=', 'beer_id')->orderBy('id', 'desc')->first()->value); } return View::make('beers.beer-of-the-day')->with(['beer' => $beer]); }
public function register() { $this->app->bind('banklink', function ($app, $parameters) { switch ($parameters['bank_code']) { case 'seb': $protocol = new Protocol\iPizza(@\Configuration::where('code', '=', 'seb/vk_snd_id')->first()->value, @\Configuration::where('code', '=', 'seb/vk_name')->first()->value, @\Configuration::where('code', '=', 'seb/vk_acc')->first()->value, @\Configuration::where('code', '=', 'seb/vk_privkey')->first()->value, @\Configuration::where('code', '=', 'seb/vk_pubkey')->first()->value, @$parameters['return_url'], $mbStrlen = true); return new SEB($protocol, $testMode = false, @\Configuration::where('code', '=', 'seb/vk_dest')->first()->value); case 'swedbank': $protocol = new Protocol\iPizza(@\Configuration::where('code', '=', 'swedbank/vk_snd_id')->first()->value, @\Configuration::where('code', '=', 'swedbank/vk_name')->first()->value, @\Configuration::where('code', '=', 'swedbank/vk_acc')->first()->value, @\Configuration::where('code', '=', 'swedbank/vk_privkey')->first()->value, @\Configuration::where('code', '=', 'swedbank/vk_pubkey')->first()->value, @$parameters['return_url'], $mbStrlen = true); return new Swedbank($protocol, $testMode = false, @\Configuration::where('code', '=', 'swedbank/vk_dest')->first()->value); case 'nordea': $protocol = new Protocol\Solo(@\Configuration::where('code', '=', 'nordea/rcv_id')->first()->value, @\Configuration::where('code', '=', 'nordea/mac_key')->first()->value, @$parameters['return_url'], @\Configuration::where('code', '=', 'nordea/rcv_name')->first()->value, @\Configuration::where('code', '=', 'nordea/rcv_account')->first()->value); return new Nordea($protocol, $testMode = false, isset($parameters['auth']) ? \Configuration::where('code', '=', 'nordea/vk_dest_auth')->first()->value : \Configuration::where('code', '=', 'nordea/vk_dest')->first()->value); case 'lhv': $protocol = new Protocol\iPizza(@\Configuration::where('code', '=', 'lhv/vk_snd_id')->first()->value, @\Configuration::where('code', '=', 'lhv/vk_name')->first()->value, @\Configuration::where('code', '=', 'lhv/vk_acc')->first()->value, @\Configuration::where('code', '=', 'lhv/vk_privkey')->first()->value, @\Configuration::where('code', '=', 'lhv/vk_pubkey')->first()->value, @$parameters['return_url'], $mbStrlen = true); return new LHV($protocol, $testMode = false, @\Configuration::where('code', '=', 'lhv/vk_dest')->first()->value); case 'danske': $protocol = new Protocol\iPizza(@\Configuration::where('code', '=', 'danske/vk_snd_id')->first()->value, @\Configuration::where('code', '=', 'danske/vk_name')->first()->value, @\Configuration::where('code', '=', 'danske/vk_acc')->first()->value, @\Configuration::where('code', '=', 'danske/vk_privkey')->first()->value, @\Configuration::where('code', '=', 'danske/vk_pubkey')->first()->value, @$parameters['return_url'], $mbStrlen = true); return new DanskeBank($protocol, $testMode = false, @\Configuration::where('code', '=', 'danske/vk_dest')->first()->value); case 'estcard': return new Estcard(@\Configuration::where('code', '=', 'estcard/url')->first()->value, @$parameters['return_url'], @\Configuration::where('code', '=', 'estcard/id')->first()->value); } }); }
public function showHome() { $beer = Beer::find(Configuration::where('name', '=', 'beer_id')->orderBy('id', 'desc')->first()->value); return View::make('home')->with(['beer' => $beer]); }