diff --git a/app/Http/Controllers/AccountController.php b/app/Http/Controllers/AccountController.php index c781b549e01e..fb8742f3c41b 100644 --- a/app/Http/Controllers/AccountController.php +++ b/app/Http/Controllers/AccountController.php @@ -1272,6 +1272,7 @@ class AccountController extends BaseController $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->gateway_fee_enabled = boolval(Input::get('gateway_fee_enabled')); + $account->send_item_details = boolval(Input::get('send_item_details')); $account->save(); diff --git a/app/Models/Account.php b/app/Models/Account.php index 31c80840259f..98daf5a88fe5 100644 --- a/app/Models/Account.php +++ b/app/Models/Account.php @@ -173,6 +173,7 @@ class Account extends Eloquent 'reset_counter_frequency_id', 'payment_type_id', 'gateway_fee_enabled', + 'send_item_details', 'reset_counter_date', 'custom_contact_label1', 'custom_contact_label2', diff --git a/app/Ninja/PaymentDrivers/BasePaymentDriver.php b/app/Ninja/PaymentDrivers/BasePaymentDriver.php index 35d7f088eb36..b45f257fc3da 100644 --- a/app/Ninja/PaymentDrivers/BasePaymentDriver.php +++ b/app/Ninja/PaymentDrivers/BasePaymentDriver.php @@ -312,11 +312,13 @@ class BasePaymentDriver // prepare and process payment $data = $this->paymentDetails($paymentMethod); + // TODO move to payment driver class if ($this->isGateway(GATEWAY_SAGE_PAY_DIRECT) || $this->isGateway(GATEWAY_SAGE_PAY_SERVER)) { $items = null; + } elseif ($this->account()->send_item_details) { + $items = $this->paymentItems(); } else { - //$items = $this->paymentItems(); $items = null; } $response = $gateway->purchase($data) diff --git a/app/Ninja/Transformers/AccountTransformer.php b/app/Ninja/Transformers/AccountTransformer.php index 456a72db6917..8c17763af1b1 100644 --- a/app/Ninja/Transformers/AccountTransformer.php +++ b/app/Ninja/Transformers/AccountTransformer.php @@ -275,6 +275,7 @@ class AccountTransformer extends EntityTransformer 'reset_counter_frequency_id' => (int) $account->reset_counter_frequency_id, 'payment_type_id' => (int) $account->payment_type_id, 'gateway_fee_enabled' => (bool) $account->gateway_fee_enabled, + 'send_item_details' => (bool) $account->send_item_details, 'reset_counter_date' => $account->reset_counter_date, 'custom_contact_label1' => $account->custom_contact_label1, 'custom_contact_label2' => $account->custom_contact_label2, diff --git a/database/migrations/2018_03_08_150414_add_slack_notifications.php b/database/migrations/2018_03_08_150414_add_slack_notifications.php index f947665b25aa..5325e03c07a9 100644 --- a/database/migrations/2018_03_08_150414_add_slack_notifications.php +++ b/database/migrations/2018_03_08_150414_add_slack_notifications.php @@ -36,6 +36,7 @@ class AddSlackNotifications extends Migration $table->boolean('auto_archive_invoice')->default(false)->nullable(); $table->boolean('auto_archive_quote')->default(false)->nullable(); $table->boolean('auto_email_invoice')->default(true)->nullable(); + $table->boolean('send_item_details')->default(false)->nullable(); }); Schema::table('expenses', function ($table) { @@ -95,6 +96,7 @@ class AddSlackNotifications extends Migration $table->dropColumn('auto_archive_invoice'); $table->dropColumn('auto_archive_quote'); $table->dropColumn('auto_email_invoice'); + $table->dropColumn('send_item_details'); }); Schema::table('jobs', function (Blueprint $table) { diff --git a/resources/lang/en/texts.php b/resources/lang/en/texts.php index de1eb22639c1..5e8a97ba7ddc 100644 --- a/resources/lang/en/texts.php +++ b/resources/lang/en/texts.php @@ -2792,6 +2792,8 @@ $LANG = array( 'purged_client' => 'Successfully purged client', 'purge_client_warning' => 'All related records (invoices, tasks, expenses, documents, etc) will also be deleted.', 'clone_product' => 'Clone Product', + 'item_details' => 'Item Details', + 'send_item_details_help' => 'Send the line item details to the payment gateway.' ); diff --git a/resources/views/accounts/payments.blade.php b/resources/views/accounts/payments.blade.php index d9bf2b672e4f..e9f298798917 100644 --- a/resources/views/accounts/payments.blade.php +++ b/resources/views/accounts/payments.blade.php @@ -9,6 +9,7 @@ {!! 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('gateway_fee_enabled', $account->gateway_fee_enabled) !!} + {!! Former::populateField('send_item_details', $account->send_item_details) !!}
@@ -31,6 +32,13 @@ ->label('gateway_fees') ->text('enable') ->value(1) !!} + + {!! Former::checkbox('send_item_details') + ->help('send_item_details_help') + ->label('item_details') + ->text('enable') + ->value(1) !!} +
{!! Former::actions( Button::success(trans('texts.save'))->withAttributes(['id' => 'formSave'])->submit()->appendIcon(Icon::create('floppy-disk')) ) !!}