mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-23 20:00:33 -04:00
Fixes for displaying payment gateways where min_limit is enforced
This commit is contained in:
parent
adba1ea547
commit
8e3ccc83ad
@ -83,7 +83,7 @@ class InvoicesTable extends Component
|
|||||||
|
|
||||||
return render('components.livewire.invoices-table', [
|
return render('components.livewire.invoices-table', [
|
||||||
'invoices' => $query,
|
'invoices' => $query,
|
||||||
'gateway_available' => !empty(auth()->user()->client->service()->getPaymentMethods(0)),
|
'gateway_available' => !empty(auth()->user()->client->service()->getPaymentMethods(-1)),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@ class CreatePaymentMethodRequest extends FormRequest
|
|||||||
|
|
||||||
$available_methods = [];
|
$available_methods = [];
|
||||||
|
|
||||||
collect($client->service()->getPaymentMethods(1))
|
collect($client->service()->getPaymentMethods(-1))
|
||||||
->filter(function ($method) use (&$available_methods) {
|
->filter(function ($method) use (&$available_methods) {
|
||||||
$available_methods[] = $method['gateway_type_id'];
|
$available_methods[] = $method['gateway_type_id'];
|
||||||
});
|
});
|
||||||
|
@ -432,7 +432,7 @@ class Client extends BaseModel implements HasLocalePreference
|
|||||||
public function getCreditCardGateway() :?CompanyGateway
|
public function getCreditCardGateway() :?CompanyGateway
|
||||||
{
|
{
|
||||||
|
|
||||||
$pms = $this->service()->getPaymentMethods(0);
|
$pms = $this->service()->getPaymentMethods(-1);
|
||||||
|
|
||||||
foreach($pms as $pm)
|
foreach($pms as $pm)
|
||||||
{
|
{
|
||||||
@ -462,7 +462,7 @@ class Client extends BaseModel implements HasLocalePreference
|
|||||||
//todo refactor this - it is only searching for existing tokens
|
//todo refactor this - it is only searching for existing tokens
|
||||||
public function getBankTransferGateway() :?CompanyGateway
|
public function getBankTransferGateway() :?CompanyGateway
|
||||||
{
|
{
|
||||||
$pms = $this->service()->getPaymentMethods(0);
|
$pms = $this->service()->getPaymentMethods(-1);
|
||||||
|
|
||||||
if($this->currency()->code == 'USD' && in_array(GatewayType::BANK_TRANSFER, array_column($pms, 'gateway_type_id'))){
|
if($this->currency()->code == 'USD' && in_array(GatewayType::BANK_TRANSFER, array_column($pms, 'gateway_type_id'))){
|
||||||
|
|
||||||
|
@ -102,6 +102,7 @@ class Company extends BaseModel
|
|||||||
'markdown_email_enabled',
|
'markdown_email_enabled',
|
||||||
'stop_on_unpaid_recurring',
|
'stop_on_unpaid_recurring',
|
||||||
'use_quote_terms_on_conversion',
|
'use_quote_terms_on_conversion',
|
||||||
|
'show_production_description_dropdown',
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $hidden = [
|
protected $hidden = [
|
||||||
|
@ -132,8 +132,7 @@ class PaymentMethod
|
|||||||
|
|
||||||
private function getMethods()
|
private function getMethods()
|
||||||
{
|
{
|
||||||
// we should prefilter $gateway->driver($this)->gatewayTypes()
|
|
||||||
// and only include the enabled payment methods on the gateway
|
|
||||||
$this->payment_methods = [];
|
$this->payment_methods = [];
|
||||||
|
|
||||||
foreach ($this->gateways as $gateway) {
|
foreach ($this->gateways as $gateway) {
|
||||||
@ -148,13 +147,12 @@ class PaymentMethod
|
|||||||
|
|
||||||
if ($this->validGatewayForAmount($gateway->fees_and_limits->{$type}, $this->amount) && $gateway->fees_and_limits->{$type}->is_enabled) {
|
if ($this->validGatewayForAmount($gateway->fees_and_limits->{$type}, $this->amount) && $gateway->fees_and_limits->{$type}->is_enabled) {
|
||||||
|
|
||||||
// if($type == GatewayType::BANK_TRANSFER);
|
|
||||||
|
|
||||||
$this->payment_methods[] = [$gateway->id => $type];
|
$this->payment_methods[] = [$gateway->id => $type];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
//$this->payment_methods[] = [$gateway->id => $type];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -243,11 +241,11 @@ class PaymentMethod
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((property_exists($fees_and_limits, 'min_limit')) && $fees_and_limits->min_limit !== null && $fees_and_limits->min_limit != -1 && $this->amount < $fees_and_limits->min_limit) {
|
if ((property_exists($fees_and_limits, 'min_limit')) && $fees_and_limits->min_limit !== null && $fees_and_limits->min_limit != -1 && ($this->amount < $fees_and_limits->min_limit && $this->amount != -1)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((property_exists($fees_and_limits, 'max_limit')) && $fees_and_limits->max_limit !== null && $fees_and_limits->max_limit != -1 && $this->amount > $fees_and_limits->max_limit) {
|
if ((property_exists($fees_and_limits, 'max_limit')) && $fees_and_limits->max_limit !== null && $fees_and_limits->max_limit != -1 && ($this->amount > $fees_and_limits->max_limit && $this->amount != -1)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -453,6 +453,9 @@ class Design extends BaseDesign
|
|||||||
foreach ($this->invoices as $invoice) {
|
foreach ($this->invoices as $invoice) {
|
||||||
foreach ($invoice->payments as $payment) {
|
foreach ($invoice->payments as $payment) {
|
||||||
|
|
||||||
|
if($payment->is_deleted)
|
||||||
|
continue;
|
||||||
|
|
||||||
$element = ['element' => 'tr', 'elements' => []];
|
$element = ['element' => 'tr', 'elements' => []];
|
||||||
|
|
||||||
$element['elements'][] = ['element' => 'td', 'content' => $invoice->number];
|
$element['elements'][] = ['element' => 'td', 'content' => $invoice->number];
|
||||||
|
@ -169,6 +169,8 @@ class CompanyTransformer extends EntityTransformer
|
|||||||
'convert_rate_to_client' => (bool) $company->convert_rate_to_client,
|
'convert_rate_to_client' => (bool) $company->convert_rate_to_client,
|
||||||
'markdown_email_enabled' => (bool) $company->markdown_email_enabled,
|
'markdown_email_enabled' => (bool) $company->markdown_email_enabled,
|
||||||
'stop_on_unpaid_recurring' => (bool) $company->stop_on_unpaid_recurring,
|
'stop_on_unpaid_recurring' => (bool) $company->stop_on_unpaid_recurring,
|
||||||
|
'show_production_description_dropdown' => (bool)$company->show_production_description_dropdown,
|
||||||
|
'use_quote_terms_on_conversion' => (bool) $company->use_quote_terms_on_conversion,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,6 +20,7 @@ class AddAutoBillTriesToInvoicesTable extends Migration
|
|||||||
Schema::table('companies', function (Blueprint $table) {
|
Schema::table('companies', function (Blueprint $table) {
|
||||||
$table->boolean('stop_on_unpaid_recurring')->default(0);
|
$table->boolean('stop_on_unpaid_recurring')->default(0);
|
||||||
$table->boolean('use_quote_terms_on_conversion')->default(0);
|
$table->boolean('use_quote_terms_on_conversion')->default(0);
|
||||||
|
$table->boolean('show_production_description_dropdown')->default(0);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user