Minor fixes for auto billing

This commit is contained in:
David Bomba 2022-05-18 14:37:11 +10:00
parent d7a505546c
commit 7f1cf9ea30

View File

@ -123,13 +123,14 @@ class AutoBillInvoice extends AbstractService
->setPaymentHash($payment_hash) ->setPaymentHash($payment_hash)
->tokenBilling($gateway_token, $payment_hash); ->tokenBilling($gateway_token, $payment_hash);
} catch (\Exception $e) { } catch (\Exception $e) {
$this->invoice->auto_bill_tries = $number_of_retries + 1; $this->invoice->auto_bill_tries += 1;
if ($this->invoice->auto_bill_tries == 3) { if ($this->invoice->auto_bill_tries == 3) {
$this->invoice->auto_bill_enabled = false; $this->invoice->auto_bill_enabled = false;
$this->invoice->auto_bill_tries = 0; //reset the counter here in case auto billing is turned on again in the future. $this->invoice->auto_bill_tries = 0; //reset the counter here in case auto billing is turned on again in the future.
$this->invoice->save(); $this->invoice->save();
} }
nlog("payment NOT captured for " . $this->invoice->number . " with error " . $e->getMessage()); nlog("payment NOT captured for " . $this->invoice->number . " with error " . $e->getMessage());
} }