From e084e85eebe7110a019b8a7d03c4a627f55ba0b1 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Fri, 3 Sep 2021 15:38:20 +1000 Subject: [PATCH] Additional logging for auto biller --- app/PaymentDrivers/Stripe/Charge.php | 4 ++++ app/Services/Invoice/AutoBillInvoice.php | 10 +++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/app/PaymentDrivers/Stripe/Charge.php b/app/PaymentDrivers/Stripe/Charge.php index 2ae298a335e2..ce5a424de7b2 100644 --- a/app/PaymentDrivers/Stripe/Charge.php +++ b/app/PaymentDrivers/Stripe/Charge.php @@ -75,6 +75,10 @@ class Charge 'description' => $description, ]; + nlog("Stripe tokenBilling payload"); + + nlog($data); + $response = $this->stripe->createPaymentIntent($data, $this->stripe->stripe_connect_auth); // $response = $local_stripe->paymentIntents->create($data); diff --git a/app/Services/Invoice/AutoBillInvoice.php b/app/Services/Invoice/AutoBillInvoice.php index 0926abf7b9e2..9505bf2e9349 100644 --- a/app/Services/Invoice/AutoBillInvoice.php +++ b/app/Services/Invoice/AutoBillInvoice.php @@ -51,12 +51,14 @@ class AutoBillInvoice extends AbstractService /* Mark the invoice as paid if there is no balance */ if ((int)$this->invoice->balance == 0) - return $this->invoice->service()->markPaid()->save(); + return $this->invoice->service()->markPaid()->workFlow()->save(); //if the credits cover the payments, we stop here, build the payment with credits and exit early if ($this->client->getSetting('use_credits_payment') != 'off') $this->applyCreditPayment(); + $amount = 0; + /* Determine $amount */ if ($this->invoice->partial > 0) { $is_partial = true; @@ -68,14 +70,16 @@ class AutoBillInvoice extends AbstractService return $this->invoice; } - info("balance remains to be paid!!"); + info("Auto Bill - balance remains to be paid!! - {$amount}"); /* Retrieve the Client Gateway Token */ $gateway_token = $this->getGateway($amount); /* Bail out if no payment methods available */ - if (! $gateway_token || ! $gateway_token->gateway->driver($this->client)->token_billing) + if (! $gateway_token || ! $gateway_token->gateway->driver($this->client)->token_billing){ + nlog("Bailing out - no suitable gateway token found."); return $this->invoice; + } /* $gateway fee */ //$fee = $gateway_token->gateway->calcGatewayFee($amount, $gateway_token->gateway_type_id, $this->invoice->uses_inclusive_taxes);