예제 #1
0
 public function getCharges(Request $request, $id)
 {
     $user = $request->user();
     $charge = Charge::apiFind($id);
     $url = '/account/charge';
     return view('auth.account.charges', ['TITLE' => '充值', 'META_KEYWORDS' => META_KEYWORDS, 'META_DESC' => META_DESC, 'PAGE_CODE' => 'auth.account.charges', 'user' => $user, 'charge' => $charge, 'url' => $url]);
 }
예제 #2
0
 public function getIndex(Request $request)
 {
     User::createTable();
     // User::createAdmin('*****@*****.**','admin');
     Img::createTable();
     Mylog::createTable();
     Email::createTable();
     Banner::createTable();
     Activity::createTable();
     Form::createTable();
     Field::createTable();
     FieldChildren::createTable();
     Result::createTable();
     ResultRow::createTable();
     Charge::createTable();
 }
예제 #3
0
 public function handleCharge(Request $request)
 {
     // Create the charge on Stripe's servers - this will charge the user's card
     $amount = $request->amount;
     //The user gets to keep 95% of the transaction. Stripe gets 2.9% + $0.30, I keep the rest. $$$$$
     $application_fee = ($amount - ($amount * 0.029 + 0.3) - 0.95 * $amount) * 100;
     try {
         $user = \App\User::find($request->user_id);
         \Stripe\Charge::create(array("amount" => $amount * 100, "currency" => "usd", "source" => $request->token, "description" => $request->description, 'destination' => $user->stripeAccount->stripe_id, 'application_fee' => $application_fee));
         \App\Charge::Create(['user_id' => $user->id, 'amount' => $amount]);
         event(new \App\Events\ChargeSucceeded($request->email, $user));
         return response()->json(['status' => 'Payment Succeeded!']);
     } catch (\Stripe\Error\Card $e) {
         // The card has been declined
         return response()->json(['status' => 'Payment Declined!']);
     }
 }
예제 #4
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     return Charge::findOrFail($id);
 }
예제 #5
0
 public function postSignup(SignupPRequest $request)
 {
     $user = User::create(['user_name' => $request->input('signup_name'), 'user_email' => $request->input('signup_name'), 'user_password' => Hash::make(WEBSITE_SECRET . $request->input('signup_password')), 'user_role' => 'member', 'user_balance' => 0, 'user_active' => 0]);
     if ($user) {
         $email = Email::create(['email_cuid' => 0, 'email_ruid' => $user->user_id, 'email_block' => 'user_confirm', 'email_target' => $user->user_email, 'email_title' => '欢迎来到[ ' . WEBSITE_NAME . ' ],请您按照提示激活您的账号', 'email_datas' => str_random(15), 'email_is_sent' => 0]);
         $this->dispatch(new SendReminderEmail($email));
         Mylog::cc($request, $user, 'signup');
         Charge::cc($request, 'bequeath:signup', ['userRelated' => $user]);
         // 邀请人处理
         $invited_user_email = $request->input('invited_user_email');
         if ($invited_user_email) {
             $userInvited = User::where('user_email', base64_decode($invited_user_email))->first();
             if ($userInvited) {
                 Charge::cc($request, 'bequeath:invited', ['userCreated' => $user, 'userRelated' => $userInvited]);
             }
         }
         $res = redirect('/login')->with('msgSuccess', '注册成功,验证邮件已经发送到您的邮箱,请您查验。');
     } else {
         $res = redirect()->back()->withInput()->with('msgError', MSG_FA);
     }
     return $res;
 }