mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
Tweak payment dates in demo data
This commit is contained in:
parent
708422dd9b
commit
583a92d5bc
@ -361,6 +361,10 @@ class DemoMode extends Command
|
||||
|
||||
$invoice = $invoice->service()->markPaid()->save();
|
||||
|
||||
$invoice->payments->each(function ($payment){
|
||||
$payment->date = now()->addDays(rand(0,90));
|
||||
$payment->save();
|
||||
});
|
||||
}
|
||||
//@todo this slow things down, but gives us PDFs of the invoices for inspection whilst debugging.
|
||||
event(new InvoiceWasCreated($invoice, $invoice->company, Ninja::eventVars()));
|
||||
|
@ -50,11 +50,20 @@ class AutoBillInvoice extends AbstractService
|
||||
if(!$gateway_token)
|
||||
return $this->invoice;
|
||||
|
||||
if($this->invoice->partial){
|
||||
$fee = $gateway_token->gateway->calcGatewayFee($this->invoice->partial);
|
||||
$amount = $this->invoice->partial + $fee;
|
||||
}
|
||||
else{
|
||||
$fee = $gateway_token->gateway->calcGatewayFee($this->invoice->balance);
|
||||
$amount = $this->invoice->balance + $fee;
|
||||
}
|
||||
|
||||
if($fee > 0)
|
||||
$this->purgeStaleGatewayFees()->addFeeToInvoice($fee);
|
||||
|
||||
|
||||
|
||||
$response = $gateway_token->gateway->driver($this->client)->tokenBilling($gateway_token, $amount, $this->invoice);
|
||||
|
||||
//if response was successful, toggle the fee type_id to paid
|
||||
|
Loading…
x
Reference in New Issue
Block a user