Skip to content

Commit d4e29ff

Browse files
authored
Merge pull request #20 from Toolstation/master
Including optional Guzzle client to use in place of default
2 parents 9b7b668 + 6bd9fc9 commit d4e29ff

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

src/Ignited/LaravelOmnipay/LaravelOmnipayManager.php

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ class LaravelOmnipayManager {
2525
*/
2626
protected $gateway;
2727

28+
/**
29+
* The Guzzle client to use (null means use default)
30+
* @var \Guzzle\Http\Client|null
31+
*/
32+
protected $httpClient;
33+
2834
/**
2935
* The array of resolved queue connections.
3036
*
@@ -70,7 +76,7 @@ protected function resolve($name)
7076
throw new \UnexpectedValueException("Gateway [$name] is not defined.");
7177
}
7278

73-
$gateway = $this->factory->create($config['driver']);
79+
$gateway = $this->factory->create($config['driver'], $this->getHttpClient());
7480

7581
$class = trim(Helper::getGatewayClassName($config['driver']), "\\");
7682

@@ -117,6 +123,16 @@ public function setGateway($name)
117123
$this->gateway = $name;
118124
}
119125

126+
public function setHttpClient($httpClient)
127+
{
128+
$this->httpClient = $httpClient;
129+
}
130+
131+
public function getHttpClient()
132+
{
133+
return $this->httpClient;
134+
}
135+
120136
public function __call($method, $parameters)
121137
{
122138
$callable = [$this->gateway(), $method];
@@ -128,4 +144,4 @@ public function __call($method, $parameters)
128144

129145
throw new \BadMethodCallException("Method [$method] is not supported by the gateway [$this->gateway].");
130146
}
131-
}
147+
}

0 commit comments

Comments
 (0)