1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 13:12:50 +01:00

Fixes for stripe

This commit is contained in:
David Bomba 2021-09-03 19:28:04 +10:00
parent e084e85eeb
commit 592387874e
2 changed files with 6 additions and 4 deletions

View File

@ -89,8 +89,8 @@ class AutoBillCron
nlog($auto_bill_partial_invoices->count(). " partial invoices to auto bill db = {$db}");
$auto_bill_partial_invoices->cursor()->each(function ($invoice){
$this->runAutoBiller($invoice);
$auto_bill_partial_invoices->cursor()->each(function ($invoice)use($db){
$this->runAutoBiller($invoice, $db);
});
$auto_bill_invoices = Invoice::whereDate('due_date', '<=', now())
@ -102,8 +102,8 @@ class AutoBillCron
nlog($auto_bill_invoices->count(). " full invoices to auto bill db = {$db}");
$auto_bill_invoices->cursor()->each(function ($invoice){
$this->runAutoBiller($invoice);
$auto_bill_invoices->cursor()->each(function ($invoice) use($db){
$this->runAutoBiller($invoice, $db);
});
}
@ -115,6 +115,7 @@ class AutoBillCron
info("Firing autobill for {$invoice->company_id} - {$invoice->number}");
try{
MultiDB::setDB($db);
$invoice->service()->autoBill()->save();
}
catch(\Exception $e) {

View File

@ -51,6 +51,7 @@ class Charge
*/
public function tokenBilling(ClientGatewayToken $cgt, PaymentHash $payment_hash)
{
nlog(" DB = ".$this->stripe->client->company->db);
$amount = array_sum(array_column($payment_hash->invoices(), 'amount')) + $payment_hash->fee_total;
$invoice = Invoice::whereIn('id', $this->transformKeys(array_column($payment_hash->invoices(), 'invoice_id')))->withTrashed()->first();