本文整理汇总了PHP中Payment::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Payment::find方法的具体用法?PHP Payment::find怎么用?PHP Payment::find使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Payment
的用法示例。
在下文中一共展示了Payment::find方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getData
private function getData($id)
{
$std = new stdClass();
$user = $this->user->idUser;
$buy = Buy::findFirst(array('conditions' => 'idBuy = ?1 AND idUser = ?2', 'bind' => array(1 => $id, 2 => $user)));
if (!$buy) {
$std->data = array('No se han encontrado datos, por favor valide la información');
$std->code = 404;
return $std;
} else {
$rec = array();
$payment = Payment::find(array('conditions' => 'idBuy = ?1 ORDER BY date DESC', 'bind' => array(1 => $id)));
if (count($payment) > 0) {
foreach ($payment as $p) {
$array = array();
$array['id'] = $p->idPayment;
$array['value'] = '$' . number_format($p->receiptValue);
$array['date'] = $p->date;
$rec[] = $array;
}
}
$datos = array('code' => $buy->idBuy, 'value' => '$' . number_format($buy->value), 'dif' => '$' . number_format($buy->value - $buy->debt), 'debt' => '$' . number_format($buy->debt));
$data = array($datos, $rec);
$std->data = $data;
$std->code = 200;
return $std;
}
}
示例2: edit
/**
* Show the form for editing the specified payment.
*
* @param int $id
* @return Response
*/
public function edit($id)
{
$payment = Payment::find($id);
$erporders = Erporder::all();
$erporderitems = Erporderitem::all();
return View::make('payments.edit', compact('payment', 'erporders', 'erporderitems'));
}
示例3: run
public function run()
{
$participants = DB::table('event_participant')->get();
foreach ($participants as $participant) {
$player = Player::find($participant->player_id);
$user = User::find($participant->user_id);
$event = Evento::find($participant->event_id);
$payment = Payment::find($participant->payment_id);
$uuid = Uuid::generate();
$new = new Participant();
$new->id = $uuid;
$new->firstname = $player->firstname;
$new->lastname = $player->lastname;
$new->due = $event->getOriginal('fee');
$new->early_due = $event->getOriginal('early_fee');
$new->early_due_deadline = $event->early_deadline;
$new->method = 'full';
$new->plan_id = Null;
$new->player_id = $player->id;
$new->event_id = $participant->event_id;
$new->accepted_on = $participant->created_at;
$new->accepted_by = $user->profile->firstname . " " . $user->profile->lastname;
$new->accepted_user = $participant->user_id;
$new->status = 1;
$new->created_at = $participant->created_at;
$new->updated_at = $participant->updated_at;
$new->save();
$update = Item::where('payment_id', '=', $payment->id)->firstOrFail();
$update->participant_id = $uuid;
$update->save();
}
}
示例4: total
public function total()
{
if (!($total = Cache::read('payments_total_' . $this->key, 'expenses'))) {
$payment = new Payment();
$total = $payment->find('all', array('fields' => array('sum(value) as total'), 'conditions' => array('or' => array('Payment.user_id' => $this->Authorization->User->id(), 'Payment.team_id' => $this->Authorization->User->Team->id()))));
Cache::write('payments_total_' . $this->key, $total, 'expenses');
}
return isset($total[0][0]) ? round($total[0][0]['total'], 2) : 0;
}
示例5: actionCreate
public function actionCreate()
{
$model = new Payment();
if (Yii::app()->getRequest()->getIsPostRequest() && isset($_POST['Payment'])) {
$model->setAttributes(Yii::app()->getRequest()->getPost('Payment'));
$model->setPaymentSystemSettings(Yii::app()->getRequest()->getPost('PaymentSettings', []));
if ($model->save()) {
Yii::app()->user->setFlash(yupe\widgets\YFlashMessages::SUCCESS_MESSAGE, Yii::t('PaymentModule.payment', 'Record was created!'));
if (!isset($_POST['submit-type'])) {
$this->redirect(['update', 'id' => $model->id]);
} else {
$this->redirect([$_POST['submit-type']]);
}
}
}
//@TODO вынести в метод модели
$criteria = new CDbCriteria();
$criteria->select = new CDbExpression('MAX(position) as position');
$max = $model->find($criteria);
$model->position = $max->position + 1;
$this->render('create', ['model' => $model]);
}
示例6: deletecardtoken
public function deletecardtoken()
{
$card_id = Input::get('card_id');
$token = Input::get('token');
$user_id = Input::get('user_id');
if ($payment = Payment::find($card_id)) {
if ($payment->owner_id == $owner_id) {
Payment::find($card_id)->delete();
$response_array = array('success' => true);
$response_code = 200;
} else {
$response_array = array('success' => false, 'error' => 'Card ID and Owner ID Doesnot matches', 'error_code' => 440);
$response_code = 200;
}
} else {
$response_array = array('success' => false, 'error' => 'Card not found', 'error_code' => 441);
$response_code = 200;
}
$response = Response::json($response_array, $response_code);
return $response;
}
示例7: deletecardtoken
public function deletecardtoken()
{
$card_id = Input::get('card_id');
$token = Input::get('token');
$owner_id = Input::get('id');
$validator = Validator::make(array('card_id' => $card_id, 'token' => $token, 'owner_id' => $owner_id), array('card_id' => 'required', 'token' => 'required', 'owner_id' => 'required|integer'));
/* $var = Keywords::where('id', 2)->first(); */
if ($validator->fails()) {
$error_messages = $validator->messages();
$response_array = array('success' => false, 'error' => 'Invalid Input', 'error_code' => 401);
$response_code = 200;
} else {
$is_admin = $this->isAdmin($token);
if ($owner_data = $this->getOwnerData($owner_id, $token, $is_admin)) {
// check for token validity
if (is_token_active($owner_data->token_expiry) || $is_admin) {
if ($payment = Payment::find($card_id)) {
if ($payment->owner_id == $owner_id) {
$pdn = Payment::where('id', $card_id)->first();
$check = trim($pdn->is_default);
Payment::find($card_id)->delete();
if ($check == 1) {
$card_count = DB::table('payment')->where('owner_id', '=', $owner_id)->count();
if ($card_count) {
$paymnt = Payment::where('owner_id', $owner_id)->first();
$paymnt->is_default = 1;
$paymnt->save();
}
}
$payments = array();
$card_count = DB::table('payment')->where('owner_id', '=', $owner_id)->count();
if ($card_count) {
$paymnt = Payment::where('owner_id', $owner_id)->orderBy('is_default', 'DESC')->get();
foreach ($paymnt as $data1) {
$default = $data1->is_default;
if ($default == 1) {
$data['is_default_text'] = "default";
} else {
$data['is_default_text'] = "not_default";
}
$data['id'] = $data1->id;
$data['customer_id'] = $data1->customer_id;
$data['card_id'] = $data1->card_token;
$data['last_four'] = $data1->last_four;
$data['is_default'] = $default;
array_push($payments, $data);
}
$response_array = array('success' => true, 'payments' => $payments);
$response_code = 200;
} else {
$response_code = 200;
$response_array = array('success' => true, 'error' => 'No Card Found', 'error_code' => 541);
}
} else {
/* $response_array = array('success' => false, 'error' => 'Card ID and ' . $var->keyword . ' ID Doesnot matches', 'error_code' => 440); */
$response_array = array('success' => false, 'error' => 'Card ID and ' . Config::get('app.generic_keywords.User') . ' ID Doesnot matches', 'error_code' => 440);
$response_code = 200;
}
} else {
$response_array = array('success' => false, 'error' => 'Card not found', 'error_code' => 441);
$response_code = 200;
}
} else {
$response_array = array('success' => false, 'error' => 'Token Expired', 'error_code' => 405);
$response_code = 200;
}
} else {
if ($is_admin) {
/* $response_array = array('success' => false, 'error' => '' . $var->keyword . ' ID not Found', 'error_code' => 410); */
$response_array = array('success' => false, 'error' => '' . Config::get('app.generic_keywords.User') . ' ID not Found', 'error_code' => 410);
} else {
$response_array = array('success' => false, 'error' => 'Not a valid token', 'error_code' => 406);
}
$response_code = 200;
}
}
$response = Response::json($response_array, $response_code);
return $response;
}
示例8: destroy
/**
* Remove the specified resource from storage.
* DELETE /accountreceivables/{id}
*
* @param int $id
* @return Response
*/
public function destroy($id)
{
Payment::find($id)->delete();
return Redirect::route('payment');
}
示例9: getPayment
/**
* fetch all Payment details from hypercharge server
* @return Hypercharge\Payment
*/
function getPayment()
{
return Payment::find($this->payment_unique_id);
}
示例10: function
<?php
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the Closure to execute when that URI is requested.
|
*/
Route::get('/pdf', function () {
$data['user'] = User::find(11);
$data['subscription'] = Subscription::find(10);
$data['payment'] = Payment::find(34);
//$pdf = PDF::loadView('docs.faktura', $data);
return View::make('docs.faktura', $data);
//return $pdf->stream();
});
//sitewide
Route::get('/', array('uses' => 'HomeController@showHome'));
Route::get('/informacje', array('uses' => 'HomeController@showAboutUs'));
//Route::get('/faq', array('uses' =>'HomeController@showFaq'));
Route::get('/kontakt', array('uses' => 'HomeController@showContact'));
Route::get('/regulamin', array('uses' => 'HomeController@showLegal'));
//Route::get('/oferta', array('uses' =>'HomeController@showPricing'));
Route::post('/contact/send', array('uses' => 'HomeController@postContactForm'));
Route::get('/robots.txt', array('uses' => 'HomeController@generateRobots'));
Route::get('/sitemap.xml', array('uses' => 'HomeController@generateSitemap'));
// auth
示例11: getPaymentDetails
public function getPaymentDetails($id)
{
$payment = Payment::find($id);
return View::make('payments.order-details')->with('payment', $payment);
}
示例12: update_order_status
public function update_order_status()
{
$id = Request::segment(3);
$order = Order::find($id);
$order->status = Input::get('status');
$order->save();
if ($order->status == 'Delivered') {
$total = $order->total_amount;
// Charge Users
$credits = UserCredit::where('user_id', $order->user_id)->first();
$balance = $credits->earned - $credits->spent;
if ($total > $balance) {
$ledger_temp = UserCredit::find($credits->id);
$ledger_temp->spent = $ledger_temp->earned;
$ledger_temp->save();
$total = $total - $balance;
} else {
$ledger_temp = UserCredit::find($credits->id);
$ledger_temp->spent = $ledger_temp->spent + $total;
$ledger_temp->save();
$total = 0;
}
$order = Order::find($id);
$order->card_payment = $total;
$order->credit_payment = $order->total_amount - $total;
$order->save();
try {
$payment = Payment::find($order->payment_id);
$customer_id = $payment->customer_id;
Stripe::setApiKey(Config::get('app.stripe_secret_key'));
Stripe_Charge::create(array("amount" => $total * 100, "currency" => "usd", "customer" => $customer_id));
$walk->is_paid = 1;
if ($walk->tip) {
$walk->tip_status = 2;
}
} catch (Exception $e) {
//print_r($e);
}
// Payment Charged Mail
$user = User::find($order->user_id);
Mail::send('emails.payment_charged', array('user' => $user, 'order' => $order), function ($message) use($user) {
$message->to($user->email, $user->first_name)->subject('Order Successfully Delivered!');
});
// Payment Charged Mail to Admin
$admin_email = Config::get('app.admin_email');
Mail::send('emails.admin_payment_charged', array('user' => $user, 'order' => $order), function ($message) use($admin_email) {
$message->to($admin_email, "Admin")->subject('Payment Charged!');
});
}
$message = "Successfully updated the order status";
$type = "success";
return Redirect::to('/admin/order/' . $id . '/details')->with('type', $type)->with('message', $message);
}
示例13: app_path
|
*/
require app_path() . '/filters.php';
// Events
Event::listen('invoice.email', function ($userId, $subscriptionId, $paymentId, $faktura = false) {
$data['user'] = User::find($userId);
$data['subscription'] = Subscription::find($subscriptionId);
$data['payment'] = Payment::find($paymentId);
$id = str_random(10);
$name = $faktura ? 'faktura' : 'rachunek';
$path = '/system/docs/' . $name . '-hasztaginfo-' . $id . '.pdf';
$savepath = public_path() . $path;
$template = $faktura ? 'docs.faktura' : 'docs.invoice';
$pdf = PDF::loadView($template, $data)->setWarnings(false)->save($savepath);
$invoice = Invoice::create(array('user_id' => $data['user']->id, 'subscription_id' => $data['subscription']->id, 'payment_id' => $data['payment']->id, 'path' => $path, 'token' => $id, 'type' => $faktura ? 2 : 1));
$payment = Payment::find($paymentId);
$payment->invoice_id = $invoice->id;
$payment->save();
$email = $data['subscription']->email;
$data = ['path' => $savepath, 'email' => $email];
Mail::later(5, 'emails.invoice', $data, function ($message) use($savepath, $email) {
$message->to($email)->subject('[hasztag.info] Potwierdzenie wpłaty');
$message->attach($savepath);
});
});
Event::listen('deactivate.subscription', function ($subscriptionId, $paymentDate) {
$subscription = Subscription::find($subscriptionId);
$subscription->is_active = 0;
$subscription->save();
$configs = BoardConfig::where('user_id', '=', $subscription->user_id)->get();
if ($configs->count() > 0) {
示例14: getPayments
private function getPayments($wantedid, $wantedstatus, $wantedtype, $whowantsid, $whowantstype){
$isperm = false;
$conditions = array();
if($wantedid > 0){
$tmpcondition = array('id=?',$wantedid);
\ActiveRecord\Utils::add_condition($conditions, $tmpcondition);
}
if($wantedstatus !== ''){
$tmpcondition = array('LCASE(status)=?', strtolower($wantedstatus));
\ActiveRecord\Utils::add_condition($conditions, $tmpcondition);
}
if($wantedtype !== ''){
$tmpcondition = array('LCASE(direction)=?', strtolower($wantedtype));
\ActiveRecord\Utils::add_condition($conditions, $tmpcondition);
}
if(($whowantstype !== Menu::ppl_type_admin && !$isperm)){
//whatever id, status been asked give if they are their related records only
$tmpcondition = array('person_id=?', $whowantsid);
\ActiveRecord\Utils::add_condition($conditions, $tmpcondition);
}
$result = \Payment::find('all', array('conditions' => $conditions, 'order' => 'updated_at desc'));
$except = array();
foreach ($result as &$rec) {
$include = array('account' => array('include' => array('orders')),'party','order');
if(strtolower($rec->direction) === Menu::payment_outwards){//account is payable
$include = array('account' => array('include' => array('orders' ,'ordertasks' => array('include' => array('task'))))
,'party'
,'order'
,'ordertask' => array('include' => array('task'))
);
}
$rec = $rec->to_array(array('include' => $include, 'except' => $except));
}
return $result;
}
示例15: deletecardtoken
public function deletecardtoken()
{
$card_id = Input::get('card_id');
$token = Input::get('token');
$owner_id = Input::get('id');
$validator = Validator::make(array('card_id' => $card_id, 'token' => $token, 'owner_id' => $owner_id), array('card_id' => 'required', 'token' => 'required', 'owner_id' => 'required|integer'));
if ($validator->fails()) {
$error_messages = $validator->messages();
$response_array = array('success' => false, 'error' => 'Invalid Input', 'error_code' => 401);
$response_code = 200;
} else {
$is_admin = $this->isAdmin($token);
if ($owner_data = $this->getOwnerData($owner_id, $token, $is_admin)) {
// check for token validity
if (is_token_active($owner_data->token_expiry) || $is_admin) {
if ($payment = Payment::find($card_id)) {
if ($payment->owner_id == $owner_id) {
Payment::find($card_id)->delete();
$response_array = array('success' => true);
$response_code = 200;
} else {
$response_array = array('success' => false, 'error' => 'Card ID and Owner ID Doesnot matches', 'error_code' => 440);
$response_code = 200;
}
} else {
$response_array = array('success' => false, 'error' => 'Card not found', 'error_code' => 441);
$response_code = 200;
}
} else {
$response_array = array('success' => false, 'error' => 'Token Expired', 'error_code' => 405);
$response_code = 200;
}
} else {
if ($is_admin) {
$response_array = array('success' => false, 'error' => 'Owner ID not Found', 'error_code' => 410);
} else {
$response_array = array('success' => false, 'error' => 'Not a valid token', 'error_code' => 406);
}
$response_code = 200;
}
}
$response = Response::json($response_array, $response_code);
return $response;
}