当前位置: 首页>>代码示例>>PHP>>正文


PHP Payment::save方法代码示例

本文整理汇总了PHP中app\models\Payment::save方法的典型用法代码示例。如果您正苦于以下问题:PHP Payment::save方法的具体用法?PHP Payment::save怎么用?PHP Payment::save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app\models\Payment的用法示例。


在下文中一共展示了Payment::save方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: createPayment

 public function createPayment(Request $request)
 {
     Auth::user();
     $order_id = session('order_id');
     $order = Order::find($order_id);
     if ($order) {
         $user = $order->id;
         $sum = $order->sum;
         $mrh_login = env('ROBOKASSA_LOGIN');
         $mrh_pass1 = env('ROBOKASSA_PASSWORD');
         $invoice_id = mt_rand();
         $inv_desc = 'Пополнение баланса';
         $crc = md5($mrh_login . ":" . $sum . ":" . $invoice_id . ":" . $mrh_pass1);
         if ($sum != 0) {
             try {
                 DB::beginTransaction();
                 $payment = new Payment();
                 $payment->uid = $invoice_id;
                 $payment->user_id = $user;
                 $payment->balance = $sum;
                 $payment->description = $inv_desc;
                 $payment->operation = '+';
                 $payment->save();
                 DB::commit();
             } catch (\PDOException $e) {
                 print $e->getMessage();
                 DB::connection()->getPdo()->rollBack();
             }
         }
         echo 'ok';
         return 1;
         header("Location: https://auth.robokassa.ru/Merchant/Index.aspx?MrchLogin={$mrh_login}&OutSum={$sum}&InvId={$invoice_id}&Desc={$inv_desc}&SignatureValue={$crc}");
     }
 }
开发者ID:venomir,项目名称:tc,代码行数:34,代码来源:PaymentController.php

示例2: create_payment

 private function create_payment($order_id)
 {
     $order = Order::find($order_id);
     if ($order) {
         $user = $order->user_id;
         $sum = $order->sum;
         $mrh_login = env('ROBOKASSA_LOGIN');
         $mrh_pass1 = env('ROBOKASSA_PASSWORD');
         $invoice_id = mt_rand();
         $inv_desc = 'Пополнение баланса';
         $crc = md5($mrh_login . ":" . $sum . ":" . $invoice_id . ":" . $mrh_pass1);
         if ($sum != 0) {
             try {
                 DB::beginTransaction();
                 $payment = new Payment();
                 $payment->uid = $invoice_id;
                 $payment->order_id = $order_id;
                 $payment->user_id = $user;
                 $payment->sum = $sum;
                 $payment->description = $inv_desc;
                 $payment->operation = '+';
                 $payment->payment_type = $order->payment_type;
                 $payment->save();
                 DB::commit();
             } catch (\PDOException $e) {
                 print $e->getMessage();
                 DB::connection()->getPdo()->rollBack();
             }
         }
         $redirect_url = "https://auth.robokassa.ru/Merchant/Index.aspx?MrchLogin={$mrh_login}&OutSum={$sum}&InvId={$invoice_id}&Desc={$inv_desc}&SignatureValue={$crc}&IsTest=1";
         return $redirect_url;
     }
     return Redirect::to('/')->with('message', 'Ошибка');
 }
开发者ID:venomir,项目名称:tc,代码行数:34,代码来源:OrderController.php

示例3: createPayment

 public function createPayment(Request $request)
 {
     \Auth::user();
     $user = $request->user()->id;
     $sum = $request->get('OutSum');
     $mrh_login = config('roboconfig.login');
     $mrh_pass1 = config('roboconfig.password1');
     $inv_id = mt_rand();
     $inv_desc = 'Пополнение баланса';
     $crc = md5($mrh_login . ":" . $sum . ":" . $inv_id . ":" . $mrh_pass1);
     if ($sum != 0) {
         try {
             DB::beginTransaction();
             $payment = new Payment();
             $payment->uid = $inv_id;
             $payment->user_id = $user;
             $payment->balance = $sum;
             $payment->description = $inv_desc;
             $payment->operation = '+';
             $payment->save();
             DB::commit();
         } catch (\PDOException $e) {
             print $e->getMessage();
             DB::connection()->getPdo()->rollBack();
         }
     }
     /* return redirect()->action('ZaLaravel\LaravelRobokassa\Controllers\IpnRobokassaController@getResult',
        array('OutSum' => $sum, 'InvId' => $inv_id, 'SignatureValue' => $crc));*/
     header("Location: https://auth.robokassa.ru/Merchant/Index.aspx?MrchLogin={$mrh_login}&OutSum={$sum}&InvId={$inv_id}&Desc={$inv_desc}&SignatureValue={$crc}");
 }
开发者ID:Gurzhii,项目名称:laravel-robokassa,代码行数:30,代码来源:PaymentController.php

示例4: store

 /**
  * Store a newly created payment in storage.
  *
  * @return Response
  */
 public function store(PaymentRequest $request)
 {
     $payment = new Payment();
     $payment->patient_id = $request->patient_id;
     $payment->charge_id = $request->charge_id;
     $payment->full_amount = $request->full_amount;
     $payment->amount_paid = $request->amount_paid;
     $payment->save();
     $url = session('SOURCE_URL');
     return redirect()->to($url)->with('message', trans('terms.record-successfully-saved'))->with('active_payment', $payment->id);
 }
开发者ID:echiteri,项目名称:iBLIS,代码行数:16,代码来源:PaymentController.php

示例5: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(StorePaymentRequest $request, $event_id)
 {
     $user_id = Auth::user()->id;
     $input = $request->all();
     if ($input['paid'] > $input['debt']) {
         Session::flash('message', 'El monto excede el monto de la deuda');
         Session::flash('alert-class', 'alert-danger');
         return redirect('promoter/transfer_payments/' . $event_id . '/create');
     }
     $payment = new Payment();
     $payment->event_id = $event_id;
     $payment->promoter_id = $user_id;
     $payment->paid = $input['paid'];
     $payment->save();
     Session::flash('message', 'Pago a organizador realizado!');
     Session::flash('alert-class', 'alert-success');
     return redirect('/promoter/transfer_payments');
 }
开发者ID:TAMQuiroz,项目名称:starkTicket,代码行数:24,代码来源:PaymentController.php

示例6: createPayment

 public function createPayment(Request $request)
 {
     $user = $request->user()->id;
     $sum = $request->get('OutSum');
     $mrh_login = config('roboconfig.testLogin');
     $mrh_pass1 = config('roboconfig.testPassword1');
     $inv_id = mt_rand();
     $inv_desc = 'Пополнение баланса';
     $crc = md5("{$mrh_login}:{$sum}:{$inv_id}:{$mrh_pass1}");
     if ($sum != 0) {
         $payment = new Payment();
         $payment->uid = $inv_id;
         $payment->user_id = $user;
         $payment->balance = $sum;
         $payment->description = $inv_desc;
         $payment->operation = '+';
         $payment->save();
     }
     return redirect()->action('ZaLaravel\\LaravelRobokassa\\Controllers\\IpnRobokassaController@getResult', array('OutSum' => $sum, 'InvId' => $inv_id));
     // header("Location: http://test.robokassa.ru/Index.aspx?MrchLogin=$mrh_login&OutSum=$sum&InvId=$inv_id&Desc=$inv_desc&SignatureValue=$crc");
 }
开发者ID:lyovkin,项目名称:v2board,代码行数:21,代码来源:PaymentController.php

示例7: createPayment

 public function createPayment(Request $request)
 {
     \Auth::user();
     $user = $request->user()->id;
     $m_shop = '75722594';
     $m_orderid = mt_rand();
     $m_amount = number_format($request->get('OutSum'), 2, '.', '');
     $m_curr = 'RUB';
     $m_desc = base64_encode('Пополнение баланса');
     $m_key = 'halyava';
     $arHash = array($m_shop, $m_orderid, $m_amount, $m_curr, $m_desc, $m_key);
     $sign = strtoupper(hash('sha256', implode(':', $arHash)));
     //dd($sign);
     if ($m_amount != 0) {
         try {
             DB::beginTransaction();
             $payment = new Payment();
             $payment->uid = $m_orderid;
             $payment->user_id = $user;
             $payment->balance = $m_amount;
             $payment->description = base64_decode($m_desc);
             $payment->operation = '+';
             $payment->save();
             DB::commit();
         } catch (\PDOException $e) {
             print $e->getMessage();
             DB::connection()->getPdo()->rollBack();
         }
     }
     /*return redirect()->action('ZaLaravel\LaravelPayeer\Controllers\IpnPayeerController@getResult',
       array('m_shop' => $m_shop,
           'm_amount' => $m_amount,
           'm_orderid' => $m_orderid,
           'm_curr' => $m_curr,
           'm_desc' => $m_desc,
           'm_sign' => $sign));*/
     header("Location:https://payeer.com/merchant/?m_shop={$m_shop}&m_orderid={$m_orderid}&m_amount={$m_amount}&m_curr={$m_curr}&m_desc={$m_desc}&m_sign={$sign}");
 }
开发者ID:za-laravel,项目名称:laravel-payeer,代码行数:38,代码来源:PaymentPayeerController.php

示例8: studentEditSubmit

 /**
  *
  * @return Response
  */
 public function studentEditSubmit($id)
 {
     $student = Student::findOrFail($id);
     // WEI payment form
     if (Request::has(['wei', 'sandwich', 'wei-total'])) {
         $input = Request::only(['wei', 'sandwich', 'wei-total', 'mean', 'cash-number', 'cash-color', 'check-number', 'check-bank', 'check-name', 'check-write', 'card-write']);
         $rules = ['wei' => 'required', 'sandwich' => 'required', 'wei-total' => 'required', 'mean' => 'required|in:card,check,cash'];
         $informations = [];
         switch ($input['mean']) {
             case 'card':
                 $rules['card-write'] = 'accepted';
                 break;
             case 'cash':
                 $rules['cash-number'] = 'required';
                 $rules['cash-color'] = 'required';
                 $informations = Request::only(['cash-number', 'cash-color']);
                 break;
             case 'check':
                 $rules['check-number'] = 'required';
                 $rules['check-bank'] = 'required';
                 $rules['check-name'] = 'required';
                 $rules['check-write'] = 'accepted';
                 $informations = Request::only(['check-number', 'check-bank', 'check-name']);
                 break;
         }
         $this->validate(Request::instance(), $rules, ['mean.required' => 'Le champ Moyen de paiement est obligatoire.', 'card-write.accepted' => 'Vous devez avoir écris le numéro indiqué derrière le ticket de CB', 'check-write.accepted' => 'Vous devez avoir écris le numéro indiqué derrière le chèque', 'check-number.required' => 'Le champ Numéro de chèque est obligatoire.', 'check-bank.required' => 'Le champ Banque du chèque est obligatoire.', 'check-name.required' => 'Le champ Émetteur du chèque est obligatoire.', 'cash-number.required' => 'Le champ Numéro de caisse est obligatoire.', 'cash-color.required' => 'Le champ Couleur de caisse est obligatoire.']);
         // Check errors
         $oldSandwich = $student->sandwichPayment && in_array($student->sandwichPayment->state, ['paid']) ? 1 : 0;
         $oldWei = $student->weiPayment && in_array($student->weiPayment->state, ['paid']) ? 1 : 0;
         $sandwich = $input['sandwich'] ? 1 : 0;
         $wei = $input['wei'] ? 1 : 0;
         if ($input['sandwich'] && $oldSandwich) {
             return Redirect::back()->withError('Vous ne pouvez pas prendre un deuxieme panier repas')->withInput();
         }
         if ($input['wei'] && $oldWei) {
             return Redirect::back()->withError('Vous ne pouvez pas prendre un deuxieme weekend d\'intégration')->withInput();
         }
         if (!$input['wei'] && !$oldWei && $input['sandwich']) {
             return Redirect::back()->withError('Vous ne pouvez pas prendre un panier repas sans prendre le weekend')->withInput();
         }
         //calculate price
         $price = Config::get('services.wei.price-other');
         if ($student->ce && $student->team_accepted && $student->team_id) {
             $price = Config::get('services.wei.price-ce');
         } elseif ($student->orga) {
             $price = Config::get('services.wei.price-orga');
         }
         // Calculate amount
         $amount = ($sandwich * Config::get('services.wei.sandwichPrice') + $wei * $price) * 100;
         if ($amount / 100 != $input['wei-total']) {
             return Redirect::back()->withError('Erreur interne sur le calcul des montants, contactez un administrateur')->withInput();
         }
         // Create payment
         $payment = new Payment(['type' => 'payment', 'mean' => $input['mean'], 'amount' => $amount, 'state' => 'paid', 'informations' => $informations]);
         $payment->save();
         // Save paiement in user object
         $user = $student;
         if ($wei) {
             $user->wei_payment = $payment->id;
         }
         if ($sandwich) {
             $user->sandwich_payment = $payment->id;
         }
         $user->updateWei();
         $user->save();
         return Redirect(route('dashboard.wei.student.edit', ['id' => $student->student_id]))->withSuccess('Vos modifications ont été enregistrées.');
     }
     // Guarantee payment form
     if (Request::has(['guarantee', 'guarantee-total'])) {
         $input = Request::only(['guarantee', 'guarantee-total', 'check2-number', 'check2-bank', 'check2-name', 'check2-write']);
         $informations = Request::only(['check-number', 'check-bank', 'check-name']);
         $this->validate(Request::instance(), ['guarantee' => 'required', 'guarantee-total' => 'required', 'check2-number' => 'required', 'check2-bank' => 'required', 'check2-name' => 'required', 'check2-write' => 'accepted'], ['check2-write.accepted' => 'Vous devez avoir écris le numéro indiqué derrière le chèque', 'check2-number.required' => 'Le champ Numéro de chèque est obligatoire.', 'check2-bank.required' => 'Le champ Banque du chèque est obligatoire.', 'check2-name.required' => 'Le champ Émetteur du chèque est obligatoire.']);
         // Check errors
         $oldGuarantee = $student->guaranteePayment && in_array($student->guaranteePayment->state, ['paid']) ? 1 : 0;
         $guarantee = $input['guarantee'] ? 1 : 0;
         if ($input['guarantee'] && $oldGuarantee) {
             return Redirect::back()->withError('Vous ne pouvez pas payer deux fois la caution')->withInput();
         }
         // Calculate amount
         $amount = $guarantee * Config::get('services.wei.guaranteePrice') * 100;
         if ($amount / 100 != $input['guarantee-total']) {
             return Redirect::back()->withError('Erreur interne sur le calcul des montants, contactez un administrateur')->withInput();
         }
         // Create payment
         $payment = new Payment(['type' => 'guarantee', 'mean' => 'check', 'amount' => $amount, 'state' => 'paid', 'informations' => $informations]);
         $payment->save();
         // Save paiement in user object
         if ($guarantee) {
             $student->guarantee_payment = $payment->id;
         }
         $student->updateWei();
         $student->save();
         return Redirect(route('dashboard.wei.student.edit', ['id' => $student->student_id]))->withSuccess('Vos modifications ont été enregistrées.');
     }
     return Redirect(route('dashboard.wei.student.edit', ['id' => $student->student_id]))->withError('Y\'a un soucis !');
 }
开发者ID:ungdev,项目名称:integration-UTT,代码行数:100,代码来源:WEIController.php

示例9: store

 public function store(MakePaymentRequest $request)
 {
     try {
         DB::transaction(function () use($request) {
             $payment = new Payment();
             $currentYear = CommonHelper::get_current_financial_year();
             $payment->to_whom_type = $request->to_whom_type;
             $payment->to_whom = $request->to_whom;
             $payment->total_amount = $request->total_amount;
             $payment->amount = $request->amount;
             $payment->transaction_detail = $request->transaction_detail;
             $payment->date = $request->date;
             $payment->year = $currentYear;
             $payment->workspace_id = Auth::user()->workspace_id;
             $payment->account_code = $request->account_code;
             $payment->voucher_no = $request->voucher_no;
             $payment->created_by = Auth::user()->id;
             $payment->created_at = time();
             $payment->save();
             // IMPACTS ON ACCOUNTING TABLES
             $workspace_id = Auth::user()->workspace_id;
             $cashCode = 11000;
             $accountPayableCode = 41000;
             $transaction_type = Config::get('common.transaction_type.payment');
             // Workspace Ledger Account Payable Debit(-)
             $accountReceivableWorkspaceData = WorkspaceLedger::where(['workspace_id' => $workspace_id, 'account_code' => $accountPayableCode, 'balance_type' => Config::get('common.balance_type_intermediate'), 'year' => $currentYear])->first();
             $accountReceivableWorkspaceData->balance -= $request->amount;
             $accountReceivableWorkspaceData->update();
             // Workspace Ledger Cash Credit(-)
             $cashWorkspaceData = WorkspaceLedger::where(['workspace_id' => $workspace_id, 'account_code' => $cashCode, 'balance_type' => Config::get('common.balance_type_intermediate'), 'year' => $currentYear])->first();
             $cashWorkspaceData->balance += $request->amount;
             $cashWorkspaceData->update();
             // Personal Account balance(-)
             $person_type = $request->to_whom_type;
             $person_id = $request->to_whom;
             $personData = PersonalAccount::where(['person_id' => $person_id, 'person_type' => $person_type])->first();
             $personData->balance -= $request->amount;
             $personData->update();
             // General Journals Account Payable Debit
             $generalJournal = new GeneralJournal();
             $generalJournal->date = strtotime($request->date);
             $generalJournal->transaction_type = $transaction_type;
             $generalJournal->reference_id = $payment->id;
             $generalJournal->year = $currentYear;
             $generalJournal->account_code = $accountPayableCode;
             $generalJournal->workspace_id = $workspace_id;
             $generalJournal->amount = $request->amount;
             $generalJournal->dr_cr_indicator = Config::get('common.debit_credit_indicator.debit');
             $generalJournal->created_by = Auth::user()->id;
             $generalJournal->created_at = time();
             $generalJournal->save();
             // General Journals Cash Credit
             $generalJournal = new GeneralJournal();
             $generalJournal->date = strtotime($request->date);
             $generalJournal->transaction_type = $transaction_type;
             $generalJournal->reference_id = $payment->id;
             $generalJournal->year = $currentYear;
             $generalJournal->account_code = $cashCode;
             $generalJournal->workspace_id = $workspace_id;
             $generalJournal->amount = $request->amount;
             $generalJournal->dr_cr_indicator = Config::get('common.debit_credit_indicator.credit');
             $generalJournal->created_by = Auth::user()->id;
             $generalJournal->created_at = time();
             $generalJournal->save();
         });
     } catch (\Exception $e) {
         //dd($e);
         Session()->flash('error_message', 'Payment Creation Failed!');
         return redirect('make_payments');
     }
     Session()->flash('flash_message', 'Payment Done Successfully!');
     return redirect('make_payments');
 }
开发者ID:saj696,项目名称:pipe,代码行数:73,代码来源:MakePaymentsController.php

示例10: extend

 /**
  * @POST("/shops/{shops}/extend", middleware="auth", as="shops.extend")
  */
 public function extend(Shops $shop)
 {
     // 500 items
     if ($shop->capacity == 500) {
         // Create transaction
         $payment = new Payment();
         $payment->uid = mt_rand();
         $payment->user_id = Auth::user()->id;
         $payment->description = 'Продление магазина на 500 товаров';
         $payment->balance = 500;
         $payment->operation = '-';
         $payment->save();
         // Check balance
         if (Auth::user()->balance < 500) {
             \Session::flash('message', 'Недостаточно средств для продления магазина, пожалуйста пополните баланс.');
             return redirect()->route('shops.my');
         } else {
             // Update shop
             $shop->paid_at = Carbon::now()->addMonth();
             $shop->update();
             // Update transaction and balance user
             $payment->status = 1;
             $payment->save();
             $modifyBalanceToUser = User::find(\Auth::user()->id);
             $modifyBalanceToUser->balance -= 500;
             $modifyBalanceToUser->update();
             \Session::flash('message', "Вы продлили магазин на 500 товаров. Спасибо за покупку ;)");
         }
         return redirect()->route('shops.my');
     }
     // 2000 items
     if ($shop->capacity == 2000) {
         // Create transaction
         $payment = new Payment();
         $payment->uid = mt_rand();
         $payment->user_id = Auth::user()->id;
         $payment->description = 'Продление магазина на 2000 товаров';
         $payment->balance = 1000;
         $payment->operation = '-';
         $payment->save();
         // Check balance
         if (Auth::user()->balance < 1000) {
             \Session::flash('message', 'Недостаточно средств для продления магазина, пожалуйста пополните баланс.');
             return redirect()->route('shops.my');
         } else {
             // Create shop
             $shop->paid_at = Carbon::now()->addMonth();
             $shop->update();
             // Update transaction and balance user
             $payment->status = 1;
             $payment->save();
             $modifyBalanceToUser = User::find(\Auth::user()->id);
             $modifyBalanceToUser->balance -= 1000;
             $modifyBalanceToUser->update();
             \Session::flash('message', "Вы продлили магазин на 2000 товаров. Спасибо за покупку ;)");
         }
         return redirect()->route('shops.my');
     }
 }
开发者ID:lyovkin,项目名称:v2board,代码行数:62,代码来源:ShopController.php

示例11: getRaising

 public function getRaising(Request $request)
 {
     //writing transaction
     $payment = new Payment();
     $payment->uid = mt_rand();
     $payment->user_id = $request->user()->id;
     $payment->description = 'Плата за поднятие';
     $payment->balance = $request->input('rise_count') * 10;
     $payment->operation = '-';
     $payment->save();
     //check
     if ($request->input('rise_count') >= 30) {
         if ($request->user()->balance < $request->input('rise_count') * 10) {
             \Session::flash('message', 'Недостаточно средств, пожалуйста пополните баланс.');
         } else {
             $payment->status = 1;
             $payment->save();
             $modifyBalanceToUser = User::find($request->user()->id);
             $rises = $request->input('rise_count');
             $modifyBalanceToUser->balance -= $rises * 10;
             $modifyBalanceToUser->balance += 100;
             $modifyBalanceToUser->ads_rise += $rises;
             $modifyBalanceToUser->update();
             \Session::flash('message', "Вы купили {$rises} поднятий.");
         }
     } elseif ($request->input('rise_count') != null && $request->input('rise_count') != 0) {
         if ($request->user()->balance < $request->input('rise_count') * 10) {
             \Session::flash('message', 'Недостаточно средств, пожалуйста пополните баланс.');
         } else {
             $payment->status = 1;
             $payment->save();
             $modifyBalanceToUser = User::find($request->user()->id);
             $rises = $request->input('rise_count');
             $modifyBalanceToUser->balance -= $rises * 10;
             $modifyBalanceToUser->ads_rise += $rises;
             $modifyBalanceToUser->update();
             \Session::flash('message', "Вы купили {$rises} поднятий.");
         }
     }
     return redirect()->back();
 }
开发者ID:lyovkin,项目名称:v2board,代码行数:41,代码来源:AdsController.php


注:本文中的app\models\Payment::save方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。