diff --git a/Model/Config/Source/Payment/Settings.php b/Model/Config/Source/Payment/Settings.php index d47190a..f2b4103 100644 --- a/Model/Config/Source/Payment/Settings.php +++ b/Model/Config/Source/Payment/Settings.php @@ -34,12 +34,12 @@ protected function getDataConfig($pathXML) public function isProduction() { - return $this->getDataConfig('payment/snap/settings/is_production') == '1' ? true : false; + return $this->getDataConfig('payment/snap/settings/is_production') == 1; } public function isRedirect() { - return $this->getDataConfig('payment/snap/settings/enable_redirect') == '1' ? true : false; + return $this->getDataConfig('payment/snap/settings/enable_redirect') == 1; } public function getMerchantId() @@ -67,7 +67,7 @@ public function getDefaultServerKey() } public function enableLog() { - return $this->getDataConfig('payment/settings/enable_log') == 1 ? true : false; + return $this->getDataConfig('payment/settings/enable_log') == 1; } public function getOrderStatus() { @@ -78,8 +78,8 @@ public function getConfigSnap() { $config = array(); $config['bank'] = $this->getDataConfig('payment/snap/basic/cc_config/bank'); $config['custom_expiry'] = $this->getDataConfig('payment/snap/custom_expiry'); - $config['is3ds'] = $this->getDataConfig('payment/snap/is3ds') == 1 ? true : false; - $config['one_click'] = $this->getDataConfig('payment/snap/one_click') == 1 ? true : false; + $config['is3ds'] = $this->getDataConfig('payment/snap/is3ds') == 1; + $config['one_click'] = $this->getDataConfig('payment/snap/one_click') == 1; $config['bin'] = $this->getDataConfig('payment/snap/basic/cc_config/bin'); return $config; } @@ -88,8 +88,8 @@ public function getConfigSpecific() { $configSpecific = array(); $configSpecific['bank'] = $this->getDataConfig('payment/snap/specific/cc_config/bank'); $configSpecific['custom_expiry'] = $this->getDataConfig('payment/specific/custom_expiry'); - $configSpecific['is3ds'] = $this->getDataConfig('payment/specific/is3ds') == 1 ? true : false; - $configSpecific['one_click'] = $this->getDataConfig('payment/specific/one_click') == 1 ? true : false; + $configSpecific['is3ds'] = $this->getDataConfig('payment/specific/is3ds') == 1; + $configSpecific['one_click'] = $this->getDataConfig('payment/specific/one_click') == 1; $configSpecific['bin'] = $this->getDataConfig('payment/snap/specific/cc_config/bin'); $configSpecific['enabled_payments'] = $this->getDataConfig('payment/snap/specific/enable_payment'); return $configSpecific; @@ -98,8 +98,8 @@ public function getConfigSpecific() { public function getConfigInstallment() { $configInstallment = array(); $configInstallment['custom_expiry'] = $this->getDataConfig('payment/installment/custom_expiry'); - $configInstallment['is3ds'] = $this->getDataConfig('payment/installment/is3ds') == 1 ? true : false; - $configInstallment['one_click'] = $this->getDataConfig('payment/installment/one_click') == 1 ? true : false; + $configInstallment['is3ds'] = $this->getDataConfig('payment/installment/is3ds') == 1; + $configInstallment['one_click'] = $this->getDataConfig('payment/installment/one_click') == 1; $configInstallment['minimal_amount'] = $this->getDataConfig('payment/installment/minimal_amount'); return $configInstallment; } @@ -108,8 +108,8 @@ public function getConfigOffline() { $configOffline = array(); $configOffline['bank'] = $this->getDataConfig('payment/snap/offline/cc_config/bank'); $configOffline['custom_expiry'] = $this->getDataConfig('payment/offline/custom_expiry'); - $configOffline['is3ds'] = $this->getDataConfig('payment/offline/is3ds') == 1 ? true : false; - $configOffline['one_click'] = $this->getDataConfig('payment/offline/one_click') == 1 ? true : false; + $configOffline['is3ds'] = $this->getDataConfig('payment/offline/is3ds') == 1; + $configOffline['one_click'] = $this->getDataConfig('payment/offline/one_click') == 1; $configOffline['bin'] = $this->getDataConfig('payment/snap/offline/cc_config/bin'); $configOffline['minimal_amount'] = $this->getDataConfig('payment/offline/minimal_amount'); $configOffline['terms'] = $this->getDataConfig('payment/snap/offline/cc_config/term'); @@ -118,42 +118,46 @@ public function getConfigOffline() { public function isNotificationLogEnabled() { - return $this->getDataConfig('payment/settings/notification_log') == 1 ? true : false; + return $this->getDataConfig('payment/settings/notification_log') == 1; } public function isRequestLogEnabled() { - return $this->getDataConfig('payment/settings/request_log') == 1 ? true : false; + return $this->getDataConfig('payment/settings/request_log') == 1; } public function isErrorLogEnabled() { - return $this->getDataConfig('payment/settings/error_log') == 1 ? true : false; + return $this->getDataConfig('payment/settings/error_log') == 1; } public function isExceptionEnabled() { - return $this->getDataConfig('payment/settings/throw_exception') == 1 ? true : false; + return $this->getDataConfig('payment/settings/throw_exception') == 1; } public function getSpecificMerchantId() { - return $this->getDataConfig('payment/snap/specific/specific_access/merchant_id'); + if ($this->getDataConfig('payment/specific/use_specific_account') == 1) { + return $this->getDataConfig('payment/snap/specific/specific_access/merchant_id'); + } else { + return $this->getMerchantId(); + } } public function getSpecificClientKey() { if ($this->isProduction()) { - if ($this->getDataConfig('payment/specific/use_specific_account') == 1 ? true : false) { + if ($this->getDataConfig('payment/specific/use_specific_account') == 1) { return $this->getDataConfig('payment/snap/specific/specific_access/production_client_key'); } else { - return $this->getDefaultServerKey(); + return $this->getDefaultClientKey(); } } else { - if ($this->getDataConfig('payment/specific/use_specific_account') == 1 ? true : false) { + if ($this->getDataConfig('payment/specific/use_specific_account') == 1) { return $this->getDataConfig('payment/snap/specific/specific_access/sandbox_client_key'); } else { - return $this->getDefaultServerKey(); + return $this->getDefaultClientKey(); } } } @@ -161,13 +165,13 @@ public function getSpecificClientKey() public function getSpecificServerKey() { if ($this->isProduction()) { - if ($this->getDataConfig('payment/specific/use_specific_account') == 1 ? true : false) { + if ($this->getDataConfig('payment/specific/use_specific_account') == 1) { return $this->getDataConfig('payment/snap/specific/specific_access/production_server_key'); } else { return $this->getDefaultServerKey(); } } else { - if ($this->getDataConfig('payment/specific/use_specific_account') == 1 ? true : false) { + if ($this->getDataConfig('payment/specific/use_specific_account') == 1) { return $this->getDataConfig('payment/snap/specific/specific_access/sandbox_server_key'); } else { return $this->getDefaultServerKey(); @@ -177,22 +181,26 @@ public function getSpecificServerKey() public function getInstallmentMerchantId() { - return $this->getDataConfig('payment/snap/installment/installment_access/merchant_id'); + if ($this->getDataConfig('payment/installment/use_specific_account') == 1) { + return $this->getDataConfig('payment/snap/installment/installment_access/merchant_id'); + } else { + return $this->getMerchantId(); + } } public function getInstallmentClientKey() { if ($this->isProduction()) { - if ($this->getDataConfig('payment/installment/use_specific_account') == 1 ? true : false) { + if ($this->getDataConfig('payment/installment/use_specific_account') == 1) { return $this->getDataConfig('payment/snap/installment/installment_access/production_client_key'); } else { - return $this->getDefaultServerKey(); + return $this->getDefaultClientKey(); } } else { - if ($this->getDataConfig('payment/installment/use_specific_account') == 1 ? true : false) { + if ($this->getDataConfig('payment/installment/use_specific_account') == 1) { return $this->getDataConfig('payment/snap/installment/installment_access/sandbox_client_key'); } else { - return $this->getDefaultServerKey(); + return $this->getDefaultClientKey(); } } } @@ -200,13 +208,13 @@ public function getInstallmentClientKey() public function getInstallmentServerKey() { if ($this->isProduction()) { - if ($this->getDataConfig('payment/installment/use_specific_account') == 1 ? true : false) { + if ($this->getDataConfig('payment/installment/use_specific_account') == 1) { return $this->getDataConfig('payment/snap/installment/installment_access/production_server_key'); } else { return $this->getDefaultServerKey(); } } else { - if ($this->getDataConfig('payment/offline/use_specific_account') == 1 ? true : false) { + if ($this->getDataConfig('payment/offline/use_specific_account') == 1) { return $this->getDataConfig('payment/snap/installment/installment_access/sandbox_server_key'); } else { return $this->getDefaultServerKey(); @@ -216,22 +224,26 @@ public function getInstallmentServerKey() public function getOfflineMerchantId() { - return $this->getDataConfig('payment/snap/offline/offline_access/merchant_id'); + if ($this->getDataConfig('payment/offline/use_specific_account') == 1) { + return $this->getDataConfig('payment/snap/offline/offline_access/merchant_id'); + } else { + return $this->getMerchantId(); + } } public function getOfflineClientKey() { if ($this->isProduction()) { - if ($this->getDataConfig('payment/offline/use_specific_account') == 1 ? true : false) { + if ($this->getDataConfig('payment/offline/use_specific_account') == 1) { return $this->getDataConfig('payment/snap/offline/offline_access/production_client_key'); } else { - return $this->getDefaultServerKey(); + return $this->getDefaultClientKey(); } } else { - if ($this->getDataConfig('payment/offline/use_specific_account') == 1 ? true : false) { + if ($this->getDataConfig('payment/offline/use_specific_account') == 1) { return $this->getDataConfig('payment/snap/offline/offline_access/sandbox_client_key'); } else { - return $this->getDefaultServerKey(); + return $this->getDefaultClientKey(); } } } @@ -239,17 +251,17 @@ public function getOfflineClientKey() public function getOfflineServerKey() { if ($this->isProduction()) { - if ($this->getDataConfig('payment/offline/use_specific_account') == 1 ? true : false) { + if ($this->getDataConfig('payment/offline/use_specific_account') == 1) { return $this->getDataConfig('payment/snap/offline/offline_access/production_server_key'); } else { return $this->getDefaultServerKey(); } } else { - if ($this->getDataConfig('payment/offline/use_specific_account') == 1 ? true : false) { + if ($this->getDataConfig('payment/offline/use_specific_account') == 1) { return $this->getDataConfig('payment/snap/offline/offline_access/sandbox_server_key'); } else { return $this->getDefaultServerKey(); } } } -} +} \ No newline at end of file diff --git a/composer.json b/composer.json index a85d8c5..1c02796 100755 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "midtrans/snap", "description": "Midtrans Accept Online Payment Magento 2 module", "type": "magento2-module", - "version": "2.3.1", + "version": "2.3.2", "authors" : [ { "name": "Zaki Ibrahim",