Skip to content

Commit

Permalink
Merge pull request #2 from atmoner/main
Browse files Browse the repository at this point in the history
v1.0.14
  • Loading branch information
atmoner committed Dec 16, 2022
2 parents 8b3c308 + 91cd770 commit 019dbc9
Show file tree
Hide file tree
Showing 7 changed files with 286 additions and 282 deletions.
213 changes: 0 additions & 213 deletions bitcanna.php

This file was deleted.

14 changes: 13 additions & 1 deletion controllers/front/validation.php
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,17 @@ public function postProcess()
$selectChain = Configuration::get('CONF_COSMOS_CHAINS');
$unserializeChains = unserialize($selectChain);

if($cart->id) {
// Check configuration
$checkAllAddress = Configuration::get('CONF_COSMOS_CHAINS_ADDR');
$checkAllAddress = unserialize($checkAllAddress);

$checkError = false;
foreach ($checkAllAddress as $key => $value) {
if(empty($value))
$checkError = true;
}

if($cart->id && $checkError === false) {
$this->context->smarty->assign('totalAmount', round(Configuration::get('BITCANNA_TOTAL_'.$cart->id), 4));
$this->context->smarty->assign('memo', $returnTrans[0]["memo"]);
$this->context->smarty->assign('viewDenom', $returnTrans[0]["viewDenom"]);
Expand All @@ -395,6 +405,8 @@ public function postProcess()
$this->context->smarty->assign('unserializeChains', $unserializeChains);
$this->context->smarty->assign('mainDomain', Context::getContext()->shop->getBaseURL(true));
$this->setTemplate('module:cosmospay/views/templates/front/payment_return.tpl');
} elseif ($checkError === true) {
$this->setTemplate('module:cosmospay/views/templates/front/bad_config.tpl');
} else {
$this->context->smarty->assign('mainDomain', Context::getContext()->shop->getBaseURL(true));
$this->setTemplate('module:cosmospay/views/templates/front/payment_cancel.tpl');
Expand Down
32 changes: 5 additions & 27 deletions 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 = '0.1.1';
$this->version = '1.0.14';
$this->ps_versions_compliancy = array('min' => '1.7', 'max' => _PS_VERSION_);
$this->author = 'Bitcanna';
$this->controllers = array('validation');
Expand All @@ -69,14 +69,7 @@ public function __construct()

public function install()
{
// $sqlCreate = "CREATE TABLE `" . _DB_PREFIX_ . ModuleTestTableTest::$definition["table"] . "` (
// `" . ModuleTestTableTest::$definition["primary"] . "` int(11) unsigned NOT NULL AUTO_INCREMENT,
// `champ_varchar_test` varchar(255) DEFAULT NULL,
// `champ_date_test` DATETIME NOT NULL,
// `champ_int_test` int(11) unsigned NOT NULL,
// PRIMARY KEY (`" . ModuleTestTableTest::$definition["primary"] . "`)
// ) ENGINE=InnoDB DEFAULT CHARSET=utf8;";


$sqlCreate = "CREATE TABLE `" . _DB_PREFIX_ . "cosmos_transaction` (
`id_order` int UNSIGNED NOT NULL,
`chain_pay` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
Expand Down Expand Up @@ -163,36 +156,24 @@ public function assignConfiguration()
$json = file_get_contents('https://store-api.bitcanna.io');
//$json = file_get_contents('https://raw.githubusercontent.com/BitCannaGlobal/cosmospay-api/main/cosmos.config.test.json');
//$array = (array)json_decode(json_encode($json));


$obj = json_decode($json);

$this->context->smarty->assign('configCosmos', $obj);


$moduleTitle = Configuration::get('CONF_COSMOS_TITLE');
$moduleDesc = Configuration::get('CONF_COSMOS_DESC');
$selectChain = Configuration::get('CONF_COSMOS_CHAINS');
$selectChainAddr = Configuration::get('CONF_COSMOS_CHAINS_ADDR');

$unserializeChains = unserialize($selectChain);
$unserializeChainsAddr = unserialize($selectChainAddr);

// var_dump($unserializeChainsAddr);
// var_dump($unserializeChains);




/* foreach ($array as $key => $value) {
echo $value;
} */
//var_dump($addressLinkedToDb);


$this->context->smarty->assign('moduleTitle', $moduleTitle);
$this->context->smarty->assign('moduleDesc', $moduleDesc);
// $this->context->smarty->assign('selectChain', $unserializeChains);
// $this->context->smarty->assign('inputActive', $unserializeChainsAddr);

if (!$unserializeChains) {
$this->context->smarty->assign('selectChain', []);
Expand Down Expand Up @@ -228,9 +209,6 @@ public function hookPaymentOptions($params)

$payment_options = [
$this->getOfflinePaymentOption(),
//$this->getExternalPaymentOption(),
//$this->getEmbeddedPaymentOption(),
//$this->getIframePaymentOption(),
];

return $payment_options;
Expand Down

0 comments on commit 019dbc9

Please sign in to comment.