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


PHP Payment::receipt方法代码示例

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


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

示例1: PaymentStore

 public function PaymentStore($id)
 {
     $user = Auth::user();
     $participant = Participant::find($id);
     $title = 'League Together - ' . $participant->event->club->name . ' Teams';
     $player = $participant->player;
     $club = $participant->event->club;
     $cart = Cart::contents(true);
     $uuid = Uuid::generate();
     //Addition for stub feature
     $follow = Follower::where("user_id", "=", $user->id)->FirstOrFail();
     //check if follower equal club
     if ($follow->club_id != $club->id) {
         $param = array('ccnumber' => str_replace('_', '', Input::get('card')), 'ccexp' => sprintf('%02s', Input::get('month')) . Input::get('year'), 'cvv' => Input::get('cvv'), 'address1' => Input::get('address'), 'city' => Input::get('city'), 'state' => Input::get('state'), 'zip' => Input::get('zip'), 'discount' => Input::get('discount'), 'club' => $club->id, 'firstname' => $user->profile->firstname, 'lastname' => $user->profile->lastname, 'phone' => $user->profile->mobile);
     } else {
         $param = array('customer_vault_id' => $user->profile->customer_vault, 'discount' => Input::get('discount'), 'club' => $club->id);
     }
     $payment = new Payment();
     $transaction = $payment->sale($param);
     if ($transaction->response == 3 || $transaction->response == 2) {
         return Redirect::action('ParticipantController@paymentCreate', array($participant->id))->with('error', $transaction->responsetext);
     } else {
         foreach (Cart::contents() as $item) {
             $payment->id = $uuid;
             $payment->customer = $user->profile->customer_vault;
             $payment->transaction = $transaction->transactionid;
             $payment->subtotal = $transaction->subtotal;
             $payment->service_fee = $transaction->fee;
             $payment->total = $transaction->total;
             $payment->promo = $transaction->promo;
             $payment->tax = $transaction->tax;
             $payment->discount = $transaction->discount;
             $payment->club_id = $club->id;
             $payment->user_id = $user->id;
             $payment->player_id = $item->player_id;
             $payment->event_type = $participant->event->type_id;
             $payment->type = $transaction->type;
             $payment->save();
             $salesfee = $item->price / getenv("SV_FEE") - $item->price;
             $sale = new Item();
             $sale->description = $item->name;
             $sale->quantity = $item->quantity;
             $sale->price = $item->price;
             $sale->fee = $salesfee;
             $sale->participant_id = $participant->id;
             $sale->payment_id = $uuid;
             $sale->event_id = $participant->event->id;
             $sale->save();
             $participant->accepted_on = Carbon::Now();
             $participant->accepted_by = $user->profile->firstname . ' ' . $user->profile->lastname;
             $participant->accepted_user = $user->id;
             $participant->method = $item->type;
             $participant->status = 1;
             $participant->save();
             //create payments plan schedule
             if ($item->type == "plan") {
                 $subtotal = $participant->plan->getOriginal('recurring');
                 $fee = $subtotal / getenv("SV_FEE") - $subtotal;
                 $total = $fee + $subtotal;
                 for ($x = 1; $x < $participant->plan->recurrences + 1; $x++) {
                     $today = Carbon::now();
                     $today->addMonths($x);
                     $payon = $participant->plan->getOriginal('on');
                     //make sure the payday is a valid day
                     if ($payon == 31) {
                         if ($today->month == 2) {
                             $payon = 28;
                         }
                         if ($today->month == 4 || $today->month == 6 || $today->month == 9 || $today->month == 11) {
                             $payon = 30;
                         }
                     }
                     $payday = Carbon::create($today->year, $today->month, $payon, 0);
                     $schedule = new SchedulePayment();
                     $schedule->date = $payday;
                     $schedule->description = "Membership Team " . $participant->event->name;
                     $schedule->subtotal = number_format($subtotal, 2);
                     $schedule->fee = number_format($fee, 2);
                     $schedule->total = number_format($total, 2);
                     $schedule->plan_id = $participant->plan->id;
                     $schedule->club_id = $club->id;
                     $schedule->participant_id = $participant->id;
                     $status = $schedule->save();
                     if (!$status) {
                         return "We process your payment but and error occurred in the process, please contact us: support@leaguetogether.com Error# 597";
                     }
                 }
                 //end for loop
             }
             //end if plan
         }
         //email receipt
         $payment->receipt($transaction, $club->id, $item->player_id);
         $data = array('club' => $club, 'player' => $player, 'user' => $user, 'participant' => $participant);
         $mail = Mail::send('emails.notification.event.accept', $data, function ($message) use($user, $club, $participant) {
             $message->from('C2C@leaguetogether.com', 'C2C Lacrosse')->to($user->email, $participant->accepted_by)->subject("Thank you for joining our event | " . $club->name);
             foreach ($club->users()->get() as $value) {
                 $message->bcc($value->email, $club->name);
             }
         });
//.........这里部分代码省略.........
开发者ID:illuminate3,项目名称:league-production,代码行数:101,代码来源:ParticipantController.php

示例2: store

 /**
 * Store a newly created resource in storage.
 * POST /payment
 *
 * @return Response
 */
 public function store()
 {
     $user = Auth::user();
     $param = array('customer_vault_id' => Input::get('vault'), 'discount' => Input::get('discount'));
     $payment = new Payment();
     $transaction = $payment->sale($param);
     if ($transaction->response == 3 || $transaction->response == 2) {
         return Redirect::action('PaymentController@create')->with('error', $transaction->responsetext);
     } else {
         $payment->user = $user->id;
         $payment->type = $transaction->type;
         $payment->transaction = $transaction->transactionid;
         $payment->subtotal = $transaction->subtotal;
         $payment->service_fee = $transaction->fee;
         $payment->total = $transaction->total;
         $payment->promo = $transaction->promo;
         $payment->tax = $transaction->tax;
         $payment->discount = $transaction->discount;
         $payment->save();
         if ($payment->id) {
             $club = "";
             foreach (Cart::contents() as $item) {
                 $salesfee = $item->price / getenv("SV_FEE") - $item->price;
                 $sale = new Item();
                 $sale->description = $item->name;
                 $sale->club_id = $item->org_id;
                 $sale->quantity = $item->quantity;
                 $sale->price = $item->price;
                 $sale->fee = $salesfee;
                 $sale->item = $item->event;
                 $sale->type = 1;
                 // $sale->discout	= ;
                 Payment::find($payment->id)->Items()->save($sale);
                 if ($item->player_id) {
                     foreach ($item->player_id as $key => $playerid) {
                         $participant = new Participant();
                         $participant->event = $item->event;
                         $participant->user = $user->id;
                         $participant->player = $playerid;
                         $participant->payment = $payment->id;
                         $participant->save();
                     }
                 } else {
                     $participant = new Participant();
                     $participant->event = $item->event;
                     $participant->user = $user->id;
                     $participant->payment = $payment->id;
                     $participant->save();
                 }
                 $club[] = $item->org_id;
             }
         }
         //email receipt
         $payment->receipt($transaction, $club);
         return Redirect::action('PaymentController@success')->with('result', $transaction);
     }
 }
开发者ID:illuminate3,项目名称:league-production,代码行数:63,代码来源:PaymentController.php

示例3: fire

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     $startDate = Carbon::now();
     $from = Carbon::now()->hour(0)->minute(0)->second(0);
     $to = Carbon::now()->hour(23)->minute(59)->second(59);
     $schedules = SchedulePayment::where('status', 0)->whereBetween('date', array($from, $to))->with('member.user.profile')->get();
     //$schedules = SchedulePayment::where('status', 0)->with('member.user.profile')->get();
     $errors = array();
     $totalAmount = array();
     $errorAmount = array();
     //save daylog
     $dayLog = new ScheduleDailyLog();
     $dayLog->started_on = Carbon::now()->toDateTimeString();
     $dayLog->payments_count = count($schedules);
     $dayLog->save();
     Cart::destroy();
     foreach ($schedules as $schedule) {
         try {
             $vault = $schedule->member->user->profile->customer_vault;
             $user = User::find($schedule->member->user->id);
             $player = Player::find($schedule->member->player->id);
             $club = Club::find($schedule->club_id);
             $team = Team::find($schedule->member->team_id);
             $uuid = Uuid::generate();
             $member = Member::find($schedule->member->id);
             $history = SchedulePayment::find($schedule->id);
             //manually login user out before login new user
             Auth::logout();
             //manually login user
             Auth::login($user);
             //clear cart content
             Cart::destroy();
             //set cart item
             $itemCart = array('id' => $team->id, 'name' => "Scheduled payment for " . $team->name, 'price' => $schedule->subtotal, 'quantity' => 1, 'organization' => $club->name, 'organization_id' => $club->id, 'player_id' => $player->id, 'user_id' => $user->id, 'type' => 'full', 'autopay' => true);
             Cart::insert($itemCart);
             //check if vault exist
             if ($vault) {
                 $param = array('customer_vault_id' => $vault, 'discount' => null, 'club' => $club->id);
                 $payment = new Payment();
                 $transaction = $payment->sale($param);
                 //temp json_decode(json_encode($array), FALSE);
                 //$transaction = json_decode(json_encode(array('response' => 1, 'total'=>$schedule->total, 'fee'=>$schedule->fee)), FALSE);
                 if ($transaction->response == 3 || $transaction->response == 2) {
                     $errors[] = array('payment_schedule_id' => $schedule->id, 'error_description' => $transaction->transactionid . ' : ' . $transaction->responsetext, 'error_amount' => $schedule->total, 'daily_log_id' => $dayLog->id);
                     array_push($errorAmount, number_format($schedule->total, 2));
                     //Email error
                     $emailerrorstatus = $payment->error($transaction, $club->id, $player->id);
                 } else {
                     array_push($totalAmount, number_format($transaction->total, 2));
                     $payment->id = $uuid;
                     $payment->customer = $vault;
                     $payment->transaction = $transaction->transactionid;
                     $payment->subtotal = $transaction->subtotal;
                     $payment->service_fee = $transaction->fee;
                     $payment->total = $transaction->total;
                     $payment->promo = $transaction->promo;
                     $payment->tax = $transaction->tax;
                     $payment->discount = $transaction->discount;
                     $payment->club_id = $club->id;
                     $payment->user_id = $user->id;
                     $payment->player_id = $player->id;
                     $payment->event_type = null;
                     $payment->type = $transaction->type;
                     $payment->save();
                     //Email receipt
                     $payment->receipt($transaction, $club->id, $player->id);
                     $sale = new Item();
                     $sale->description = $itemCart['name'];
                     $sale->quantity = $itemCart['quantity'];
                     $sale->price = $itemCart['price'];
                     $sale->fee = $transaction->fee;
                     $sale->member_id = $member->id;
                     $sale->team_id = $team->id;
                     $sale->payment_id = $uuid;
                     $sale->save();
                     //update schedule
                     $history->status = 2;
                     $history->save();
                 }
             } else {
                 //save error that vault didnt exist
                 $errors[] = array('payment_schedule_id' => $schedule->id, 'error_description' => 'Customer Vault not found', 'error_amount' => number_format($schedule->total, 2), 'daily_log_id' => $dayLog->id);
                 array_push($errorAmount, number_format($schedule->total, 2));
             }
         } catch (Exception $e) {
             //save internal error
             $errors[] = array('payment_schedule_id' => $schedule->id, 'error_description' => $e, 'error_amount' => number_format($schedule->total, 2), 'daily_log_id' => $dayLog->id);
             array_push($errorAmount, number_format($schedule->total, 2));
         }
     }
     //end of foreach schedule
     //save log for everything done
     $dayLogEnd = ScheduleDailyLog::find($dayLog->id);
     $dayLogEnd->ended_on = Carbon::now()->toDateTimeString();
     $dayLogEnd->successful_count = Count($totalAmount);
//.........这里部分代码省略.........
开发者ID:illuminate3,项目名称:league-production,代码行数:101,代码来源:PlanSchedule.php

示例4: PaymentStoreTeam


//.........这里部分代码省略.........
             $early_due = $team->getOriginal('early_due');
             $early_due_deadline = $team->getOriginal('early_due_deadline');
             $member = new Member();
             $member->id = $uuidMember;
             $member->firstname = $player->firstname;
             $member->lastname = $player->lastname;
             $member->due = $due;
             $member->early_due = $early_due;
             $member->early_due_deadline = $early_due_deadline;
             $member->plan_id = $team->plan_id;
             $member->player_id = $player->id;
             $member->team_id = $item->team_id;
             $member->accepted_on = Carbon::Now();
             $member->accepted_by = $user->profile->firstname . ' ' . $user->profile->lastname;
             $member->accepted_user = $user->id;
             $member->method = $item->type;
             $member->status = 1;
             $member->save();
             $payment->id = $uuid;
             $payment->customer = $user->profile->customer_vault;
             $payment->transaction = $transaction->transactionid;
             $payment->subtotal = $transaction->subtotal;
             $payment->service_fee = $transaction->fee;
             $payment->total = $transaction->total;
             $payment->promo = $transaction->promo;
             $payment->tax = $transaction->tax;
             $payment->discount = $transaction->discount;
             $payment->club_id = $club->id;
             $payment->user_id = $user->id;
             $payment->player_id = $item->player_id;
             $payment->event_type = null;
             $payment->type = $transaction->type;
             $payment->save();
             $salesfee = $item->price / getenv("SV_FEE") - $item->price;
             $sale = new Item();
             $sale->description = $item->name;
             $sale->quantity = $item->quantity;
             $sale->price = $item->price;
             $sale->fee = $salesfee;
             $sale->member_id = $uuidMember;
             $sale->team_id = $item->team_id;
             $sale->payment_id = $uuid;
             $sale->save();
             $member = Member::find($uuidMember);
             //create payments plan schedule
             if ($item->type == "plan") {
                 $subtotal = $member->plan->getOriginal('recurring');
                 $fee = $subtotal / getenv("SV_FEE") - $subtotal;
                 $total = $fee + $subtotal;
                 for ($x = 1; $x < $member->plan->recurrences + 1; $x++) {
                     $today = Carbon::now();
                     $today->addMonths($x);
                     $payon = $member->plan->getOriginal('on');
                     //make sure the payday is a valid day
                     if ($payon == 31) {
                         if ($today->month == 2) {
                             $payon = 28;
                         }
                         if ($today->month == 4 || $today->month == 6 || $today->month == 9 || $today->month == 11) {
                             $payon = 30;
                         }
                     }
                     $payday = Carbon::create($today->year, $today->month, $payon, 0);
                     $schedule = new SchedulePayment();
                     $schedule->date = $payday;
                     $schedule->description = "Membership Team " . $member->team->name;
                     $schedule->subtotal = number_format($subtotal, 2);
                     $schedule->fee = number_format($fee, 2);
                     $schedule->total = number_format($total, 2);
                     $schedule->plan_id = $member->plan->id;
                     $schedule->club_id = $club->id;
                     $schedule->member_id = $member->id;
                     $status = $schedule->save();
                     if (!$status) {
                         return "We process your payment but and error occurred in the process, please contact us: support@leaguetogether.com Error# 597";
                     }
                 }
                 //end for loop
             }
             //end if plan
             //waitlist process
             if ($team->max < $team->members->count()) {
                 //add to waitlist
                 $waitlist = new Waitlist();
                 $waitlist->id = Uuid::generate();
                 $waitlist->member_id = $uuidMember;
                 $waitlist->team_id = $team->id;
                 $waitlist->save();
             }
             if ($club->processor_name == 'Bluepay') {
                 //return Redirect::action('ClubPublicController@PaymentSuccessTeam', array($club->id, $team->id))->with('result','Success');
                 return Redirect::action('ClubPublicController@PaymentCreateTeam', array($club->id, $team->id))->with('error', 'Player added successfully.  Please check your email for receipt.');
             } else {
                 $payment->receipt($transaction, $club->id, $item->player_id);
                 return Redirect::action('ClubPublicController@PaymentSuccessTeam', array($club->id, $team->id))->with('result', $transaction);
             }
             //return Redirect::action('ClubPublicController@PaymentSuccessTeam', array($club->id, $team->id))->with('result',$transaction);
         }
     }
 }
开发者ID:illuminate3,项目名称:league-production,代码行数:101,代码来源:ClubPublicController.php


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