/** @test */ function user_get_correct_error_on_decline_of_card() { $user = factory(App\User::class)->create(); $repo = new TransactionRepository(); $info = $repo->processTransaction('424242424242424', '8', '2014', 12345, 100, $user->email); $this->assertTrue(is_string($info)); }
public function transactions(TransactionRepository $transactions) { return view('admin.main')->with('transactions', $transactions->all()); }
/** * Process the Transaction and return to complete * @param Request $request * @return \Illumination\Http\Response */ public function processTransaction(Request $request) { $transaction = new TransactionRepository(); //Run the Transaction; $parent = Auth::user(); $transactionInformation = $transaction->processTransaction($request->get('cc_number'), $request->get('exp_month'), $request->get('exp_year'), $request->get('cvc'), $request->get('amount'), $parent->email); if (is_string($transactionInformation)) { $transactionError = $transactionInformation; $total = $parent->totalRegistrationCost(); return view('register.transaction', compact('transactionError', 'total')); } // dd($transactionInformation); $array = $transaction->prepareTransactionForDatabase($transactionInformation); // dd($array); $parent->transactions()->create($array); $parent->increment('registered'); //Throw the Event Event::fire(new ChildWasRegistered($parent)); // Send the View to Registration Complete Page return redirect()->route('register.complete'); }