Exemplo n.º 1
0
 /**
  * @return \Illuminate\Http\RedirectResponse
  *
  * Final Checkout Confirmation
  */
 public function checkout(Request $request)
 {
     /*********************************************************************
      *   Do Whatever You normally Would To get your Products Information
      *   An example could be to get it out of the Session Store, Via Your Cart Package or Something
      *   Or If you are Passing It Via a Request Object, Type-Hint the Method With your
      *   Request Object to get it in here.
      */
     try {
         // Let the array contain all Necessary Data Needed (For the Default Gateway)
         // You need to create your own TransactionData and not use the testTransactionData
         // i.e all Inputs for the PayButton
         //            $transactionData = $this->testTransactionData($request);
         $transactionData = $this->allInOneTestData($request);
         $merchantRef = $this->paymentGateway->logTransaction($transactionData);
         $items = json_decode($this->paymentGateway->serializeItemsToJson($transactionData), true);
         return view('vendor.lara-pay-ng.confirm', compact('transactionData', 'merchantRef', 'items'));
     } catch (UnspecifiedTransactionAmountException $e) {
         dd($e);
         // Handle This Exception However you please
         // Shouldn't Ever Occur If you Do the Implementation Correctly
     } catch (UnknownPaymentGatewayException $e) {
         dd($e);
         // Handle This Exception However you please
         // Shouldn't Ever Occur If you Choose One of the Supported Gateways and Spell It right
     }
 }