Skip to content

Commit

Permalink
Update version 1.0.16
Browse files Browse the repository at this point in the history
  • Loading branch information
atmoner committed Jan 26, 2023
1 parent 9c7b4fe commit e3a2ef7
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 7 deletions.
10 changes: 9 additions & 1 deletion controllers/front/validation.php
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,15 @@ public function postProcess()

// Check the currency from prestashop and convert it to price chain
$currencyList = "usd,aed,ars,aud,bdt,bhd,bmd,brl,cad,chf,clp,cny,czk,dkk,eur,gbp,hkd,huf,idr,ils,inr,jpy,krw,kwd,lkr,mmk,mxn,myr,ngn,nok,nzd,php,pkr,pln,rub,sar,sek,sgd,thb,try,twd,uah,vef,vnd,zar,xdr";
$dataValueCoin = file_get_contents('https://api.coingecko.com/api/v3/simple/price?ids='.$dataChain['coingeckoId'].'&vs_currencies='.$currencyList);


if ($dataChain['coingeckoId'] === 'bitcanna') {
$dataValueCoin = file_get_contents('https://bcnaracle.bitcanna.io/bcnaracle.json');
} else {
$dataValueCoin = file_get_contents('https://api.coingecko.com/api/v3/simple/price?ids='.$dataChain['coingeckoId'].'&vs_currencies='.$currencyList);
}


$decodedData = json_decode($dataValueCoin);
$currencyNow = strtolower($this->context->currency->iso_code);
// And display good price!
Expand Down
2 changes: 1 addition & 1 deletion cosmospay.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function __construct()
{
$this->name = 'cosmospay';
$this->tab = 'payments_gateways';
$this->version = '1.0.15';
$this->version = '1.0.16';
$this->ps_versions_compliancy = array('min' => '1.7', 'max' => _PS_VERSION_);
$this->author = 'Bitcanna';
$this->controllers = array('validation');
Expand Down
11 changes: 10 additions & 1 deletion js/mainscript.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function startChecking( order_id, mainDomain, memo, isBlocked, nonceSelectChain, nonceDeleteOrder, nonceSwitchMethod, setDefault ) {
function startChecking( order_id, mainDomain, memo, isBlocked, nonceSelectChain, nonceDeleteOrder, nonceSwitchMethod, setDefault, isMobile ) {

$( '#chainIcon' ).hide()
$( '#chainIcon2' ).hide()
Expand Down Expand Up @@ -44,6 +44,15 @@ function startChecking( order_id, mainDomain, memo, isBlocked, nonceSelectChain,
timerOrder( result.startTime )
}
})

let finalMethod = ''
if(isMobile) {
finalMethod = 'another'
} else
finalMethod = 'keplr'

$.post( mainDomain+"index.php?fc=module&module=cosmospay&controller=validation", { switchMethod: finalMethod}, function( result ) {
})
}


Expand Down
14 changes: 10 additions & 4 deletions views/templates/front/payment_return.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
{$orderSymbol}{$orderValue}
</div>
</div>

<div class="cosmos-content">
<p>Select your cryptocurrency:</p>
<div class="box">
Expand All @@ -32,7 +32,10 @@
<p>Select your prefered way to pay:</p>
<div class="box">
<select id="selectMethod">
<option value="keplr">Pay automatically with keplr</option>
{if !Context::getContext()->isMobile()}
<option value="keplr">Pay automatically with keplr</option>
{/if}

<option value="another">Pay with another wallet</option>
</select>
</div>
Expand Down Expand Up @@ -101,6 +104,7 @@
{$orderSymbol}{$orderValue}
</div>
</div>

<div class="d-flex justify-content-center">
<div class="cosmos-content" id="manualFinal">
<div id="phase1">
Expand Down Expand Up @@ -159,7 +163,6 @@ Time left: <b><span id="minutes"></span>:<span id="seconds"></span></b>
<script>
window.onload = function() {
console.log(exportCosmosConfig)
var order_id = "{$orderId}";
var mainDomain = "{$mainDomain}";
Expand All @@ -170,6 +173,8 @@ console.log(exportCosmosConfig)
var nonceSwitchMethod = ""
var nonceSwitchMethod = ""
var setDefault = "{$unserializeChains[0]}"
var isMobile = "{Context::getContext()->isMobile()}"
console.log(isMobile)
startChecking(
order_id,
mainDomain,
Expand All @@ -178,7 +183,8 @@ console.log(exportCosmosConfig)
nonceSelectChain,
nonceDeleteOrder,
nonceSwitchMethod,
setDefault
setDefault,
isMobile
);
}
</script>
Expand Down

0 comments on commit e3a2ef7

Please sign in to comment.