Exemplo n.º 1
0
 public function index()
 {
     $payments = Payment::where('account_code', 'like', '2%')->paginate(Config::get('common.pagination'));
     $accounts = ChartOfAccount::where('account_type', 1)->where('code', 'like', '2%')->lists('name', 'code');
     $status = Config::get('common.status');
     return view('makePayment.index', compact('payments', 'status', 'accounts'));
 }
 public function getResult(Request $request)
 {
     $out_sum = $request->get('OutSum');
     $inv_id = $request->get('InvId');
     $user = Payment::select('user_id')->where('uid', '=', $inv_id)->first();
     $checksum = $request->get('SignatureValue');
     $password2 = config('roboconfig.password2');
     if (strtolower($checksum) == strtolower(md5($out_sum . ":" . $inv_id . ":" . $password2))) {
         if (Payment::where('uid', '=', $inv_id) && Payment::where('balance', '=', $out_sum)) {
             try {
                 DB::beginTransaction();
                 $payment = Payment::where('uid', '=', $inv_id)->first();
                 if ($payment->status == 0) {
                     $payment->status = 1;
                     $payment->update();
                     $addBalanceToUser = User::find($user->user_id);
                     $addBalanceToUser->balance += $out_sum;
                     $addBalanceToUser->update();
                 }
                 DB::commit();
             } catch (\PDOException $e) {
                 \Session::flash('message', "{$e->getMessage}()");
                 DB::connection()->getPdo()->rollBack();
             }
         }
     }
     return redirect()->action('ProfileController@index');
 }
Exemplo n.º 3
0
 /**
  * @return \Illuminate\Routing\Route|null|string
  */
 public function ingnoreId()
 {
     $id = $this->route('payment');
     $patient_id = $this->input('patient_id');
     $charge_id = $this->input('charge_id');
     $full_amount = $this->input('full_amount');
     return Payment::where(compact('id', 'test_id'))->exists() ? $id : '';
 }
 /**
  * @param Request $request
  * @return \Illuminate\Http\RedirectResponse|void
  */
 public function getResult(Request $request)
 {
     if ($_SERVER['REMOTE_ADDR'] != '37.59.221.230') {
         return;
     }
     //dd(\Request::all());
     $m_key = 'halyava';
     $m_shop = $request->get('m_shop');
     $m_orderid = $request->get('m_orderid');
     $m_amount = $request->get('m_amount');
     $m_curr = $request->get('m_curr');
     $m_desc = $request->get('m_desc');
     $checksum = $request->get('m_sign');
     $user = Payment::select('user_id')->where('uid', '=', $m_orderid)->first();
     if (isset($_POST['m_operation_id']) && isset($checksum)) {
         $arHash = array($m_shop, $m_orderid, $m_amount, $m_curr, $m_desc, $m_key);
         $sign_hash = strtoupper(hash('sha256', implode(':', $arHash)));
         if ($checksum == $sign_hash && $_POST['m_status'] == 'success') {
             if (Payment::where('uid', '=', $m_orderid) && Payment::where('balance', '=', $m_amount)) {
                 try {
                     DB::beginTransaction();
                     $payment = Payment::where('uid', '=', $m_orderid)->first();
                     if ($payment->status == 0) {
                         $payment->status = 1;
                         $payment->update();
                         $addBalanceToUser = User::find($user->user_id);
                         $addBalanceToUser->balance += $m_amount;
                         $addBalanceToUser->update();
                     }
                     DB::commit();
                 } catch (\PDOException $e) {
                     \Session::flash('message', "{$e->getMessage}()");
                     DB::connection()->getPdo()->rollBack();
                 }
             }
         }
     }
     return redirect()->action('ProfileController@index');
 }
Exemplo n.º 5
0
 /**
  * Show the form for creating a new resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function create($event_id)
 {
     $event = Event::find($event_id);
     if ($event->cancelled || empty($event)) {
         Session::flash('message', 'Evento cancelado');
         Session::flash('alert-class', 'alert-warning');
         return redirect('promoter/event/record');
     }
     $amountAccumulated = $event->amountAccumulated();
     $amountComission = $amountAccumulated * $event->percentage_comission / 100;
     $totalToPay = $amountAccumulated - $amountComission;
     $paid = Payment::where("event_id", $event_id)->sum('paid');
     $debt = 0;
     if ($totalToPay > $paid) {
         $debt = $totalToPay - $paid;
     }
     if ($debt <= 0) {
         Session::flash('message', 'No se puede transferir, tiene deuda igual a cero');
         Session::flash('alert-class', 'alert-warning');
         return redirect('promoter/event/record');
     }
     $objs = array("event" => $event, "amountAccumulated" => $amountAccumulated, "benefit" => $amountComission, "totalToPay" => $totalToPay, "paid" => $paid, "debt" => $debt);
     return view('internal.promoter.payment.create', $objs);
 }