public function postRecharge() { try { $voucher_type = Input::get('voucher_type', NULL); $pin = Input::get('pin', NULL); if ($voucher_type == NULL) { throw new Exception("Select Voucher Type."); } if ($pin == NULL) { throw new Exception("Please enter a valid PIN"); } switch ($voucher_type) { case 'prepaid': Recharge::viaPin($pin, Auth::id()); $this->notifySuccess('Recharge Successful.'); break; case 'refill': Refillcoupons::viaPin($pin, Auth::id()); $this->notifySuccess('Refill Applied.'); break; } return Redirect::route(self::HOME); } catch (Exception $e) { $this->notifyError($e->getMessage()); return Redirect::back(); } }
public function postRefill() { try { $pin = Input::get('pin', NULL); Refillcoupons::viaPin($pin, Auth::id()); $this->notifySuccess('Refill Successful.'); return Redirect::route(self::HOME); } catch (Exception $e) { $this->notifyError($e->getMessage()); return Redirect::back(); } }
public function postRecharge() { try { if (Refillcoupons::viaPin(Input::get('pin'), Input::get('user_id'))) { $this->notifySuccess('Refill Successful.'); } else { $this->notifyError('Refill Failed.'); } } catch (Exception $e) { $this->notifyError($e->getMessage()); return Redirect::back(); } return Redirect::back(); }
public static function refillOnline($uid, $data) { DB::transaction(function () use($uid, $data) { $temp = ['validity' => 1, 'validity_unit' => 'Days', 'count' => 1]; $data = array_merge($data, $temp); if (!($pins = self::generate($data))) { throw new Exception('Refill Failed. Phase:1'); } $pin = current($pins); if (!self::now($pin, $uid, 'online')) { throw new Exception("Refill Failed. Phase:2"); } if (!Refillcoupons::where('pin', $pin)->update(['user_id' => $uid])) { throw new Exception('Refill Failed. Phase:3'); } }); }
public function frinternetResponse() { try { $response = DP::response(Input::all()); DirecpayTransaction::updateResponse($response); $details = $response->getDetails(); if ($response->txnSucceed()) { Refillcoupons::refillOnline(Auth::id(), $details); $this->notifySuccess('Account Refilled.'); } else { $this->notifyError('Account Refill Failed.'); } return Redirect::route('frinternet.dashboard'); } catch (Exception $e) { $this->notifyError($e->getMessage()); return Redirect::route('frinternet.dashboard'); } }