mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-04 01:34:35 -04:00
Working on gateway fee slippage
This commit is contained in:
parent
61646ec55c
commit
b6bea31646
@ -236,7 +236,7 @@ class CreateSingleAccount extends Command
|
|||||||
$client->id_number = $this->getNextClientNumber($client);
|
$client->id_number = $this->getNextClientNumber($client);
|
||||||
|
|
||||||
$settings = $client->settings;
|
$settings = $client->settings;
|
||||||
$settings->currency_id = (string) rand(1, 79);
|
$settings->currency_id = "1";
|
||||||
$client->settings = $settings;
|
$client->settings = $settings;
|
||||||
|
|
||||||
$country = Country::all()->random();
|
$country = Country::all()->random();
|
||||||
|
@ -287,4 +287,6 @@ class InvoiceSum
|
|||||||
{
|
{
|
||||||
return $this->getTotalTaxes();
|
return $this->getTotalTaxes();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -301,4 +301,5 @@ class InvoiceSumInclusive
|
|||||||
{
|
{
|
||||||
return $this->getTotalTaxes();
|
return $this->getTotalTaxes();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -286,7 +286,7 @@ class CompanyGateway extends BaseModel
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($fees_and_limits->fee_percent) {
|
if ($fees_and_limits->fee_percent) {
|
||||||
$fee += $amount * $fees_and_limits->fee_percent / 100;
|
$fee += round(($amount * $fees_and_limits->fee_percent / 100),2);
|
||||||
info("fee after adding fee percent = {$fee}");
|
info("fee after adding fee percent = {$fee}");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -300,17 +300,17 @@ class CompanyGateway extends BaseModel
|
|||||||
/**/
|
/**/
|
||||||
if ($include_taxes) {
|
if ($include_taxes) {
|
||||||
if ($fees_and_limits->fee_tax_rate1) {
|
if ($fees_and_limits->fee_tax_rate1) {
|
||||||
$fee += $pre_tax_fee * $fees_and_limits->fee_tax_rate1 / 100;
|
$fee += round(($pre_tax_fee * $fees_and_limits->fee_tax_rate1 / 100),2);
|
||||||
info("fee after adding fee tax 1 = {$fee}");
|
info("fee after adding fee tax 1 = {$fee}");
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($fees_and_limits->fee_tax_rate2) {
|
if ($fees_and_limits->fee_tax_rate2) {
|
||||||
$fee += $pre_tax_fee * $fees_and_limits->fee_tax_rate2 / 100;
|
$fee += round(($pre_tax_fee * $fees_and_limits->fee_tax_rate2 / 100),2);
|
||||||
info("fee after adding fee tax 2 = {$fee}");
|
info("fee after adding fee tax 2 = {$fee}");
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($fees_and_limits->fee_tax_rate3) {
|
if ($fees_and_limits->fee_tax_rate3) {
|
||||||
$fee += $pre_tax_fee * $fees_and_limits->fee_tax_rate3 / 100;
|
$fee += round(($pre_tax_fee * $fees_and_limits->fee_tax_rate3 / 100),2);
|
||||||
info("fee after adding fee tax 3 = {$fee}");
|
info("fee after adding fee tax 3 = {$fee}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -44,6 +44,9 @@ class AddGatewayFee extends AbstractService
|
|||||||
{
|
{
|
||||||
$gateway_fee = round($this->company_gateway->calcGatewayFee($this->amount), $this->invoice->client->currency()->precision);
|
$gateway_fee = round($this->company_gateway->calcGatewayFee($this->amount), $this->invoice->client->currency()->precision);
|
||||||
|
|
||||||
|
if((int)$gateway_fee == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
$this->cleanPendingGatewayFees();
|
$this->cleanPendingGatewayFees();
|
||||||
|
|
||||||
if ($gateway_fee > 0) {
|
if ($gateway_fee > 0) {
|
||||||
|
@ -212,6 +212,8 @@ class InvoiceService
|
|||||||
|
|
||||||
public function updateStatus()
|
public function updateStatus()
|
||||||
{
|
{
|
||||||
|
info("invoice balance = {$this->invoice->balance}");
|
||||||
|
|
||||||
if((int)$this->invoice->balance == 0)
|
if((int)$this->invoice->balance == 0)
|
||||||
$this->setStatus(Invoice::STATUS_PAID);
|
$this->setStatus(Invoice::STATUS_PAID);
|
||||||
|
|
||||||
@ -232,7 +234,7 @@ class InvoiceService
|
|||||||
return $item;
|
return $item;
|
||||||
})->toArray();
|
})->toArray();
|
||||||
|
|
||||||
$this->invoice = $this->invoice->calc()->getInvoice();
|
//$this->invoice = $this->invoice->calc()->getInvoice();
|
||||||
|
|
||||||
$this->deletePdf();
|
$this->deletePdf();
|
||||||
|
|
||||||
|
@ -67,12 +67,16 @@ class PaymentService
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$this->payment->ledger()->updatePaymentBalance($this->payment->amount);
|
$this->payment
|
||||||
|
->ledger()
|
||||||
|
->updatePaymentBalance($this->payment->amount);
|
||||||
|
|
||||||
$client->service()
|
$client->service()
|
||||||
->updateBalance($this->payment->amount)
|
->updateBalance($this->payment->amount)
|
||||||
->updatePaidToDate($this->payment->amount * -1)
|
->updatePaidToDate($this->payment->amount * -1)
|
||||||
->save();
|
->save();
|
||||||
|
|
||||||
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function refundPayment(array $data) :?Payment
|
public function refundPayment(array $data) :?Payment
|
||||||
|
@ -31,7 +31,6 @@ class UpdateGatewayTableVisibleColumn extends Migration
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
Schema::table('expenses', function ($t){
|
Schema::table('expenses', function ($t){
|
||||||
$t->renameColumn('invoice_category_id', 'category_id');
|
$t->renameColumn('invoice_category_id', 'category_id');
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user