mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-13 22:54:25 +01:00
Use initialize method to set configuration
This commit is contained in:
parent
d6608f863c
commit
c67564823b
@ -39,18 +39,7 @@ class PaymentService extends BaseService
|
|||||||
public function createGateway($accountGateway)
|
public function createGateway($accountGateway)
|
||||||
{
|
{
|
||||||
$gateway = Omnipay::create($accountGateway->gateway->provider);
|
$gateway = Omnipay::create($accountGateway->gateway->provider);
|
||||||
$config = $accountGateway->getConfig();
|
$gateway->initialize((array) $accountGateway->getConfig());
|
||||||
|
|
||||||
foreach ($config as $key => $val) {
|
|
||||||
if (!$val) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
$function = "set".ucfirst($key);
|
|
||||||
if (method_exists($gateway, $function)) {
|
|
||||||
$gateway->$function($val);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($accountGateway->isGateway(GATEWAY_DWOLLA)) {
|
if ($accountGateway->isGateway(GATEWAY_DWOLLA)) {
|
||||||
if ($gateway->getSandbox() && isset($_ENV['DWOLLA_SANDBOX_KEY']) && isset($_ENV['DWOLLA_SANSBOX_SECRET'])) {
|
if ($gateway->getSandbox() && isset($_ENV['DWOLLA_SANDBOX_KEY']) && isset($_ENV['DWOLLA_SANSBOX_SECRET'])) {
|
||||||
|
Loading…
Reference in New Issue
Block a user