2015-03-16 22:45:25 +01:00
|
|
|
@extends('accounts.nav')
|
|
|
|
|
|
|
|
@section('content')
|
|
|
|
@parent
|
|
|
|
|
2015-04-01 21:57:02 +02:00
|
|
|
{!! Former::open($url)->method($method)->rule()->addClass('col-md-8 col-md-offset-2 warn-on-exit') !!}
|
|
|
|
{!! Former::populate($account) !!}
|
2015-03-16 22:45:25 +01:00
|
|
|
|
2015-04-01 21:57:02 +02:00
|
|
|
{!! Former::legend($title) !!}
|
2015-03-16 22:45:25 +01:00
|
|
|
|
|
|
|
@if ($accountGateway)
|
2015-04-15 18:35:41 +02:00
|
|
|
{!! Former::populateField('payment_type_id', $paymentTypeId) !!}
|
2015-04-01 21:57:02 +02:00
|
|
|
{!! Former::populateField('gateway_id', $accountGateway->gateway_id) !!}
|
2015-04-15 18:35:41 +02:00
|
|
|
{!! Former::populateField('recommendedGateway_id', $accountGateway->gateway_id) !!}
|
2015-03-16 22:45:25 +01:00
|
|
|
@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
|
2015-04-15 18:35:41 +02:00
|
|
|
|
|
|
|
{!! Former::select('payment_type_id')
|
|
|
|
->options($paymentTypes)
|
|
|
|
->addGroupClass('payment-type-option')
|
|
|
|
->onchange('setPaymentType()') !!}
|
|
|
|
|
|
|
|
{!! Former::select('gateway_id')->addOption('', '')
|
2015-03-16 22:45:25 +01:00
|
|
|
->dataClass('gateway-dropdown')
|
2015-04-15 18:35:41 +02:00
|
|
|
->addGroupClass('gateway-option')
|
|
|
|
->fromQuery($selectGateways, 'name', 'id')
|
|
|
|
->onchange('setFieldsShown()') !!}
|
2015-03-16 22:45:25 +01:00
|
|
|
|
|
|
|
@foreach ($gateways as $gateway)
|
|
|
|
|
|
|
|
<div id="gateway_{{ $gateway->id }}_div" class='gateway-fields' style="display: none">
|
|
|
|
@foreach ($gateway->fields as $field => $details)
|
|
|
|
|
|
|
|
@if (in_array($field, ['solutionType', 'landingPage', 'headerImageUrl', 'brandName']))
|
|
|
|
{{-- do nothing --}}
|
|
|
|
@elseif ($field == 'testMode' || $field == 'developerMode')
|
|
|
|
{{-- Former::checkbox($gateway->id.'_'.$field)->label(Utils::toSpaceCase($field))->text('Enable') --}}
|
|
|
|
@elseif ($field == 'username' || $field == 'password')
|
2015-04-01 21:57:02 +02:00
|
|
|
{!! Former::text($gateway->id.'_'.$field)->label('API '. ucfirst(Utils::toSpaceCase($field))) !!}
|
2015-03-16 22:45:25 +01:00
|
|
|
@else
|
2015-04-01 21:57:02 +02:00
|
|
|
{!! Former::text($gateway->id.'_'.$field)->label(Utils::toSpaceCase($field)) !!}
|
2015-03-16 22:45:25 +01:00
|
|
|
@endif
|
|
|
|
|
|
|
|
@endforeach
|
|
|
|
|
|
|
|
@if ($gateway->getHelp())
|
|
|
|
<div class="form-group">
|
|
|
|
<label class="control-label col-lg-4 col-sm-4"></label>
|
|
|
|
<div class="col-lg-8 col-sm-8 help-block">
|
2015-04-06 13:46:02 +02:00
|
|
|
{!! $gateway->getHelp() !!}
|
2015-03-16 22:45:25 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
@endif
|
|
|
|
|
|
|
|
@if ($gateway->id == GATEWAY_STRIPE)
|
2015-04-01 21:57:02 +02:00
|
|
|
{!! Former::select('token_billing_type_id')->options($tokenBillingOptions)->help(trans('texts.token_billing_help')) !!}
|
2015-03-16 22:45:25 +01:00
|
|
|
@endif
|
|
|
|
</div>
|
|
|
|
|
|
|
|
@endforeach
|
|
|
|
|
2015-04-15 18:35:41 +02:00
|
|
|
{!! Former::checkboxes('creditCardTypes[]')
|
|
|
|
->label('Accepted Credit Cards')
|
|
|
|
->checkboxes($creditCardTypes)
|
|
|
|
->class('creditcard-types')
|
|
|
|
->addGroupClass('gateway-option')
|
2015-04-06 13:46:02 +02:00
|
|
|
!!}
|
|
|
|
|
|
|
|
|
2015-03-16 22:45:25 +01:00
|
|
|
<p/> <p/>
|
|
|
|
|
2015-04-01 21:57:02 +02:00
|
|
|
{!! Former::actions(
|
2015-04-06 13:46:02 +02:00
|
|
|
Button::success(trans('texts.save'))->submit()->large()->appendIcon(Icon::create('floppy-disk')),
|
|
|
|
$countGateways > 0 ? Button::normal(trans('texts.cancel'))->large()->asLinkTo('/company/payments')->appendIcon(Icon::create('remove-circle')) : false) !!}
|
2015-04-01 21:57:02 +02:00
|
|
|
{!! Former::close() !!}
|
2015-03-16 22:45:25 +01:00
|
|
|
|
|
|
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
|
2015-04-15 18:35:41 +02:00
|
|
|
function setPaymentType() {
|
|
|
|
var val = $('#payment_type_id').val();
|
|
|
|
if (val == 'PAYMENT_TYPE_CREDIT_CARD') {
|
|
|
|
$('.gateway-option').show();
|
|
|
|
setFieldsShown();
|
|
|
|
} else {
|
|
|
|
$('.gateway-option').hide();
|
|
|
|
|
|
|
|
if (val == 'PAYMENT_TYPE_PAYPAL') {
|
|
|
|
setFieldsShown({{ GATEWAY_PAYPAL_EXPRESS }});
|
|
|
|
} else {
|
|
|
|
setFieldsShown({{ GATEWAY_BITPAY }});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function setFieldsShown(val) {
|
|
|
|
if (!val) {
|
|
|
|
val = $('#gateway_id').val();
|
|
|
|
}
|
|
|
|
|
2015-03-16 22:45:25 +01:00
|
|
|
$('.gateway-fields').hide();
|
|
|
|
$('#gateway_' + val + '_div').show();
|
|
|
|
}
|
|
|
|
|
|
|
|
function gatewayLink(url) {
|
|
|
|
var host = new URL(url).hostname;
|
|
|
|
if (host) {
|
|
|
|
openUrl(url, '/affiliate/' + host);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-04-15 18:35:41 +02:00
|
|
|
$(function() {
|
|
|
|
setPaymentType();
|
|
|
|
@if ($accountGateway)
|
|
|
|
$('.payment-type-option').hide();
|
|
|
|
@endif
|
|
|
|
})
|
|
|
|
|
2015-03-16 22:45:25 +01:00
|
|
|
</script>
|
|
|
|
|
|
|
|
@stop
|