Skip to content

Commit

Permalink
Merge pull request #78 from culqi/feat/sonic-brand-visa
Browse files Browse the repository at this point in the history
Feat/sonic brand visa
  • Loading branch information
JoseHCalderon authored Jun 18, 2024
2 parents c896900 + e9638f3 commit 6ab98c4
Show file tree
Hide file tree
Showing 30 changed files with 390 additions and 64 deletions.
2 changes: 1 addition & 1 deletion config_es.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<module>
<name>culqi</name>
<displayName><![CDATA[Culqi]]></displayName>
<version><![CDATA[3.1.0]]></version>
<version><![CDATA[3.1.1]]></version>
<description><![CDATA[Con&eacute;ctate a nuestra pasarela de pagos para aumentar tus ventas.]]></description>
<author><![CDATA[Culqi]]></author>
<tab><![CDATA[payments_gateways]]></tab>
Expand Down
13 changes: 10 additions & 3 deletions controllers/front/payment.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,23 @@ public function initContent()
$urlapi_ordercharges = URLAPI_ORDERCHARGES_INTEG;
$urlapi_checkout = URLAPI_CHECKOUT_INTEG;
$urlapi_3ds = URLAPI_INTEG_3DS;

if(Configuration::get('CULQI_ENVIROMENT')=='prod'){
$urlapi_ordercharges = URLAPI_ORDERCHARGES_PROD;
$urlapi_checkout = URLAPI_CHECKOUT_PROD;
$urlapi_3ds = URLAPI_PROD_3DS;
}
$version = time();

$this->context->controller->addCSS(__PS_BASE_URI__.'modules/'.$this->module->name.'/views/css/culqi.css?_='.$version);
$this->context->controller->addCSS(__PS_BASE_URI__.'modules/'.$this->module->name.'/views/css/global.css');
$this->context->controller->addCSS(__PS_BASE_URI__.'modules/'.$this->module->name.'/views/css/culqi.css');
$this->context->controller->addCSS(__PS_BASE_URI__.'modules/'.$this->module->name.'/views/css/brands.css');
$this->context->controller->addCSS(__PS_BASE_URI__.'modules/'.$this->module->name.'/views/css/waitMe.min.css');
$this->context->controller->addJS($urlapi_checkout);
$this->context->controller->addJS('https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js');

$cart = $this->context->cart;
$address = Db::getInstance()->ExecuteS("SELECT * FROM " . _DB_PREFIX_ . "address where id_address=" . $cart->id_address_invoice);

if (!$this->module->checkCurrency($cart))
{
Expand All @@ -39,6 +43,9 @@ public function initContent()

$total = Tools::ps_round($cart->getOrderTotal(true, Cart::BOTH), _PS_PRICE_DISPLAY_PRECISION_);
$color_palette = Configuration::get('CULQI_COLOR_PALETTE');
if(!$color_palette) {
$color_palette = "-";
}
$base_url = Tools::getShopDomainSsl(true, true) . __PS_BASE_URI__ . 'module/culqi/payment';

$total = $total*100;
Expand All @@ -63,7 +70,7 @@ public function initContent()
$this->context->smarty->assign('multipayment_enable', Configuration::get('CULQI_ENABLED'));
$this->context->smarty->assign("psversion", array('min' => '1.6', 'max' => _PS_VERSION_)['max']);
$this->context->smarty->assign("culqipluginversion", 'v'.CULQI_PLUGIN_VERSION);
$this->context->smarty->assign("module_dir", $this->_path);
$this->context->smarty->assign("module_dir", $this->module->getPathUri());
$this->context->smarty->assign("descripcion", "Orden de compra ".$cart->id);
$this->context->smarty->assign("orden", $cart->id);
$this->context->smarty->assign("enviroment_backend", $urlapi_ordercharges);
Expand Down
43 changes: 31 additions & 12 deletions culqi.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
if (!defined('_PS_VERSION_'))
exit;

define('CULQI_PLUGIN_VERSION', '3.1.0');
define('CULQI_PLUGIN_VERSION', '3.1.1');

define('URLAPI_INTEG', 'https://integ-panel.culqi.com');
define('URLAPI_PROD', 'https://panel.culqi.com');
Expand Down Expand Up @@ -220,12 +220,10 @@ public function getCulqiInfoCheckout() {

$cart = $this->context->cart;
$address = Db::getInstance()->ExecuteS("SELECT * FROM " . _DB_PREFIX_ . "address where id_address=" . $cart->id_address_invoice);
//var_dump($currency); exit(1);
if($address) {
$country = Db::getInstance()->ExecuteS("SELECT * FROM " . _DB_PREFIX_ . "country where id_country=" . $address[0]['id_country']);
}
$total = Tools::ps_round($cart->getOrderTotal(true, Cart::BOTH), _PS_PRICE_DISPLAY_PRECISION_);
//$total = Tools::ps_round($cart->getOrderTotal(true, Cart::BOTH), PS_PRICE_DISPLAY_PRECISION);
//var_dump(PS_PRICE_DISPLAY_PRECISION); exit(1);
//$total = $cart->getOrderTotal(true, Cart::BOTH);
//var_dump($this->context->currency); exit(1);
$color_palette = Configuration::get('CULQI_COLOR_PALETTE');
$total = $total * 100;

Expand All @@ -246,7 +244,7 @@ public function getCulqiInfoCheckout() {

return array(
"psversion" => $this->ps_versions_compliancy['max'],
'culqipluginversion' => $this->version,
"culqipluginversion" => $this->version,
"module_dir" => $this->_path,
"descripcion" => "Orden de compra ".$cart->id,
"orden" => $cart->id,
Expand All @@ -270,8 +268,9 @@ public function getCulqiInfoCheckout() {
"currency" => $this->context->currency->iso_code,
"address" => $address,
"customer" => $this->context->customer,
'commerce' => Configuration::get('PS_SHOP_NAME'),
"BASE_URL" => $base_url
"commerce" => Configuration::get('PS_SHOP_NAME'),
"BASE_URL" => $base_url,
"country" =>$country ?? "PE"
);
}

Expand Down Expand Up @@ -374,10 +373,30 @@ public function getContent()

private function createStates()
{
if (!Configuration::get('CULQI_STATE_OK')) {
if (!Configuration::get('CULQI_STATE_OK') || Configuration::get('CULQI_STATE_OK') == "0") {
$txt_state='Pago aceptado';
$orderstate = Db::getInstance()->ExecuteS("SELECT distinct osl.id_order_state, osl.name FROM " . _DB_PREFIX_ . "order_state_lang osl, " . _DB_PREFIX_ . "order_state os where osl.id_order_state=os.id_order_state and osl.name='" . $txt_state . "' and deleted=0");
Configuration::updateValue('CULQI_STATE_OK', (int)$orderstate[0]['id_order_state']);
$rows = Db::getInstance()->getValue($this->queryGetStates($txt_state));
if (intval($rows) == 0) {
$order_state = new OrderState();
$order_state->name = array();
foreach (Language::getLanguages() as $language) {
$order_state->name[$language['id_lang']] = $txt_state;
}
$order_state->send_email = false;
$order_state->color = '#32CD32';
$order_state->hidden = false;
$order_state->paid = true;
$order_state->module_name = 'culqi';
$order_state->delivery = false;
$order_state->logable = false;
$order_state->invoice = true;
$order_state->pdf_invoice = true;
$order_state->add();
Configuration::updateValue('CULQI_STATE_OK', (int)$order_state->id);
} else {
$orderstate = Db::getInstance()->ExecuteS("SELECT distinct osl.id_order_state, osl.name FROM " . _DB_PREFIX_ . "order_state_lang osl, " . _DB_PREFIX_ . "order_state os where osl.id_order_state=os.id_order_state and osl.name='" . $txt_state . "' and deleted=0");
Configuration::updateValue('CULQI_STATE_OK', (int)$orderstate[0]['id_order_state']);
}
}
if (!Configuration::get('CULQI_STATE_PENDING')) {
$txt_state = 'En espera de pago por Culqi';
Expand Down
File renamed without changes.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 6ab98c4

Please sign in to comment.