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

Minor fixes for Stripe connect webhooks

This commit is contained in:
David Bomba 2022-05-14 07:54:19 +10:00
parent 0c55a9968d
commit 3b6a4b7538
2 changed files with 9 additions and 2 deletions

View File

@ -131,7 +131,7 @@ class NinjaMailerJob implements ShouldQueue
$response = $e->getResponse();
$message_body = json_decode($response->getBody()->getContents());
if(property_exists($message_body, 'Message')){
if($message_body && property_exists($message_body, 'Message')){
$message = $message_body->Message;
nlog($message);
}
@ -268,9 +268,10 @@ class NinjaMailerJob implements ShouldQueue
return false;
/* On the hosted platform, if the user is over the email quotas, we do not send the email. */
if(Ninja::isHosted() && $this->company->account->emailQuotaExceeded())
if(Ninja::isHosted() && $this->company->account && $this->company->account->emailQuotaExceeded())
return true;
/* Ensure the user has a valid email address */
if(!str_contains($this->nmo->to_user->email, "@"))
return true;

View File

@ -601,9 +601,14 @@ class StripePaymentDriver extends BaseDriver
}
} elseif ($request->type === 'source.chargeable') {
$this->init();
foreach ($request->data as $transaction) {
if(!$request->data['object']['amount'] || empty($request->data['object']['amount']))
continue;
$charge = \Stripe\Charge::create([
'amount' => $request->data['object']['amount'],
'currency' => $request->data['object']['currency'],
@ -619,6 +624,7 @@ class StripePaymentDriver extends BaseDriver
->orWhere('transaction_reference', $transaction['id']);
})
->first();
if ($payment) {
$payment->status_id = Payment::STATUS_COMPLETED;
$payment->save();