From c67564823b6abb9267291668f34710fbfffcc344 Mon Sep 17 00:00:00 2001 From: DraperStudio Date: Tue, 19 Apr 2016 22:02:46 +0200 Subject: [PATCH] Use initialize method to set configuration --- app/Services/PaymentService.php | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/app/Services/PaymentService.php b/app/Services/PaymentService.php index 2f4b57f11ff0..61af6cd2336c 100644 --- a/app/Services/PaymentService.php +++ b/app/Services/PaymentService.php @@ -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'])) {