1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-12 14:12:44 +01:00

Use initialize method to set configuration

This commit is contained in:
DraperStudio 2016-04-19 22:02:46 +02:00
parent d6608f863c
commit c67564823b

View File

@ -39,18 +39,7 @@ class PaymentService extends BaseService
public function createGateway($accountGateway)
{
$gateway = Omnipay::create($accountGateway->gateway->provider);
$config = $accountGateway->getConfig();
foreach ($config as $key => $val) {
if (!$val) {
continue;
}
$function = "set".ucfirst($key);
if (method_exists($gateway, $function)) {
$gateway->$function($val);
}
}
$gateway->initialize((array) $accountGateway->getConfig());
if ($accountGateway->isGateway(GATEWAY_DWOLLA)) {
if ($gateway->getSandbox() && isset($_ENV['DWOLLA_SANDBOX_KEY']) && isset($_ENV['DWOLLA_SANSBOX_SECRET'])) {