diff --git a/app/Services/Payment/RefundPayment.php b/app/Services/Payment/RefundPayment.php index 60dd10acb1db..1c84507ce082 100644 --- a/app/Services/Payment/RefundPayment.php +++ b/app/Services/Payment/RefundPayment.php @@ -119,10 +119,14 @@ class RefundPayment private function calculateTotalRefund() { - if (isset($this->refund_data['invoices']) && count($this->refund_data['invoices']) > 0) + if (array_key_exists('invoices', $this->refund_data) && count($this->refund_data['invoices']) > 0){ + info("array of invoice to refund"); $this->total_refund = collect($this->refund_data['invoices'])->sum('amount'); - else + } + else{ + info("no invoices found - refunding total."); $this->total_refund = $this->refund_data['amount']; + } return $this; } @@ -145,8 +149,8 @@ class RefundPayment $this->credit_note->date = $this->refund_data['date']; $this->credit_note->status_id = Credit::STATUS_SENT; $this->credit_note->client_id = $this->payment->client->id; - $this->credit_note->amount = $this->refund_data['amount']; - $this->credit_note->balance = $this->refund_data['amount']; + $this->credit_note->amount = $this->total_refund; + $this->credit_note->balance = $this->total_refund; $this->credit_note->save(); $this->credit_note->number = $this->payment->client->getNextCreditNumber($this->payment->client); diff --git a/config/ninja.php b/config/ninja.php index 8675ced52548..61cfd167f2cb 100644 --- a/config/ninja.php +++ b/config/ninja.php @@ -12,8 +12,8 @@ return [ 'require_https' => env('REQUIRE_HTTPS', true), 'app_url' => env('APP_URL', ''), 'app_domain' => env('APP_DOMAIN', ''), - 'app_version' => '5.0.4', - 'minimum_client_version' => '5.0.4', + 'app_version' => '5.0.5', + 'minimum_client_version' => '5.0.11', 'terms_version' => '1.0.1', 'api_secret' => env('API_SECRET', ''), 'google_maps_api_key' => env('GOOGLE_MAPS_API_KEY'),