Skip to content

Commit 293856c

Browse files
committed
added custom adapter config parameter to make method of factory class
1 parent 83ff172 commit 293856c

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

src/Factory.php

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,16 @@ class Factory
1111
* @var AdapterInterface
1212
*/
1313
protected $gateway;
14-
/**
15-
* @param $adapter
16-
* @param TransactionInterface $invoice
17-
*
18-
* @return $this
19-
* @throws \Tartan\Larapay\Exception
20-
*/
21-
public function make($adapter, TransactionInterface $invoice)
14+
15+
/**
16+
* @param $adapter adapter name
17+
* @param TransactionInterface $invoice
18+
* @param array adapter configuration
19+
*
20+
* @return $this
21+
* @throws Exception
22+
*/
23+
public function make($adapter, TransactionInterface $invoice, array $adapterConfig = [])
2224
{
2325
$adapter = ucfirst(strtolower($adapter));
2426

@@ -41,7 +43,7 @@ public function make($adapter, TransactionInterface $invoice)
4143
throw new Exception("Adapter class '$adapterName' does not exist");
4244
}
4345

44-
$config = config('larapay.'.strtolower($adapter));
46+
$config = count($adapterConfig) ? $adapterConfig : config('larapay.'.strtolower($adapter));
4547
Log::debug('init gateway config', $config);
4648

4749
$bankAdapter = new $adapterName($invoice, $config);

0 commit comments

Comments
 (0)