當前位置: 首頁>>代碼示例>>PHP>>正文


PHP models\Payment類代碼示例

本文整理匯總了PHP中app\models\Payment的典型用法代碼示例。如果您正苦於以下問題:PHP Payment類的具體用法?PHP Payment怎麽用?PHP Payment使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Payment類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: 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

示例2: 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

示例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: actionValidate

 /**
  * Validation method
  *
  * @param $type
  *
  * @return array
  * @throws \yii\web\BadRequestHttpException
  */
 public function actionValidate($type)
 {
     $model = new Payment(['scenario' => $type]);
     // throw exception if scenario wrong
     if (!in_array($type, [Payment::SCENARIO_PHONE, Payment::SCENARIO_CARD])) {
         throw new BadRequestHttpException('Wrong type');
     }
     if (Yii::$app->request->isAjax && $model->load(Yii::$app->request->post())) {
         Yii::$app->response->format = Response::FORMAT_JSON;
         // validate model
         $errors = ActiveForm::validate($model);
         return ['valid' => empty($errors), 'code' => empty($errors) ? self::CODE_OK : self::CODE_VALIDATION_ERROR, 'description' => $errors];
     }
 }
開發者ID:Alex8552,項目名稱:paymentwall,代碼行數:22,代碼來源:SiteController.php

示例5: readCallback

 public static function readCallback($payload)
 {
     $crypt = new Encrypter(base64_decode(Config::get('services.etupay.key')), 'AES-256-CBC');
     $payload = json_decode($crypt->decrypt($payload));
     if ($payload && is_numeric($payload->service_data)) {
         $paymentId = $payload->service_data;
         $payment = Payment::findOrFail($paymentId);
         switch ($payload->step) {
             case 'INITIALISED':
                 $payment->state = 'returned';
                 break;
             case 'PAID':
             case 'AUTHORISATION':
                 $payment->state = 'paid';
                 break;
             case 'REFUSED':
             case 'CANCELED':
                 $payment->state = 'refused';
                 break;
             case 'REFUNDED':
                 $payment->state = 'refunded';
                 break;
         }
         $payment->informations = ['transaction_id' => $payload->transaction_id];
         $payment->save();
         if ($payment->newcomer) {
             $payment->newcomer->updateWei();
         } elseif ($payment->student) {
             $payment->student->updateWei();
         }
         return $payment;
     }
     return null;
 }
開發者ID:ungdev,項目名稱:integration-UTT,代碼行數:34,代碼來源:EtuPay.php

示例6: getResult

 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');
 }
開發者ID:Gurzhii,項目名稱:laravel-robokassa,代碼行數:28,代碼來源:IpnRobokassaController.php

示例7: store

 public function store()
 {
     $data = Input::all();
     $error = false;
     if (isset($data['invoice_id'])) {
         $invoice = Invoice::scope($data['invoice_id'])->with('client')->first();
         if ($invoice) {
             $data['invoice'] = $invoice->public_id;
             $data['client'] = $invoice->client->public_id;
         } else {
             $error = trans('validation.not_in', ['attribute' => 'invoice_id']);
         }
     } else {
         $error = trans('validation.not_in', ['attribute' => 'invoice_id']);
     }
     if (!isset($data['transaction_reference'])) {
         $data['transaction_reference'] = '';
     }
     if (!$error) {
         $payment = $this->paymentRepo->save($data);
         $payment = Payment::scope($payment->public_id)->with('client', 'contact', 'user', 'invoice')->first();
         $payment = Utils::remapPublicIds([$payment]);
     }
     $response = json_encode($error ?: $payment, JSON_PRETTY_PRINT);
     $headers = Utils::getApiHeaders();
     return Response::make($response, 200, $headers);
 }
開發者ID:n-a-m-e,項目名稱:invoice-ninja,代碼行數:27,代碼來源:PaymentApiController.php

示例8: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::statement("SET foreign_key_checks = 0");
     Payment::truncate();
     Payment::create(array('apartment_id' => '1', 'due_date' => '2016-08-07', 'amount' => '1000', 'fine' => '100'));
     Payment::create(array('apartment_id' => '2', 'due_date' => '2016-08-07', 'amount' => '2000', 'fine' => '200'));
 }
開發者ID:suchayj,項目名稱:easymanage,代碼行數:12,代碼來源:PaymentSeeder.php

示例9: edit

 public function edit($publicId)
 {
     $payment = Payment::scope($publicId)->firstOrFail();
     $payment->payment_date = Utils::fromSqlDate($payment->payment_date);
     $data = array('client' => null, 'invoice' => null, 'invoices' => Invoice::scope()->where('is_recurring', '=', false)->where('is_quote', '=', false)->with('client', 'invoice_status')->orderBy('invoice_number')->get(), 'payment' => $payment, 'method' => 'PUT', 'url' => 'payments/' . $publicId, 'title' => trans('texts.edit_payment'), 'paymentTypes' => Cache::get('paymentTypes'), 'clients' => Client::scope()->with('contacts')->orderBy('name')->get());
     return View::make('payments.edit', $data);
 }
開發者ID:joshuadwire,項目名稱:invoiceninja,代碼行數:7,代碼來源:PaymentController.php

示例10: testDestroy

 /**
  * Tests the update function in the PaymentController
  * @param  void
  * @return void
  */
 public function testDestroy()
 {
     $this->withoutMiddleware();
     $this->call('POST', '/payment', $this->paymentData);
     $paymentStored = Payment::orderBy('id', 'desc')->first();
     $paymentStored->delete($paymentStored->id);
     $this->assertEquals(Payment::all()->count(), 0);
 }
開發者ID:echiteri,項目名稱:iBLIS,代碼行數:13,代碼來源:PaymentControllerTest.php

示例11: getDatatableActions

 protected function getDatatableActions($entityType)
 {
     return [[trans('texts.apply_credit'), function ($model) {
         return URL::to("payments/create/{$model->client_public_id}") . '?paymentTypeId=1';
     }, function ($model) {
         return Payment::canCreate();
     }]];
 }
開發者ID:sseshachala,項目名稱:invoiceninja,代碼行數:8,代碼來源:CreditService.php

示例12: ingnoreId

 /**
  * @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 : '';
 }
開發者ID:echiteri,項目名稱:iBLIS,代碼行數:11,代碼來源:PaymentRequest.php

示例13: index

 public function index()
 {
     $payments = Payment::scope()->orderBy('created_at', 'desc')->get();
     $payments = Utils::remapPublicIds($payments->toArray());
     $response = json_encode($payments, JSON_PRETTY_PRINT);
     $headers = Utils::getApiHeaders(count($payments));
     return Response::make($response, 200, $headers);
 }
開發者ID:ricoa,項目名稱:invoice-ninja,代碼行數:8,代碼來源:PaymentApiController.php

示例14: show

 public function show(Request $request)
 {
     $dateFrom = $request->get('dateFrom');
     $dateTo = $request->get('dateTo');
     //$d1 = (new \DateTime($dateFrom))->format('Y-m-d H:i');
     //$payments = Payment::whereBetween('date', [$dateFrom, $dateTo])->whereNull('payment_date')->get();
     $payments = Payment::whereNotNull('payment_date')->with(['user', 'place'])->get();
     return view('director.reportinfo', compact('payments'));
 }
開發者ID:rodiaa,項目名稱:trpo,代碼行數:9,代碼來源:ReportController.php

示例15: 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


注:本文中的app\models\Payment類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。