diff --git a/app/controllers/AccountController.php b/app/controllers/AccountController.php index 2fb4e0e39dc7..6036a93b3753 100755 --- a/app/controllers/AccountController.php +++ b/app/controllers/AccountController.php @@ -97,7 +97,6 @@ class AccountController extends \BaseController public function getSearchData() { $data = $this->accountRepo->getSearchData(); - return Response::json($data); } @@ -119,94 +118,16 @@ class AccountController extends \BaseController return View::make('accounts.details', $data); } elseif ($section == ACCOUNT_PAYMENTS) { - $account = Account::with('account_gateways')->findOrFail(Auth::user()->account_id); - $accountGateway = null; - $config = null; - $configFields = null; - $selectedCards = 0; - if (count($account->account_gateways) > 0) { - $accountGateway = $account->account_gateways[0]; - $config = $accountGateway->config; - $selectedCards = $accountGateway->accepted_credit_cards; - - $configFields = json_decode($config); - - foreach ($configFields as $configField => $value) { - $configFields->$configField = str_repeat('*', strlen($value)); - } + $account = Auth::user()->account; + $account->load('account_gateways'); + $count = count($account->account_gateways); + + if ($count == 0) { + return Redirect::to('gateways/create'); } else { - $accountGateway = AccountGateway::createNew(); - $accountGateway->gateway_id = GATEWAY_MOOLAH; + return View::make('accounts.payments', ['showAdd' => $count < 2]); } - - $recommendedGateways = Gateway::remember(DEFAULT_QUERY_CACHE) - ->where('recommended', '=', '1') - ->orderBy('sort_order') - ->get(); - $recommendedGatewayArray = array(); - - foreach ($recommendedGateways as $recommendedGateway) { - $arrayItem = array( - 'value' => $recommendedGateway->id, - 'other' => 'false', - 'data-imageUrl' => asset($recommendedGateway->getLogoUrl()), - 'data-siteUrl' => $recommendedGateway->site_url, - ); - $recommendedGatewayArray[$recommendedGateway->name] = $arrayItem; - } - - $creditCardsArray = unserialize(CREDIT_CARDS); - $creditCards = []; - foreach ($creditCardsArray as $card => $name) { - if ($selectedCards > 0 && ($selectedCards & $card) == $card) { - $creditCards[$name['text']] = ['value' => $card, 'data-imageUrl' => asset($name['card']), 'checked' => 'checked']; - } else { - $creditCards[$name['text']] = ['value' => $card, 'data-imageUrl' => asset($name['card'])]; - } - } - - $otherItem = array( - 'value' => 1000000, - 'other' => 'true', - 'data-imageUrl' => '', - 'data-siteUrl' => '', - ); - $recommendedGatewayArray['Other Options'] = $otherItem; - - $gateways = Gateway::remember(DEFAULT_QUERY_CACHE)->where('payment_library_id', '=', 1)->orderBy('name')->get(); - - foreach ($gateways as $gateway) { - $paymentLibrary = $gateway->paymentlibrary; - - $gateway->fields = $gateway->getFields(); - - if ($accountGateway && $accountGateway->gateway_id == $gateway->id) { - $accountGateway->fields = $gateway->fields; - } - } - - $tokenBillingOptions = []; - for ($i=1; $i<=4; $i++) { - $tokenBillingOptions[$i] = trans("texts.token_billing_{$i}"); - } - - $data = [ - 'account' => $account, - 'accountGateway' => $accountGateway, - 'config' => $configFields, - 'gateways' => $gateways, - 'dropdownGateways' => Gateway::remember(DEFAULT_QUERY_CACHE) - ->where('recommended', '=', '0') - ->where('payment_library_id', '=', 1) - ->orderBy('name') - ->get(), - 'recommendedGateways' => $recommendedGatewayArray, - 'creditCardTypes' => $creditCards, - 'tokenBillingOptions' => $tokenBillingOptions, - ]; - - return View::make('accounts.payments', $data); } elseif ($section == ACCOUNT_NOTIFICATIONS) { $data = [ 'account' => Account::with('users')->findOrFail(Auth::user()->account_id), @@ -272,8 +193,6 @@ class AccountController extends \BaseController { if ($section == ACCOUNT_DETAILS) { return AccountController::saveDetails(); - } elseif ($section == ACCOUNT_PAYMENTS) { - return AccountController::savePayments(); } elseif ($section == ACCOUNT_IMPORT_EXPORT) { return AccountController::importFile(); } elseif ($section == ACCOUNT_MAP) { @@ -614,102 +533,6 @@ class AccountController extends \BaseController return Redirect::to('company/notifications'); } - private function savePayments() - { - $rules = array(); - $recommendedId = Input::get('recommendedGateway_id'); - - if ($gatewayId = $recommendedId == 1000000 ? Input::get('gateway_id') : $recommendedId) { - $gateway = Gateway::findOrFail($gatewayId); - - $paymentLibrary = $gateway->paymentlibrary; - - $fields = $gateway->getFields(); - - foreach ($fields as $field => $details) { - if (!in_array($field, ['testMode', 'developerMode', 'headerImageUrl', 'solutionType', 'landingPage', 'brandName', 'logoImageUrl', 'borderColor'])) { - if (strtolower($gateway->name) == 'beanstream') { - if (in_array($field, ['merchant_id', 'passCode'])) { - $rules[$gateway->id.'_'.$field] = 'required'; - } - } else { - $rules[$gateway->id.'_'.$field] = 'required'; - } - } - } - } - - $creditcards = Input::get('creditCardTypes'); - $validator = Validator::make(Input::all(), $rules); - - if ($validator->fails()) { - return Redirect::to('company/payments') - ->withErrors($validator) - ->withInput(); - } else { - $account = Account::with('account_gateways')->findOrFail(Auth::user()->account_id); - - if ($gatewayId) { - $accountGateway = AccountGateway::createNew(); - $accountGateway->gateway_id = $gatewayId; - $isMasked = false; - - $config = new stdClass(); - foreach ($fields as $field => $details) { - $value = trim(Input::get($gateway->id.'_'.$field)); - - if ($value && $value === str_repeat('*', strlen($value))) { - $isMasked = true; - } - - $config->$field = $value; - } - - $cardCount = 0; - if ($creditcards) { - foreach ($creditcards as $card => $value) { - $cardCount += intval($value); - } - } - - // check if a gateway is already configured - $currentGateway = false; - if (count($account->account_gateways)) { - $currentGateway = $account->account_gateways[0]; - } - - // if the values haven't changed don't update the config - if ($isMasked && $currentGateway) { - $currentGateway->accepted_credit_cards = $cardCount; - $currentGateway->save(); - // if there's an existing config for this gateway update it - } elseif (!$isMasked && $currentGateway && $currentGateway->gateway_id == $gatewayId) { - $currentGateway->accepted_credit_cards = $cardCount; - $currentGateway->config = json_encode($config); - $currentGateway->save(); - // otherwise, create a new gateway config - } else { - $accountGateway->config = json_encode($config); - $accountGateway->accepted_credit_cards = $cardCount; - - $account->account_gateways()->delete(); - $account->account_gateways()->save($accountGateway); - } - - if (Input::get('token_billing_type_id')) { - $account->token_billing_type_id = Input::get('token_billing_type_id'); - $account->save(); - } - - Session::flash('message', trans('texts.updated_settings')); - } else { - Session::flash('error', trans('validation.required', ['attribute' => 'gateway'])); - } - - return Redirect::to('company/payments'); - } - } - private function saveDetails() { $rules = array( diff --git a/app/controllers/AccountGatewayController.php b/app/controllers/AccountGatewayController.php new file mode 100755 index 000000000000..e6f646e4e70a --- /dev/null +++ b/app/controllers/AccountGatewayController.php @@ -0,0 +1,292 @@ +join('gateways', 'gateways.id', '=', 'account_gateways.gateway_id') + ->where('account_gateways.deleted_at', '=', null) + ->where('account_gateways.account_id', '=', \Auth::user()->account_id) + ->select('account_gateways.public_id', 'gateways.name', 'account_gateways.deleted_at'); + + return Datatable::query($query) + ->addColumn('name', function ($model) { return link_to('gateways/'.$model->public_id.'/edit', $model->name); }) + ->addColumn('dropdown', function ($model) { + $actions = '
'; + + return $actions; + }) + ->orderColumns(['name']) + ->make(); + } + + public function edit($publicId) + { + $accountGateway = AccountGateway::scope($publicId)->firstOrFail(); + $config = $accountGateway->config; + $selectedCards = $accountGateway->accepted_credit_cards; + + $configFields = json_decode($config); + + foreach ($configFields as $configField => $value) { + $configFields->$configField = str_repeat('*', strlen($value)); + } + + $data = self::getViewModel($accountGateway); + $data['url'] = 'gateways/'.$publicId; + $data['method'] = 'PUT'; + $data['title'] = trans('texts.edit_gateway') . ' - ' . $accountGateway->gateway->name; + $data['config'] = $configFields; + + return View::make('accounts.account_gateway', $data); + } + + public function update($publicId) + { + return $this->save($publicId); + } + + public function store() + { + return $this->save(); + } + + /** + * Displays the form for account creation + * + */ + public function create() + { + $data = self::getViewModel(); + $data['url'] = 'gateways'; + $data['method'] = 'POST'; + $data['title'] = trans('texts.add_gateway'); + + return View::make('accounts.account_gateway', $data); + } + + private function getViewModel($accountGateway = false) + { + $selectedCards = $accountGateway ? $accountGateway->accepted_credit_cards : 0; + $account = Auth::user()->account; + + $recommendedGateways = Gateway::remember(DEFAULT_QUERY_CACHE) + ->where('recommended', '=', '1') + ->orderBy('sort_order') + ->get(); + $recommendedGatewayArray = array(); + + foreach ($recommendedGateways as $recommendedGateway) { + $arrayItem = array( + 'value' => $recommendedGateway->id, + 'other' => 'false', + 'data-imageUrl' => asset($recommendedGateway->getLogoUrl()), + 'data-siteUrl' => $recommendedGateway->site_url, + ); + $recommendedGatewayArray[$recommendedGateway->name] = $arrayItem; + } + + $creditCardsArray = unserialize(CREDIT_CARDS); + $creditCards = []; + foreach ($creditCardsArray as $card => $name) { + if ($selectedCards > 0 && ($selectedCards & $card) == $card) { + $creditCards[$name['text']] = ['value' => $card, 'data-imageUrl' => asset($name['card']), 'checked' => 'checked']; + } else { + $creditCards[$name['text']] = ['value' => $card, 'data-imageUrl' => asset($name['card'])]; + } + } + + $otherItem = array( + 'value' => 1000000, + 'other' => 'true', + 'data-imageUrl' => '', + 'data-siteUrl' => '', + ); + $recommendedGatewayArray['Other Options'] = $otherItem; + + $account->load('account_gateways'); + $currentGateways = $account->account_gateways; + $gateways = Gateway::where('payment_library_id', '=', 1)->orderBy('name'); + $onlyPayPal = false; + if (!$accountGateway) { + if (count($currentGateways) > 0) { + $currentGateway = $currentGateways[0]; + if ($currentGateway->isPayPal()) { + $gateways->where('id', '!=', GATEWAY_PAYPAL_EXPRESS); + } else { + $gateways->where('id', '=', GATEWAY_PAYPAL_EXPRESS); + $onlyPayPal = true; + } + } + } + $gateways = $gateways->get(); + + foreach ($gateways as $gateway) { + $paymentLibrary = $gateway->paymentlibrary; + $gateway->fields = $gateway->getFields(); + + if ($accountGateway && $accountGateway->gateway_id == $gateway->id) { + $accountGateway->fields = $gateway->fields; + } + } + + $tokenBillingOptions = []; + for ($i=1; $i<=4; $i++) { + $tokenBillingOptions[$i] = trans("texts.token_billing_{$i}"); + } + + return [ + 'account' => $account, + 'accountGateway' => $accountGateway, + 'config' => false, + 'gateways' => $gateways, + 'recommendedGateways' => $recommendedGatewayArray, + 'creditCardTypes' => $creditCards, + 'tokenBillingOptions' => $tokenBillingOptions, + 'showBreadcrumbs' => false, + 'onlyPayPal' => $onlyPayPal, + 'countGateways' => count($currentGateways) + ]; + } + + public function delete() + { + $accountGatewayPublicId = Input::get('accountGatewayPublicId'); + $gateway = AccountGateway::scope($accountGatewayPublicId)->firstOrFail(); + + $gateway->delete(); + + Session::flash('message', trans('texts.deleted_gateway')); + + return Redirect::to('company/payments'); + } + + /** + * Stores new account + * + */ + public function save($accountGatewayPublicId = false) + { + $rules = array(); + $recommendedId = Input::get('recommendedGateway_id'); + + $gatewayId = ($recommendedId == 1000000 ? Input::get('gateway_id') : $recommendedId); + + if (!$gatewayId) { + Session::flash('error', trans('validation.required', ['attribute' => 'gateway'])); + return Redirect::to('gateways/create') + ->withInput(); + } + + $gateway = Gateway::findOrFail($gatewayId); + $paymentLibrary = $gateway->paymentlibrary; + $fields = $gateway->getFields(); + + foreach ($fields as $field => $details) { + if (!in_array($field, ['testMode', 'developerMode', 'headerImageUrl', 'solutionType', 'landingPage', 'brandName', 'logoImageUrl', 'borderColor'])) { + if (strtolower($gateway->name) == 'beanstream') { + if (in_array($field, ['merchant_id', 'passCode'])) { + $rules[$gateway->id.'_'.$field] = 'required'; + } + } else { + $rules[$gateway->id.'_'.$field] = 'required'; + } + } + } + + $creditcards = Input::get('creditCardTypes'); + $validator = Validator::make(Input::all(), $rules); + + if ($validator->fails()) { + return Redirect::to('gateways/create') + ->withErrors($validator) + ->withInput(); + } else { + $account = Account::with('account_gateways')->findOrFail(Auth::user()->account_id); + + if ($accountGatewayPublicId) { + $accountGateway = AccountGateway::scope($accountGatewayPublicId)->firstOrFail(); + } else { + $accountGateway = AccountGateway::createNew(); + $accountGateway->gateway_id = $gatewayId; + } + + $isMasked = false; + + $config = new stdClass(); + foreach ($fields as $field => $details) { + $value = trim(Input::get($gateway->id.'_'.$field)); + + if ($value && $value === str_repeat('*', strlen($value))) { + $isMasked = true; + } + + $config->$field = $value; + } + + $cardCount = 0; + if ($creditcards) { + foreach ($creditcards as $card => $value) { + $cardCount += intval($value); + } + } + + // if the values haven't changed don't update the config + if ($isMasked && $accountGatewayPublicId) { + $accountGateway->accepted_credit_cards = $cardCount; + $accountGateway->save(); + // if there's an existing config for this gateway update it + } elseif (!$isMasked && $accountGatewayPublicId && $accountGateway->gateway_id == $gatewayId) { + $accountGateway->accepted_credit_cards = $cardCount; + $accountGateway->config = json_encode($config); + $accountGateway->save(); + // otherwise, create a new gateway config + } else { + $accountGateway->config = json_encode($config); + $accountGateway->accepted_credit_cards = $cardCount; + $account->account_gateways()->save($accountGateway); + } + + if (Input::get('token_billing_type_id')) { + $account->token_billing_type_id = Input::get('token_billing_type_id'); + $account->save(); + } + + if ($accountGatewayPublicId) { + $message = trans('texts.updated_gateway'); + } else { + $message = trans('texts.created_gateway'); + } + + Session::flash('message', $message); + + return Redirect::to('company/payments'); + } + } + +} \ No newline at end of file diff --git a/app/controllers/InvoiceController.php b/app/controllers/InvoiceController.php index e41dfd98775f..dabbb0c00c10 100755 --- a/app/controllers/InvoiceController.php +++ b/app/controllers/InvoiceController.php @@ -167,8 +167,8 @@ class InvoiceController extends \BaseController $invoice->invoice_date = Utils::fromSqlDate($invoice->invoice_date); $invoice->due_date = Utils::fromSqlDate($invoice->due_date); - $invoice->is_pro = $client->account->isPro(); - + $invoice->is_pro = $client->account->isPro(); + $contact = $invitation->contact; $contact->setVisible([ 'first_name', @@ -184,7 +184,8 @@ class InvoiceController extends \BaseController 'invitation' => $invitation, 'invoiceLabels' => $client->account->getInvoiceLabels(), 'contact' => $contact, - 'hasToken' => $client->getGatewayToken() + 'hasToken' => $client->getGatewayToken(), + 'countGateways' => AccountGateway::scope()->count(), ); return View::make('invoices.view', $data); diff --git a/app/controllers/PaymentController.php b/app/controllers/PaymentController.php index f94a93a3fcf6..af651e117c3e 100755 --- a/app/controllers/PaymentController.php +++ b/app/controllers/PaymentController.php @@ -226,7 +226,7 @@ class PaymentController extends \BaseController private function getPaymentDetails($invoice, $input = null) { $key = $invoice->invoice_number.'_details'; - $gateway = $invoice->client->account->account_gateways[0]->gateway; + $gateway = $invoice->client->account->getGatewayByType(Session::get('payment_type'))->gateway; $paymentLibrary = $gateway->paymentlibrary; $currencyCode = $invoice->client->currency ? $invoice->client->currency->code : ($invoice->account->currency ? $invoice->account->currency->code : 'USD'); @@ -301,10 +301,25 @@ class PaymentController extends \BaseController if (Input::get('use_token') == 'true') { return self::do_payment($invitationKey, false, true); } - // For PayPal Express we redirect straight to their site - $invitation = Invitation::with('invoice.client.account', 'invoice.client.account.account_gateways.gateway')->where('invitation_key', '=', $invitationKey)->firstOrFail(); - $account = $invitation->invoice->client->account; - if ($account->isGatewayConfigured(GATEWAY_PAYPAL_EXPRESS)) { + + if (Input::has('use_paypal')) { + Session::put('payment_type', Input::get('use_paypal') == 'true' ? PAYMENT_TYPE_PAYPAL : PAYMENT_TYPE_CREDIT_CARD); + } elseif (!Session::has('payment_type')) { + Session::put('payment_type', PAYMENT_TYPE_ANY); + } + + // For PayPal we redirect straight to their site + $usePayPal = false; + if ($usePayPal = Input::get('use_paypal')) { + $usePayPal = $usePayPal == 'true'; + } else { + $invitation = Invitation::with('invoice.client.account', 'invoice.client.account.account_gateways.gateway')->where('invitation_key', '=', $invitationKey)->firstOrFail(); + $account = $invitation->invoice->client->account; + if (count($account->account_gateways) == 1 && $account->getGatewayByType(PAYMENT_TYPE_PAYPAL)) { + $usePayPal = true; + } + } + if ($usePayPal) { if (Session::has('error')) { Session::reflash(); return Redirect::to('view/'.$invitationKey); @@ -316,8 +331,8 @@ class PaymentController extends \BaseController $invitation = Invitation::with('invoice.invoice_items', 'invoice.client.currency', 'invoice.client.account.account_gateways.gateway')->where('invitation_key', '=', $invitationKey)->firstOrFail(); $invoice = $invitation->invoice; $client = $invoice->client; - $accountGateway = $invoice->client->account->account_gateways[0]; - $gateway = $invoice->client->account->account_gateways[0]->gateway; + $accountGateway = $invoice->client->account->getGatewayByType(Session::get('payment_type')); + $gateway = $invoice->client->account->getGatewayByType(Session::get('payment_type'))->gateway; $paymentLibrary = $gateway->paymentlibrary; $acceptedCreditCardTypes = $accountGateway->getCreditcardTypes(); @@ -363,7 +378,7 @@ class PaymentController extends \BaseController $account = $this->accountRepo->getNinjaAccount(); $account->load('account_gateways.gateway'); - $accountGateway = $account->account_gateways[0]; + $accountGateway = $account->getGatewayByType(Session::get('payment_type')); $gateway = $accountGateway->gateway; $paymentLibrary = $gateway->paymentlibrary; $acceptedCreditCardTypes = $accountGateway->getCreditcardTypes(); @@ -415,7 +430,7 @@ class PaymentController extends \BaseController $account = $this->accountRepo->getNinjaAccount(); $account->load('account_gateways.gateway'); - $accountGateway = $account->account_gateways[0]; + $accountGateway = $account->getGatewayByType(PAYMENT_TYPE_CREDIT_CARD); try { $affiliate = Affiliate::find(Session::get('affiliate_id')); @@ -527,7 +542,7 @@ class PaymentController extends \BaseController $invoice = $invitation->invoice; $client = $invoice->client; $account = $client->account; - $accountGateway = $account->account_gateways[0]; + $accountGateway = $account->getGatewayByType(Session::get('payment_type')); $paymentLibrary = $accountGateway->gateway->paymentlibrary; if ($onSite) { @@ -542,7 +557,7 @@ class PaymentController extends \BaseController try { if ($paymentLibrary->id == PAYMENT_LIBRARY_OMNIPAY) { $gateway = self::createGateway($accountGateway); - $details = self::getPaymentDetails($invoice, $useToken ? false : Input::all()); + $details = self::getPaymentDetails($invoice, $useToken || !$onSite ? false : Input::all()); if ($accountGateway->gateway_id == GATEWAY_STRIPE) { if ($useToken) { @@ -572,10 +587,14 @@ class PaymentController extends \BaseController $ref = $response->getTransactionReference(); if (!$ref) { + Session::flash('error', $response->getMessage()); - return Redirect::to('payment/'.$invitationKey) - ->withInput(); + if ($onSite) { + return Redirect::to('payment/'.$invitationKey)->withInput(); + } else { + return Redirect::to('view/'.$invitationKey); + } } if ($response->isSuccessful()) { @@ -587,64 +606,31 @@ class PaymentController extends \BaseController $invitation->transaction_reference = $ref; $invitation->save(); + Session::save(); $response->redirect(); } else { Session::flash('error', $response->getMessage()); return Utils::fatalError('Sorry, there was an error processing your payment. Please try again later. +', $response->getMessage()); } - } elseif ($paymentLibrary->id == PAYMENT_LIBRARY_PHP_PAYMENTS) { - $gateway = $accountGateway->gateway; - $provider = $gateway->provider; - $p = new PHP_Payments(array('mode' => 'test')); - - $config = Payment_Utility::load('config', 'drivers/'.$provider); - - switch ($gateway->id) { - case GATEWAY_BEANSTREAM: - $config['delay_charge'] = false; - $config['bill_outstanding'] = true; - break; - case GATEWAY_AMAZON: - $config['return_url'] = URL::to('complete'); - $config['abandon_url'] = URL::to('/'); - $config['immediate_return'] = 0; - $config['process_immediate'] = 1; - $config['ipn_url'] = URL::to('ipn'); - $config['collect_shipping_address'] = false; - break; - } - - $details = self::getPaymentDetails($invoice, Input::all()); - - $response = $p->oneoff_payment($provider, $details, $config); - - if (strtolower($response->status) == 'success') { - $payment = self::createPayment($invitation, $response->response_message); - - Session::flash('message', trans('texts.applied_payment')); - - return Redirect::to('view/'.$payment->invitation->invitation_key); - } else { - Session::flash('error', $response->response_message); - - return Utils::fatalError('Sorry, there was an error processing your payment. Please try again later.
', $response->response_message); - } } } catch (\Exception $e) { $errorMessage = trans('texts.payment_error'); Session::flash('error', $errorMessage."
".$e->getMessage()); Utils::logError(Utils::getErrorString($e)); - return Redirect::to('payment/'.$invitationKey) - ->withInput(); + if ($onSite) { + return Redirect::to('payment/'.$invitationKey)->withInput(); + } else { + return Redirect::to('view/'.$invitationKey); + } } } private function createPayment($invitation, $ref, $payerId = null) { $invoice = $invitation->invoice; - $accountGateway = $invoice->client->account->account_gateways[0]; + $accountGateway = $invoice->client->account->getGatewayByType(Session::get('payment_type')); if ($invoice->account->account_key == NINJA_ACCOUNT_KEY) { $account = Account::find($invoice->client->public_id); @@ -681,7 +667,7 @@ class PaymentController extends \BaseController $invitation = Invitation::with('invoice.client.currency', 'invoice.client.account.account_gateways.gateway')->where('transaction_reference', '=', $token)->firstOrFail(); $invoice = $invitation->invoice; - $accountGateway = $invoice->client->account->account_gateways[0]; + $accountGateway = $invoice->client->account->getGatewayByType(Session::get('payment_type')); $gateway = self::createGateway($accountGateway); try { diff --git a/app/controllers/UserController.php b/app/controllers/UserController.php index 931eae529052..85fff4f86da3 100755 --- a/app/controllers/UserController.php +++ b/app/controllers/UserController.php @@ -478,4 +478,30 @@ class UserController extends BaseController return Redirect::to('/')->with('clearGuestKey', true); } + + public function changePassword() + { + // check the current password is correct + if (!Auth::validate([ + 'email' => Auth::user()->email, + 'password' => Input::get('current_password') + ])) { + return trans('texts.password_error_incorrect'); + } + + // validate the new password + $password = Input::get('new_password'); + $confirm = Input::get('confirm_password'); + + if (strlen($password) < 6 || $password != $confirm) { + return trans('texts.password_error_invalid'); + } + + // save the new password + $user = Auth::user(); + $user->password = $password; + $user->save(); + + return RESULT_SUCCESS; + } } diff --git a/app/filters.php b/app/filters.php index db20fa951eb8..8dddcf16f908 100755 --- a/app/filters.php +++ b/app/filters.php @@ -184,8 +184,13 @@ Route::filter('api.access', function() Auth::loginUsingId($token->user_id); Session::set('token_id', $token->id); } else { + sleep(3); return Response::make('Invalid token', 403, $headers); } + + if (!Utils::isNinja()) { + return null; + } if (!Utils::isPro()) { return Response::make('API requires pro plan', 403, $headers); diff --git a/app/lang/da/texts.php b/app/lang/da/texts.php index c9bb24e2dbf7..5f6f867cc4ab 100644 --- a/app/lang/da/texts.php +++ b/app/lang/da/texts.php @@ -466,7 +466,7 @@ return array( 'payment_title' => 'Enter Your Billing Address and Credit Card information', 'payment_cvv' => '*This is the 3-4 digit number onthe back of your card', - 'payment_footer1' => '*Billing address must match address accociated with credit card.', + 'payment_footer1' => '*Billing address must match address associated with credit card.', 'payment_footer2' => '*Please click "PAY NOW" only once - transaction may take up to 1 minute to process.', 'id_number' => 'ID Number', @@ -532,7 +532,7 @@ return array( 'billing_address' => 'Billing address', 'billing_method' => 'Billing method', 'order_overview' => 'Order overview', - 'match_address' => '*Address must match address accociated with credit card.', + 'match_address' => '*Address must match address associated with credit card.', 'click_once' => '*Please click "PAY NOW" only once - transaction may take up to 1 minute to process.', 'default_invoice_footer' => 'Set default invoice footer', @@ -549,6 +549,23 @@ return array( 'edit_token' => 'Edit Token', 'delete_token' => 'Delete Token', 'token' => 'Token', + + 'add_gateway' => 'Add Gateway', + 'delete_gateway' => 'Delete Gateway', + 'edit_gateway' => 'Edit Gateway', + 'updated_gateway' => 'Successfully updated gateway', + 'created_gateway' => 'Successfully created gateway', + 'deleted_gateway' => 'Successfully deleted gateway', + 'pay_with_paypal' => 'PayPal', + 'pay_with_card' => 'Credit card', + + 'change_password' => 'Change password', + 'current_password' => 'Current password', + 'new_password' => 'New password', + 'confirm_password' => 'Confirm password', + 'password_error_incorrect' => 'The current password is incorrect.', + 'password_error_invalid' => 'The new password is invalid.', + 'updated_password' => 'Successfully updated password', ); diff --git a/app/lang/de/texts.php b/app/lang/de/texts.php index 3a237817ddcf..9d3829fda9ad 100644 --- a/app/lang/de/texts.php +++ b/app/lang/de/texts.php @@ -539,6 +539,23 @@ return array( 'edit_token' => 'Token bearbeiten', 'delete_token' => 'Token löschen', 'token' => 'Token', + + 'add_gateway' => 'Add Gateway', + 'delete_gateway' => 'Delete Gateway', + 'edit_gateway' => 'Edit Gateway', + 'updated_gateway' => 'Successfully updated gateway', + 'created_gateway' => 'Successfully created gateway', + 'deleted_gateway' => 'Successfully deleted gateway', + 'pay_with_paypal' => 'PayPal', + 'pay_with_card' => 'Credit card', + + 'change_password' => 'Change password', + 'current_password' => 'Current password', + 'new_password' => 'New password', + 'confirm_password' => 'Confirm password', + 'password_error_incorrect' => 'The current password is incorrect.', + 'password_error_invalid' => 'The new password is invalid.', + 'updated_password' => 'Successfully updated password', ); diff --git a/app/lang/en/texts.php b/app/lang/en/texts.php index f15f14e5e85c..7d06c89a6f4e 100644 --- a/app/lang/en/texts.php +++ b/app/lang/en/texts.php @@ -464,7 +464,7 @@ return array( 'payment_title' => 'Enter Your Billing Address and Credit Card information', 'payment_cvv' => '*This is the 3-4 digit number onthe back of your card', - 'payment_footer1' => '*Billing address must match address accociated with credit card.', + 'payment_footer1' => '*Billing address must match address associated with credit card.', 'payment_footer2' => '*Please click "PAY NOW" only once - transaction may take up to 1 minute to process.', 'id_number' => 'ID Number', @@ -530,7 +530,7 @@ return array( 'billing_address' => 'Billing address', 'billing_method' => 'Billing method', 'order_overview' => 'Order overview', - 'match_address' => '*Address must match address accociated with credit card.', + 'match_address' => '*Address must match address associated with credit card.', 'click_once' => '*Please click "PAY NOW" only once - transaction may take up to 1 minute to process.', 'default_invoice_footer' => 'Set default invoice footer', @@ -548,4 +548,21 @@ return array( 'delete_token' => 'Delete Token', 'token' => 'Token', + 'add_gateway' => 'Add Gateway', + 'delete_gateway' => 'Delete Gateway', + 'edit_gateway' => 'Edit Gateway', + 'updated_gateway' => 'Successfully updated gateway', + 'created_gateway' => 'Successfully created gateway', + 'deleted_gateway' => 'Successfully deleted gateway', + 'pay_with_paypal' => 'PayPal', + 'pay_with_card' => 'Credit card', + + 'change_password' => 'Change password', + 'current_password' => 'Current password', + 'new_password' => 'New password', + 'confirm_password' => 'Confirm password', + 'password_error_incorrect' => 'The current password is incorrect.', + 'password_error_invalid' => 'The new password is invalid.', + 'updated_password' => 'Successfully updated password', + ); diff --git a/app/lang/es/texts.php b/app/lang/es/texts.php index 76aac6f70da1..f400c21b21bd 100644 --- a/app/lang/es/texts.php +++ b/app/lang/es/texts.php @@ -435,7 +435,7 @@ return array( 'payment_title' => 'Enter Your Billing Address and Credit Card information', 'payment_cvv' => '*This is the 3-4 digit number onthe back of your card', - 'payment_footer1' => '*Billing address must match address accociated with credit card.', + 'payment_footer1' => '*Billing address must match address associated with credit card.', 'payment_footer2' => '*Please click "PAY NOW" only once - transaction may take up to 1 minute to process.', 'vat_number' => 'Vat Number', @@ -502,7 +502,7 @@ return array( 'billing_address' => 'Billing address', 'billing_method' => 'Billing method', 'order_overview' => 'Order overview', - 'match_address' => '*Address must match address accociated with credit card.', + 'match_address' => '*Address must match address associated with credit card.', 'click_once' => '*Please click "PAY NOW" only once - transaction may take up to 1 minute to process.', 'default_invoice_footer' => 'Set default invoice footer', @@ -520,4 +520,22 @@ return array( 'delete_token' => 'Delete Token', 'token' => 'Token', + 'add_gateway' => 'Add Gateway', + 'delete_gateway' => 'Delete Gateway', + 'edit_gateway' => 'Edit Gateway', + 'updated_gateway' => 'Successfully updated gateway', + 'created_gateway' => 'Successfully created gateway', + 'deleted_gateway' => 'Successfully deleted gateway', + 'pay_with_paypal' => 'PayPal', + 'pay_with_card' => 'Credit card', + + 'change_password' => 'Change password', + 'current_password' => 'Current password', + 'new_password' => 'New password', + 'confirm_password' => 'Confirm password', + 'password_error_incorrect' => 'The current password is incorrect.', + 'password_error_invalid' => 'The new password is invalid.', + 'updated_password' => 'Successfully updated password', + + ); \ No newline at end of file diff --git a/app/lang/fr/texts.php b/app/lang/fr/texts.php index 3ca233cf043c..36ca7b9c7311 100644 --- a/app/lang/fr/texts.php +++ b/app/lang/fr/texts.php @@ -456,7 +456,7 @@ return array( 'payment_title' => 'Enter Your Billing Address and Credit Card information', 'payment_cvv' => '*This is the 3-4 digit number onthe back of your card', - 'payment_footer1' => '*Billing address must match address accociated with credit card.', + 'payment_footer1' => '*Billing address must match address associated with credit card.', 'payment_footer2' => '*Please click "PAY NOW" only once - transaction may take up to 1 minute to process.', 'vat_number' => 'Numéro de TVA', @@ -523,7 +523,7 @@ return array( 'billing_address' => 'Billing address', 'billing_method' => 'Billing method', 'order_overview' => 'Order overview', - 'match_address' => '*Address must match address accociated with credit card.', + 'match_address' => '*Address must match address associated with credit card.', 'click_once' => '*Please click "PAY NOW" only once - transaction may take up to 1 minute to process.', 'default_invoice_footer' => 'Set default invoice footer', @@ -541,4 +541,22 @@ return array( 'delete_token' => 'Delete Token', 'token' => 'Token', + 'add_gateway' => 'Add Gateway', + 'delete_gateway' => 'Delete Gateway', + 'edit_gateway' => 'Edit Gateway', + 'updated_gateway' => 'Successfully updated gateway', + 'created_gateway' => 'Successfully created gateway', + 'deleted_gateway' => 'Successfully deleted gateway', + 'pay_with_paypal' => 'PayPal', + 'pay_with_card' => 'Credit card', + + 'change_password' => 'Change password', + 'current_password' => 'Current password', + 'new_password' => 'New password', + 'confirm_password' => 'Confirm password', + 'password_error_incorrect' => 'The current password is incorrect.', + 'password_error_invalid' => 'The new password is invalid.', + 'updated_password' => 'Successfully updated password', + + ); \ No newline at end of file diff --git a/app/lang/it/texts.php b/app/lang/it/texts.php index 7fa241629f23..b3772a45764d 100644 --- a/app/lang/it/texts.php +++ b/app/lang/it/texts.php @@ -457,7 +457,7 @@ return array( 'payment_title' => 'Enter Your Billing Address and Credit Card information', 'payment_cvv' => '*This is the 3-4 digit number onthe back of your card', - 'payment_footer1' => '*Billing address must match address accociated with credit card.', + 'payment_footer1' => '*Billing address must match address associated with credit card.', 'payment_footer2' => '*Please click "PAY NOW" only once - transaction may take up to 1 minute to process.', 'vat_number' => 'Vat Number', 'id_number' => 'ID Number', @@ -525,7 +525,7 @@ return array( 'billing_address' => 'Billing address', 'billing_method' => 'Billing method', 'order_overview' => 'Order overview', - 'match_address' => '*Address must match address accociated with credit card.', + 'match_address' => '*Address must match address associated with credit card.', 'click_once' => '*Please click "PAY NOW" only once - transaction may take up to 1 minute to process.', 'default_invoice_footer' => 'Set default invoice footer', @@ -542,5 +542,23 @@ return array( 'edit_token' => 'Edit Token', 'delete_token' => 'Delete Token', 'token' => 'Token', + + 'add_gateway' => 'Add Gateway', + 'delete_gateway' => 'Delete Gateway', + 'edit_gateway' => 'Edit Gateway', + 'updated_gateway' => 'Successfully updated gateway', + 'created_gateway' => 'Successfully created gateway', + 'deleted_gateway' => 'Successfully deleted gateway', + 'pay_with_paypal' => 'PayPal', + 'pay_with_card' => 'Credit card', + + 'change_password' => 'Change password', + 'current_password' => 'Current password', + 'new_password' => 'New password', + 'confirm_password' => 'Confirm password', + 'password_error_incorrect' => 'The current password is incorrect.', + 'password_error_invalid' => 'The new password is invalid.', + 'updated_password' => 'Successfully updated password', + ); diff --git a/app/lang/lt/texts.php b/app/lang/lt/texts.php index d0985358a938..d144838b8ddd 100644 --- a/app/lang/lt/texts.php +++ b/app/lang/lt/texts.php @@ -466,7 +466,7 @@ return array( 'payment_title' => 'Enter Your Billing Address and Credit Card information', 'payment_cvv' => '*This is the 3-4 digit number onthe back of your card', - 'payment_footer1' => '*Billing address must match address accociated with credit card.', + 'payment_footer1' => '*Billing address must match address associated with credit card.', 'payment_footer2' => '*Please click "PAY NOW" only once - transaction may take up to 1 minute to process.', 'vat_number' => 'Vat Number', 'id_number' => 'ID Number', @@ -533,7 +533,7 @@ return array( 'billing_address' => 'Billing address', 'billing_method' => 'Billing method', 'order_overview' => 'Order overview', - 'match_address' => '*Address must match address accociated with credit card.', + 'match_address' => '*Address must match address associated with credit card.', 'click_once' => '*Please click "PAY NOW" only once - transaction may take up to 1 minute to process.', 'default_invoice_footer' => 'Set default invoice footer', @@ -550,6 +550,24 @@ return array( 'edit_token' => 'Edit Token', 'delete_token' => 'Delete Token', 'token' => 'Token', + + 'add_gateway' => 'Add Gateway', + 'delete_gateway' => 'Delete Gateway', + 'edit_gateway' => 'Edit Gateway', + 'updated_gateway' => 'Successfully updated gateway', + 'created_gateway' => 'Successfully created gateway', + 'deleted_gateway' => 'Successfully deleted gateway', + 'pay_with_paypal' => 'PayPal', + 'pay_with_card' => 'Credit card', + + 'change_password' => 'Change password', + 'current_password' => 'Current password', + 'new_password' => 'New password', + 'confirm_password' => 'Confirm password', + 'password_error_incorrect' => 'The current password is incorrect.', + 'password_error_invalid' => 'The new password is invalid.', + 'updated_password' => 'Successfully updated password', + ); diff --git a/app/lang/nb_NO/texts.php b/app/lang/nb_NO/texts.php index 25a3109460db..e1efa117ccae 100644 --- a/app/lang/nb_NO/texts.php +++ b/app/lang/nb_NO/texts.php @@ -464,7 +464,7 @@ return array( 'payment_title' => 'Enter Your Billing Address and Credit Card information', 'payment_cvv' => '*This is the 3-4 digit number onthe back of your card', - 'payment_footer1' => '*Billing address must match address accociated with credit card.', + 'payment_footer1' => '*Billing address must match address associated with credit card.', 'payment_footer2' => '*Please click "PAY NOW" only once - transaction may take up to 1 minute to process.', 'vat_number' => 'Vat Number', 'id_number' => 'ID Number', @@ -531,7 +531,7 @@ return array( 'billing_address' => 'Billing address', 'billing_method' => 'Billing method', 'order_overview' => 'Order overview', - 'match_address' => '*Address must match address accociated with credit card.', + 'match_address' => '*Address must match address associated with credit card.', 'click_once' => '*Please click "PAY NOW" only once - transaction may take up to 1 minute to process.', 'default_invoice_footer' => 'Set default invoice footer', @@ -549,5 +549,22 @@ return array( 'delete_token' => 'Delete Token', 'token' => 'Token', + 'add_gateway' => 'Add Gateway', + 'delete_gateway' => 'Delete Gateway', + 'edit_gateway' => 'Edit Gateway', + 'updated_gateway' => 'Successfully updated gateway', + 'created_gateway' => 'Successfully created gateway', + 'deleted_gateway' => 'Successfully deleted gateway', + 'pay_with_paypal' => 'PayPal', + 'pay_with_card' => 'Credit card', + + 'change_password' => 'Change password', + 'current_password' => 'Current password', + 'new_password' => 'New password', + 'confirm_password' => 'Confirm password', + 'password_error_incorrect' => 'The current password is incorrect.', + 'password_error_invalid' => 'The new password is invalid.', + 'updated_password' => 'Successfully updated password', + ); \ No newline at end of file diff --git a/app/lang/nl/texts.php b/app/lang/nl/texts.php index e9f4e7d5abc8..d4d233db6248 100644 --- a/app/lang/nl/texts.php +++ b/app/lang/nl/texts.php @@ -458,7 +458,7 @@ return array( 'payment_title' => 'Enter Your Billing Address and Credit Card information', 'payment_cvv' => '*This is the 3-4 digit number onthe back of your card', - 'payment_footer1' => '*Billing address must match address accociated with credit card.', + 'payment_footer1' => '*Billing address must match address associated with credit card.', 'payment_footer2' => '*Please click "PAY NOW" only once - transaction may take up to 1 minute to process.', 'vat_number' => 'Vat Number', 'id_number' => 'ID Number', @@ -526,7 +526,7 @@ return array( 'billing_address' => 'Billing address', 'billing_method' => 'Billing method', 'order_overview' => 'Order overview', - 'match_address' => '*Address must match address accociated with credit card.', + 'match_address' => '*Address must match address associated with credit card.', 'click_once' => '*Please click "PAY NOW" only once - transaction may take up to 1 minute to process.', 'default_invoice_footer' => 'Set default invoice footer', @@ -543,6 +543,24 @@ return array( 'edit_token' => 'Edit Token', 'delete_token' => 'Delete Token', 'token' => 'Token', - + + 'add_gateway' => 'Add Gateway', + 'delete_gateway' => 'Delete Gateway', + 'edit_gateway' => 'Edit Gateway', + 'updated_gateway' => 'Successfully updated gateway', + 'created_gateway' => 'Successfully created gateway', + 'deleted_gateway' => 'Successfully deleted gateway', + 'pay_with_paypal' => 'PayPal', + 'pay_with_card' => 'Credit card', + + 'change_password' => 'Change password', + 'current_password' => 'Current password', + 'new_password' => 'New password', + 'confirm_password' => 'Confirm password', + 'password_error_incorrect' => 'The current password is incorrect.', + 'password_error_invalid' => 'The new password is invalid.', + 'updated_password' => 'Successfully updated password', + + ); \ No newline at end of file diff --git a/app/lang/pt_BR/texts.php b/app/lang/pt_BR/texts.php index 079721e4d925..9fcd74d41adc 100644 --- a/app/lang/pt_BR/texts.php +++ b/app/lang/pt_BR/texts.php @@ -446,7 +446,7 @@ return array( 'payment_title' => 'Enter Your Billing Address and Credit Card information', 'payment_cvv' => '*This is the 3-4 digit number onthe back of your card', - 'payment_footer1' => '*Billing address must match address accociated with credit card.', + 'payment_footer1' => '*Billing address must match address associated with credit card.', 'payment_footer2' => '*Please click "PAY NOW" only once - transaction may take up to 1 minute to process.', 'vat_number' => 'Vat Number', 'id_number' => 'ID Number', @@ -513,7 +513,7 @@ return array( 'billing_address' => 'Billing address', 'billing_method' => 'Billing method', 'order_overview' => 'Order overview', - 'match_address' => '*Address must match address accociated with credit card.', + 'match_address' => '*Address must match address associated with credit card.', 'click_once' => '*Please click "PAY NOW" only once - transaction may take up to 1 minute to process.', 'default_invoice_footer' => 'Set default invoice footer', @@ -531,5 +531,23 @@ return array( 'delete_token' => 'Delete Token', 'token' => 'Token', + 'add_gateway' => 'Add Gateway', + 'delete_gateway' => 'Delete Gateway', + 'edit_gateway' => 'Edit Gateway', + 'updated_gateway' => 'Successfully updated gateway', + 'created_gateway' => 'Successfully created gateway', + 'deleted_gateway' => 'Successfully deleted gateway', + 'pay_with_paypal' => 'PayPal', + 'pay_with_card' => 'Credit card', + + + 'change_password' => 'Change password', + 'current_password' => 'Current password', + 'new_password' => 'New password', + 'confirm_password' => 'Confirm password', + 'password_error_incorrect' => 'The current password is incorrect.', + 'password_error_invalid' => 'The new password is invalid.', + 'updated_password' => 'Successfully updated password', + ); diff --git a/app/models/Account.php b/app/models/Account.php index caaa03c12689..bbe026266a64 100755 --- a/app/models/Account.php +++ b/app/models/Account.php @@ -96,6 +96,21 @@ class Account extends Eloquent } } + public function getGatewayByType($type = PAYMENT_TYPE_ANY) + { + foreach ($this->account_gateways as $gateway) { + if ($type == PAYMENT_TYPE_ANY) { + return $gateway; + } elseif ($gateway->isPayPal() && $type == PAYMENT_TYPE_PAYPAL) { + return $gateway; + } elseif (!$gateway->isPayPal() && $type == PAYMENT_TYPE_CREDIT_CARD) { + return $gateway; + } + } + + return false; + } + public function getGatewayConfig($gatewayId) { foreach ($this->account_gateways as $gateway) { diff --git a/app/models/AccountGateway.php b/app/models/AccountGateway.php index 39ebd7a8be3b..002bc830795e 100755 --- a/app/models/AccountGateway.php +++ b/app/models/AccountGateway.php @@ -20,4 +20,9 @@ class AccountGateway extends EntityModel return $arrayOfImages; } + + public function isPayPal() { + return $this->gateway_id == GATEWAY_PAYPAL_EXPRESS; + } } + diff --git a/app/models/Client.php b/app/models/Client.php index 70d0c7a3b7df..df723de8fc77 100755 --- a/app/models/Client.php +++ b/app/models/Client.php @@ -229,9 +229,9 @@ class Client extends EntityModel return false; } - $accountGateway = $this->account->account_gateways[0]; + $accountGateway = $this->account->getGatewayConfig(GATEWAY_STRIPE); - if ($accountGateway->gateway_id != GATEWAY_STRIPE) { + if (!$accountGateway) { return false; } diff --git a/app/routes.php b/app/routes.php index 377407cc6ec0..fc436e177b86 100755 --- a/app/routes.php +++ b/app/routes.php @@ -81,6 +81,7 @@ Route::group(array('before' => 'auth'), function() { Route::post('users/delete', 'UserController@delete'); Route::get('send_confirmation/{user_id}', 'UserController@sendConfirmation'); Route::get('restore_user/{user_id}', 'UserController@restoreUser'); + Route::post('users/change_password', 'UserController@changePassword'); Route::get('api/tokens', array('as'=>'api.tokens', 'uses'=>'TokenController@getDatatable')); Route::resource('tokens', 'TokenController'); @@ -102,6 +103,10 @@ Route::group(array('before' => 'auth'), function() { Route::post('remove_logo', 'AccountController@removeLogo'); Route::post('account/go_pro', 'AccountController@enableProPlan'); + Route::resource('gateways', 'AccountGatewayController'); + Route::get('api/gateways', array('as'=>'api.gateways', 'uses'=>'AccountGatewayController@getDatatable')); + Route::post('gateways/delete', 'AccountGatewayController@delete'); + Route::resource('clients', 'ClientController'); Route::get('api/clients', array('as'=>'api.clients', 'uses'=>'ClientController@getDatatable')); Route::get('api/activities/{client_id?}', array('as'=>'api.activities', 'uses'=>'ActivityController@getDatatable')); @@ -277,6 +282,7 @@ define('PAYMENT_LIBRARY_PHP_PAYMENTS', 2); define('GATEWAY_AUTHORIZE_NET', 1); define('GATEWAY_AUTHORIZE_NET_SIM', 2); define('GATEWAY_PAYPAL_EXPRESS', 17); +define('GATEWAY_PAYPAL_PRO', 18); define('GATEWAY_STRIPE', 23); define('GATEWAY_TWO_CHECKOUT', 27); define('GATEWAY_BEANSTREAM', 29); @@ -322,6 +328,10 @@ define('TOKEN_BILLING_OPT_IN', 2); define('TOKEN_BILLING_OPT_OUT', 3); define('TOKEN_BILLING_ALWAYS', 4); +define('PAYMENT_TYPE_PAYPAL', 'PAYMENT_TYPE_PAYPAL'); +define('PAYMENT_TYPE_CREDIT_CARD', 'PAYMENT_TYPE_CREDIT_CARD'); +define('PAYMENT_TYPE_ANY', 'PAYMENT_TYPE_ANY'); + /* define('GATEWAY_AMAZON', 30); define('GATEWAY_BLUEPAY', 31); @@ -347,7 +357,7 @@ define('CREDIT_CARDS', serialize($creditCards)); HTML::macro('nav_link', function($url, $text, $url2 = '', $extra = '') { - $class = ( Request::is($url) || Request::is($url.'/*') || Request::is($url2) ) ? ' class="active"' : ''; + $class = ( Request::is($url) || Request::is($url.'/*') || Request::is($url2.'/*') ) ? ' class="active"' : ''; $title = ucwords(trans("texts.$text")) . Utils::getProLabel($text); return '
diff --git a/app/views/accounts/payments.blade.php b/app/views/accounts/payments.blade.php index a47ba1ce2cab..abb07a11c787 100755 --- a/app/views/accounts/payments.blade.php +++ b/app/views/accounts/payments.blade.php @@ -3,146 +3,58 @@ @section('content') @parent - {{ Former::open()->rule()->addClass('col-md-8 col-md-offset-2 warn-on-exit') }} - {{ Former::populate($account) }} + {{ Former::open('gateways/delete')->addClass('user-form') }} + {{ Former::legend('online_payments') }} - {{ Former::legend('Payment Gateway') }} - - @if ($accountGateway) - {{ Former::populateField('gateway_id', $accountGateway->gateway_id) }} - {{ Former::populateField('recommendedGateway_id', $accountGateway->gateway_id) }} - @if ($config) - @foreach ($accountGateway->fields as $field => $junk) - @if (in_array($field, ['solutionType', 'landingPage', 'headerImageUrl', 'brandName'])) - {{-- do nothing --}} - @elseif (isset($config->$field)) - {{ Former::populateField($accountGateway->gateway_id.'_'.$field, $config->$field) }} - @endif - @endforeach - @endif - @endif - -