From cd11889044c52795dad646cdb3a4d385b1db0df8 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Tue, 3 Oct 2023 00:31:51 +1100 Subject: [PATCH 01/12] v5.7.26 --- VERSION.txt | 2 +- config/ninja.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/VERSION.txt b/VERSION.txt index fac458944652..518765f54ea8 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1 +1 @@ -5.7.24 \ No newline at end of file +5.7.26 \ No newline at end of file diff --git a/config/ninja.php b/config/ninja.php index 884d337903b6..268998f55115 100644 --- a/config/ninja.php +++ b/config/ninja.php @@ -15,8 +15,8 @@ return [ 'require_https' => env('REQUIRE_HTTPS', true), 'app_url' => rtrim(env('APP_URL', ''), '/'), 'app_domain' => env('APP_DOMAIN', 'invoicing.co'), - 'app_version' => env('APP_VERSION','5.7.24'), - 'app_tag' => env('APP_TAG','5.7.24'), + 'app_version' => env('APP_VERSION','5.7.26'), + 'app_tag' => env('APP_TAG','5.7.26'), 'minimum_client_version' => '5.0.16', 'terms_version' => '1.0.1', 'api_secret' => env('API_SECRET', ''), From 7b8529ca95e8b741879382d22fa18456bb626d98 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Tue, 3 Oct 2023 08:36:10 +1100 Subject: [PATCH 02/12] Fixes for braintree --- config/beacon.php | 4 ---- .../ninja2020/gateways/braintree/ach/authorize.blade.php | 4 +++- .../portal/ninja2020/gateways/braintree/ach/pay.blade.php | 2 +- .../ninja2020/gateways/braintree/credit_card/pay.blade.php | 4 +++- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/config/beacon.php b/config/beacon.php index 8fff666a8173..2ba9017a06bd 100644 --- a/config/beacon.php +++ b/config/beacon.php @@ -36,10 +36,6 @@ return [ * the built in metrics. */ 'system_logging' => [ - 'Turbo124\Beacon\Jobs\System\CpuMetric', - 'Turbo124\Beacon\Jobs\System\HdMetric', - 'Turbo124\Beacon\Jobs\System\MemMetric', - App\Jobs\Ninja\CheckDbStatus::class, ], ]; diff --git a/resources/views/portal/ninja2020/gateways/braintree/ach/authorize.blade.php b/resources/views/portal/ninja2020/gateways/braintree/ach/authorize.blade.php index 4f2e9918b587..602ece639370 100644 --- a/resources/views/portal/ninja2020/gateways/braintree/ach/authorize.blade.php +++ b/resources/views/portal/ninja2020/gateways/braintree/ach/authorize.blade.php @@ -92,5 +92,7 @@ @section('gateway_footer') - @vite('resources/js/clients/payment_methods/braintree-ach.js') + + + @endsection diff --git a/resources/views/portal/ninja2020/gateways/braintree/ach/pay.blade.php b/resources/views/portal/ninja2020/gateways/braintree/ach/pay.blade.php index 50f87edcd4bb..c89e84297f30 100644 --- a/resources/views/portal/ninja2020/gateways/braintree/ach/pay.blade.php +++ b/resources/views/portal/ninja2020/gateways/braintree/ach/pay.blade.php @@ -43,7 +43,7 @@ @endsection @push('footer') - + @endsection
\ No newline at end of file From f80767bcfce9ca8f60e5d1385554893208c88836 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Tue, 3 Oct 2023 09:08:27 +1100 Subject: [PATCH 03/12] Minor fixes for eway --- .../build/assets/eway-credit-card-19df3242.js | 9 ------- public/build/manifest.json | 2 +- .../js/clients/payments/eway-credit-card.js | 27 ++++++++++--------- 3 files changed, 16 insertions(+), 22 deletions(-) delete mode 100644 public/build/assets/eway-credit-card-19df3242.js diff --git a/public/build/assets/eway-credit-card-19df3242.js b/public/build/assets/eway-credit-card-19df3242.js deleted file mode 100644 index a586de3bc9a9..000000000000 --- a/public/build/assets/eway-credit-card-19df3242.js +++ /dev/null @@ -1,9 +0,0 @@ -/** - * Invoice Ninja (https://invoiceninja.com). - * - * @link https://github.com/invoiceninja/invoiceninja source repository - * - * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com) - * - * @license https://www.elastic.co/licensing/elastic-license - */class i{constructor(){this.cardStyles="padding: 2px; border: 1px solid #AAA; border-radius: 3px; height: 34px; width: 100%;",this.errorCodes=new Map,this.errorCodes.set("V6000","Validation error"),this.errorCodes.set("V6001","Invalid CustomerIP"),this.errorCodes.set("V6002","Invalid DeviceID"),this.errorCodes.set("V6003","Invalid Request PartnerID"),this.errorCodes.set("V6004","Invalid Request Method"),this.errorCodes.set("V6010","Invalid TransactionType, account not certified for eCome only MOTO or Recurring available"),this.errorCodes.set("V6011","Invalid Payment TotalAmount"),this.errorCodes.set("V6012","Invalid Payment InvoiceDescription"),this.errorCodes.set("V6013","Invalid Payment InvoiceNumber"),this.errorCodes.set("V6014","Invalid Payment InvoiceReference"),this.errorCodes.set("V6015","Invalid Payment CurrencyCode"),this.errorCodes.set("V6016","Payment Required"),this.errorCodes.set("V6017","Payment CurrencyCode Required"),this.errorCodes.set("V6018","Unknown Payment CurrencyCode"),this.errorCodes.set("V6019","Cardholder identity authentication required"),this.errorCodes.set("V6020","Cardholder Input Required"),this.errorCodes.set("V6021","EWAY_CARDHOLDERNAME Required"),this.errorCodes.set("V6022","EWAY_CARDNUMBER Required"),this.errorCodes.set("V6023","EWAY_CARDCVN Required"),this.errorCodes.set("V6024","Cardholder Identity Authentication One Time Password Not Active Yet"),this.errorCodes.set("V6025","PIN Required"),this.errorCodes.set("V6033","Invalid Expiry Date"),this.errorCodes.set("V6034","Invalid Issue Number"),this.errorCodes.set("V6035","Invalid Valid From Date"),this.errorCodes.set("V6039","Invalid Network Token Status"),this.errorCodes.set("V6040","Invalid TokenCustomerID"),this.errorCodes.set("V6041","Customer Required"),this.errorCodes.set("V6042","Customer FirstName Required"),this.errorCodes.set("V6043","Customer LastName Required"),this.errorCodes.set("V6044","Customer CountryCode Required"),this.errorCodes.set("V6045","Customer Title Required"),this.errorCodes.set("V6046","TokenCustomerID Required"),this.errorCodes.set("V6047","RedirectURL Required"),this.errorCodes.set("V6048","CheckoutURL Required when CheckoutPayment specified"),this.errorCodes.set("V6049","nvalid Checkout URL"),this.errorCodes.set("V6051","Invalid Customer FirstName"),this.errorCodes.set("V6052","Invalid Customer LastName"),this.errorCodes.set("V6053","Invalid Customer CountryCode"),this.errorCodes.set("V6058","Invalid Customer Title"),this.errorCodes.set("V6059","Invalid RedirectURL"),this.errorCodes.set("V6060","Invalid TokenCustomerID"),this.errorCodes.set("V6061","Invalid Customer Reference"),this.errorCodes.set("V6062","Invalid Customer CompanyName"),this.errorCodes.set("V6063","Invalid Customer JobDescription"),this.errorCodes.set("V6064","Invalid Customer Street1"),this.errorCodes.set("V6065","Invalid Customer Street2"),this.errorCodes.set("V6066","Invalid Customer City"),this.errorCodes.set("V6067","Invalid Customer State"),this.errorCodes.set("V6068","Invalid Customer PostalCode"),this.errorCodes.set("V6069","Invalid Customer Email"),this.errorCodes.set("V6070","Invalid Customer Phone"),this.errorCodes.set("V6071","Invalid Customer Mobile"),this.errorCodes.set("V6072","Invalid Customer Comments"),this.errorCodes.set("V6073","Invalid Customer Fax"),this.errorCodes.set("V6074","Invalid Customer URL"),this.errorCodes.set("V6075","Invalid ShippingAddress FirstName"),this.errorCodes.set("V6076","Invalid ShippingAddress LastName"),this.errorCodes.set("V6077","Invalid ShippingAddress Street1"),this.errorCodes.set("V6078","Invalid ShippingAddress Street2"),this.errorCodes.set("V6079","Invalid ShippingAddress City"),this.errorCodes.set("V6080","Invalid ShippingAddress State"),this.errorCodes.set("V6081","Invalid ShippingAddress PostalCode"),this.errorCodes.set("V6082","Invalid ShippingAddress Email"),this.errorCodes.set("V6083","Invalid ShippingAddress Phone"),this.errorCodes.set("V6084","Invalid ShippingAddress Country"),this.errorCodes.set("V6085","Invalid ShippingAddress ShippingMethod"),this.errorCodes.set("V6086","Invalid ShippingAddress Fax"),this.errorCodes.set("V6091","Unknown Customer CountryCode"),this.errorCodes.set("V6092","Unknown ShippingAddress CountryCode"),this.errorCodes.set("V6093","Insufficient Address Information"),this.errorCodes.set("V6100","Invalid EWAY_CARDNAME"),this.errorCodes.set("V6101","Invalid EWAY_CARDEXPIRYMONTH"),this.errorCodes.set("V6102","Invalid EWAY_CARDEXPIRYYEAR"),this.errorCodes.set("V6103","Invalid EWAY_CARDSTARTMONTH"),this.errorCodes.set("V6104","Invalid EWAY_CARDSTARTYEAR"),this.errorCodes.set("V6105","Invalid EWAY_CARDISSUENUMBER"),this.errorCodes.set("V6106","Invalid EWAY_CARDCVN"),this.errorCodes.set("V6107","Invalid EWAY_ACCESSCODE"),this.errorCodes.set("V6108","Invalid CustomerHostAddress"),this.errorCodes.set("V6109","Invalid UserAgent"),this.errorCodes.set("V6110","Invalid EWAY_CARDNUMBER"),this.errorCodes.set("V6111","Unauthorised API Access, Account Not PCI Certified"),this.errorCodes.set("V6112","Redundant card details other than expiry year and month"),this.errorCodes.set("V6113","Invalid transaction for refund"),this.errorCodes.set("V6114","Gateway validation error"),this.errorCodes.set("V6115","Invalid DirectRefundRequest, Transaction ID"),this.errorCodes.set("V6116","Invalid card data on original TransactionID"),this.errorCodes.set("V6117","Invalid CreateAccessCodeSharedRequest, FooterText"),this.errorCodes.set("V6118","Invalid CreateAccessCodeSharedRequest, HeaderText"),this.errorCodes.set("V6119","Invalid CreateAccessCodeSharedRequest, Language"),this.errorCodes.set("V6120","Invalid CreateAccessCodeSharedRequest, LogoUrl"),this.errorCodes.set("V6121","Invalid TransactionSearch, Filter Match Type"),this.errorCodes.set("V6122","Invalid TransactionSearch, Non numeric Transaction ID"),this.errorCodes.set("V6123","Invalid TransactionSearch,no TransactionID or AccessCode specified"),this.errorCodes.set("V6124","Invalid Line Items. The line items have been provided however the totals do not match the TotalAmount field"),this.errorCodes.set("V6125","Selected Payment Type not enabled"),this.errorCodes.set("V6126","Invalid encrypted card number, decryption failed"),this.errorCodes.set("V6127","Invalid encrypted cvn, decryption failed"),this.errorCodes.set("V6128","Invalid Method for Payment Type"),this.errorCodes.set("V6129","Transaction has not been authorised for Capture/Cancellation"),this.errorCodes.set("V6130","Generic customer information error"),this.errorCodes.set("V6131","Generic shipping information error"),this.errorCodes.set("V6132","Transaction has already been completed or voided, operation not permitted"),this.errorCodes.set("V6133","Checkout not available for Payment Type"),this.errorCodes.set("V6134","Invalid Auth Transaction ID for Capture/Void"),this.errorCodes.set("V6135","PayPal Error Processing Refund"),this.errorCodes.set("V6136","Original transaction does not exist or state is incorrect"),this.errorCodes.set("V6140","Merchant account is suspended"),this.errorCodes.set("V6141","Invalid PayPal account details or API signature"),this.errorCodes.set("V6142","Authorise not available for Bank/Branch"),this.errorCodes.set("V6143","Invalid Public Key"),this.errorCodes.set("V6144","Method not available with Public API Key Authentication"),this.errorCodes.set("V6145","Credit Card not allow if Token Customer ID is provided with Public API Key Authentication"),this.errorCodes.set("V6146","Client Side Encryption Key Missing or Invalid"),this.errorCodes.set("V6147","Unable to Create One Time Code for Secure Field"),this.errorCodes.set("V6148","Secure Field has Expired"),this.errorCodes.set("V6149","Invalid Secure Field One Time Code"),this.errorCodes.set("V6150","Invalid Refund Amount"),this.errorCodes.set("V6151","Refund amount greater than original transaction"),this.errorCodes.set("V6152","Original transaction already refunded for total amount"),this.errorCodes.set("V6153","Card type not support by merchant"),this.errorCodes.set("V6154","Insufficent Funds Available For Refund"),this.errorCodes.set("V6155","Missing one or more fields in request"),this.errorCodes.set("V6160","Encryption Method Not Supported"),this.errorCodes.set("V6161","Encryption failed, missing or invalid key"),this.errorCodes.set("V6165","Invalid Click-to-Pay (Visa Checkout) data or decryption failed"),this.errorCodes.set("V6170","Invalid TransactionSearch, Invoice Number is not unique"),this.errorCodes.set("V6171","Invalid TransactionSearch, Invoice Number not found"),this.errorCodes.set("V6220","Three domain secure XID invalid"),this.errorCodes.set("V6221","Three domain secure ECI invalid"),this.errorCodes.set("V6222","Three domain secure AVV invalid"),this.errorCodes.set("V6223","Three domain secure XID is required"),this.errorCodes.set("V6224","Three Domain Secure ECI is required"),this.errorCodes.set("V6225","Three Domain Secure AVV is required"),this.errorCodes.set("V6226","Three Domain Secure AuthStatus is required"),this.errorCodes.set("V6227","Three Domain Secure AuthStatus invalid"),this.errorCodes.set("V6228","Three domain secure Version is required"),this.errorCodes.set("V6230","Three domain secure Directory Server Txn ID invalid"),this.errorCodes.set("V6231","Three domain secure Directory Server Txn ID is required"),this.errorCodes.set("V6232","Three domain secure Version is invalid"),this.errorCodes.set("V6501","Invalid Amex InstallementPlan"),this.errorCodes.set("V6502","Invalid Number Of Installements for Amex. Valid values are from 0 to 99 inclusive"),this.errorCodes.set("V6503","Merchant Amex ID required"),this.errorCodes.set("V6504","Invalid Merchant Amex ID"),this.errorCodes.set("V6505","Merchant Terminal ID required"),this.errorCodes.set("V6506","Merchant category code required"),this.errorCodes.set("V6507","Invalid merchant category code"),this.errorCodes.set("V6508","Amex 3D ECI required"),this.errorCodes.set("V6509","Invalid Amex 3D ECI"),this.errorCodes.set("V6510","Invalid Amex 3D verification value"),this.errorCodes.set("V6511","Invalid merchant location data"),this.errorCodes.set("V6512","Invalid merchant street address"),this.errorCodes.set("V6513","Invalid merchant city"),this.errorCodes.set("V6514","Invalid merchant country"),this.errorCodes.set("V6515","Invalid merchant phone"),this.errorCodes.set("V6516","Invalid merchant postcode"),this.errorCodes.set("V6517","Amex connection error"),this.errorCodes.set("V6518","Amex EC Card Details API returned invalid data"),this.errorCodes.set("V6520","Invalid or missing Amex Point Of Sale Data"),this.errorCodes.set("V6521","Invalid or missing Amex transaction date time"),this.errorCodes.set("V6522","Invalid or missing Amex Original transaction date time"),this.errorCodes.set("V6530","Credit Card Number in non Credit Card Field")}get groupFieldConfig(){var e,t,r,s,o;return{publicApiKey:(e=document.querySelector("meta[name=public-api-key]"))==null?void 0:e.content,fieldDivId:"eway-secure-panel",fieldType:"group",styles:"",layout:{fonts:["Lobster"],rows:[{styles:"",cells:[{colSpan:12,styles:"margin-top: 15px;",label:{fieldColSpan:4,text:(t=document.querySelector("meta[name=translation-card-name]"))==null?void 0:t.content,styles:""},field:{fieldColSpan:8,fieldType:"name",styles:this.cardStyles,divStyles:"padding-left: 10px;"}},{colSpan:12,styles:"margin-top: 15px;",label:{fieldColSpan:4,text:(r=document.querySelector("meta[name=translation-expiry_date]"))==null?void 0:r.content,styles:""},field:{fieldColSpan:8,fieldType:"expirytext",styles:this.cardStyles,divStyles:"padding-left: 10px;"}}]},{styles:"",cells:[{colSpan:12,styles:"margin-top: 15px;",label:{fieldColSpan:4,text:(s=document.querySelector("meta[name=translation-card_number]"))==null?void 0:s.content,styles:""},field:{fieldColSpan:8,fieldType:"card",styles:this.cardStyles}},{colSpan:12,styles:"margin-top: 15px;",label:{fieldColSpan:4,text:(o=document.querySelector("meta[name=translation-cvv]"))==null?void 0:o.content,styles:""},field:{fieldColSpan:8,fieldType:"cvn",styles:this.cardStyles}}]}]}}}securePanelCallback(e){if(document.getElementById("errors").hidden=!0,e.errors)return this.handleErrors(e.errors);document.getElementById("authorize-card")&&(document.getElementById("authorize-card").disabled=!1),document.getElementById("pay-now")&&(document.getElementById("pay-now").disabled=!1),document.querySelector("input[name=securefieldcode]").value=e.secureFieldCode}handleErrors(e){let t=e.split(" "),r="";t.forEach(s=>{r=r.concat(this.errorCodes.get(s)+"
")}),document.getElementById("errors").innerHTML=r,document.getElementById("errors").hidden=!1}completeAuthorization(e){e.target.parentElement.disabled=!0,document.getElementById("server-response").submit()}completePaymentUsingToken(e){e.target.parentElement.disabled=!0,document.getElementById("server-response").submit()}completePaymentWithoutToken(e){e.target.parentElement.disabled=!0;let t=document.querySelector('input[name="token-billing-checkbox"]:checked');t&&(document.querySelector('input[name="store_card"]').value=t.value),document.getElementById("server-response").submit()}initialize(){this.eWAY=eWAY.setupSecureField(this.groupFieldConfig,e=>this.securePanelCallback(e))}handle(){var e,t;this.initialize(),(e=document.getElementById("authorize-card"))==null||e.addEventListener("click",r=>this.completeAuthorization(r)),Array.from(document.getElementsByClassName("toggle-payment-with-token")).forEach(r=>r.addEventListener("click",s=>{document.getElementById("eway-secure-panel").classList.add("hidden"),document.getElementById("save-card--container").style.display="none",document.querySelector("input[name=token]").value=s.target.dataset.token,document.getElementById("pay-now").disabled=!1})),document.getElementById("toggle-payment-with-credit-card").addEventListener("click",r=>{document.getElementById("eway-secure-panel").classList.remove("hidden"),document.getElementById("save-card--container").style.display="grid",document.querySelector("input[name=token]").value="",document.getElementById("pay-now").disabled=!0}),(t=document.getElementById("pay-now"))==null||t.addEventListener("click",r=>document.querySelector("input[name=token]").value?this.completePaymentUsingToken(r):this.completePaymentWithoutToken(r))}}new i().handle(); diff --git a/public/build/manifest.json b/public/build/manifest.json index 6db392895bb8..62fe8624e99b 100644 --- a/public/build/manifest.json +++ b/public/build/manifest.json @@ -76,7 +76,7 @@ "src": "resources/js/clients/payments/checkout-credit-card.js" }, "resources/js/clients/payments/eway-credit-card.js": { - "file": "assets/eway-credit-card-19df3242.js", + "file": "assets/eway-credit-card-62ce5f3b.js", "isEntry": true, "src": "resources/js/clients/payments/eway-credit-card.js" }, diff --git a/resources/js/clients/payments/eway-credit-card.js b/resources/js/clients/payments/eway-credit-card.js index 3b0c3f6053c8..3d4f99297e70 100644 --- a/resources/js/clients/payments/eway-credit-card.js +++ b/resources/js/clients/payments/eway-credit-card.js @@ -469,7 +469,7 @@ class EwayRapid { ?.addEventListener('click', (e) => this.completeAuthorization(e)); Array.from( - document.getElementsByClassName('toggle-payment-with-token') + document.getElementsByClassName('toggle-payment-with-token') ?? [] ).forEach((element) => element.addEventListener('click', (element) => { document @@ -483,17 +483,20 @@ class EwayRapid { }) ); - document - .getElementById('toggle-payment-with-credit-card') - .addEventListener('click', (element) => { - document - .getElementById('eway-secure-panel') - .classList.remove('hidden'); - document.getElementById('save-card--container').style.display = - 'grid'; - document.querySelector('input[name=token]').value = ''; - document.getElementById('pay-now').disabled = true; - }); + if (document.getElementById('toggle-payment-with-credit-card')) + { + document + .getElementById('toggle-payment-with-credit-card') + .addEventListener('click', (element) => { + document + .getElementById('eway-secure-panel') + .classList.remove('hidden'); + document.getElementById('save-card--container').style.display = + 'grid'; + document.querySelector('input[name=token]').value = ''; + document.getElementById('pay-now').disabled = true; + }); + } document.getElementById('pay-now')?.addEventListener('click', (e) => { let tokenInput = document.querySelector('input[name=token]'); From 814ac115e804d57ad1f1ea00f2ad0df907a9f3ac Mon Sep 17 00:00:00 2001 From: David Bomba Date: Tue, 3 Oct 2023 14:50:47 +1100 Subject: [PATCH 04/12] Fixes for gocardless invalid credentials --- app/PaymentDrivers/GoCardlessPaymentDriver.php | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/app/PaymentDrivers/GoCardlessPaymentDriver.php b/app/PaymentDrivers/GoCardlessPaymentDriver.php index c798c5c1e989..bd461197f663 100644 --- a/app/PaymentDrivers/GoCardlessPaymentDriver.php +++ b/app/PaymentDrivers/GoCardlessPaymentDriver.php @@ -98,10 +98,17 @@ class GoCardlessPaymentDriver extends BaseDriver public function init(): self { - $this->gateway = new \GoCardlessPro\Client([ - 'access_token' => $this->company_gateway->getConfigField('accessToken'), - 'environment' => $this->company_gateway->getConfigField('testMode') ? \GoCardlessPro\Environment::SANDBOX : \GoCardlessPro\Environment::LIVE, - ]); + try { + $this->gateway = new \GoCardlessPro\Client([ + 'access_token' => $this->company_gateway->getConfigField('accessToken'), + 'environment' => $this->company_gateway->getConfigField('testMode') ? \GoCardlessPro\Environment::SANDBOX : \GoCardlessPro\Environment::LIVE, + ]); + } + catch(\GoCardlessPro\Core\Exception\AuthenticationException $e){ + + throw new \Exception('GoCardless: Invalid Access Token', 403); + + } return $this; } From 08f13cba2a8e81c8f537c3d1b7da5de7488ef199 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Tue, 3 Oct 2023 19:31:17 +1100 Subject: [PATCH 05/12] Fixes for user locale --- app/Export/CSV/BaseExport.php | 1 + app/Models/User.php | 2 +- app/Transformers/RecurringExpenseTransformer.php | 1 - 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Export/CSV/BaseExport.php b/app/Export/CSV/BaseExport.php index ebde41731350..e0344792895c 100644 --- a/app/Export/CSV/BaseExport.php +++ b/app/Export/CSV/BaseExport.php @@ -132,6 +132,7 @@ class BaseExport ]; protected array $invoice_report_keys = [ + 'name' => 'client.name', "invoice_number" => "invoice.number", "amount" => "invoice.amount", "balance" => "invoice.balance", diff --git a/app/Models/User.php b/app/Models/User.php index 8b321a3c932e..22e5130d0df1 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -660,7 +660,7 @@ class User extends Authenticatable implements MustVerifyEmail public function getLocale() { - $locale = $this->language->locale ?? false; + $locale = $this->language->locale ?? null; if($locale) App::setLocale($locale); diff --git a/app/Transformers/RecurringExpenseTransformer.php b/app/Transformers/RecurringExpenseTransformer.php index 62388d1f9a8b..4b48e8654e55 100644 --- a/app/Transformers/RecurringExpenseTransformer.php +++ b/app/Transformers/RecurringExpenseTransformer.php @@ -90,7 +90,6 @@ class RecurringExpenseTransformer extends EntityTransformer 'currency_id' => (string) $recurring_expense->currency_id ?: '', 'category_id' => $this->encodePrimaryKey($recurring_expense->category_id), 'payment_type_id' => (string) $recurring_expense->payment_type_id ?: '', - 'recurring_recurring_expense_id' => (string) $recurring_expense->recurring_recurring_expense_id ?: '', 'is_deleted' => (bool) $recurring_expense->is_deleted, 'should_be_invoiced' => (bool) $recurring_expense->should_be_invoiced, 'invoice_documents' => (bool) $recurring_expense->invoice_documents, From 1c906fcb52bbee2dc9f25398200c77f6739e93b4 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Wed, 4 Oct 2023 00:17:32 +1100 Subject: [PATCH 06/12] Catch up currency_id which is not passed --- .../Requests/Payment/StorePaymentRequest.php | 20 ++++++++++++++----- app/Repositories/PaymentRepository.php | 2 +- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/app/Http/Requests/Payment/StorePaymentRequest.php b/app/Http/Requests/Payment/StorePaymentRequest.php index 97736fda7a55..e51eeb50bc57 100644 --- a/app/Http/Requests/Payment/StorePaymentRequest.php +++ b/app/Http/Requests/Payment/StorePaymentRequest.php @@ -33,11 +33,18 @@ class StorePaymentRequest extends Request */ public function authorize() : bool { - return auth()->user()->can('create', Payment::class); + /** @var \App\Models\User $user */ + $user = auth()->user(); + + return $user->can('create', Payment::class); } public function prepareForValidation() { + + /** @var \App\Models\User $user */ + $user = auth()->user(); + $input = $this->all(); $invoices_total = 0; @@ -86,7 +93,7 @@ class StorePaymentRequest extends Request } if (! isset($input['date'])) { - $input['date'] = now()->addSeconds(auth()->user()->company()->timezone()->utc_offset)->format('Y-m-d'); + $input['date'] = now()->addSeconds($user->company()->timezone()->utc_offset)->format('Y-m-d'); } $this->replace($input); @@ -94,10 +101,13 @@ class StorePaymentRequest extends Request public function rules() { + /** @var \App\Models\User $user */ + $user = auth()->user(); + $rules = [ 'amount' => ['numeric', 'bail', new PaymentAmountsBalanceRule(), new ValidCreditsPresentRule($this->all())], // 'client_id' => 'bail|required|exists:clients,id', - 'client_id' => 'bail|required|exists:clients,id,company_id,'.auth()->user()->company()->id.',is_deleted,0', + 'client_id' => 'bail|required|exists:clients,id,company_id,'.$user->company()->id.',is_deleted,0', 'invoices.*.invoice_id' => 'bail|required|distinct|exists:invoices,id', 'invoices.*.amount' => 'bail|required', 'invoices.*.invoice_id' => new ValidInvoicesRules($this->all()), @@ -105,8 +115,8 @@ class StorePaymentRequest extends Request 'credits.*.credit_id' => new ValidCreditsRules($this->all()), 'credits.*.amount' => ['bail','required', new CreditsSumRule($this->all())], 'invoices' => new ValidPayableInvoicesRule(), - 'number' => ['nullable', 'bail', Rule::unique('payments')->where('company_id', auth()->user()->company()->id)], - 'idempotency_key' => ['nullable', 'bail', 'string','max:64', Rule::unique('payments')->where('company_id', auth()->user()->company()->id)], + 'number' => ['nullable', 'bail', Rule::unique('payments')->where('company_id', $user->company()->id)], + 'idempotency_key' => ['nullable', 'bail', 'string','max:64', Rule::unique('payments')->where('company_id', $user->company()->id)], ]; diff --git a/app/Repositories/PaymentRepository.php b/app/Repositories/PaymentRepository.php index f11a6f3cebd6..114f320cf47b 100644 --- a/app/Repositories/PaymentRepository.php +++ b/app/Repositories/PaymentRepository.php @@ -108,7 +108,7 @@ class PaymentRepository extends BaseRepository $payment->is_manual = true; $payment->status_id = Payment::STATUS_COMPLETED; - if (! $payment->currency_id && $client) { + if ((!$payment->currency_id || $payment->currency_id == 0) && $client) { if (property_exists($client->settings, 'currency_id')) { $payment->currency_id = $client->settings->currency_id; } else { From a0749be96ea416d76228da329cfc3f5957209401 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Wed, 4 Oct 2023 00:54:41 +1100 Subject: [PATCH 07/12] always set the currency_id --- app/Repositories/PaymentRepository.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/Repositories/PaymentRepository.php b/app/Repositories/PaymentRepository.php index 114f320cf47b..6bc842e4b559 100644 --- a/app/Repositories/PaymentRepository.php +++ b/app/Repositories/PaymentRepository.php @@ -101,6 +101,9 @@ class PaymentRepository extends BaseRepository $client->saveQuietly(); } }, 1); + + $client = Client::query()->where('id', $data['client_id'])->withTrashed()->first(); + } /*Fill the payment*/ From b7087a36ecfd25ad7ced0086a65b668505855a1e Mon Sep 17 00:00:00 2001 From: David Bomba Date: Wed, 4 Oct 2023 00:59:20 +1100 Subject: [PATCH 08/12] Fixes for is_react --- app/Http/Controllers/Auth/ContactForgotPasswordController.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/Http/Controllers/Auth/ContactForgotPasswordController.php b/app/Http/Controllers/Auth/ContactForgotPasswordController.php index f6e33e00fee5..c71e7a1076ec 100644 --- a/app/Http/Controllers/Auth/ContactForgotPasswordController.php +++ b/app/Http/Controllers/Auth/ContactForgotPasswordController.php @@ -80,6 +80,7 @@ class ContactForgotPasswordController extends Controller 'passwordEmailRoute' => 'client.password.email', 'account' => $account, 'company' => $company, + 'is_react' => false, ]); } From d88b21a2e292e68a4909caf11eacfe0addb81212 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Wed, 4 Oct 2023 08:26:06 +1100 Subject: [PATCH 09/12] Remove company name from client selector --- .../ninja2020/components/general/sidebar/header.blade.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/views/portal/ninja2020/components/general/sidebar/header.blade.php b/resources/views/portal/ninja2020/components/general/sidebar/header.blade.php index 36079be88655..b2b227c01f39 100644 --- a/resources/views/portal/ninja2020/components/general/sidebar/header.blade.php +++ b/resources/views/portal/ninja2020/components/general/sidebar/header.blade.php @@ -25,7 +25,7 @@ @foreach($multiple_contacts as $contact) {{ $contact->client->present()->name()}} - {{ $contact->company->present()->name() }} + class="block px-4 py-2 text-sm leading-5 text-gray-700 hover:bg-gray-100 hover:text-gray-900 focus:outline-none focus:bg-gray-100 focus:text-gray-900">{{ $contact->client->present()->name()}} @endforeach From a3e8f8ff027fae558f7f6aa21cd1254120b909e3 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Wed, 4 Oct 2023 08:35:54 +1100 Subject: [PATCH 10/12] Updates for filters --- app/Filters/PaymentFilters.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Filters/PaymentFilters.php b/app/Filters/PaymentFilters.php index af094202aaed..bc16744d4be8 100644 --- a/app/Filters/PaymentFilters.php +++ b/app/Filters/PaymentFilters.php @@ -114,7 +114,7 @@ class PaymentFilters extends QueryFilters } if(in_array('partially_unapplied', $status_parameters)) { - $query->where('amount', '>', 'applied')->where('refunded', 0); + $query->whereColumn('amount', '>', 'applied')->where('refunded', 0); } }); From ef166e98030559d483da234f7277f3fb3adc3a37 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Wed, 4 Oct 2023 11:32:45 +1100 Subject: [PATCH 11/12] Reminder tests --- tests/Feature/ReminderTest.php | 38 ++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/tests/Feature/ReminderTest.php b/tests/Feature/ReminderTest.php index ca4265d2ebc1..51e141228ac0 100644 --- a/tests/Feature/ReminderTest.php +++ b/tests/Feature/ReminderTest.php @@ -158,6 +158,44 @@ class ReminderTest extends TestCase } + public function testReminderInThePast() + { + + $translations = new \stdClass; + $translations->late_fee_added = "Fee added :date"; + + $settings = $this->company->settings; + $settings->enable_reminder1 = false; + $settings->schedule_reminder1 = ''; + $settings->num_days_reminder1 = 1; + $settings->enable_reminder2 = false; + $settings->schedule_reminder2 = ''; + $settings->num_days_reminder2 = 2; + $settings->enable_reminder3 = false; + $settings->schedule_reminder3 = ''; + $settings->num_days_reminder3 = 3; + $settings->timezone_id = '29'; + $settings->entity_send_time = 0; + $settings->endless_reminder_frequency_id = '5'; + $settings->enable_reminder_endless = true; + $settings->translations = $translations; + $settings->late_fee_amount1 = '0'; + $settings->late_fee_amount2 = '0'; + $settings->late_fee_amount3 = '0'; + + $this->buildData(($settings)); + + $this->invoice->date = now()->subMonths(2)->format('Y-m-d'); + $this->invoice->due_date = now()->subMonth()->format('Y-m-d'); + $this->invoice->last_sent_date = now(); + + $this->invoice->service()->setReminder($settings)->save(); + + $this->invoice = $this->invoice->fresh(); + + $this->assertEquals(now()->startOfDay()->addMonth()->format('Y-m-d'), \Carbon\Carbon::parse($this->invoice->next_send_date)->startOfDay()->format('Y-m-d')); + } + public function testsForTranslationsInReminders() { From c5569cc89a17052e0fce41d4d9498193d54de496 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Thu, 5 Oct 2023 12:01:00 +1100 Subject: [PATCH 12/12] Updated dependencies + v5.7.26 --- composer.lock | 107 ++++++++++++++++++++++++-------------------------- 1 file changed, 52 insertions(+), 55 deletions(-) diff --git a/composer.lock b/composer.lock index d1741407d1ca..cae23d0ecc8f 100644 --- a/composer.lock +++ b/composer.lock @@ -485,16 +485,16 @@ }, { "name": "aws/aws-sdk-php", - "version": "3.282.0", + "version": "3.283.0", "source": { "type": "git", "url": "https://github.com/aws/aws-sdk-php.git", - "reference": "79a3ed5bb573f592823f8b1cffe0dbac3132e6b4" + "reference": "5084c03431ecda0003e35d7fc7a12eeca4242685" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/79a3ed5bb573f592823f8b1cffe0dbac3132e6b4", - "reference": "79a3ed5bb573f592823f8b1cffe0dbac3132e6b4", + "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/5084c03431ecda0003e35d7fc7a12eeca4242685", + "reference": "5084c03431ecda0003e35d7fc7a12eeca4242685", "shasum": "" }, "require": { @@ -574,9 +574,9 @@ "support": { "forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80", "issues": "https://github.com/aws/aws-sdk-php/issues", - "source": "https://github.com/aws/aws-sdk-php/tree/3.282.0" + "source": "https://github.com/aws/aws-sdk-php/tree/3.283.0" }, - "time": "2023-09-28T18:09:20+00:00" + "time": "2023-10-04T18:08:32+00:00" }, { "name": "bacon/bacon-qr-code", @@ -2169,16 +2169,16 @@ }, { "name": "firebase/php-jwt", - "version": "v6.8.1", + "version": "v6.9.0", "source": { "type": "git", "url": "https://github.com/firebase/php-jwt.git", - "reference": "5dbc8959427416b8ee09a100d7a8588c00fb2e26" + "reference": "f03270e63eaccf3019ef0f32849c497385774e11" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/firebase/php-jwt/zipball/5dbc8959427416b8ee09a100d7a8588c00fb2e26", - "reference": "5dbc8959427416b8ee09a100d7a8588c00fb2e26", + "url": "https://api.github.com/repos/firebase/php-jwt/zipball/f03270e63eaccf3019ef0f32849c497385774e11", + "reference": "f03270e63eaccf3019ef0f32849c497385774e11", "shasum": "" }, "require": { @@ -2226,9 +2226,9 @@ ], "support": { "issues": "https://github.com/firebase/php-jwt/issues", - "source": "https://github.com/firebase/php-jwt/tree/v6.8.1" + "source": "https://github.com/firebase/php-jwt/tree/v6.9.0" }, - "time": "2023-07-14T18:33:00+00:00" + "time": "2023-10-05T00:24:42+00:00" }, { "name": "fruitcake/php-cors", @@ -4287,16 +4287,16 @@ }, { "name": "laravel/framework", - "version": "v10.25.2", + "version": "v10.26.2", "source": { "type": "git", "url": "https://github.com/laravel/framework.git", - "reference": "6014dd456b414b305fb0b408404efdcec18e64bc" + "reference": "6e5440f7c518f26b4495e5d7e4796ec239e26df9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/framework/zipball/6014dd456b414b305fb0b408404efdcec18e64bc", - "reference": "6014dd456b414b305fb0b408404efdcec18e64bc", + "url": "https://api.github.com/repos/laravel/framework/zipball/6e5440f7c518f26b4495e5d7e4796ec239e26df9", + "reference": "6e5440f7c518f26b4495e5d7e4796ec239e26df9", "shasum": "" }, "require": { @@ -4483,20 +4483,20 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2023-09-28T14:08:59+00:00" + "time": "2023-10-03T14:24:20+00:00" }, { "name": "laravel/prompts", - "version": "v0.1.10", + "version": "v0.1.11", "source": { "type": "git", "url": "https://github.com/laravel/prompts.git", - "reference": "37ed55f6950d921a87d5beeab16d03f8de26b060" + "reference": "cce65a90e64712909ea1adc033e1d88de8455ffd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/prompts/zipball/37ed55f6950d921a87d5beeab16d03f8de26b060", - "reference": "37ed55f6950d921a87d5beeab16d03f8de26b060", + "url": "https://api.github.com/repos/laravel/prompts/zipball/cce65a90e64712909ea1adc033e1d88de8455ffd", + "reference": "cce65a90e64712909ea1adc033e1d88de8455ffd", "shasum": "" }, "require": { @@ -4538,9 +4538,9 @@ ], "support": { "issues": "https://github.com/laravel/prompts/issues", - "source": "https://github.com/laravel/prompts/tree/v0.1.10" + "source": "https://github.com/laravel/prompts/tree/v0.1.11" }, - "time": "2023-09-29T07:26:07+00:00" + "time": "2023-10-03T01:07:35+00:00" }, { "name": "laravel/serializable-closure", @@ -9560,16 +9560,16 @@ }, { "name": "sentry/sentry-laravel", - "version": "3.8.0", + "version": "3.8.1", "source": { "type": "git", "url": "https://github.com/getsentry/sentry-laravel.git", - "reference": "c7e7611553f9f90af10ed98dde1a680220f02e4d" + "reference": "b6142a80fa9360a10b786d2da032339602d0e362" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/getsentry/sentry-laravel/zipball/c7e7611553f9f90af10ed98dde1a680220f02e4d", - "reference": "c7e7611553f9f90af10ed98dde1a680220f02e4d", + "url": "https://api.github.com/repos/getsentry/sentry-laravel/zipball/b6142a80fa9360a10b786d2da032339602d0e362", + "reference": "b6142a80fa9360a10b786d2da032339602d0e362", "shasum": "" }, "require": { @@ -9636,7 +9636,7 @@ ], "support": { "issues": "https://github.com/getsentry/sentry-laravel/issues", - "source": "https://github.com/getsentry/sentry-laravel/tree/3.8.0" + "source": "https://github.com/getsentry/sentry-laravel/tree/3.8.1" }, "funding": [ { @@ -9648,7 +9648,7 @@ "type": "custom" } ], - "time": "2023-09-05T11:02:34+00:00" + "time": "2023-10-04T10:21:16+00:00" }, { "name": "setasign/fpdf", @@ -14528,16 +14528,16 @@ }, { "name": "brianium/paratest", - "version": "v7.2.7", + "version": "v7.2.8", "source": { "type": "git", "url": "https://github.com/paratestphp/paratest.git", - "reference": "1526eb4fd195f65075456dee394d14742ae0a66c" + "reference": "882b02d197328138686bb06ce7d8cbb98fc0a16c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/paratestphp/paratest/zipball/1526eb4fd195f65075456dee394d14742ae0a66c", - "reference": "1526eb4fd195f65075456dee394d14742ae0a66c", + "url": "https://api.github.com/repos/paratestphp/paratest/zipball/882b02d197328138686bb06ce7d8cbb98fc0a16c", + "reference": "882b02d197328138686bb06ce7d8cbb98fc0a16c", "shasum": "" }, "require": { @@ -14607,7 +14607,7 @@ ], "support": { "issues": "https://github.com/paratestphp/paratest/issues", - "source": "https://github.com/paratestphp/paratest/tree/v7.2.7" + "source": "https://github.com/paratestphp/paratest/tree/v7.2.8" }, "funding": [ { @@ -14619,7 +14619,7 @@ "type": "paypal" } ], - "time": "2023-09-14T14:10:09+00:00" + "time": "2023-10-04T13:38:04+00:00" }, { "name": "composer/class-map-generator", @@ -15046,16 +15046,16 @@ }, { "name": "friendsofphp/php-cs-fixer", - "version": "v3.34.0", + "version": "v3.34.1", "source": { "type": "git", "url": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer.git", - "reference": "7c7a4ad2ed8fe50df3e25528218b13d383608f23" + "reference": "98bf1b1068b4ceddbbc2a2b70b67a5e380add9e3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/7c7a4ad2ed8fe50df3e25528218b13d383608f23", - "reference": "7c7a4ad2ed8fe50df3e25528218b13d383608f23", + "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/98bf1b1068b4ceddbbc2a2b70b67a5e380add9e3", + "reference": "98bf1b1068b4ceddbbc2a2b70b67a5e380add9e3", "shasum": "" }, "require": { @@ -15076,9 +15076,6 @@ "symfony/process": "^5.4 || ^6.0", "symfony/stopwatch": "^5.4 || ^6.0" }, - "conflict": { - "stevebauman/unfinalize": "*" - }, "require-dev": { "facile-it/paraunit": "^1.3 || ^2.0", "justinrainbow/json-schema": "^5.2", @@ -15132,7 +15129,7 @@ ], "support": { "issues": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues", - "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.34.0" + "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.34.1" }, "funding": [ { @@ -15140,7 +15137,7 @@ "type": "github" } ], - "time": "2023-09-29T15:34:26+00:00" + "time": "2023-10-03T23:51:05+00:00" }, { "name": "hamcrest/hamcrest-php", @@ -15851,16 +15848,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.36", + "version": "1.10.37", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "ffa3089511121a672e62969404e4fddc753f9b15" + "reference": "058ba07e92f744d4dcf6061ae75283d0c6456f2e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/ffa3089511121a672e62969404e4fddc753f9b15", - "reference": "ffa3089511121a672e62969404e4fddc753f9b15", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/058ba07e92f744d4dcf6061ae75283d0c6456f2e", + "reference": "058ba07e92f744d4dcf6061ae75283d0c6456f2e", "shasum": "" }, "require": { @@ -15909,20 +15906,20 @@ "type": "tidelift" } ], - "time": "2023-09-29T14:07:45+00:00" + "time": "2023-10-02T16:18:37+00:00" }, { "name": "phpunit/php-code-coverage", - "version": "10.1.6", + "version": "10.1.7", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "56f33548fe522c8d82da7ff3824b42829d324364" + "reference": "355324ca4980b8916c18b9db29f3ef484078f26e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/56f33548fe522c8d82da7ff3824b42829d324364", - "reference": "56f33548fe522c8d82da7ff3824b42829d324364", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/355324ca4980b8916c18b9db29f3ef484078f26e", + "reference": "355324ca4980b8916c18b9db29f3ef484078f26e", "shasum": "" }, "require": { @@ -15979,7 +15976,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/10.1.6" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/10.1.7" }, "funding": [ { @@ -15987,7 +15984,7 @@ "type": "github" } ], - "time": "2023-09-19T04:59:03+00:00" + "time": "2023-10-04T15:34:17+00:00" }, { "name": "phpunit/php-file-iterator",