diff --git a/app/Filters/QuoteFilters.php b/app/Filters/QuoteFilters.php index 1c1d298eba..f619559b62 100644 --- a/app/Filters/QuoteFilters.php +++ b/app/Filters/QuoteFilters.php @@ -33,10 +33,11 @@ class QuoteFilters extends QueryFilters } return $this->builder->where(function ($query) use ($filter) { - $query->where('quotes.custom_value1', 'like', '%'.$filter.'%') - ->orWhere('quotes.custom_value2', 'like', '%'.$filter.'%') - ->orWhere('quotes.custom_value3', 'like', '%'.$filter.'%') - ->orWhere('quotes.custom_value4', 'like', '%'.$filter.'%'); + $query->where('quotes.number', 'like', '%'.$filter.'%') + ->orwhere('quotes.custom_value1', 'like', '%'.$filter.'%') + ->orWhere('quotes.custom_value2', 'like', '%'.$filter.'%') + ->orWhere('quotes.custom_value3', 'like', '%'.$filter.'%') + ->orWhere('quotes.custom_value4', 'like', '%'.$filter.'%'); }); } diff --git a/app/Http/Controllers/ClientPortal/InvoiceController.php b/app/Http/Controllers/ClientPortal/InvoiceController.php index 4b835e8ef4..622b64d20e 100644 --- a/app/Http/Controllers/ClientPortal/InvoiceController.php +++ b/app/Http/Controllers/ClientPortal/InvoiceController.php @@ -56,8 +56,6 @@ class InvoiceController extends Controller { set_time_limit(0); - // $invoice->service()->removeUnpaidGatewayFees()->save(); - $invitation = $invoice->invitations()->where('client_contact_id', auth()->guard('contact')->user()->id)->first(); if ($invitation && auth()->guard('contact') && ! session()->get('is_silent') && ! $invitation->viewed_date) { diff --git a/app/Http/Requests/Account/UpdateAccountRequest.php b/app/Http/Requests/Account/UpdateAccountRequest.php index f39af8be11..1ac2534ea6 100644 --- a/app/Http/Requests/Account/UpdateAccountRequest.php +++ b/app/Http/Requests/Account/UpdateAccountRequest.php @@ -26,7 +26,7 @@ class UpdateAccountRequest extends Request */ public function authorize() { - return (auth()->user()->isAdmin() || auth()->user()->isOwner()) && (int) $this->account->id === auth()->user()->account_id; + return (auth()->user()->isAdmin() || auth()->user()->isOwner()) && ($this->account->id == auth()->user()->account_id); } /** diff --git a/app/Http/Requests/BankTransaction/UpdateBankTransactionRequest.php b/app/Http/Requests/BankTransaction/UpdateBankTransactionRequest.php index fb5927590d..9fa3f7ccb2 100644 --- a/app/Http/Requests/BankTransaction/UpdateBankTransactionRequest.php +++ b/app/Http/Requests/BankTransaction/UpdateBankTransactionRequest.php @@ -33,7 +33,6 @@ class UpdateBankTransactionRequest extends Request /* Ensure we have a client name, and that all emails are unique*/ $rules = [ 'date' => 'bail|required|date', - 'description' => 'bail|sometimes|string', 'amount' => 'numeric|required', ]; diff --git a/app/PaymentDrivers/Forte/CreditCard.php b/app/PaymentDrivers/Forte/CreditCard.php index 2ff3b94f3e..336ef7b525 100644 --- a/app/PaymentDrivers/Forte/CreditCard.php +++ b/app/PaymentDrivers/Forte/CreditCard.php @@ -89,18 +89,23 @@ class CreditCard public function paymentResponse(PaymentResponseRequest $request) { - $payment_hash = PaymentHash::whereRaw('BINARY `hash`= ?', [$request->input('payment_hash')])->firstOrFail(); + $payment_hash = PaymentHash::where('hash', $request->input('payment_hash'))->firstOrFail(); $amount_with_fee = $payment_hash->data->total->amount_with_fee; $invoice_totals = $payment_hash->data->total->invoice_totals; $fee_total = 0; - for ($i = ($invoice_totals * 100) ; $i < ($amount_with_fee * 100); $i++) { - $calculated_fee = ( 3 * $i) / 100; - $calculated_amount_with_fee = round(($i + $calculated_fee) / 100,2); - if ($calculated_amount_with_fee == $amount_with_fee) { - $fee_total = round($calculated_fee / 100,2); - $amount_with_fee = $calculated_amount_with_fee; - break; + $fees_and_limits = $this->forte->company_gateway->getFeesAndLimits(GatewayType::CREDIT_CARD); + + if(property_exists($fees_and_limits, 'fee_percent') && $fees_and_limits->fee_percent > 0) + { + for ($i = ($invoice_totals * 100) ; $i < ($amount_with_fee * 100); $i++) { + $calculated_fee = ( 3 * $i) / 100; + $calculated_amount_with_fee = round(($i + $calculated_fee) / 100,2); + if ($calculated_amount_with_fee == $amount_with_fee) { + $fee_total = round($calculated_fee / 100,2); + $amount_with_fee = $calculated_amount_with_fee; + break; + } } } diff --git a/app/PaymentDrivers/SquarePaymentDriver.php b/app/PaymentDrivers/SquarePaymentDriver.php index 44acfbfc64..2e6c1659f5 100644 --- a/app/PaymentDrivers/SquarePaymentDriver.php +++ b/app/PaymentDrivers/SquarePaymentDriver.php @@ -106,15 +106,6 @@ class SquarePaymentDriver extends BaseDriver /** @var ApiResponse */ $response = $this->square->getRefundsApi()->refund($body); - // if ($response->isSuccess()) { - // return [ - // 'transaction_reference' => $refund->action_id, - // 'transaction_response' => json_encode($response), - // 'success' => $checkout_payment->status == 'Refunded', - // 'description' => $checkout_payment->status, - // 'code' => $checkout_payment->http_code, - // ]; - // } } public function tokenBilling(ClientGatewayToken $cgt, PaymentHash $payment_hash)