mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Working on gateway fees
This commit is contained in:
parent
7b2f46b087
commit
b2cfc8b99a
@ -49,6 +49,11 @@ class AccountGatewaySettings extends EntityModel
|
|||||||
return floatval($this->fee_amount) || floatval($this->fee_percent);
|
return floatval($this->fee_amount) || floatval($this->fee_percent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function hasTaxes()
|
||||||
|
{
|
||||||
|
return floatval($this->fee_tax_rate1) || floatval($this->fee_tax_rate1);
|
||||||
|
}
|
||||||
|
|
||||||
public function feesToString()
|
public function feesToString()
|
||||||
{
|
{
|
||||||
$parts = [];
|
$parts = [];
|
||||||
@ -61,10 +66,6 @@ class AccountGatewaySettings extends EntityModel
|
|||||||
$parts[] = (floor($this->fee_percent * 1000) / 1000) . '%';
|
$parts[] = (floor($this->fee_percent * 1000) / 1000) . '%';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->fee_location == FEE_LOCATION_ITEM && (floatval($this->fee_tax_rate1) || floatval($this->fee_tax_rate1))) {
|
|
||||||
$parts[] = trans('texts.tax');
|
|
||||||
}
|
|
||||||
|
|
||||||
return join(' + ', $parts);
|
return join(' + ', $parts);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -97,7 +97,7 @@ class AccountGatewayDatatable extends EntityDatatable
|
|||||||
[
|
[
|
||||||
'fees',
|
'fees',
|
||||||
function ($model) {
|
function ($model) {
|
||||||
if (! $model->gateway_fee_location) {
|
if (! $feeLocation = $model->gateway_fee_location) {
|
||||||
return trans('texts.fees_disabled');
|
return trans('texts.fees_disabled');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -118,6 +118,17 @@ class AccountGatewayDatatable extends EntityDatatable
|
|||||||
$html .= $gatewayType->name . ' — ';
|
$html .= $gatewayType->name . ' — ';
|
||||||
}
|
}
|
||||||
$html .= $accountGatewaySettings->feesToString();
|
$html .= $accountGatewaySettings->feesToString();
|
||||||
|
|
||||||
|
if ($feeLocation == FEE_LOCATION_ITEM) {
|
||||||
|
if ($accountGatewaySettings->hasTaxes()) {
|
||||||
|
$html .= ' + ' . trans('texts.tax');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$field = ($feeLocation == FEE_LOCATION_CHARGE1 ? 'custom_invoice_taxes1' : 'custom_invoice_taxes1');
|
||||||
|
if (\Auth::user()->account->$field) {
|
||||||
|
$html .= ' + ' . trans('texts.tax');
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
return $html ?: trans('texts.no_fees');
|
return $html ?: trans('texts.no_fees');
|
||||||
},
|
},
|
||||||
|
@ -2401,7 +2401,7 @@ $LANG = array(
|
|||||||
'fees' => 'Fees',
|
'fees' => 'Fees',
|
||||||
'fee' => 'Fee',
|
'fee' => 'Fee',
|
||||||
'set_limits_fees' => 'Set :gateway_type Limits/Fees',
|
'set_limits_fees' => 'Set :gateway_type Limits/Fees',
|
||||||
'fees_tax_help' => 'Enable line item taxes to set fee tax rates.',
|
'fees_tax_help' => 'Enable line item taxes to set the fee tax rates.',
|
||||||
'fees_sample' => 'The fee for a :amount invoice would be :total.',
|
'fees_sample' => 'The fee for a :amount invoice would be :total.',
|
||||||
'discount_sample' => 'The discount for a :amount invoice would be :total.',
|
'discount_sample' => 'The discount for a :amount invoice would be :total.',
|
||||||
'no_fees' => 'No Fees',
|
'no_fees' => 'No Fees',
|
||||||
@ -2410,12 +2410,14 @@ $LANG = array(
|
|||||||
'location' => 'Location',
|
'location' => 'Location',
|
||||||
'line_item' => 'Line Item',
|
'line_item' => 'Line Item',
|
||||||
'surcharge' => 'Surcharge',
|
'surcharge' => 'Surcharge',
|
||||||
'first_surcharge' => 'Enabled - Use first surcharge',
|
'location_first_surcharge' => 'Enabled - First surcharge',
|
||||||
'second_surcharge' => 'Enabled - Use second surcharge',
|
'location_second_surcharge' => 'Enabled - Second surcharge',
|
||||||
|
'location_line_item' => 'Enabled - Line item',
|
||||||
'online_payment_surcharge' => 'Online Payment Surcharge',
|
'online_payment_surcharge' => 'Online Payment Surcharge',
|
||||||
'gateway_fees' => 'Gateway Fees',
|
'gateway_fees' => 'Gateway Fees',
|
||||||
'fees_disabled' => 'Fees are disabled',
|
'fees_disabled' => 'Fees are disabled',
|
||||||
'gateway_fees_help' => 'Automatically add an online payment surcharge [partial payments are not supported].',
|
//'gateway_fees_help' => 'Automatically add an online payment surcharge [partial payments are not supported].',
|
||||||
|
'gateway_fees_help' => 'Automatically add an online payment surcharge or line item.<br/>Use \'Line item\' to support partial payments.',
|
||||||
'gateway' => 'Gateway',
|
'gateway' => 'Gateway',
|
||||||
|
|
||||||
);
|
);
|
||||||
|
@ -27,9 +27,9 @@
|
|||||||
<br/>
|
<br/>
|
||||||
{!! Former::select('gateway_fee_location')
|
{!! Former::select('gateway_fee_location')
|
||||||
->addOption(trans('texts.disabled'), '')
|
->addOption(trans('texts.disabled'), '')
|
||||||
->addOption(trans('texts.first_surcharge') . ($account->custom_invoice_label1 ? ' | ' . $account->custom_invoice_label1 : ''), FEE_LOCATION_CHARGE1)
|
->addOption(trans('texts.location_first_surcharge') . ($account->custom_invoice_label1 ? ' | ' . $account->custom_invoice_label1 : ''), FEE_LOCATION_CHARGE1)
|
||||||
->addOption(trans('texts.second_surcharge') . ($account->custom_invoice_label2 ? ' | ' . $account->custom_invoice_label2 : '' ), FEE_LOCATION_CHARGE2)
|
->addOption(trans('texts.location_second_surcharge') . ($account->custom_invoice_label2 ? ' | ' . $account->custom_invoice_label2 : '' ), FEE_LOCATION_CHARGE2)
|
||||||
//->addOption(trans('texts.line_item'), FEE_LOCATION_ITEM)
|
->addOption(trans('texts.location_line_item'), FEE_LOCATION_ITEM)
|
||||||
->help('gateway_fees_help')
|
->help('gateway_fees_help')
|
||||||
->label('gateway_fees')!!}
|
->label('gateway_fees')!!}
|
||||||
<br/>
|
<br/>
|
||||||
@ -164,13 +164,14 @@
|
|||||||
{!! Former::text('fee_tax_rate1') !!}
|
{!! Former::text('fee_tax_rate1') !!}
|
||||||
{!! Former::text('fee_tax_name2') !!}
|
{!! Former::text('fee_tax_name2') !!}
|
||||||
{!! Former::text('fee_tax_rate2') !!}
|
{!! Former::text('fee_tax_rate2') !!}
|
||||||
</div>
|
</div><br/>
|
||||||
|
|
||||||
<br/><div id="feeSample" class="help-block"></div>
|
<div class="help-block">
|
||||||
|
<span id="feeSample"></span>
|
||||||
@if (false && !$account->invoice_item_taxes && $account->invoice_taxes && count($taxRates))
|
@if ($account->gateway_fee_location == FEE_LOCATION_ITEM && !$account->invoice_item_taxes && $account->invoice_taxes && count($taxRates))
|
||||||
<br/><div class="help-block">{{ trans('texts.fees_tax_help') }}</div>
|
{{ trans('texts.fees_tax_help') }}
|
||||||
@endif
|
@endif
|
||||||
|
</div>
|
||||||
|
|
||||||
<br/><b>{{ trans('texts.gateway_fees_disclaimer') }}</b>
|
<br/><b>{{ trans('texts.gateway_fees_disclaimer') }}</b>
|
||||||
|
|
||||||
@ -252,6 +253,10 @@
|
|||||||
$('#paymentLimitsModal').modal('show');
|
$('#paymentLimitsModal').modal('show');
|
||||||
|
|
||||||
updateFeeSample();
|
updateFeeSample();
|
||||||
|
|
||||||
|
@if ($account->gateway_fee_location == FEE_LOCATION_ITEM)
|
||||||
|
$('#taxDiv').show();
|
||||||
|
@endif
|
||||||
}
|
}
|
||||||
|
|
||||||
var limitsSlider = document.getElementById('payment-limits-slider');
|
var limitsSlider = document.getElementById('payment-limits-slider');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user