Closed andreasherne closed 5 years ago
Good to know this update. We will consider adding this soon. If you require this urgently, our developer can add give a rough instruction, on how to change code to do this
@blockonomics I have tried to change the code on my own and some changes , overall the address is being generated correctly for Monero, but the only issue I am facing is - QR Code is not being generated for the Monero page.
These are the changes I implemented in the woocommerce plugin found in wordpress repo https://wordpress.org/plugins/blockonomics-bitcoin-payments/
1) On blockonomics-bitcoin-payments\js\app.js
L61 to
$compileProvider.aHrefSanitizationWhitelist(/^\s*(https?|ftp|mailto|data|chrome-extension|bitcoin|ethereum|litecoin|monero):/);
L204 to
//Define supported altcoins
$scope.altcoins = {
"ETH": "Ethereum",
"LTC": "Litecoin",
"XMR": "Monero"
};
L520 to
//Define supported altcoins
$scope.altcoins = {
"ETH": "Ethereum",
"LTC": "Litecoin",
"XMR": "Monero"
};
2) On blockonomics-bitcoin-payments\order.php
L102 to
<a ng-click="pay_altcoins()" href=""><button><i class="cf" ng-hide="altcoinselect!='Ethereum'" ng-class={'cf-eth':'{{altcoinselect}}'!=''} ></i><i class="cf" ng-hide="altcoinselect!='Litecoin'" ng-class={'cf-ltc':'{{altcoinselect}}'!=''} ></i><i class="cf" ng-hide="altcoinselect!='Monero'" ng-class={'cf-xmr':'{{altcoinselect}}'!=''} ></i> <?=__('Pay with', 'blockonomics-bitcoin-payments')?> {{altcoinselect}}</button></a>
L175 to
<h4><i class="cf bnomics-alt-icon" ng-hide="altcoinselect!='Ethereum'" ng-class={'cf-eth':'{{altcoinselect}}'!=''} ></i><i class="cf bnomics-alt-icon" ng-hide="altcoinselect!='Litecoin'" ng-class={'cf-ltc':'{{altcoinselect}}'!=''} ></i><i class="cf bnomics-alt-icon" ng-hide="altcoinselect!='Monero'" ng-class={'cf-xmr':'{{altcoinselect}}'!=''} ></i></h4>
L182 to
<h4><i class="cf bnomics-alt-icon" ng-hide="altcoinselect!='Ethereum'" ng-class={'cf-eth':'{{altcoinselect}}'!=''} ></i><i class="cf bnomics-alt-icon" ng-hide="altcoinselect!='Litecoin'" ng-class={'cf-ltc':'{{altcoinselect}}'!=''} ></i><i class="cf bnomics-alt-icon" ng-hide="altcoinselect!='Monero'" ng-class={'cf-xmr':'{{altcoinselect}}'!=''} ></i></h4>
3) On blockonomics-bitcoin-payments\templates\order.php
L118 to
<a ng-click="pay_altcoins()" href="" class="button bnomics-altcoin-margin"><i class="cf" ng-hide="altcoinselect!='Ethereum'" ng-class={'cf-eth':'{{altcoinselect}}'!=''} ></i><i class="cf" ng-hide="altcoinselect!='Litecoin'" ng-class={'cf-ltc':'{{altcoinselect}}'!=''} ></i><i class="cf" ng-hide="altcoinselect!='Monero'" ng-class={'cf-xmr':'{{altcoinselect}}'!=''} ></i> <?=__('Pay with', 'blockonomics-bitcoin-payments')?> {{altcoinselect}}</a>
The above code changes are working fine - only QR code for Monero is not getting generated, any help is much appreciated.
Thnx in advance!
To add a new coin requires three steps:
1) Add coin to the url sanitation list here
eg. |monero
2) Add the coin name and symbol to $scope.altcoins list here and here
eg. "XMR": "Monero"
3) Add the coin icon to the select list in order.php here
eg. <i class="cf" ng-hide="altcoinselect!='Monero'" ng-class={'cf-xmr':'{{altcoinselect}}'!=''} ></i>
@DarrenWestwood , Thnx for your response, I have done all of the above mentioned steps as you can see from my previous response, but the QR code for Monero is not getting generated. The QR code for all others e.g. BTC, ETH and LTC is getting generated.
I researched it a bit and I think the issue is with the qrcode data generated in order.php here
If size="221" version="8"
is chosen then QR code for Monero is getting generated, but there is a CSS issue in case of BTC QR code shifting slightly to the right.
The issue stems from the fact that Flyp.me uses XMR sub-addresses which are close to 90 characters long. This makes the QR code payment url for Monero 135 characters long.
e.g. monero:83pFQ3bt6U1L8nvvjZ1xZ49ZnDE4LsX5fJKSNmY5NxPHaLwH9kYS7qsJL5krYNbaSZ2G4J5mzMXLnaLusKNac3B2NuPdZVv?amount=1.20160825&value=1.20160825
@andreasherne
You can leave the size="160"
and only change version="8"
This should solve your issue.
Monero uses tx_amount
parameter in URI.
https://monero.fandom.com/wiki/URI_formatting
@DarrenWestwood
version="8"
works! QR code for Monero is getting generated.
Flyp.me has recently added Monero support. Since Monero is one of the most active crypto with a great community, how do we add Monero as one of the Altcoin option in Blockonomics.