Add option not to send line item details to payment gateway

This commit is contained in:
Hillel Coren 2018-03-25 15:05:24 +03:00
parent dbdffc6aca
commit fa0ff9f001
7 changed files with 18 additions and 1 deletions

View File

@ -1272,6 +1272,7 @@ class AccountController extends BaseController
$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_enabled = boolval(Input::get('gateway_fee_enabled')); $account->gateway_fee_enabled = boolval(Input::get('gateway_fee_enabled'));
$account->send_item_details = boolval(Input::get('send_item_details'));
$account->save(); $account->save();

View File

@ -173,6 +173,7 @@ class Account extends Eloquent
'reset_counter_frequency_id', 'reset_counter_frequency_id',
'payment_type_id', 'payment_type_id',
'gateway_fee_enabled', 'gateway_fee_enabled',
'send_item_details',
'reset_counter_date', 'reset_counter_date',
'custom_contact_label1', 'custom_contact_label1',
'custom_contact_label2', 'custom_contact_label2',

View File

@ -312,11 +312,13 @@ class BasePaymentDriver
// prepare and process payment // prepare and process payment
$data = $this->paymentDetails($paymentMethod); $data = $this->paymentDetails($paymentMethod);
// TODO move to payment driver class // TODO move to payment driver class
if ($this->isGateway(GATEWAY_SAGE_PAY_DIRECT) || $this->isGateway(GATEWAY_SAGE_PAY_SERVER)) { if ($this->isGateway(GATEWAY_SAGE_PAY_DIRECT) || $this->isGateway(GATEWAY_SAGE_PAY_SERVER)) {
$items = null; $items = null;
} elseif ($this->account()->send_item_details) {
$items = $this->paymentItems();
} else { } else {
//$items = $this->paymentItems();
$items = null; $items = null;
} }
$response = $gateway->purchase($data) $response = $gateway->purchase($data)

View File

@ -275,6 +275,7 @@ class AccountTransformer extends EntityTransformer
'reset_counter_frequency_id' => (int) $account->reset_counter_frequency_id, 'reset_counter_frequency_id' => (int) $account->reset_counter_frequency_id,
'payment_type_id' => (int) $account->payment_type_id, 'payment_type_id' => (int) $account->payment_type_id,
'gateway_fee_enabled' => (bool) $account->gateway_fee_enabled, 'gateway_fee_enabled' => (bool) $account->gateway_fee_enabled,
'send_item_details' => (bool) $account->send_item_details,
'reset_counter_date' => $account->reset_counter_date, 'reset_counter_date' => $account->reset_counter_date,
'custom_contact_label1' => $account->custom_contact_label1, 'custom_contact_label1' => $account->custom_contact_label1,
'custom_contact_label2' => $account->custom_contact_label2, 'custom_contact_label2' => $account->custom_contact_label2,

View File

@ -36,6 +36,7 @@ class AddSlackNotifications extends Migration
$table->boolean('auto_archive_invoice')->default(false)->nullable(); $table->boolean('auto_archive_invoice')->default(false)->nullable();
$table->boolean('auto_archive_quote')->default(false)->nullable(); $table->boolean('auto_archive_quote')->default(false)->nullable();
$table->boolean('auto_email_invoice')->default(true)->nullable(); $table->boolean('auto_email_invoice')->default(true)->nullable();
$table->boolean('send_item_details')->default(false)->nullable();
}); });
Schema::table('expenses', function ($table) { Schema::table('expenses', function ($table) {
@ -95,6 +96,7 @@ class AddSlackNotifications extends Migration
$table->dropColumn('auto_archive_invoice'); $table->dropColumn('auto_archive_invoice');
$table->dropColumn('auto_archive_quote'); $table->dropColumn('auto_archive_quote');
$table->dropColumn('auto_email_invoice'); $table->dropColumn('auto_email_invoice');
$table->dropColumn('send_item_details');
}); });
Schema::table('jobs', function (Blueprint $table) { Schema::table('jobs', function (Blueprint $table) {

View File

@ -2792,6 +2792,8 @@ $LANG = array(
'purged_client' => 'Successfully purged client', 'purged_client' => 'Successfully purged client',
'purge_client_warning' => 'All related records (invoices, tasks, expenses, documents, etc) will also be deleted.', 'purge_client_warning' => 'All related records (invoices, tasks, expenses, documents, etc) will also be deleted.',
'clone_product' => 'Clone Product', 'clone_product' => 'Clone Product',
'item_details' => 'Item Details',
'send_item_details_help' => 'Send the line item details to the payment gateway.'
); );

View File

@ -9,6 +9,7 @@
{!! 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_enabled', $account->gateway_fee_enabled) !!} {!! Former::populateField('gateway_fee_enabled', $account->gateway_fee_enabled) !!}
{!! Former::populateField('send_item_details', $account->send_item_details) !!}
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
@ -31,6 +32,13 @@
->label('gateway_fees') ->label('gateway_fees')
->text('enable') ->text('enable')
->value(1) !!} ->value(1) !!}
{!! Former::checkbox('send_item_details')
->help('send_item_details_help')
->label('item_details')
->text('enable')
->value(1) !!}
<br/> <br/>
{!! Former::actions( Button::success(trans('texts.save'))->withAttributes(['id' => 'formSave'])->submit()->appendIcon(Icon::create('floppy-disk')) ) !!} {!! Former::actions( Button::success(trans('texts.save'))->withAttributes(['id' => 'formSave'])->submit()->appendIcon(Icon::create('floppy-disk')) ) !!}
</div> </div>