/** * Process a manual gocardless payment * * @param $amount * @param $reason * @param User $user * @param $ref * @param $returnPath * @return mixed * @throws \BB\Exceptions\NotImplementedException */ private function handleManualBill($amount, $reason, $user, $ref, $returnPath) { $payment_details = array('amount' => $amount, 'name' => $this->getName($reason, $user->id), 'description' => $this->getDescription($reason), 'redirect_uri' => route('account.payment.gocardless.manual-return', [$user->id]), 'user' => ['first_name' => $user->given_name, 'last_name' => $user->family_name, 'billing_address1' => $user->address_line_1, 'billing_address2' => $user->address_line_2, 'billing_town' => $user->address_line_3, 'billing_postcode' => $user->address_postcode, 'country_code' => 'GB'], 'state' => $reason . ':' . $ref . ':' . $returnPath); $redirectUrl = $this->goCardless->newBillUrl($payment_details); if (\Request::wantsJson()) { return \Response::json(['url' => $redirectUrl], 303); } return \Redirect::to($redirectUrl); }