From 59557138b6a30b4e1ce61ee62c3f3f66591b49d9 Mon Sep 17 00:00:00 2001 From: odenktools Date: Mon, 4 Jan 2021 01:22:01 +0700 Subject: [PATCH 1/3] Fixing Bca Host Configuration --- config/bca.php | 16 ++++++++++++++-- src/BcaFactory.php | 15 +++++++-------- src/BcaManager.php | 2 +- 3 files changed, 22 insertions(+), 11 deletions(-) diff --git a/config/bca.php b/config/bca.php index 754cea1..3e90c53 100644 --- a/config/bca.php +++ b/config/bca.php @@ -23,7 +23,13 @@ 'host' => 'sandbox.bca.co.id', 'scheme' => 'https', 'development' => true, - 'options' => [], + 'options' => [ + 'host' => 'sandbox.bca.co.id', + 'scheme' => 'https', + 'timeout' => 60, + 'port' => 443, + 'timezone' => 'Asia/Jakarta' + ], 'port' => 443, 'timeout' => 30, ], @@ -38,7 +44,13 @@ 'host' => 'sandbox.bca.co.id', 'scheme' => 'https', 'development' => true, - 'options' => [], + 'options' => [ + 'host' => 'sandbox.bca.co.id', + 'scheme' => 'https', + 'timeout' => 60, + 'port' => 443, + 'timezone' => 'Asia/Jakarta' + ], 'port' => 443, 'timeout' => 30, ], diff --git a/src/BcaFactory.php b/src/BcaFactory.php index b9eaa3e..814f17d 100644 --- a/src/BcaFactory.php +++ b/src/BcaFactory.php @@ -20,11 +20,11 @@ class BcaFactory * @param array $config * @param array $options optional parameter * - * @return \BcaHttp + * @return BcaHttp */ - public function make(array $config, $options = []) + public function make(array $config, array $options = []) { - $config = $this->getConfig($config, $options); + $config = $this->getConfig($config); return $this->getClient($config, $options); } @@ -33,13 +33,12 @@ public function make(array $config, $options = []) * Get the configuration data. * * @param string[] $config - * @param array $options optional parameter * * @throws \InvalidArgumentException * * @return array */ - protected function getConfig(array $config, $options = array()) + protected function getConfig(array $config) { $keys = [ 'corp_id', @@ -55,7 +54,7 @@ protected function getConfig(array $config, $options = array()) } } - return array_only($config, $keys); + return array_intersect_key($config, array_flip((array)$keys)); } /** @@ -64,9 +63,9 @@ protected function getConfig(array $config, $options = array()) * @param string[] $auth * @param array $options optional parameter * - * @return \BcaHttp + * @return BcaHttp */ - protected function getClient(array $auth, $options = []) + protected function getClient(array $auth, array $options = []) { return new BcaHttp( $auth['corp_id'], diff --git a/src/BcaManager.php b/src/BcaManager.php index db2bfa2..21279da 100644 --- a/src/BcaManager.php +++ b/src/BcaManager.php @@ -45,7 +45,7 @@ public function __construct(Repository $config, BcaFactory $factory) */ protected function createConnection(array $config) { - return $this->factory->make($config); + return $this->factory->make($config, $config['options']); } /** From d89c6e2230fd4c6e92d8a48692515a9dc4301fa9 Mon Sep 17 00:00:00 2001 From: Hendra Susanto Date: Mon, 1 Nov 2021 14:04:18 +0700 Subject: [PATCH 2/3] add support to laravel 6 --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 8cf0314..ce2cd3e 100644 --- a/composer.json +++ b/composer.json @@ -13,8 +13,8 @@ "require": { "php": ">=5.4", "ext-curl": "*", - "illuminate/support": "5.2.x|5.3.x|5.4.x|5.5.x|5.6.x|5.7.x|5.8.x", - "illuminate/contracts": "5.2.x|5.3.x|5.4.x|5.5.x|5.6.x|5.7.x|5.8.x", + "illuminate/support": "5.2.x|5.3.x|5.4.x|5.5.x|5.6.x|5.7.x|5.8.x|^6.0", + "illuminate/contracts": "5.2.x|5.3.x|5.4.x|5.5.x|5.6.x|5.7.x|5.8.x|^6.0", "graham-campbell/manager": "^2.4 || ^3.0 || ^4.0", "odenktools/php-bca": "2.*" }, From 4abb0f2e3575546390f3a7f8f31f5828ae41ee28 Mon Sep 17 00:00:00 2001 From: Hendra Susanto Date: Mon, 1 Nov 2021 18:30:17 +0700 Subject: [PATCH 3/3] fix test errors --- src/BcaManager.php | 2 +- tests/AbstractTestCase.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/BcaManager.php b/src/BcaManager.php index 21279da..db2bfa2 100644 --- a/src/BcaManager.php +++ b/src/BcaManager.php @@ -45,7 +45,7 @@ public function __construct(Repository $config, BcaFactory $factory) */ protected function createConnection(array $config) { - return $this->factory->make($config, $config['options']); + return $this->factory->make($config); } /** diff --git a/tests/AbstractTestCase.php b/tests/AbstractTestCase.php index 18ccd45..976db9a 100644 --- a/tests/AbstractTestCase.php +++ b/tests/AbstractTestCase.php @@ -21,7 +21,7 @@ abstract class AbstractTestCase extends AbstractPackageTestCase * * @return string */ - protected function getServiceProviderClass($app) + protected function getServiceProviderClass() { return BcaServiceProvider::class; }