mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2026-03-03 02:57:01 +00:00
Fixes for gateway_fee schema update
This commit is contained in:
@@ -53,7 +53,7 @@ class CompanyFactory
|
||||
$company->smtp_host = '';
|
||||
$company->smtp_local_domain = '';
|
||||
$company->smtp_password = '';
|
||||
$company->smtp_port = '';
|
||||
$company->smtp_port = 0;
|
||||
$company->smtp_username = '';
|
||||
$company->smtp_verify_peer = true;
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ class Backup extends BaseModel
|
||||
|
||||
public function storeRemotely(?string $html, Client | Vendor $client_or_vendor)
|
||||
{
|
||||
if (! $html || empty($html)) {
|
||||
if (empty($html)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -430,6 +430,11 @@ class BaseDriver extends AbstractPaymentDriver
|
||||
$invoice_item->quantity = 1;
|
||||
$invoice_item->cost = (float)$fee_total;
|
||||
|
||||
if($invoice->discount > 0 && !$invoice->is_amount_discount){
|
||||
$invoice_item->discount = -1 * $invoice->discount;
|
||||
$invoice_item->is_amount_discount = false;
|
||||
}
|
||||
|
||||
$invoice_items = $invoice->line_items;
|
||||
$invoice_items[] = $invoice_item;
|
||||
|
||||
@@ -443,7 +448,7 @@ class BaseDriver extends AbstractPaymentDriver
|
||||
$invoice_item->tax_id = (string)\App\Models\Product::PRODUCT_TYPE_OVERRIDE_TAX;
|
||||
}
|
||||
|
||||
$invoice->line_items = $invoice_items;
|
||||
$invoice->line_items = array_values($invoice_items);
|
||||
|
||||
/**Refresh Invoice values*/
|
||||
$invoice = $invoice->calc()->getInvoice();
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
|
||||
Schema::table('invoices', function (Blueprint $table) {
|
||||
if (!Schema::hasColumn('invoices', 'gateway_fee')) {
|
||||
$table->decimal('gateway_fee', 13, 6)->default(0);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
//
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user