1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 21:22:58 +01:00

Add BACS to livewire

This commit is contained in:
Lars Kusch 2022-12-16 11:35:35 +01:00
parent 974f4b2ca3
commit b88dc785d7

View File

@ -458,6 +458,29 @@ class Client extends BaseModel implements HasLocalePreference
return null;
}
public function getBACSGateway() :?CompanyGateway
{
$pms = $this->service()->getPaymentMethods(-1);
foreach ($pms as $pm) {
if ($pm['gateway_type_id'] == GatewayType::BACS) {
$cg = CompanyGateway::find($pm['company_gateway_id']);
if ($cg && ! property_exists($cg->fees_and_limits, GatewayType::BACS)) {
$fees_and_limits = $cg->fees_and_limits;
$fees_and_limits->{GatewayType::BACS} = new FeesAndLimits;
$cg->fees_and_limits = $fees_and_limits;
$cg->save();
}
if ($cg && $cg->fees_and_limits->{GatewayType::BACS}->is_enabled) {
return $cg;
}
}
}
return null;
}
//todo refactor this - it is only searching for existing tokens
public function getBankTransferGateway() :?CompanyGateway