Closed cnohall closed 3 years ago
Lets remove this message not necessary
API Key is not provided to communicate with Blockonomics
change to Please specify an API Key
I've now removed this message and updated
API Key is not provided to communicate with Blockonomics
to
Please specify an API Key
This is how it looks like now, both when clicking Save or Test Setup, if API key is not specified:
On @shivaenigma's initiative, I introduced getServerAPIURL()
:
public function getServerAPIURL($crypto, $path) {
$domain = ($crypto == 'btc') ? 'www' : 'bch';
return "https://" . $domain . ".blockonomics.co" . $path;
}
There are four different paths, BLOCKONOMICS_PRICE_URL
BLOCKONOMICS_NEW_ADDRESS_URL
BLOCKONOMICS_GET_CALLBACKS_URL
BLOCKONOMICS_SET_CALLBACKS_URL
. Each path is only used once. Instead of saving each path as a variable in the configuration, they're stored in their respective function. This saves us from defining variables, updating and deleting them.
$BLOCKONOMICS_WEBSOCKET_URL
still remains, and can be removed. However, since it's not connected to testSetup() or the Admin-ui, I suggest that make those changes in the next PR.
BCH Integration - Admin UI and TestSetup
This PR is related to issue #105. This PR introduces a new Currencies section that consists of two checkboxes. One for BTC and one for BCH. The Save button in the Settings section and the Test Setup in the Currencies section save the values from both sections, with the exception that pressing Test Setup also runs
TestSetup()
for the active cryptos. Which values are saved or not is easy to adapt, if need be.Current design
Code changes
blockonomics.php
has been quite heavily modified, to accommodate the new section and test setup for both cryptos. The code was written according to the pattern set in the WooCommerce-plugin.validation.php
only has a few new comments and a changed function name.The module has been tested and the correct error messages are shown at the right time. It also correctly updates the callback for both BTC and BCH. The checkout still works. However, since we don't have a selection screen at the moment the checkout will always create an order in BTC.
The module is in line with PrestaShop's standards.