diff --git a/app/Services/Payment/RefundPayment.php b/app/Services/Payment/RefundPayment.php index ac4e31a4c6..961366a011 100644 --- a/app/Services/Payment/RefundPayment.php +++ b/app/Services/Payment/RefundPayment.php @@ -72,17 +72,15 @@ class RefundPayment { if ($this->refund_data['gateway_refund'] !== false && $this->total_refund > 0) { if ($this->payment->company_gateway) { - $response = $gateway->driver($this->payment->client)->refund($this->payment, $this->total_refund); + $response = $this->payment->company_gateway->driver($this->payment->client)->refund($this->payment, $this->total_refund); - if ($response['success']) { + if ($response['success'] == false) { throw new PaymentRefundFailed(); } $this->payment->refunded += $this->total_refund; - $this - ->createActivity($gateway) - ->updateCreditNoteBalance(); + $this->createActivity($this->payment); } } else { $this->payment->refunded += $this->total_refund; @@ -106,7 +104,7 @@ class RefundPayment $fields->user_id = $this->payment->user_id; $fields->company_id = $this->payment->company_id; $fields->activity_type_id = Activity::REFUNDED_PAYMENT; - $fields->credit_id = $this->credit_note->id; + // $fields->credit_id = $this->credit_note->id; // TODO $fields->notes = json_encode($notes); if (isset($this->refund_data['invoices'])) {