本文整理汇总了PHP中app\models\Payment类的典型用法代码示例。如果您正苦于以下问题:PHP Payment类的具体用法?PHP Payment怎么用?PHP Payment使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Payment类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: save
public function save($input, $payment = null)
{
$publicId = isset($input['public_id']) ? $input['public_id'] : false;
if ($payment) {
// do nothing
} elseif ($publicId) {
$payment = Payment::scope($publicId)->firstOrFail();
if (Utils::isNinjaDev()) {
\Log::warning('Entity not set in payment repo save');
}
} else {
$payment = Payment::createNew();
}
if ($payment->is_deleted) {
return $payment;
}
$paymentTypeId = false;
if (isset($input['payment_type_id'])) {
$paymentTypeId = $input['payment_type_id'] ? $input['payment_type_id'] : null;
$payment->payment_type_id = $paymentTypeId;
}
if (isset($input['payment_date_sql'])) {
$payment->payment_date = $input['payment_date_sql'];
} elseif (isset($input['payment_date'])) {
$payment->payment_date = Utils::toSqlDate($input['payment_date']);
} else {
$payment->payment_date = date('Y-m-d');
}
if (isset($input['transaction_reference'])) {
$payment->transaction_reference = trim($input['transaction_reference']);
}
if (!$publicId) {
$clientId = $input['client_id'];
$amount = Utils::parseFloat($input['amount']);
if ($paymentTypeId == PAYMENT_TYPE_CREDIT) {
$credits = Credit::scope()->where('client_id', '=', $clientId)->where('balance', '>', 0)->orderBy('created_at')->get();
$remaining = $amount;
foreach ($credits as $credit) {
$remaining -= $credit->apply($remaining);
if (!$remaining) {
break;
}
}
}
$payment->invoice_id = $input['invoice_id'];
$payment->client_id = $clientId;
$payment->amount = $amount;
}
$payment->save();
return $payment;
}
开发者ID:hillelcoren,项目名称:invoice-ninja,代码行数:51,代码来源:PaymentRepository.php
示例17: 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
示例18: getPaymentsCount
/**
* report generation functions DTR
*/
public function getPaymentsCount()
{
$year = date("Y");
$current_month = (int) date("m");
$months = [];
$j = $current_month;
for ($i = 0; $i < $j; $i++) {
$month = $current_month;
$monthly = Payment::find()->where('MONTH(date) = :month AND YEAR(date) = :year', [':month' => $month, ':year' => $year])->count();
array_push($months, $monthly);
$current_month--;
}
$before = array_map('intval', array_reverse($months));
return json_encode($before);
}
开发者ID:livingdreams,项目名称:kidcrossing,代码行数:18,代码来源:Payment.php
示例19: search
/**
* Creates data provider instance with search query applied
*
* @param array $params
*
* @return ActiveDataProvider
*/
public function search($params)
{
$query = Payment::find();
// add conditions that should always apply here
$dataProvider = new ActiveDataProvider(['query' => $query]);
$this->load($params);
if (!$this->validate()) {
// uncomment the following line if you do not want to return any records when validation fails
// $query->where('0=1');
return $dataProvider;
}
// grid filtering conditions
$query->andFilterWhere(['id' => $this->id, 'user_id' => $this->user_id, 'amount' => $this->amount, 'status' => $this->status, 'date' => $this->date]);
$query->andFilterWhere(['like', 'customer_id', $this->customer_id])->andFilterWhere(['like', 'subcription_id', $this->subcription_id])->andFilterWhere(['like', 'ip_address', $this->ip_address])->andFilterWhere(['>=', 'date', $this->start_date])->andFilterWhere(['<=', 'date', $this->end_date]);
return $dataProvider;
}
开发者ID:livingdreams,项目名称:kidcrossing,代码行数:23,代码来源:PaymentSearch.php
示例20: index
/**
* @SWG\Get(
* path="/payments",
* tags={"payment"},
* summary="List of payments",
* @SWG\Response(
* response=200,
* description="A list with payments",
* @SWG\Schema(type="array", @SWG\Items(ref="#/definitions/Payment"))
* ),
* @SWG\Response(
* response="default",
* description="an ""unexpected"" error"
* )
* )
*/
public function index()
{
$paginator = Payment::scope();
$payments = Payment::scope()->with('client.contacts', 'invitation', 'user', 'invoice');
if ($clientPublicId = Input::get('client_id')) {
$filter = function ($query) use($clientPublicId) {
$query->where('public_id', '=', $clientPublicId);
};
$payments->whereHas('client', $filter);
$paginator->whereHas('client', $filter);
}
$payments = $payments->orderBy('created_at', 'desc')->paginate();
$paginator = $paginator->paginate();
$transformer = new PaymentTransformer(Auth::user()->account, Input::get('serializer'));
$data = $this->createCollection($payments, $transformer, 'payments', $paginator);
return $this->response($data);
}
开发者ID:abusby,项目名称:invoiceninja,代码行数:33,代码来源:PaymentApiController.php
注:本文中的app\models\Payment类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论