当前位置: 首页>>代码示例>>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;未经允许,请勿转载。