Non-debug logging fix

This commit is contained in:
Rafał Drożdżal 2018-03-08 10:46:25 +01:00
parent 33928948eb
commit 673bc5ad5f
2 changed files with 20 additions and 2 deletions

View File

@ -21,7 +21,20 @@ class Bitpay_Core_Helper_Data extends Mage_Core_Helper_Abstract
*/ */
public function debugData($debugData) public function debugData($debugData)
{ {
//log information about the environment
$phpVersion = explode('-', phpversion())[0];
$extendedDebugData = array(
'[PHP version] ' . $phpVersion,
'[Magento version] ' . \Mage::getVersion(),
'[BitPay plugin version] ' . $this->getExtensionVersion(),
);
foreach($extendedDebugData as &$param)
{
$param = PHP_EOL . "\t\t" . $param;
}
if (true === isset($debugData) && false === empty($debugData)) { if (true === isset($debugData) && false === empty($debugData)) {
\Mage::getModel('bitpay/method_bitcoin')->debugData($extendedDebugData);
\Mage::getModel('bitpay/method_bitcoin')->debugData($debugData); \Mage::getModel('bitpay/method_bitcoin')->debugData($debugData);
} }
} }
@ -166,6 +179,8 @@ class Bitpay_Core_Helper_Data extends Mage_Core_Helper_Abstract
'label' => (string) $label, 'label' => (string) $label,
) )
); );
$network = \Mage::getStoreConfig('payment/bitpay/network');
$this->debugData('[INFO] In Bitpay_Core_Helper_Data::sendPairingRequest(): using the network "' . $network . '".');
if (false === isset($token) || true === empty($token)) { if (false === isset($token) || true === empty($token)) {
$this->debugData('[ERROR] In Bitpay_Core_Helper_Data::sendPairingRequest(): could not obtain the token from the pairing process. Cannot continue!'); $this->debugData('[ERROR] In Bitpay_Core_Helper_Data::sendPairingRequest(): could not obtain the token from the pairing process. Cannot continue!');
@ -375,4 +390,9 @@ class Bitpay_Core_Helper_Data extends Mage_Core_Helper_Abstract
{ {
return "payment_bitpay.log"; return "payment_bitpay.log";
} }
public function getExtensionVersion()
{
return (string) \Mage::getConfig()->getNode()->modules->Bitpay_Core->version;
}
} }

View File

@ -9,8 +9,6 @@ class Bitpay_Core_Model_Observer {
public function implementOrderStatus($e) { public function implementOrderStatus($e) {
$order = $e -> getOrder(); $order = $e -> getOrder();
$paymentCode = $order -> getPayment() -> getMethodInstance() -> getCode(); $paymentCode = $order -> getPayment() -> getMethodInstance() -> getCode();
Mage::log('sales_order_place_after--------------:');
Mage::log('$paymentCode:' . $paymentCode);
if ($paymentCode == 'bitpay') { if ($paymentCode == 'bitpay') {
$order -> setState(Mage_Sales_Model_Order::STATE_NEW, true); $order -> setState(Mage_Sales_Model_Order::STATE_NEW, true);
$order -> save(); $order -> save();