Ejemplo n.º 1
0
 public function paypal(Request $request)
 {
     $rules = ['amount' => 'required|numeric|min:5|max:1000'];
     $this->validate($request, $rules);
     $amount = $request->get('amount');
     $paypalService = new PaypalPaymentService();
     try {
         $url = $paypalService->getRefillUrl($amount, $this->user);
     } catch (\Exception $e) {
         $errorData = $e->getData();
         LogMapper::log('paypal_error', $e->getMessage(), 'get_url', ['user' => $this->user->id, 'amount' => $amount, 'error_data' => $errorData]);
         return Redirect::back()->withErrors(['paypal' => 'Failed paypal']);
     }
     return redirect($url);
 }