Fixes for gateway_fee schema update

This commit is contained in:
David Bomba 2024-10-10 09:07:26 +11:00
parent 8e4ac94da9
commit dbc10d11e4
4 changed files with 38 additions and 3 deletions

View File

@ -53,7 +53,7 @@ class CompanyFactory
$company->smtp_host = ''; $company->smtp_host = '';
$company->smtp_local_domain = ''; $company->smtp_local_domain = '';
$company->smtp_password = ''; $company->smtp_password = '';
$company->smtp_port = ''; $company->smtp_port = 0;
$company->smtp_username = ''; $company->smtp_username = '';
$company->smtp_verify_peer = true; $company->smtp_verify_peer = true;

View File

@ -56,7 +56,7 @@ class Backup extends BaseModel
public function storeRemotely(?string $html, Client | Vendor $client_or_vendor) public function storeRemotely(?string $html, Client | Vendor $client_or_vendor)
{ {
if (! $html || empty($html)) { if (empty($html)) {
return; return;
} }

View File

@ -430,6 +430,11 @@ class BaseDriver extends AbstractPaymentDriver
$invoice_item->quantity = 1; $invoice_item->quantity = 1;
$invoice_item->cost = (float)$fee_total; $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->line_items;
$invoice_items[] = $invoice_item; $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_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*/ /**Refresh Invoice values*/
$invoice = $invoice->calc()->getInvoice(); $invoice = $invoice->calc()->getInvoice();

View File

@ -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
{
//
}
};