Merge pull request #818 from DraperStudio/develop

Use initialize method to set configuration
This commit is contained in:
Hillel Coren 2016-04-20 10:14:21 +03:00
commit eaa4ffab0e

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'])) {