mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-03 07:24:34 -04:00
Fixes for the Forte payment driver
This commit is contained in:
parent
194defa49c
commit
3466d53845
@ -33,10 +33,11 @@ class QuoteFilters extends QueryFilters
|
|||||||
}
|
}
|
||||||
|
|
||||||
return $this->builder->where(function ($query) use ($filter) {
|
return $this->builder->where(function ($query) use ($filter) {
|
||||||
$query->where('quotes.custom_value1', 'like', '%'.$filter.'%')
|
$query->where('quotes.number', 'like', '%'.$filter.'%')
|
||||||
->orWhere('quotes.custom_value2', 'like', '%'.$filter.'%')
|
->orwhere('quotes.custom_value1', 'like', '%'.$filter.'%')
|
||||||
->orWhere('quotes.custom_value3', 'like', '%'.$filter.'%')
|
->orWhere('quotes.custom_value2', 'like', '%'.$filter.'%')
|
||||||
->orWhere('quotes.custom_value4', 'like', '%'.$filter.'%');
|
->orWhere('quotes.custom_value3', 'like', '%'.$filter.'%')
|
||||||
|
->orWhere('quotes.custom_value4', 'like', '%'.$filter.'%');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,8 +56,6 @@ class InvoiceController extends Controller
|
|||||||
{
|
{
|
||||||
set_time_limit(0);
|
set_time_limit(0);
|
||||||
|
|
||||||
// $invoice->service()->removeUnpaidGatewayFees()->save();
|
|
||||||
|
|
||||||
$invitation = $invoice->invitations()->where('client_contact_id', auth()->guard('contact')->user()->id)->first();
|
$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) {
|
if ($invitation && auth()->guard('contact') && ! session()->get('is_silent') && ! $invitation->viewed_date) {
|
||||||
|
@ -26,7 +26,7 @@ class UpdateAccountRequest extends Request
|
|||||||
*/
|
*/
|
||||||
public function authorize()
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -33,7 +33,6 @@ class UpdateBankTransactionRequest extends Request
|
|||||||
/* Ensure we have a client name, and that all emails are unique*/
|
/* Ensure we have a client name, and that all emails are unique*/
|
||||||
$rules = [
|
$rules = [
|
||||||
'date' => 'bail|required|date',
|
'date' => 'bail|required|date',
|
||||||
'description' => 'bail|sometimes|string',
|
|
||||||
'amount' => 'numeric|required',
|
'amount' => 'numeric|required',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -89,18 +89,23 @@ class CreditCard
|
|||||||
|
|
||||||
public function paymentResponse(PaymentResponseRequest $request)
|
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;
|
$amount_with_fee = $payment_hash->data->total->amount_with_fee;
|
||||||
$invoice_totals = $payment_hash->data->total->invoice_totals;
|
$invoice_totals = $payment_hash->data->total->invoice_totals;
|
||||||
$fee_total = 0;
|
$fee_total = 0;
|
||||||
|
|
||||||
for ($i = ($invoice_totals * 100) ; $i < ($amount_with_fee * 100); $i++) {
|
$fees_and_limits = $this->forte->company_gateway->getFeesAndLimits(GatewayType::CREDIT_CARD);
|
||||||
$calculated_fee = ( 3 * $i) / 100;
|
|
||||||
$calculated_amount_with_fee = round(($i + $calculated_fee) / 100,2);
|
if(property_exists($fees_and_limits, 'fee_percent') && $fees_and_limits->fee_percent > 0)
|
||||||
if ($calculated_amount_with_fee == $amount_with_fee) {
|
{
|
||||||
$fee_total = round($calculated_fee / 100,2);
|
for ($i = ($invoice_totals * 100) ; $i < ($amount_with_fee * 100); $i++) {
|
||||||
$amount_with_fee = $calculated_amount_with_fee;
|
$calculated_fee = ( 3 * $i) / 100;
|
||||||
break;
|
$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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,15 +106,6 @@ class SquarePaymentDriver extends BaseDriver
|
|||||||
/** @var ApiResponse */
|
/** @var ApiResponse */
|
||||||
$response = $this->square->getRefundsApi()->refund($body);
|
$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)
|
public function tokenBilling(ClientGatewayToken $cgt, PaymentHash $payment_hash)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user