@if ($accountGateway)
{!! Former::populateField('gateway_id', $accountGateway->gateway_id) !!}
{!! Former::populateField('payment_type_id', $paymentTypeId) !!}
{!! Former::populateField('recommendedGateway_id', $accountGateway->gateway_id) !!}
{!! Former::populateField('show_address', intval($accountGateway->show_address)) !!}
{!! Former::populateField('update_address', intval($accountGateway->update_address)) !!}
{!! Former::populateField('publishable_key', $accountGateway->getPublishableStripeKey() ? str_repeat('*', strlen($accountGateway->getPublishableStripeKey())) : '') !!}
{!! Former::populateField('enable_ach', $accountGateway->getAchEnabled() ? '1' : null) !!}
{!! Former::populateField('plaid_client_id', $accountGateway->getPlaidClientId() ? str_repeat('*', strlen($accountGateway->getPlaidClientId())) : '') !!}
{!! Former::populateField('plaid_secret', $accountGateway->getPlaidSecret() ? str_repeat('*', strlen($accountGateway->getPlaidSecret())) : '') !!}
{!! Former::populateField('plaid_public_key', $accountGateway->getPlaidPublicKey() ? str_repeat('*', strlen($accountGateway->getPlaidPublicKey())) : '') !!}
@if ($config)
@foreach ($accountGateway->fields as $field => $junk)
@if (in_array($field, $hiddenFields))
{{-- do nothing --}}
@elseif (isset($config->$field))
{{ Former::populateField($accountGateway->gateway_id.'_'.$field, $config->$field) }}
@endif
@endforeach
@endif
@else
{!! Former::populateField('gateway_id', GATEWAY_STRIPE) !!}
{!! Former::populateField('show_address', 1) !!}
{!! Former::populateField('update_address', 1) !!}
@endif
{!! Former::select('payment_type_id')
->options($paymentTypes)
->addGroupClass('payment-type-option')
->onchange('setPaymentType()') !!}
{!! Former::select('gateway_id')
->dataClass('gateway-dropdown')
->addGroupClass('gateway-option gateway-choice')
->fromQuery($selectGateways, 'name', 'id')
->onchange('setFieldsShown()') !!}
@foreach ($gateways as $gateway)
@if ($gateway->getHelp())
@endif
@foreach ($gateway->fields as $field => $details)
@if ($details && !$accountGateway && !is_array($details))
{!! Former::populateField($gateway->id.'_'.$field, $details) !!}
@endif
@if (in_array($field, $hiddenFields))
{{-- do nothing --}}
@elseif ($gateway->id == GATEWAY_DWOLLA && ($field == 'key' || $field == 'secret')
&& isset($_ENV['DWOLLA_KEY']) && isset($_ENV['DWOLLA_SECRET']))
{{-- do nothing --}}
@elseif ($field == 'testMode' || $field == 'developerMode' || $field == 'sandbox')
{!! Former::checkbox($gateway->id.'_'.$field)->label(ucwords(Utils::toSpaceCase($field)))->text('Enable')->value('true') !!}
@elseif ($field == 'username' || $field == 'password')
{!! Former::text($gateway->id.'_'.$field)->label('API '. ucfirst(Utils::toSpaceCase($field))) !!}
@else
{!! Former::text($gateway->id.'_'.$field)->label($gateway->id == GATEWAY_STRIPE ? trans('texts.secret_key') : ucwords(Utils::toSpaceCase($field))) !!}
@endif
@endforeach
@if ($gateway->id == GATEWAY_STRIPE)
{!! Former::text('publishable_key') !!}
@endif
@if ($gateway->id == GATEWAY_STRIPE || $gateway->id == GATEWAY_BRAINTREE)
{!! Former::select('token_billing_type_id')
->options($tokenBillingOptions)
->help(trans('texts.token_billing_help')) !!}
@endif
@endforeach
{!! Former::checkbox('show_address')
->label(trans('texts.billing_address'))
->text(trans('texts.show_address_help'))
->addGroupClass('gateway-option') !!}
{!! Former::checkbox('update_address')
->label(' ')
->text(trans('texts.update_address_help'))
->addGroupClass('gateway-option') !!}
{!! Former::checkboxes('creditCardTypes[]')
->label('Accepted Credit Cards')
->checkboxes($creditCardTypes)
->class('creditcard-types')
->addGroupClass('gateway-option')
!!}
@if ($account->getGatewayByType(PAYMENT_TYPE_DIRECT_DEBIT))
{!! Former::checkbox('enable_ach')
->label(trans('texts.ach'))
->text(trans('texts.enable_ach'))
->value(null)
->disabled(true)
->help(trans('texts.stripe_ach_disabled')) !!}
@else
{!! Former::checkbox('enable_ach')
->label(trans('texts.ach'))
->text(trans('texts.enable_ach'))
->help(trans('texts.stripe_ach_help')) !!}
{!! Former::text('plaid_client_id')->label(trans('texts.client_id')) !!}
{!! Former::text('plaid_secret')->label(trans('texts.secret')) !!}
{!! Former::text('plaid_public_key')->label(trans('texts.public_key'))
->help(trans('texts.plaid_environment_help')) !!}
@endif