Skip to content

Commit

Permalink
Merge pull request #16 from clipto/feature/13-wykop-coin
Browse files Browse the repository at this point in the history
Added Wykop Coin as currency (conversion/exchange rate is skipped)
  • Loading branch information
clipto authored May 21, 2018
2 parents a4ad7e1 + 5010e17 commit 8114e9a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
7 changes: 5 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","POL"));
$this->currencyIsWaves = in_array(get_woocommerce_currency(), array("WAVES","WNET","ARTcoin","POL","Wykop Coin"));
if($this->currencyIsWaves) {
if (get_woocommerce_currency() == "Waves") {
$this->assetCode = 'Waves';
Expand All @@ -43,7 +43,10 @@ public function __construct()
} else if (get_woocommerce_currency() == "POL") {
$this->assetCode = 'POL';
$this->assetId = 'Fx2rhWK36H1nfXsiD4orNpBm2QG1JrMhx3eUcPVcoZm2';
}
} else if (get_woocommerce_currency() == "Wykop Coin") {
$this->assetCode = 'Wykop Coin';
$this->assetId = 'AHcY2BMoxDZ57mLCWWQYBcWvKzf7rdFMgozJn6n4xgLt';
}
} else {
$this->assetId = $this->get_option('asset_id');
$this->assetCode = $this->get_option('asset_code');
Expand Down
6 changes: 4 additions & 2 deletions readme.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
=== Waves Gateway for Woocommerce ===
Contributors: uwtoken,tubbynl
Contributors: uwtoken,tubbynl, clipto
Donate link: Waves: 3P4gvv7rZC1kFDobs4oQHN3H6NQckWiu9wz (tubbynl),3PFn9SGPJ8yVjcmBps48Jx6ddz1QXwUiYqP (uwtoken)
Tags: billing, invoicing, woocommerce, payment
Requires at least: 3.0.1
Tested up to: 4.8
Stable tag: 0.4.2
Stable tag: 0.4.3
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.3
* Added Wykop Coin currency as static currency (conversion is skipped)
- 0.4.2
* Added POL currency as static currency (conversion is skipped)
- 0.4.1
Expand Down
4 changes: 3 additions & 1 deletion waves-gateway-for-woocommerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ public function WavesCurrencies( $currencies )
$currencies['WNET'] = __( 'Wavesnode.NET', 'wnet' );
$currencies['ARTcoin'] = __( 'ARTcoin', 'ARTcoin' );
$currencies['POL'] = __( 'POLTOKEN.PL', 'POL' );
$currencies['Wykop Coin'] = __( 'WYKOP.PL', 'Wykop Coin' );
return $currencies;
}

Expand All @@ -123,6 +124,7 @@ public function WavesCurrencySymbols( $currency_symbol, $currency ) {
case 'WNET': $currency_symbol = 'WNET'; break;
case 'ARTcoin': $currency_symbol = 'ARTcoin'; break;
case 'POL': $currency_symbol = 'POL'; break;
case 'Wykop Coin': $currency_symbol = 'Wykop Coin'; break;
}
return $currency_symbol;
}
Expand Down Expand Up @@ -157,7 +159,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","POL")) && $options['show_prices'] == 'yes') {
if(!in_array(get_woocommerce_currency(), array("WAVES","WNET","ARTcoin","POL","Wykop Coin")) && $options['show_prices'] == 'yes') {
$waves_currency = $options['asset_code'];
if(empty($waves_currency)) {
$waves_currency = 'Waves';
Expand Down

0 comments on commit 8114e9a

Please sign in to comment.