2016-03-31 23 views
0

Ben 400 hatayla her zaman ben başarısız bir işlem görünümünde güzel hataları görüntülemek için çalışıyorum 400 Errorlaravel PHP istirahat API 400 Hata

aşağıda ekranı olsun. Ancak, doğru bir şekilde $ ex ayrıştırıp ayırmadığımı görmek için bu ekranı geçemiyorum.

try { 
     $payment->create($apiContext); 

     $customer = Customer::where('fname', $request->bill_fname) 
         ->where('lname', $request->bill_lname)->first(); 
     if (!$customer) { 
      $customer = Customer::create(['fname' => $request->bill_fname, 'lname' => $request->bill_lname, 'email' => $request->email, 'phone' => $request->phonenum]); 
     } 

     if(empty($request->cc_token)) { 
     $savedcard = CreditCardTable::where('externalCardId', ($request->card_type . substr($request->card_number, -5)))->first(); 
     if(!$savedcard) { 
     $card->create($apiContext); 
     $creditcard = CreditCardTable::create(['customer_id' => $customer->id, 'card_id' => $card->id, 'externalCardId' => ($request->card_type . substr($request->card_number, -5))]); 
      } 
     } 

     //dd($payment); 
     //store all info in respective tables 
     $terminal = Terminal::create(['customer_id' => $customer->id, 'description' => $request->description, 'invoice_id' => $payment->transactions[0]->invoice_number, 'total' => ((($request->amount + $request->shipping_amount) * ($request->tax_rate/100)) + ($request->amount + $request->shipping_amount)), 'create_time' => $payment->create_time, 'paypal_id' => $payment->id, 'paypal_parent_payment' => $payment->transactions[0]->related_resources[0]->sale->id]); 
     $billaddress = BillAddress::where('addrline1', $request->addrline1) 
         ->where('addrline2', $request->addrline2) 
         ->where('zipcode', $request->bill_zip)->first(); 
     if(!$billaddress) { 
      $billaddress = BillAddress::create(['customer_id' => $customer->id, 'addrline1' => $request->addrline1, 'addrline2' => $request->addrline2, 'city' => $request->bill_city, 'state' => $request->bill_state, 'zipcode' => $request->bill_zip]); 
     } 
     if($request->isSame == 'No') { 
     $shipaddress = ShipAddress::where('addrline1', $request->ship_addr_line1) 
         ->where('addrline2', $request->ship_addr_line2) 
         ->where('zipcode', $request->ship_zip)->first(); 
     if(!$shipaddress) { 
      $shipaddress = ShipAddress::create(['customer_id' => $customer->id, 'addrline1' => $request->ship_addr_line1, 'addrline2' => $request->ship_addr_line2, 'city' => $request->ship_bill_city, 'state' => $request->ship_state, 'zipcode' => $request->ship_zip]); 
      } 
     } 
     else { 
      //ship address is bill address 
      $shipaddress = BillAddress::where('addrline1', $request->addrline1) 
         ->where('addrline2', $request->addrline2) 
         ->where('zipcode', $request->bill_zip)->first(); 
      if(!$shipaddress) { 
      $shipaddress = BillAddress::create(['customer_id' => $customer->id, 'addrline1' => $request->addrline1, 'addrline2' => $request->addrline2, 'city' => $request->bill_city, 'state' => $request->bill_state, 'zipcode' => $request->bill_zip]); 
      } 
     } 
      // dd($payment); 
      return view('pages.terminal.success')->with('payment', $payment)->with('fname', $request->bill_fname)->with('lname', $request->bill_lname); 
      } 
    catch (PayPal\Exception\PayPalConnectionException $ex) { 
       return view('errors.unsuccessful')->with('ex', $ex); 
       } 
    catch (Exception $ex) { 
     return view('errors.unsuccessful')->with('ex', $ex); 
    } 

Errors.Unsuccesful

@extends('app') 

@section('content') 
    <div class="alert alert-danger"> 
     <h4>Oh No!</h4> 
     <p>Transaction was not processed processed</p> 
    </div> 

    <div class="panel panel-danger"> 
    <div class="panel-heading"> 
    <h3 class="panel-title">Error</h3> 
    </div> 
    <div class="panel-body"> 
    {{ echo $ex->getCode(); // Prints the Error Code 
    echo $ex->getData(); // Prints the detailed error message }} 
    </div> 
</div> 

@endsection 

@include('errors.list') 

Onların yanlış yaptıklarını kullanıcı haber böylece nasıl güzel bu hataları görüntülerim şu şekildedir:

Benim kodudur?

+0

gg ($ ex) \ ters eğik çizgi koyularak genel ad gelen özel durum çözme deneyin ilk – Juakali92

+0

i dd ($ ex) ne zaman PayPalException bloğunda 400 hata ekranını alıyorum – rbur0425

cevap

0

herhangi bir hata Kumandanızda üzerinden gelen olup olmadığını görmek için

... 
catch (\PayPal\Exception\PayPalConnectionException $ex) { 
...