Simplified plugin configuration, improved error messages

This commit is contained in:
Pieter Poorthuis 2018-03-19 14:55:39 +01:00
parent b2d2fe9213
commit f43c3bac6c
3 changed files with 70 additions and 65 deletions

View File

@ -33,7 +33,7 @@ class Bitpay_Core_Model_Config_PairingCode extends Mage_Core_Model_Config_Data
\Mage::helper('bitpay')->sendPairingRequest($pairingCode);
} catch (\Exception $e) {
\Mage::helper('bitpay')->debugData(sprintf('[ERROR] Exception thrown while calling the sendPairingRequest() function. The specific error message is: "%s"', $e->getMessage()));
\Mage::getSingleton('core/session')->addError('There was an error while trying to pair with BitPay using the pairing code '.$pairingCode.'. Please try again or enable debug mode and send the "payment_bitpay.log" file to support@bitpay.com for more help.');
\Mage::getSingleton('core/session')->addError('There was an error while trying to pair with BitPay using the pairing code '.$pairingCode.'. Please make sure you select the correct Network (Livenet vs Testnet) and try again with a new 7 character pairing code or enable debug mode and send the "payment_bitpay.log" file to support@bitpay.com for more help.');
return;
}

View File

@ -132,17 +132,17 @@
<order_status>new</order_status>
<payment_action>authorize</payment_action>
<active>0</active>
<title>Bitcoin</title>
<api_key>test</api_key>
<network>testnet</network>
<title>Bitcoin and Bitcoin Cash</title>
<api_key>test</api_key>
<network>livenet</network>
<debug>0</debug>
<notification_url>bitpay/ipn</notification_url>
<redirect_url>checkout/onepage/success</redirect_url>
<failure_url>checkout/cart</failure_url>
<failure_url>checkout/cart</failure_url>
<speed>medium</speed>
<fullscreen>0</fullscreen>
<invoice_new>new</invoice_new>
<invoice_paid>processing</invoice_paid>
<invoice_paid>pending</invoice_paid>
<invoice_confirmed>processing</invoice_confirmed>
<invoice_complete>complete</invoice_complete>
<invoice_expired>canceled</invoice_expired>

View File

@ -28,8 +28,8 @@
<pairing_code translate="label">
<label>Pairing Code</label>
<comment>
<![CDATA[You must first create a pairing code for your BitPay Merchant account at <a href="https://bitpay.com/api-tokens" target="_blank">https://bitpay.com/api-tokens</a> and copy/paste
that code here. Once you have successfully paired this Magento store with your BitPay Merchant account, you can begin accepting Bitcoins as payment.]]>
<![CDATA[You must first create a pairing code for your BitPay Merchant account at <a href="https://bitpay.com/api-tokens" target="_blank">https://bitpay.com/api-tokens</a> -> Add New Token -> Add Token and copy/paste
the 7 character pairing code here.]]>
</comment>
<frontend_type>text</frontend_type>
<backend_model>bitpay/config_pairingCode</backend_model>
@ -38,6 +38,15 @@
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</pairing_code>
<fullscreen translate="label">
<label>Redirect Checkout</label>
<frontend_type>select</frontend_type>
<source_model>adminhtml/system_config_source_yesno</source_model>
<sort_order>2</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</fullscreen>
<active translate="label">
<label>Enabled</label>
<frontend_type>select</frontend_type>
@ -106,27 +115,66 @@
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</failure_url>
<fullscreen translate="label">
<label>Redirect Checkout</label>
<frontend_type>select</frontend_type>
<source_model>adminhtml/system_config_source_yesno</source_model>
<sort_order>2</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>0</show_in_store>
</fullscreen>
<speed translate="label">
<label>Transaction Speed</label>
<frontend_type>select</frontend_type>
<source_model>bitpay/transactionSpeed</source_model>
<invoice>
<label>Invoice Settings</label>
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
<sort_order>70</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</invoice>
<invoice_paid translate="label">
<label>Paid</label>
<comment>
<![CDATA[An invoice is considered "paid" when the Bitcoin network sees a transaction.]]>
</comment>
<frontend_type>select</frontend_type>
<source_model>adminhtml/system_config_source_order_status</source_model>
<sort_order>71</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</invoice_paid>
<invoice_confirmed translate="label">
<label>Confirmed</label>
<comment>
<![CDATA[A confirmed invoice means that the Bitcoin network has approved the transaction.]]>
</comment>
<frontend_type>select</frontend_type>
<source_model>adminhtml/system_config_source_order_status</source_model>
<sort_order>72</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</invoice_confirmed>
<invoice_complete translate="label">
<label>Complete</label>
<comment>
<![CDATA[A completed BitPay invoice indicates the payment for the invoice has been fully confirmed by the Bitcoin network and the funds have been deposited into your BitPay Merchant account.]]>
</comment>
<frontend_type>select</frontend_type>
<source_model>adminhtml/system_config_source_order_status</source_model>
<sort_order>73</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</invoice_complete>
<speed translate="label">
<label>Transaction Speed</label>
<frontend_type>select</frontend_type>
<source_model>bitpay/transactionSpeed</source_model>
<sort_order>74</sort_order>
<show_in_default>0</show_in_default>
<show_in_website>0</show_in_website>
<show_in_store>0</show_in_store>
<comment>
<![CDATA[Determines when a BitPay payment confirmation is sent.<br /><strong>High:</strong> an invoice is confirmed immediately when payment received.<br /><strong>Medium:</strong> an invoice is confirmed after 1 block confirmation by the Bitcoin network (~10 mins).<br /><strong>Low:</strong> an invoice is confirmed after 6 block confirmations by the Bitcoin network (~1 hour).<br />The default and safest setting is "Low". A "High" setting is quicker to generate a payment confirmation but is riskier since the transaction could have not been officially confirmed by the Bitcoin network itself.]]>
</comment>
</speed>
<mage_settings_heading>
<label>Magento Specific Settings</label>
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
@ -178,50 +226,7 @@
<show_in_store>0</show_in_store>
<frontend_class>validate-number</frontend_class>
</sort_order>
<invoice>
<label>Invoice Settings</label>
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
<sort_order>100</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</invoice>
<invoice_paid translate="label">
<label>Paid</label>
<comment>
<![CDATA[An invoice is considered "paid" when the Bitcoin network sees a transaction.]]>
</comment>
<frontend_type>select</frontend_type>
<source_model>adminhtml/system_config_source_order_status</source_model>
<sort_order>120</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</invoice_paid>
<invoice_confirmed translate="label">
<label>Confirmed</label>
<comment>
<![CDATA[A confirmed invoice means that the Bitcoin network has approved the transaction.]]>
</comment>
<frontend_type>select</frontend_type>
<source_model>adminhtml/system_config_source_order_status</source_model>
<sort_order>130</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</invoice_confirmed>
<invoice_complete translate="label">
<label>Complete</label>
<comment>
<![CDATA[A completed BitPay invoice indicates the payment for the invoice has been fully confirmed by the Bitcoin network and the funds have been deposited into your BitPay Merchant account.]]>
</comment>
<frontend_type>select</frontend_type>
<source_model>adminhtml/system_config_source_order_status</source_model>
<sort_order>140</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</invoice_complete>
<requirements>
<label>Requirements</label>
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>