Skip to content

Commit

Permalink
Merge pull request #14 from wavesnode/feature/11-pol-currency
Browse files Browse the repository at this point in the history
Feature/11 pol currency
  • Loading branch information
clipto authored Apr 20, 2018
2 parents 7b88eee + c77f740 commit a4ad7e1
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
6 changes: 4 additions & 2 deletions includes/class-waves-gateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function __construct()
$this->has_fields = true;

// assetCode+id if woocommerce_currency is set to Waves-like currency
$this->currencyIsWaves = in_array(get_woocommerce_currency(), array("WAVES","WNET","ARTcoin"));
$this->currencyIsWaves = in_array(get_woocommerce_currency(), array("WAVES","WNET","ARTcoin","POL"));
if($this->currencyIsWaves) {
if (get_woocommerce_currency() == "Waves") {
$this->assetCode = 'Waves';
Expand All @@ -40,11 +40,13 @@ public function __construct()
} else if (get_woocommerce_currency() == "ARTcoin") {
$this->assetCode = 'ARTcoin';
$this->assetId = 'GQe2a2uReaEiHLdjzC8q4Popr9tnKonEpcaihEoZrNiR';
} else if (get_woocommerce_currency() == "POL") {
$this->assetCode = 'POL';
$this->assetId = 'Fx2rhWK36H1nfXsiD4orNpBm2QG1JrMhx3eUcPVcoZm2';
}
} else {
$this->assetId = $this->get_option('asset_id');
$this->assetCode = $this->get_option('asset_code');

}
if(empty($this->assetId)) {
$this->assetId = null;
Expand Down
4 changes: 3 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Donate link: Waves: 3P4gvv7rZC1kFDobs4oQHN3H6NQckWiu9wz (tubbynl),3PFn9SGPJ8yVjc
Tags: billing, invoicing, woocommerce, payment
Requires at least: 3.0.1
Tested up to: 4.8
Stable tag: 0.4.1
Stable tag: 0.4.2
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Expand Down Expand Up @@ -39,6 +39,8 @@ Install the plugin by uploading the zipfile in your WP admin interface or via FT

== Changelog ==

- 0.4.2
* Added POL currency as static currency (conversion is skipped)
- 0.4.1
* Waves conversions round on 2 decimals
- 0.4.0
Expand Down
6 changes: 4 additions & 2 deletions waves-gateway-for-woocommerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Plugin Name: WNET Gateway for Woocommerce (also for other Waves assets)
* Plugin URI: https://github.com/wavesnode/gateway-for-woocommerce/
* Description: Show prices in Waves (or asset) and accept Waves payments in your woocommerce webshop
* Version: 0.4.1
* Version: 0.4.2
* Author: Tubby / Useless Waves Token
* License: GPLv2 or later
* License URI: http://www.opensource.org/licenses/gpl-license.php
Expand Down Expand Up @@ -113,6 +113,7 @@ public function WavesCurrencies( $currencies )
$currencies['WAVES'] = __( 'Waves', 'waves' );
$currencies['WNET'] = __( 'Wavesnode.NET', 'wnet' );
$currencies['ARTcoin'] = __( 'ARTcoin', 'ARTcoin' );
$currencies['POL'] = __( 'POLTOKEN.PL', 'POL' );
return $currencies;
}

Expand All @@ -121,6 +122,7 @@ public function WavesCurrencySymbols( $currency_symbol, $currency ) {
case 'WAVES': $currency_symbol = 'WAVES'; break;
case 'WNET': $currency_symbol = 'WNET'; break;
case 'ARTcoin': $currency_symbol = 'ARTcoin'; break;
case 'POL': $currency_symbol = 'POL'; break;
}
return $currency_symbol;
}
Expand Down Expand Up @@ -155,7 +157,7 @@ public function WavesFilterCartSubtotal($price, $cart_item, $cart_item_key)
private function convertToWavesPrice($price_string, $price)
{
$options = get_option('woocommerce_waves_settings');
if(!in_array(get_woocommerce_currency(), array("WAVES","WNET","ARTcoin")) && $options['show_prices'] == 'yes') {
if(!in_array(get_woocommerce_currency(), array("WAVES","WNET","ARTcoin","POL")) && $options['show_prices'] == 'yes') {
$waves_currency = $options['asset_code'];
if(empty($waves_currency)) {
$waves_currency = 'Waves';
Expand Down

0 comments on commit a4ad7e1

Please sign in to comment.