Ver Mensaje Individual
  #1 (permalink)  
Antiguo 16/10/2009, 20:44
prosan
 
Fecha de Ingreso: octubre-2008
Mensajes: 6
Antigüedad: 16 años, 1 mes
Puntos: 0
Implementar Dinero Mail en Cs-cart

Amigos de Foros del Web, quisiera la ayuda para solucionar un problema que ha superado mi poco conocimiento, deseo implementar es sistema de Pago Dinero Mail en mi sitio web como medio de pago, este sitio trabaja con Cs-Cart
La ayuda que necesito especificamente es pasar las variables necesarias desde la tienda a Dinero mail.

Amigos de Foros del Web, quisiera la ayuda para solucionar un problema que ha superado mi poco conocimiento, deseo implementar es sistema de Pago Dinero Mail en mi sitio web como medio de pago, este sitio trabaja con Cs-Cart
La ayuda que necesito especificamente es pasar las variables necesarias desde la tienda a Dinero mail.

Copio Codigo referencia dineromail.php de Oscommerce para sacar variables necesarias.

<?php

class dineromail {
var $code, $title, $description, $enabled;


function dineromail() {
global $order;

$this->code = 'dineromail';
$this->title = MODULE_PAYMENT_DINEROMAIL_TEXT_TITLE;
$this->description = MODULE_PAYMENT_DINEROMAIL_TEXT_DESCRIPTION;
$this->sort_order = MODULE_PAYMENT_DINEROMAIL_SORT_ORDER;
$this->enabled = ((MODULE_PAYMENT_DINEROMAIL_STATUS == 'True') ? true : false);

if ((int)MODULE_PAYMENT_DINEROMAIL_ORDER_STATUS_ID > 0) {
$this->order_status = MODULE_PAYMENT_DINEROMAIL_ORDER_STATUS_ID;
}

if (is_object($order)) $this->update_status();

$this->form_action_url = 'https://chile.dineromail.com/Shop/Shop_Ingreso.asp';
}

function update_status() {
global $order;

if ( ($this->enabled == true) && ((int)MODULE_PAYMENT_DINEROMAIL_ZONE > 0) ) {
$check_flag = false;
$check_query = tep_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_PAYMENT_DINEROMAIL_ZONE . "' and zone_country_id = '" . $order->billing['country']['id'] . "' order by zone_id");
while ($check = tep_db_fetch_array($check_query)) {
if ($check['zone_id'] < 1) {
$check_flag = true;
break;
} elseif ($check['zone_id'] == $order->billing['zone_id']) {
$check_flag = true;
break;
}
}

if ($check_flag == false) {
$this->enabled = false;
}
}
}

function javascript_validation() {
return false;
}

function selection() {
return array('id' => $this->code,
'module' => $this->title);
}

function pre_confirmation_check() {
return false;
}

function confirmation() {
return false;
}

function process_button() {
global $order, $currencies, $currency;

$my_currency = $currency;

$a = $order->info['total'];
$b = $order->info['shipping_cost'];
$c = $currencies->get_value($my_currency);
$d = $currencies->get_decimal_places($my_currency);
$total = $a * $c;
$precio = number_format($total, $d, '.', ',');

$productos = "Productos de " . STORE_NAME . ": ";

for ($i=0, $n=sizeof($order->products); $i<$n; $i++) {
$productos .= "<br/>" . "- " . $order->products[$i]['qty'] . '&nbsp;x ' . $order->products[$i]['name'];
}
if ($my_currency == 'USD'){
$TipoMoneda = '2';}else{
$TipoMoneda = '1';}


$process_button_string = tep_draw_hidden_field('NombreItem', $productos) .
tep_draw_hidden_field('TipoMoneda', $TipoMoneda) .
tep_draw_hidden_field('PrecioItem', $precio) .
tep_draw_hidden_field('usr_nombre', $order->customer['firstname']) .
tep_draw_hidden_field('usr_apellido', $order->customer['lastname']) .
tep_draw_hidden_field('usr_tel_numero', $order->customer['telephone']) .
tep_draw_hidden_field('usr_email', $order->customer['email_address']) .
tep_draw_hidden_field('E_Comercio', MODULE_PAYMENT_DINEROMAIL_ID) .
tep_draw_hidden_field('trx_id', MODULE_PAYMENT_DINEROMAIL_ID) .
tep_draw_hidden_field('image_url', '').
tep_draw_hidden_field('DireccionEnvio', '0' ) .
tep_draw_hidden_field('DireccionExito', tep_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL')) .
tep_draw_hidden_field('DireccionFracaso', tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'));

return $process_button_string;
}

function before_process() {
return false;
}

function after_process() {
return false;
}

function output_error() {
return false;
}

function check() {
if (!isset($this->_check)) {
$check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_DINEROMAIL_STATUS'");
$this->_check = tep_db_num_rows($check_query);
}
return $this->_check;
}


Esta es la Extructura del archivo dineromail.tpl que hay que modificar segun las variables anteriores para que funcione en la tienda.

<?php

if ( !defined('AREA') ) { die('Access denied'); }

if (defined('PAYMENT_NOTIFICATION')) {
$payment_id = db_get_field("SELECT payment_id FROM ?:orders WHERE order_id = ?i", $_REQUEST['order_id']);
$processor_data = fn_get_payment_method_data($payment_id);
$order_info = fn_get_order_info($_REQUEST['order_id']);

$order_number_id = ($processor_data['params']['mode'] == 'test') ? '1' : $_REQUEST['order_number'];

$pp_response = array();
if ((strtoupper(md5($processor_data['params']['secret_word'] . $processor_data['params']['account_number'] . $order_number_id . $order_info['total'])) == $_REQUEST['key']) && ($_REQUEST['credit_card_processed'] == 'Y')) {
$pp_response['order_status'] = 'P';
$pp_response['reason_text'] = fn_get_lang_var('order_id') . '-' . $_REQUEST['order_number'];

} else {
$pp_response['order_status'] = ($_REQUEST['credit_card_processed'] == 'K') ? 'O' : 'F';
$pp_response['reason_text'] = ($_REQUEST['credit_card_processed'] == 'Y') ? "MD5 Hash is invalid" : fn_get_lang_var('order_id') . '-' . $_REQUEST['order_number'];
}

$pp_response['transaction_id'] = (!empty($_REQUEST['tcoid'])) ? $_REQUEST['tcoid'] : '';

if (fn_check_payment_script('2checkout.php', $_REQUEST['order_id'])) {
fn_finish_payment($_REQUEST['order_id'], $pp_response, false);
fn_order_placement_routines($_REQUEST['order_id']);
}
exit;

} else {
$__bstate = $order_info['b_state'];
if ($order_info['b_country'] != 'US' && $order_info['b_country'] != 'CA') {
$__bstate = "XX";
}
$__sstate = @$order_info['s_state'];
if ($order_info['s_country'] != 'US' && $order_info['s_country'] != 'CA') {
$__sstate = "XX";
}
$is_test = ($processor_data['params']['mode'] == 'test') ? 'Y' : 'N';
$cart_order_id = ($order_info['repaid']) ? ($order_id .'_'. $order_info['repaid']) : $order_id;
$sh_cost = fn_order_shipping_cost($order_info);

echo <<<EOT
<html>
<body onLoad="document.process.submit();">
<form action="https://chile.dineromail.com/Shop/Shop_Ingreso.asp" method="POST" name="process">
<input type="hidden" name="sid" value="{$processor_data['params']['account_number']}" />
<input type="hidden" name="total" value="{$order_info['total']}" />
<input type="hidden" name="cart_order_id" value="{$cart_order_id}" />
<input type="hidden" name="card_holder_name" value="{$order_info['b_firstname']} {$order_info['b_lastname']}" />
<input type="hidden" name="street_address" value="{$order_info['b_address']}" />
<input type="hidden" name="city" value="{$order_info['b_city']}" />
<input type="hidden" name="state" value="{$__bstate}" />
<input type="hidden" name="zip" value="{$order_info['b_zipcode']}" />
<input type="hidden" name="country" value="{$order_info['b_country']}" />
<input type="hidden" name="email" value="{$order_info['email']}" />
<input type="hidden" name="phone" value="{$order_info['phone']}" />
<input type="hidden" name="ship_name" value="{$order_info['s_firstname']} {$order_info['s_lastname']}" />
<input type="hidden" name="ship_address" value="{$order_info['s_address']}" />
<input type="hidden" name="ship_city" value="{$order_info['s_city']}" />
<input type="hidden" name="ship_state" value="{$__sstate}" />
<input type="hidden" name="ship_zip" value="{$order_info['s_zipcode']}" />
<input type="hidden" name="ship_country" value="{$order_info['s_country']}" />
<input type="hidden" name="fixed" value="Y" />
<input type="hidden" name="id_type" value="1" />
<input type="hidden" name="sh_cost" value="{$sh_cost}" />
<input type="hidden" name="demo" value="{$is_test}" />
<input type="hidden" name="dispatch" value="payment_notification" />
<input type="hidden" name="payment" value="2checkout" />
<input type="hidden" name="order_id" value="{$order_id}" />
EOT;

// Products
$it = 0;
if (!empty($order_info['items'])) {
foreach ($order_info['items'] as $k => $v) {
$it++;
$is_tangible = (!empty($v['extra']['is_edp']) && $v['extra']['is_edp'] == 'Y') ? 'N' : 'Y';
$price = fn_format_price($v['price'] - (fn_external_discounts($v) / $v['amount']));
$suffix = "_$it";
echo <<<EOT
<input type="hidden" name="c_prod{$suffix}" value="{$v['product_id']},{$v['amount']}" />
<input type="hidden" name="c_name{$suffix}" value="{$v['product']}" />
<input type="hidden" name="c_description{$suffix}" value="{$v['product']}" />
<input type="hidden" name="c_price{$suffix}" value="{$price}" />
<input type="hidden" name="c_tangible{$suffix}" value="{$is_tangible}" />
EOT;
}
}
// Certificates
if (!empty($order_info['gift_certificates'])) {
foreach ($order_info['gift_certificates'] as $k => $v) {
$it++;
$v['amount'] = (!empty($v['extra']['exclude_from_calculate'])) ? 0 : $v['amount'];
$suffix = "_$it";
echo <<<EOT
<input type="hidden" name="c_prod{$suffix}" value="{$v['gift_cert_id']},1" />
<input type="hidden" name="c_name{$suffix}" value="{$v['gift_cert_code']}" />
<input type="hidden" name="c_description{$suffix}" value="{$v['gift_cert_code']}" />
<input type="hidden" name="c_price{$suffix}" value="{$v['amount']}" />
<input type="hidden" name="c_tangible{$suffix}" value="N" />
EOT;
}
}

/*if (floatval($order_info['subtotal_discount'])) {
$it++;
$suffix = "_$it";
$desc = fn_get_lang_var('order_discount');
$pr = fn_format_price($order_info['subtotal_discount']);
echo <<<EOT
<input type="hidden" name="c_prod{$suffix}" value="ORDER_DISCOUNT,1" />
<input type="hidden" name="c_name{$suffix}" value="{$desc}" />
<input type="hidden" name="c_description{$suffix}" value="{$desc}" />
<input type="hidden" name="c_price{$suffix}" value="{$pr}" />
<input type="hidden" name="c_tangible{$suffix}" value="N" />
EOT;
}*/
?>