Working on gateway fees

This commit is contained in:
Hillel Coren 2017-03-16 16:03:17 +02:00
parent 022ad2e414
commit 21166a3be7
20 changed files with 151 additions and 107 deletions

View File

@ -394,6 +394,10 @@ if (! defined('APP_NAME')) {
define('GATEWAY_TYPE_CUSTOM', 6); define('GATEWAY_TYPE_CUSTOM', 6);
define('GATEWAY_TYPE_TOKEN', 'token'); define('GATEWAY_TYPE_TOKEN', 'token');
define('FEE_LOCATION_CHARGE1', 'invoice_charge1');
define('FEE_LOCATION_CHARGE2', 'invoice_charge2');
define('FEE_LOCATION_ITEM', 'invoice_item');
define('REMINDER1', 'reminder1'); define('REMINDER1', 'reminder1');
define('REMINDER2', 'reminder2'); define('REMINDER2', 'reminder2');
define('REMINDER3', 'reminder3'); define('REMINDER3', 'reminder3');

View File

@ -1188,6 +1188,7 @@ class AccountController extends BaseController
$account = Auth::user()->account; $account = Auth::user()->account;
$account->token_billing_type_id = Input::get('token_billing_type_id'); $account->token_billing_type_id = Input::get('token_billing_type_id');
$account->auto_bill_on_due_date = boolval(Input::get('auto_bill_on_due_date')); $account->auto_bill_on_due_date = boolval(Input::get('auto_bill_on_due_date'));
$account->gateway_fee_location = Input::get('gateway_fee_location') ?: null;
$account->save(); $account->save();
event(new UserSettingsChanged()); event(new UserSettingsChanged());

View File

@ -93,6 +93,7 @@ class Account extends Eloquent
'domain_id', 'domain_id',
'payment_terms', 'payment_terms',
'payment_type_id', 'payment_type_id',
'gateway_fee_location',
]; ];
/** /**

View File

@ -58,10 +58,10 @@ class AccountGatewaySettings extends EntityModel
} }
if (floatval($this->fee_percent)) { if (floatval($this->fee_percent)) {
$parts[] = $this->fee_percent . '%'; $parts[] = (floor($this->fee_percent * 1000) / 1000) . '%';
} }
if (floatval($this->fee_tax_rate1) || floatval($this->fee_tax_rate1)) { if ($this->fee_location == FEE_LOCATION_ITEM && (floatval($this->fee_tax_rate1) || floatval($this->fee_tax_rate1))) {
$parts[] = trans('texts.tax'); $parts[] = trans('texts.tax');
} }

View File

@ -13,7 +13,8 @@ trait ChargesFees
{ {
public function calcGatewayFee($gatewayTypeId = false, $includeTax = true) public function calcGatewayFee($gatewayTypeId = false, $includeTax = true)
{ {
$settings = $this->account->getGatewaySettings($gatewayTypeId); $account = $this->account;
$settings = $account->getGatewaySettings($gatewayTypeId);
$fee = 0; $fee = 0;
if (! $settings) { if (! $settings) {
@ -25,14 +26,10 @@ trait ChargesFees
} }
if ($settings->fee_percent) { if ($settings->fee_percent) {
$amount = $this->amount; $fee += $this->amount * $settings->fee_percent / 100;
if ($item = $this->getGatewayFeeItem()) {
$amount -= $item->amount();
}
$fee += $amount * $settings->fee_percent / 100;
} }
if ($includeTax) { if ($account->gateway_fee_location == FEE_LOCATION_ITEM && $includeTax) {
$preTaxFee = $fee; $preTaxFee = $fee;
if ($settings->fee_tax_rate1) { if ($settings->fee_tax_rate1) {
@ -46,60 +43,4 @@ trait ChargesFees
return round($fee, 2); return round($fee, 2);
} }
public function getGatewayFeeItem()
{
foreach ($this->invoice_items as $item) {
if ($item->invoice_item_type_id == INVOICE_ITEM_TYPE_GATEWAY_FEE) {
return $item;
}
}
return false;
}
public function getGatewayFee()
{
$item = $this->getGatewayFeeItem();
return $item ? $item->cost : 0;
}
public function setGatewayFee($gatewayTypeId)
{
$settings = $this->account->getGatewaySettings($gatewayTypeId);
$fee = $this->calcGatewayFee($gatewayTypeId);
$feePreTax = $this->calcGatewayFee($gatewayTypeId, false);
$item = $this->getGatewayFeeItem();
if ($fee == ($item ? $item->amount() : 0)) {
return;
}
if ($item) {
$this->amount -= $item->amount();
$this->balance -= $item->amount();
if (! $fee) {
$item->forceDelete();
}
}
if ($fee) {
$item = $item ?: InvoiceItem::createNew($this);
$item->invoice_item_type_id = INVOICE_ITEM_TYPE_GATEWAY_FEE;
$item->product_key = trans('texts.fee');
$item->notes = trans('texts.' . GatewayType::getAliasFromId($gatewayTypeId));
$item->cost = $feePreTax;
$item->qty = 1;
$item->tax_rate1 = $settings->fee_tax_rate1;
$item->tax_name1 = $settings->fee_tax_name1;
$item->tax_rate2 = $settings->fee_tax_rate2;
$item->tax_name2 = $settings->fee_tax_name2;
$this->invoice_items()->save($item);
}
$this->amount += $fee;
$this->balance += $fee;
$this->save();
}
} }

View File

@ -208,7 +208,7 @@ trait PresentsInvoice
'website', 'website',
'phone', 'phone',
'blank', 'blank',
'adjustment', 'surcharge',
'tax_invoice', 'tax_invoice',
'tax_quote', 'tax_quote',
'statement', 'statement',

View File

@ -97,6 +97,10 @@ class AccountGatewayDatatable extends EntityDatatable
[ [
'fees', 'fees',
function ($model) { function ($model) {
if (! $model->gateway_fee_location) {
return trans('texts.fees_disabled');
}
$gatewayTypes = $this->getGatewayTypes($model->id, $model->gateway_id); $gatewayTypes = $this->getGatewayTypes($model->id, $model->gateway_id);
$html = ''; $html = '';
foreach ($gatewayTypes as $gatewayTypeId) { foreach ($gatewayTypes as $gatewayTypeId) {

View File

@ -133,7 +133,8 @@ class BasePaymentDriver
} }
// apply gateway fees // apply gateway fees
$this->invoice()->setGatewayFee($this->gatewayType); $invoicRepo = app('App\Ninja\Repositories\InvoiceRepository');
$invoicRepo->setGatewayFee($this->invoice(), $this->gatewayType);
if ($this->isGatewayType(GATEWAY_TYPE_TOKEN) || $gateway->is_offsite) { if ($this->isGatewayType(GATEWAY_TYPE_TOKEN) || $gateway->is_offsite) {
if (Session::has('error')) { if (Session::has('error')) {
@ -849,8 +850,8 @@ class BasePaymentDriver
$label = trans('texts.payment_type_on_file', ['type' => $paymentMethod->payment_type->name]); $label = trans('texts.payment_type_on_file', ['type' => $paymentMethod->payment_type->name]);
} }
if ($fees = $this->invoice()->present()->gatewayFee($paymentMethod->payment_type->gateway_type_id)) { if ($fee = $this->invoice()->present()->gatewayFee($paymentMethod->payment_type->gateway_type_id)) {
$label .= sprintf(' - %s %s', $fees, trans('texts.fee')); $label .= sprintf(' - %s: %s', trans('texts.fee'), $fee);
} }
$links[] = [ $links[] = [
@ -885,8 +886,8 @@ class BasePaymentDriver
$label = trans("texts.{$gatewayTypeAlias}"); $label = trans("texts.{$gatewayTypeAlias}");
} }
if ($fees = $this->invoice()->present()->gatewayFee($gatewayTypeId)) { if ($fee = $this->invoice()->present()->gatewayFee($gatewayTypeId)) {
$label .= sprintf(' - %s %s', $fees, trans('texts.fee')); $label .= sprintf(' - %s: %s', trans('texts.fee'), $fee);
} }
$links[] = [ $links[] = [

View File

@ -257,23 +257,22 @@ class InvoicePresenter extends EntityPresenter
{ {
$invoice = $this->entity; $invoice = $this->entity;
$account = $invoice->account; $account = $invoice->account;
$fees = $invoice->calcGatewayFee($gatewayTypeId); $settings = $account->getGatewaySettings($gatewayTypeId);
if (! $fees) { if (! $settings || ! $settings->areFeesEnabled()) {
return false; return '';
} }
return $account->formatMoney($fees, $invoice->client); $parts = [];
}
public function payNowLabel($gatewayTypeId = false) if ($settings->fee_amount) {
{ $parts[] = $account->formatMoney($settings->fee_amount, $invoice->client);
$str = trans('texts.pay_now');
if ($fees = $this->gatewayFee($gatewayTypeId)) {
$str .= sprintf(' - %s %s', $fees, trans('texts.fee'));
} }
return $str; if (floatval($settings->fee_percent) > 0) {
$parts[] = (floor($settings->fee_percent * 1000) / 1000) . '%';
}
return join(' + ', $parts);
} }
} }

View File

@ -15,6 +15,7 @@ class AccountGatewayRepository extends BaseRepository
{ {
$query = DB::table('account_gateways') $query = DB::table('account_gateways')
->join('gateways', 'gateways.id', '=', 'account_gateways.gateway_id') ->join('gateways', 'gateways.id', '=', 'account_gateways.gateway_id')
->join('accounts', 'accounts.id', '=', 'account_gateways.account_id')
->where('account_gateways.account_id', '=', $accountId) ->where('account_gateways.account_id', '=', $accountId)
->whereNull('account_gateways.deleted_at'); ->whereNull('account_gateways.deleted_at');
@ -23,6 +24,7 @@ class AccountGatewayRepository extends BaseRepository
'account_gateways.public_id', 'account_gateways.public_id',
'gateways.name', 'gateways.name',
'account_gateways.deleted_at', 'account_gateways.deleted_at',
'account_gateways.gateway_id'); 'account_gateways.gateway_id',
'accounts.gateway_fee_location');
} }
} }

View File

@ -1007,4 +1007,40 @@ class InvoiceRepository extends BaseRepository
return $invoices; return $invoices;
} }
public function setGatewayFee($invoice, $gatewayTypeId)
{
$account = $invoice->account;
$location = $account->gateway_fee_location;
if (! $location) {
return;
}
if (! $invoice->relationLoaded('invoice_items')) {
$invoice->load('invoice_items');
}
// first remove fee if already set
if ($location == FEE_LOCATION_ITEM) {
// todo
} else {
if ($location == FEE_LOCATION_CHARGE1) {
$field = 'custom_value1';
} elseif ($location == FEE_LOCATION_CHARGE2) {
$field = 'custom_value2';
}
if ($invoice->$field > 0) {
$data = $invoice->toArray();
$data[$field] = 0;
$invoice = $this->save($data, $invoice);
}
}
$fee = $invoice->calcGatewayFee($gatewayTypeId);
$data = $invoice->toArray();
$data[$field] = $fee;
$this->save($data, $invoice);
}
} }

View File

@ -0,0 +1,31 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddGatewayFeeLocation extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('accounts', function ($table) {
$table->enum('gateway_fee_location', [FEE_LOCATION_CHARGE1, FEE_LOCATION_CHARGE2, FEE_LOCATION_ITEM])->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('accounts', function ($table) {
$table->dropColumn('gateway_fee_location');
});
}
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -562,10 +562,10 @@ NINJA.subtotals = function(invoice, hideBalance)
} }
if (NINJA.parseFloat(invoice.custom_value1) && invoice.custom_taxes1 == '1') { if (NINJA.parseFloat(invoice.custom_value1) && invoice.custom_taxes1 == '1') {
data.push([{text: account.custom_invoice_label1 || invoiceLabels.adjustment, style: ['subtotalsLabel', 'customTax1Label']}, {text: formatMoneyInvoice(invoice.custom_value1, invoice), style: ['subtotals', 'customTax1']}]); data.push([{text: account.custom_invoice_label1 || invoiceLabels.surcharge, style: ['subtotalsLabel', 'customTax1Label']}, {text: formatMoneyInvoice(invoice.custom_value1, invoice), style: ['subtotals', 'customTax1']}]);
} }
if (NINJA.parseFloat(invoice.custom_value2) && invoice.custom_taxes2 == '1') { if (NINJA.parseFloat(invoice.custom_value2) && invoice.custom_taxes2 == '1') {
data.push([{text: account.custom_invoice_label2 || invoiceLabels.adjustment, style: ['subtotalsLabel', 'customTax2Label']}, {text: formatMoneyInvoice(invoice.custom_value2, invoice), style: ['subtotals', 'customTax2']}]); data.push([{text: account.custom_invoice_label2 || invoiceLabels.surcharge, style: ['subtotalsLabel', 'customTax2Label']}, {text: formatMoneyInvoice(invoice.custom_value2, invoice), style: ['subtotals', 'customTax2']}]);
} }
for (var key in invoice.item_taxes) { for (var key in invoice.item_taxes) {
@ -586,10 +586,10 @@ NINJA.subtotals = function(invoice, hideBalance)
} }
if (NINJA.parseFloat(invoice.custom_value1) && invoice.custom_taxes1 != '1') { if (NINJA.parseFloat(invoice.custom_value1) && invoice.custom_taxes1 != '1') {
data.push([{text: account.custom_invoice_label1 || invoiceLabels.adjustment, style: ['subtotalsLabel', 'custom1Label']}, {text: formatMoneyInvoice(invoice.custom_value1, invoice), style: ['subtotals', 'custom1']}]); data.push([{text: account.custom_invoice_label1 || invoiceLabels.surcharge, style: ['subtotalsLabel', 'custom1Label']}, {text: formatMoneyInvoice(invoice.custom_value1, invoice), style: ['subtotals', 'custom1']}]);
} }
if (NINJA.parseFloat(invoice.custom_value2) && invoice.custom_taxes2 != '1') { if (NINJA.parseFloat(invoice.custom_value2) && invoice.custom_taxes2 != '1') {
data.push([{text: account.custom_invoice_label2 || invoiceLabels.adjustment, style: ['subtotalsLabel', 'custom2Label']}, {text: formatMoneyInvoice(invoice.custom_value2, invoice), style: ['subtotals', 'custom2']}]); data.push([{text: account.custom_invoice_label2 || invoiceLabels.surcharge, style: ['subtotalsLabel', 'custom2Label']}, {text: formatMoneyInvoice(invoice.custom_value2, invoice), style: ['subtotals', 'custom2']}]);
} }
var paid = invoice.amount - invoice.balance; var paid = invoice.amount - invoice.balance;

View File

@ -700,7 +700,7 @@ $LANG = array(
'oneclick_login' => 'One-Click Login', 'oneclick_login' => 'One-Click Login',
'disable' => 'Disable', 'disable' => 'Disable',
'invoice_quote_number' => 'Invoice and Quote Numbers', 'invoice_quote_number' => 'Invoice and Quote Numbers',
'invoice_charges' => 'Invoice Charges', 'invoice_charges' => 'Invoice Surcharges',
'notification_invoice_bounced' => 'We were unable to deliver Invoice :invoice to :contact.', 'notification_invoice_bounced' => 'We were unable to deliver Invoice :invoice to :contact.',
'notification_invoice_bounced_subject' => 'Unable to deliver Invoice :invoice', 'notification_invoice_bounced_subject' => 'Unable to deliver Invoice :invoice',
'notification_quote_bounced' => 'We were unable to deliver Quote :invoice to :contact.', 'notification_quote_bounced' => 'We were unable to deliver Quote :invoice to :contact.',
@ -1353,7 +1353,7 @@ $LANG = array(
'wepay_payment_tos_agree' => 'I agree to the WePay :terms and :privacy_policy.', 'wepay_payment_tos_agree' => 'I agree to the WePay :terms and :privacy_policy.',
'privacy_policy' => 'Privacy Policy', 'privacy_policy' => 'Privacy Policy',
'wepay_payment_tos_agree_required' => 'You must agree to the WePay Terms of Service and Privacy Policy.', 'wepay_payment_tos_agree_required' => 'You must agree to the WePay Terms of Service and Privacy Policy.',
'payment_settings_supported_gateways' => 'These options are supported by the WePay, Stripe, and Braintree gateways.', 'payment_settings_supported_gateways' => 'Note: token billing is supported by WePay, Stripe, and Braintree.',
'ach_email_prompt' => 'Please enter your email address:', 'ach_email_prompt' => 'Please enter your email address:',
'verification_pending' => 'Verification Pending', 'verification_pending' => 'Verification Pending',
@ -2402,13 +2402,19 @@ $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',
'fee_amount' => 'Amount',
'fee_percent' => 'Percent',
'fees_tax_help' => 'Enable line item taxes to set fee tax rates.', 'fees_tax_help' => 'Enable line item taxes to set 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.',
'no_fees' => 'No Fees', 'no_fees' => 'No Fees',
'gateway_fees_disclaimer' => 'Warning: not all payment gateways allow adding fees, please review their terms of service.', 'gateway_fees_disclaimer' => 'Warning: not all payment gateways allow adding fees, please review their terms of service.',
'percent' => 'Percent',
'location' => 'Location',
'line_item' => 'Line Item',
'surcharge' => 'Surcharge',
'first_surcharge' => 'Enabled - Use first surcharge',
'second_surcharge' => 'Enabled - Use second surcharge',
'online_payment_surcharge' => 'Online Payment Surcharge',
'gateway_fees' => 'Gateway Fees',
'fees_disabled' => 'Fees are disabled',
); );
return $LANG; return $LANG;

View File

@ -8,7 +8,7 @@
<script type="text/javascript"> <script type="text/javascript">
$(function() { $(function() {
if (isStorageSupported()) { if (isStorageSupported() && /\/settings\//.test(location.href)) {
localStorage.setItem('last:settings_page', location.href); localStorage.setItem('last:settings_page', location.href);
} }

View File

@ -8,7 +8,7 @@
{!! Former::open()->addClass('warn-on-exit') !!} {!! Former::open()->addClass('warn-on-exit') !!}
{!! Former::populateField('token_billing_type_id', $account->token_billing_type_id) !!} {!! Former::populateField('token_billing_type_id', $account->token_billing_type_id) !!}
{!! Former::populateField('auto_bill_on_due_date', $account->auto_bill_on_due_date) !!} {!! Former::populateField('auto_bill_on_due_date', $account->auto_bill_on_due_date) !!}
{!! Former::populateField('gateway_fee_location', $account->gateway_fee_location) !!}
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
@ -27,6 +27,14 @@
<div class="form-group"> <div class="form-group">
<div class="col-sm-offset-4 col-sm-8"><p>{!! trans('texts.payment_settings_supported_gateways') !!}</p></div> <div class="col-sm-offset-4 col-sm-8"><p>{!! trans('texts.payment_settings_supported_gateways') !!}</p></div>
</div> </div>
{!! Former::select('gateway_fee_location')
->addOption(trans('texts.disabled'), '')
->addOption(trans('texts.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.line_item'), FEE_LOCATION_ITEM)
->label('gateway_fees')!!}
{!! Former::actions( Button::success(trans('texts.save'))->submit()->appendIcon(Icon::create('floppy-disk')) ) !!} {!! Former::actions( Button::success(trans('texts.save'))->submit()->appendIcon(Icon::create('floppy-disk')) ) !!}
</div> </div>
</div> </div>
@ -56,6 +64,7 @@
->render('datatable') !!} ->render('datatable') !!}
{!! Former::open( 'settings/payment_gateway_limits') !!} {!! Former::open( 'settings/payment_gateway_limits') !!}
<div class="modal fade" id="paymentLimitsModal" tabindex="-1" role="dialog" <div class="modal fade" id="paymentLimitsModal" tabindex="-1" role="dialog"
aria-labelledby="paymentLimitsModalLabel" aria-labelledby="paymentLimitsModalLabel"
aria-hidden="true"> aria-hidden="true">
@ -121,18 +130,21 @@
<div class="panel-body"> <div class="panel-body">
{!! Former::text('fee_amount') {!! Former::text('fee_amount')
->label('amount')
->onchange('updateFeeSample()') ->onchange('updateFeeSample()')
->type('number') ->type('number')
->min('0') ->min('0')
->step('any') !!} ->step('any') !!}
{!! Former::text('fee_percent') {!! Former::text('fee_percent')
->label('percent')
->onchange('updateFeeSample()') ->onchange('updateFeeSample()')
->type('number') ->type('number')
->min('0') ->min('0')
->step('any') ->step('any')
->append('%') !!} ->append('%') !!}
<div id="taxDiv" style="display:none">
@if ($account->invoice_item_taxes) @if ($account->invoice_item_taxes)
{!! Former::select('tax_rate1') {!! Former::select('tax_rate1')
->onchange('onTaxRateChange(1)') ->onchange('onTaxRateChange(1)')
@ -149,6 +161,7 @@
@endif @endif
@endif @endif
</div>
<div style="display:none"> <div style="display:none">
{!! Former::text('fee_tax_name1') !!} {!! Former::text('fee_tax_name1') !!}
@ -159,12 +172,12 @@
<br/><div id="feeSample" class="help-block"></div> <br/><div id="feeSample" class="help-block"></div>
<br/><b>{{ trans('texts.gateway_fees_disclaimer') }}</b>
@if (!$account->invoice_item_taxes && $account->invoice_taxes && count($taxRates)) @if (!$account->invoice_item_taxes && $account->invoice_taxes && count($taxRates))
<br/><div class="help-block">{{ trans('texts.fees_tax_help') }}</div> <br/><div class="help-block">{{ trans('texts.fees_tax_help') }}</div>
@endif @endif
<br/><b>{{ trans('texts.gateway_fees_disclaimer') }}</b>
</div> </div>
</div> </div>
</div> </div>
@ -348,9 +361,11 @@
onTaxRateChange(instance); onTaxRateChange(instance);
} }
/*
$(function() {
javascript:showLimitsModal('Credit Card', 1);
})
*/
</script> </script>
@stop @stop

View File

@ -422,7 +422,7 @@
<tr> <tr>
<td class="hide-border" colspan="3"/> <td class="hide-border" colspan="3"/>
<td style="display:none" class="hide-border" data-bind="visible: $root.invoice_item_taxes.show"/> <td style="display:none" class="hide-border" data-bind="visible: $root.invoice_item_taxes.show"/>
<td colspan="{{ $account->hide_quantity ? 1 : 2 }}">{{ $account->custom_invoice_label1 ?: trans('texts.adjustment') }}</td> <td colspan="{{ $account->hide_quantity ? 1 : 2 }}">{{ $account->custom_invoice_label1 ?: trans('texts.surcharge') }}</td>
<td style="text-align: right;padding-right: 28px" colspan="2"><input name="custom_value1" class="form-control" data-bind="value: custom_value1, valueUpdate: 'afterkeydown'"/></td> <td style="text-align: right;padding-right: 28px" colspan="2"><input name="custom_value1" class="form-control" data-bind="value: custom_value1, valueUpdate: 'afterkeydown'"/></td>
</tr> </tr>
@endif @endif
@ -431,7 +431,7 @@
<tr> <tr>
<td class="hide-border" colspan="3"/> <td class="hide-border" colspan="3"/>
<td style="display:none" class="hide-border" data-bind="visible: $root.invoice_item_taxes.show"/> <td style="display:none" class="hide-border" data-bind="visible: $root.invoice_item_taxes.show"/>
<td colspan="{{ $account->hide_quantity ? 1 : 2 }}">{{ $account->custom_invoice_label2 ?: trans('texts.adjustment') }}</td> <td colspan="{{ $account->hide_quantity ? 1 : 2 }}">{{ $account->custom_invoice_label2 ?: trans('texts.surcharge') }}</td>
<td style="text-align: right;padding-right: 28px" colspan="2"><input name="custom_value2" class="form-control" data-bind="value: custom_value2, valueUpdate: 'afterkeydown'"/></td> <td style="text-align: right;padding-right: 28px" colspan="2"><input name="custom_value2" class="form-control" data-bind="value: custom_value2, valueUpdate: 'afterkeydown'"/></td>
</tr> </tr>
@endif @endif
@ -479,7 +479,7 @@
<tr> <tr>
<td class="hide-border" colspan="3"/> <td class="hide-border" colspan="3"/>
<td style="display:none" class="hide-border" data-bind="visible: $root.invoice_item_taxes.show"/> <td style="display:none" class="hide-border" data-bind="visible: $root.invoice_item_taxes.show"/>
<td colspan="{{ $account->hide_quantity ? 1 : 2 }}">{{ $account->custom_invoice_label1 ?: trans('texts.adjustment') }}</td> <td colspan="{{ $account->hide_quantity ? 1 : 2 }}">{{ $account->custom_invoice_label1 ?: trans('texts.surcharge') }}</td>
<td style="text-align: right;padding-right: 28px" colspan="2"><input name="custom_value1" class="form-control" data-bind="value: custom_value1, valueUpdate: 'afterkeydown'"/></td> <td style="text-align: right;padding-right: 28px" colspan="2"><input name="custom_value1" class="form-control" data-bind="value: custom_value1, valueUpdate: 'afterkeydown'"/></td>
</tr> </tr>
@endif @endif
@ -488,7 +488,7 @@
<tr> <tr>
<td class="hide-border" colspan="3"/> <td class="hide-border" colspan="3"/>
<td style="display:none" class="hide-border" data-bind="visible: $root.invoice_item_taxes.show"/> <td style="display:none" class="hide-border" data-bind="visible: $root.invoice_item_taxes.show"/>
<td colspan="{{ $account->hide_quantity ? 1 : 2 }}">{{ $account->custom_invoice_label2 ?: trans('texts.adjustment') }}</td> <td colspan="{{ $account->hide_quantity ? 1 : 2 }}">{{ $account->custom_invoice_label2 ?: trans('texts.surcharge') }}</td>
<td style="text-align: right;padding-right: 28px" colspan="2"><input name="custom_value2" class="form-control" data-bind="value: custom_value2, valueUpdate: 'afterkeydown'"/></td> <td style="text-align: right;padding-right: 28px" colspan="2"><input name="custom_value2" class="form-control" data-bind="value: custom_value2, valueUpdate: 'afterkeydown'"/></td>
</tr> </tr>
@endif @endif

View File

@ -123,7 +123,10 @@
@if (count($paymentTypes) > 1) @if (count($paymentTypes) > 1)
{!! DropdownButton::success(trans('texts.pay_now'))->withContents($paymentTypes)->large() !!} {!! DropdownButton::success(trans('texts.pay_now'))->withContents($paymentTypes)->large() !!}
@elseif (count($paymentTypes) == 1) @elseif (count($paymentTypes) == 1)
<a href='{!! $paymentURL !!}' class="btn btn-success btn-lg">{{ $invoice->present()->payNowLabel($gatewayTypeId) }}</a> <a href='{!! $paymentURL !!}' class="btn btn-success btn-lg">{{ trans('texts.pay_now') }}</a>
@if ($fee = $invoice->present()->gatewayFee($gatewayTypeId))
<div class="help-block">{{ trans('texts.online_payment_surcharge') }}: {{ $fee }}</div>
@endif
@endif @endif
@else @else
{!! Button::normal(trans('texts.download_pdf'))->withAttributes(['onclick' => 'onDownloadClick()'])->large() !!} {!! Button::normal(trans('texts.download_pdf'))->withAttributes(['onclick' => 'onDownloadClick()'])->large() !!}