Fixes for mollie webhooks

This commit is contained in:
David Bomba 2021-12-04 22:50:12 +11:00
parent 7adaab984b
commit ceab20b829
2 changed files with 5 additions and 5 deletions

View File

@ -263,12 +263,13 @@ class BaseDriver extends AbstractPaymentDriver
event('eloquent.created: App\Models\Payment', $payment);
if ($this->client->getSetting('client_online_payment_notification'))
if ($this->client->getSetting('client_online_payment_notification') && in_array($status, [Payment::STATUS_COMPLETED, Payment::STATUS_PENDING
]))
$payment->service()->sendEmail();
event(new PaymentWasCreated($payment, $payment->company, Ninja::eventVars()));
if (property_exists($this->payment_hash->data, 'billing_context')) {
if (property_exists($this->payment_hash->data, 'billing_context') && $status == Payment::STATUS_COMPLETED) {
$billing_subscription = \App\Models\Subscription::find($this->payment_hash->data->billing_context->subscription_id);
// To access campaign hash => $this->payment_hash->data->billing_context->campaign;

View File

@ -324,7 +324,6 @@ class MolliePaymentDriver extends BaseDriver
/* Harvest Payment Hash*/
$payment_hash = PaymentHash::where('hash', $payment->metadata->hash)->first();
$data = [
'gateway_type_id' => $payment->metadata->gateway_type_id,
'amount' => $amount = array_sum(array_column($payment_hash->invoices(), 'amount')) + $payment_hash->fee_total,