aledis Posted August 19, 2011 Share Posted August 19, 2011 Hola soy nuevo por aqui les dejo un script para DineroMail, como virtud esta preparado para distintos paises y para funcionar con callback o ipn. <?php function rapimail_config() { $configarray = array( "FriendlyName" => array("Type" => "System", "Value"=>"Dineromail"), "dm_mail" => array("FriendlyName" => "Correo con el que entras a DineroMail", "Type" => "text", "Size" => "20", ), "dm_nrocta" => array("FriendlyName" => "Numero de Cuenta", "Type" => "text", "Size" => "7", ), "dm_nrocta2" => array("FriendlyName" => "Numero de Cuenta", "Type" => "text", "Size" => "1", ), "dm_ipn" => array("FriendlyName" => "Contraseña de la IPN de la cuenta", "Type" => "text", "Size" => "20", ), "dm_pais" => array("FriendlyName" => "Pais de DineroMail", "Type" => "dropdown", "Options" => "argentina,mexico,chile", ), "dm_moneda" => array("FriendlyName" => "Moneda (1 pesos - 2 dolares)", "Type" => "dropdown", "Options" => "1,2", ), "dm_medios" => array("FriendlyName" => "Medios de Pago", "Type" => "text", "Size" => "20", ), "dm_nombre_item" => array("FriendlyName" => "Nombre del Item", "Type" => "text", "Size" => "20", ), "dm_logo" => array("FriendlyName" => "URL del Logo", "Type" => "text", "Size" => "50", ), "dm_boton" => array("FriendlyName" => "URL del Botón", "Type" => "text", "Size" => "50", ), "dm_url_exito" => array("FriendlyName" => "URL de Compra Exitosa", "Type" => "text", "Size" => "50", ), "dm_url_fracaso" => array("FriendlyName" => "URL de Compra Fracasada", "Type" => "text", "Size" => "50", ), "dm_mensaje" => array("FriendlyName" => "Mensaje", "Type" => "yesno", "Description" => "Desea que el comprador pueda dejar un mensaje?", ), "dm_envio" => array("FriendlyName" => "Direccion de Envio", "Type" => "yesno", "Description" => "Desea que el comprador pueda especificar una dirección de envio?", ), ); return $configarray; } function rapimail_link($params) { # Gateway Specific Variables $gtwMail = $params['dm_mail']; $gtwCta = $params['dm_nrocta']; $gtwCta2 = $params['dm_nrocta2']; $gtwIPN = $params['dm_ipn']; $gtwPais = $params['dm_pais']; $gtwCurr = $params['dm_moneda']; $gtwMedios = $params['dm_medios']; $gtwLogo = $params['dm_logo']; $gtwBoton = $params['dm_boton']; $gtwUrlOk = $params['dm_url_exito']; $gtwUrlFail = $params['dm_url_fracaso']; $gtwItemName = $params['dm_nombre_item']; $gtwMsg = $params['dm_mensaje']; $gtwEnv = $params['dm_envio']; # Invoice Variables $invoiceid = $params['invoiceid']; $description = $params["description"]; $amount = $params['amount']; # Format: ##.## # Client Variables $firstname = $params['clientdetails']['firstname']; $lastname = $params['clientdetails']['lastname']; $email = $params['clientdetails']['email']; $address1 = $params['clientdetails']['address1']; $address2 = $params['clientdetails']['address2']; $city = $params['clientdetails']['city']; $state = $params['clientdetails']['state']; $postcode = $params['clientdetails']['postcode']; $country = $params['clientdetails']['country']; $phone = $params['clientdetails']['phonenumber']; # System Variables $companyname = $params['companyname']; $systemurl = $params['systemurl']; $currency = $params['currency']; if($gtwBoton == "") { $gtwBoton = "https://www.dineromail.com/imagenes/post-login/boton-comprar-01.jpg"; } if($gtwLogo =="") { $gtwLogo = "http://"; } $code = " <form action=\"https://".$gtwPais.".dineromail.com/Shop/Shop_Ingreso.asp\" method=\"post\" target=\"_blank\"> <input type=\"image\" src=\"".$gtwBoton."\" border=\"0\" name=\"submit\" alt=\"Pagar con DineroMail\"> <input type=\"hidden\" name=\"E_Comercio\" value=\"".$gtwCta."\" > <input type=\"hidden\" name=\"NroItem\" value=\"".$invoiceid."\" > <input type=\"hidden\" name=\"TipoMoneda\" value=\"".$gtwCurr."\" > <input type=\"hidden\" name=\"PrecioItem\" value=\"".$amount."\" > <input type=\"hidden\" name=\"TRX_ID\" value=\"".$invoiceid."\" > <input type=\"hidden\" name=\"DireccionEnvio\" value=\"".$gtwEnv."\" > <input type=\"hidden\" name=\"Mensaje\" value=\"".$gtwMsg."\" > <input type=\"hidden\" name=\"usr_email\" value=\"".$email."\"> <input type=\"hidden\" name=\"usr_nombre\" value=\"".$firstname."\" > <input type=\"hidden\" name=\"usr_apellido\" value=\"".$lastname."\" > <input type=\"hidden\" name=\"usr_tel_numero\" value=\"".$phone."\" > <input type=\"hidden\" name=\"image_url\" value=\"".$gtwLogo."\" > <input type=\"hidden\" name=\"DireccionExito\" value=\"http://".$gtwUrlOk."\" > <input type=\"hidden\" name=\"DireccionFracaso\" value=\"http://".$gtwUrlFail."\" > <input type=\"hidden\" name=\"MediosPago\" value=\"".$gtwMedios."\" > <input type=\"hidden\" value=\"Pago por FACTURA Nº ".$invoiceid." - ".$email."\" name=\"NombreItem\"> </form>"; return $code; } ?> Tambien les paso otro codigo que no esta probado puede funcionar o no si alguien lo quiere probar o mejorar bienvenido sea. <?php include( "../../../dbconnect.php" ); include( "../../../includes/functions.php" ); include( "../../../includes/gatewayfunctions.php" ); include( "../../../includes/invoicefunctions.php" ); $gatewaymodule = "dineromail"; $GATEWAY = getgatewayvariables( $gatewaymodule ); if ( !$GATEWAY['type'] ) { exit( "Module Not Activated" );# Checks gateway module is active before accepting callback } $dm_ipn_url = "http://".$GATEWAY['dm_pais'].".dineromail.com/Vender/Consulta_IPN.asp"; $notificacion = $_REQUEST['notificacion']; $notificacion = htmlspecialchars_decode( urldecode( $notificacion ) ); @unlink( "tmpXML.xml" ); $fp = @fopen( "tmpXML.xml", "a+" ); @fwrite( @$fp, @$notificacion ); @fclose( @$fp ); $doc = simplexml_load_file( "tmpXML.xml" ); $post = "<REPORTE><NROCTA>"; $post .= $GATEWAY['dm_nrocta']; $post .= "</NROCTA><DETALLE><CONSULTA><CLAVE>"; $post .= $GATEWAY['dm_ipn']; $post .= "</CLAVE><TIPO>1</TIPO><OPERACIONES>"; if ( $doc->operaciones->operacion ) { foreach ( $doc->operaciones->operacion as $OPERACION ) { $trx_id = $OPERACION->id; $post .= "<ID>".$trx_id."</ID>"; checkcbinvoiceid( $trx_id, $GATEWAY['name'] ); } } $post .= "</OPERACIONES></CONSULTA></DETALLE></REPORTE>"; $post = "DATA=".urlencode( $post ); $error = 1; $x = 0; $post = str_replace( "\n", "", $post ); $post = str_replace( "\t", "", $post ); $ch = curl_init( $dm_ipn_url ); while ( $error != 0 ) { curl_setopt( $ch, CURLOPT_POST, 1 ); curl_setopt( $ch, CURLOPT_POSTFIELDS, $post ); curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true ); $resultado = curl_exec( $ch ); $error = curl_errno( $ch ); if ( 5 < $x ) { break; } ++$x; } curl_close( $ch ); $res = simplexml_load_string( $resultado ); foreach ( $res->DETALLE->OPERACIONES->OPERACION as $OPERACION2 ) { if ( $OPERACION2->ESTADO == 2 ) { checkcbtransid( $OPERACION2->NUMTRANSACCION ); $dmid = $OPERACION2->ID; $dmtrans = $OPERACION2->NUMTRANSACCION; addinvoicepayment( $dmid, $dmtrans, $gatewaymodule ); logtransaction( $GATEWAY['name'], $_REQUEST, "Successful" ); } } @unlink( "tmpXML.xml" ); ?> Saludos Link to comment Share on other sites More sharing options...
mochisnetwork Posted August 24, 2011 Share Posted August 24, 2011 hola, me interesa esta script para dineromail, la pregunta es como lo aplico en el whmcs junto al de dineromail mexico es decir el de oxxo y demas, o como funciona te agradeceria me explicaras a detalle gracias Link to comment Share on other sites More sharing options...
aledis Posted August 24, 2011 Author Share Posted August 24, 2011 hola,me interesa esta script para dineromail, la pregunta es como lo aplico en el whmcs junto al de dineromail mexico es decir el de oxxo y demas, o como funciona te agradeceria me explicaras a detalle gracias Funciona con dineromail de mexico chile y argentina, subis el archivo a la carpeta modules/gateways/ cuando configuras el modulo seleccionas como pais mexico y los demas datos de tu cuenta en DM. Pd el callback creo que no funciona tira un error. Link to comment Share on other sites More sharing options...
mochisnetwork Posted August 25, 2011 Share Posted August 25, 2011 ok gracias por la respuesta probare el script Link to comment Share on other sites More sharing options...
aroiz Posted October 25, 2011 Share Posted October 25, 2011 Bien, algo asi implementamos nosotros pero el detalle es que no puedes abrir cuentas en diferenes paises para dineromail, tienes que ser ciudadano , o conseguirte a alguien que sea tu intermediario. Link to comment Share on other sites More sharing options...
gaboman Posted February 13, 2012 Share Posted February 13, 2012 Gracias por compartir vamos a probar y con gusto daremos nuestra opinion, Saludos Link to comment Share on other sites More sharing options...
Recommended Posts