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


PHP Payment::create_customer方法代码示例

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


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

示例1: PaymentValidate

 public function PaymentValidate($id)
 {
     $user = Auth::user();
     $participant = Participant::find($id);
     $club = $participant->event->club;
     $validator = Validator::make(Input::all(), Payment::$rules);
     if ($validator->passes()) {
         //validation done prior ajax
         $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'), 'club' => $club->id);
         $payment = new Payment();
         $transaction = $payment->create_customer($param, $user);
         if ($transaction->response == 3 || $transaction->response == 2) {
             $data = array('success' => false, 'error' => $transaction);
             return Redirect::action('ParticipantController@paymentCreate', array($participant->id))->with('error', $transaction->responsetext);
         } else {
             $user->profile->customer_vault = $transaction->customer_vault_id;
             $user->profile->save();
             $data = array('success' => true, 'customer' => $transaction->customer_vault_id, 'card' => substr($param['ccnumber'], -4), 'ccexp' => $param['ccexp'], 'zip' => $param['zip']);
             return Redirect::action('ParticipantController@paymentCreate', array($participant->id));
         }
     }
     return Redirect::back()->withErrors($validator)->withInput();
 }
开发者ID:illuminate3,项目名称:league-production,代码行数:23,代码来源:ParticipantController.php

示例2: validate

 /**
 * Validate & Save customer card data. Ajax only
 *
 * @param  int  $id
 * @return Response
 */
 public function validate()
 {
     $user = Auth::user();
     $validator = Validator::make(Input::all(), Payment::$rules);
     if ($validator->passes()) {
         //validation done prior ajax
         $param = array('ccnumber' => Input::get('card'), 'ccexp' => 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'));
         $payment = new Payment();
         $transaction = $payment->create_customer($param, $user);
         if ($transaction->response == 3 || $transaction->response == 2) {
             $data = array('success' => false, 'error' => $transaction);
             return $data;
         } else {
             //update user customer #
             User::where('id', $user->id)->update(array('customer_id' => $transaction->customer_vault_id));
             //retrived data save from API - See API documentation
             $data = array('success' => true, 'customer' => $transaction->customer_vault_id, 'card' => substr($param['ccnumber'], -4), 'ccexp' => $param['ccexp'], 'zip' => $param['zip']);
             return $data;
         }
     }
     return Redirect::back()->withErrors($validator)->withInput();
 }
开发者ID:illuminate3,项目名称:league-production,代码行数:28,代码来源:PaymentController.php

示例3: validation

 public function validation($team, $member)
 {
     $member = Member::find($member);
     $player = Player::find($member->player_id)->with("user")->FirstOrFail();
     $user = $player->user[0];
     $messages = array('card.required' => "Credit Card Number Required", 'month.required' => "Expiration Month Required", 'year.required' => "Expiration Year Required", 'cvv.required' => "Security Code Required", 'address1.required' => "Billing Address Required", 'city.required' => "Billing City Required", 'state.required' => "Billing state Required", 'zip.required' => "Billing zip Required");
     $validator = Validator::make(Input::all(), Plan::$rules_validation, $messages);
     if ($validator->passes()) {
         //validation done prior ajax
         $param = array('ccnumber' => Input::get('card'), 'ccexp' => sprintf('%02s', Input::get('month')) . Input::get('year'), 'cvv' => Input::get('cvv'), 'address1' => Input::get('address1'), 'city' => Input::get('city'), 'state' => Input::get('state'), 'zip' => Input::get('zip'));
         $payment = new Payment();
         $transaction = $payment->create_customer($param, $user->id);
         if ($transaction->response == 3 || $transaction->response == 2) {
             $data = array('success' => false, 'error' => $transaction);
             $object = json_decode(json_encode($data), FALSE);
             return Redirect::back()->withErrors($object->error->responsetext)->withInput();
         } else {
             //update user customer #
             User::where('id', $user->id)->update(array('customer_id' => $transaction->customer_vault_id));
             return Redirect::action('PlanController@create', array($team, $member->id));
         }
     }
     $error = $validator->errors()->all(':message');
     return Redirect::back()->withErrors($error)->withInput();
 }
开发者ID:illuminate3,项目名称:league-production,代码行数:25,代码来源:PlanController.php

示例4: PaymentValidateTeam

 public function PaymentValidateTeam($club, $id)
 {
     $user = Auth::user();
     $club = Club::find($club);
     $team = Team::find($id);
     $validator = Validator::make(Input::all(), Payment::$rules);
     if ($validator->passes()) {
         //validation done prior ajax
         $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'), 'club' => $club->id);
         $payment = new Payment();
         $transaction = $payment->create_customer($param, $user);
         if ($transaction->response == 3 || $transaction->response == 2) {
             $data = array('success' => false, 'error' => $transaction);
             return Redirect::action('ClubPublicController@PaymentCreateTeam', array($club->id, $team->id))->with('error', $transaction->responsetext);
         } else {
             //update user customer #
             $user->profile->customer_vault = $transaction->customer_vault_id;
             $user->profile->save();
             //User::where('id', $user->id)->update(array('customer_id' => $transaction->customer_vault_id ));
             //retrived data save from API - See API documentation
             $data = array('success' => true, 'customer' => $transaction->customer_vault_id, 'card' => substr($param['ccnumber'], -4), 'ccexp' => $param['ccexp'], 'zip' => $param['zip']);
             return Redirect::action('ClubPublicController@PaymentCreateTeam', array($club->id, $team->id));
         }
     }
     return Redirect::back()->withErrors($validator)->withInput();
 }
开发者ID:illuminate3,项目名称:league-production,代码行数:26,代码来源:ClubPublicController.php


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