From 03d80d6006c7fddeaee8150a13cc45981043f309 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Fri, 26 Jun 2020 13:32:09 +1000 Subject: [PATCH 1/2] Tweaks for refunding --- app/Services/Payment/RefundPayment.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/app/Services/Payment/RefundPayment.php b/app/Services/Payment/RefundPayment.php index 60dd10acb1..1c84507ce0 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); From d049aca8ca9acbd7adc380724c136860a638552e Mon Sep 17 00:00:00 2001 From: David Bomba Date: Fri, 26 Jun 2020 19:54:43 +1000 Subject: [PATCH 2/2] Update min client version --- config/ninja.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/ninja.php b/config/ninja.php index 8675ced525..61cfd167f2 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'),