mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Fixes for getPaymentMethods
This commit is contained in:
parent
78d726a483
commit
9d27480f2d
@ -107,7 +107,7 @@ class PaymentMethod
|
|||||||
->company
|
->company
|
||||||
->company_gateways
|
->company_gateways
|
||||||
->whereIn('id', $transformed_ids)
|
->whereIn('id', $transformed_ids)
|
||||||
->where('gateway_key', '=', '54faab2ab6e3223dbe848b1686490baa')
|
->where('gateway_key', '54faab2ab6e3223dbe848b1686490baa')
|
||||||
->sortby(function ($model) use ($transformed_ids) { //company gateways are sorted in order of priority
|
->sortby(function ($model) use ($transformed_ids) { //company gateways are sorted in order of priority
|
||||||
return array_search($model->id, $transformed_ids);// this closure sorts for us
|
return array_search($model->id, $transformed_ids);// this closure sorts for us
|
||||||
});
|
});
|
||||||
@ -117,7 +117,7 @@ class PaymentMethod
|
|||||||
$this->gateways = $this->client
|
$this->gateways = $this->client
|
||||||
->company
|
->company
|
||||||
->company_gateways
|
->company_gateways
|
||||||
->where('gateway_key', '=', '54faab2ab6e3223dbe848b1686490baa')
|
->where('gateway_key', '54faab2ab6e3223dbe848b1686490baa')
|
||||||
->where('is_deleted', false);
|
->where('is_deleted', false);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -163,13 +163,16 @@ class PaymentMethod
|
|||||||
|
|
||||||
//note we have to use GatewayType::CREDIT_CARD as alias for CUSTOM
|
//note we have to use GatewayType::CREDIT_CARD as alias for CUSTOM
|
||||||
foreach ($this->gateways as $gateway) {
|
foreach ($this->gateways as $gateway) {
|
||||||
|
|
||||||
foreach ($gateway->driver($this->client)->gatewayTypes() as $type) {
|
foreach ($gateway->driver($this->client)->gatewayTypes() as $type) {
|
||||||
|
|
||||||
if (isset($gateway->fees_and_limits) && property_exists($gateway->fees_and_limits, $type)) {
|
if (isset($gateway->fees_and_limits) && property_exists($gateway->fees_and_limits, $type)) {
|
||||||
if ($this->validGatewayForAmount($gateway->fees_and_limits->{GatewayType::CREDIT_CARD}, $this->amount)) {
|
|
||||||
$this->payment_methods->push([$gateway->id => $type]);
|
if ($this->validGatewayForAmount($gateway->fees_and_limits->{GatewayType::CREDIT_CARD}, $this->amount))
|
||||||
}
|
$this->payment_methods[] = [$gateway->id => $type];
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$this->payment_methods->push([$gateway->id => NULL]);
|
$this->payment_methods[] = [$gateway->id => NULL];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user