mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-03 12:44:35 -04:00
Payment methods
This commit is contained in:
parent
8e4e38776b
commit
b14ac451c4
@ -377,6 +377,29 @@ class Client extends BaseModel implements HasLocalePreference
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getBankTransferGateway() :?CompanyGateway
|
||||||
|
{
|
||||||
|
$company_gateways = $this->getSetting('company_gateway_ids');
|
||||||
|
|
||||||
|
if (strlen($company_gateways)>=1) {
|
||||||
|
$gateways = $this->company->company_gateways->whereIn('id', $company_gateways);
|
||||||
|
} else {
|
||||||
|
$gateways = $this->company->company_gateways;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($gateways as $gateway) {
|
||||||
|
if ($this->currency()->code == 'USD' && in_array(GatewayType::BANK_TRANSFER, $gateway->driver($this)->gatewayTypes())) {
|
||||||
|
return $gateway;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->currency()->code == 'EUR' && in_array(GatewayType::SEPA, $gateway->driver($this)->gatewayTypes())) {
|
||||||
|
return $gateway;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public function getCurrencyCode()
|
public function getCurrencyCode()
|
||||||
{
|
{
|
||||||
if ($this->currency()) {
|
if ($this->currency()) {
|
||||||
@ -386,15 +409,6 @@ class Client extends BaseModel implements HasLocalePreference
|
|||||||
return 'USD';
|
return 'USD';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getPaymentMethodByType($amount, $type) :array
|
|
||||||
{
|
|
||||||
$gateways = $this->company->company_gateways;
|
|
||||||
|
|
||||||
$gateways = $gateways->map(function ($gateway) use($type){
|
|
||||||
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generates an array of payment urls per client
|
* Generates an array of payment urls per client
|
||||||
* for a given amount.
|
* for a given amount.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user