Changeset 807735
- Timestamp:
- 11/20/2013 07:41:07 PM (12 years ago)
- Location:
- webpay-woocommerce-plugin
- Files:
-
- 1 added
- 4 edited
- 4 copied
-
tags/2.1.9 (added)
-
tags/2.1.9/trunk (copied) (copied from webpay-woocommerce-plugin/trunk)
-
tags/2.1.9/trunk/php/thankYouPage.php (copied) (copied from webpay-woocommerce-plugin/trunk/php/thankYouPage.php)
-
tags/2.1.9/trunk/readme.txt (copied) (copied from webpay-woocommerce-plugin/trunk/readme.txt)
-
tags/2.1.9/trunk/webpay.php (copied) (copied from webpay-woocommerce-plugin/trunk/webpay.php)
-
trunk/README.md (modified) (2 diffs)
-
trunk/php/thankYouPage.php (modified) (1 diff)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/webpay.php (modified) (15 diffs)
Legend:
- Unmodified
- Added
- Removed
-
webpay-woocommerce-plugin/trunk/README.md
r760404 r807735 68 68 4. La página usada por HTML_TR_NORMAL = http://DIRECCIONDETUPAGINA/?page_id=xt_compra&pay=webpay&wc-api=WC_Webpay 69 69 70 5. Es necesario cambiar en la página de recepción del pedido [woocommerce-thankyou] por [webpay-thankyou]. 71 70 72 # Ejemplo **tbk_config.dat**. # 71 73 … … 94 96 ``` 95 97 #CHANGELOG 98 * V2.2 : Se establece el short-code [webpay-thankyou] para realizar las validaciones necesarias por parte de transbank. Es necesario cambiar en la página de recepción del pedido por [woocommerce-thankyou]. 99 * V2.1.9 : Se usa el estandar definido por woocommerce para los códigos de estado. 100 * V2.1.8 : Arreglada posible duplicidad cuando la orden pasa a on-hold. 101 * V2.1.7 : 102 * V2.1.6 : Modificado para que funcionara con versiones más antiguas de php. 96 103 * V2.1.5 : Se cambian los permisos por defecto de la carpeta común. Con esto se deben asegurar que el usuario que ejecuta los CGI sea el mismo que crea los archivos. 97 104 * V2.1.2 : Se externaliza la carpeta común al directorio de uploads. De esta manera no se borra la información al actualizar el plugin. -
webpay-woocommerce-plugin/trunk/php/thankYouPage.php
r804502 r807735 1 1 <?php 2 if (isset($_REQUEST['status'])): 3 if ($_REQUEST['status'] == "failure"): 4 //echo '<h2>' . __('Un error ha ocurrido', 'webpay') . '</h2>'; 2 5 3 if (isset($_REQUEST['status'])): 4 if ($_REQUEST['status'] == "failure"): 5 echo '<h2>' . __('Un error ha ocurrido', 'webpay') . '</h2>'; 6 $TBK_ID_SESION 7 = $_REQUEST["TBK_ID_SESION"]; 8 $TBK_ORDEN_COMPRA 9 = $_REQUEST["TBK_ORDEN_COMPRA"]; 10 ?> 11 <h2>Transacción Fracasada - Orden <?=$_REQUEST['order']?></h2> 6 12 7 $TBK_ID_SESION 8 = $_REQUEST["TBK_ID_SESION"]; 9 $TBK_ORDEN_COMPRA 10 = $_REQUEST["TBK_ORDEN_COMPRA"]; 11 ?> 12 <CENTER> 13 <B>TRANSACCIÓN FRACASADA !!!</B> 14 <TABLE> 15 <TR><TH>FRACASO</TH></TR> 16 <TR><TD> 17 TBK_ID_SESION=<?php echo $TBK_ID_SESION; ?><BR> 18 TBK_ORDEN_COMPRA=<?php echo $TBK_ORDEN_COMPRA; ?><BR> 19 </TD></TR> 20 </TABLE> 21 </CENTER> 22 <?php 23 else: 24 //IF IT IS A WEBPAY PAYMENT 25 global $webpay_table_name; 26 global $wpdb; 27 $order_id = explode('_', $_REQUEST['order']); 28 $order_id = (int) $order_id[0]; 29 $paramArr = array(); 30 $myOrderDetails = $wpdb->get_row("SELECT * FROM $webpay_table_name WHERE idOrder = $order_id", ARRAY_A); 31 if ($myOrderDetails): 32 ?> 33 <h2 class="related_products_title order_confirmed"><?= "Información Extra de la Transacción"; ?></h2> 34 <div class="clear"></div> 35 <table class="shop_table order_details"> 36 <thead> 37 <tr> 38 <th class="product-name"><?php echo "Dato" ?></th> 39 <th class="product-quantity"><?php echo "Valor"; ?></th> 13 </h3>Las posibles causas de este rechazo son:</h3> 14 15 <ul style="margin-left: 50px"> 16 <li> Error en el ingreso de los datos de su tarjeta de crédito o Debito (fecha y/o código de seguridad).</li> 17 <li> Su tarjeta de crédito o debito no cuenta con el cupo necesario para cancelar la compra.</li> 18 <li> Tarjeta aún no habilitada en el sistema financiero. </li> 19 <li> Si el problema persiste favor comunicarse con su Banco emisor. </li> 20 </ul> 21 22 <?php 23 else: 24 //IF IT IS A WEBPAY PAYMENT 25 global $webpay_table_name; 26 global $wpdb; 27 $order_id = explode('_', $_REQUEST['order']); 28 $order_id = (int) $order_id[0]; 29 $paramArr = array(); 30 $myOrderDetails = $wpdb->get_row("SELECT * FROM $webpay_table_name WHERE idOrder = $order_id", ARRAY_A); 31 if ($myOrderDetails): 32 ?> 33 <h2 class="related_products_title order_confirmed"><?= "Información Extra de la Transacción"; ?></h2> 34 <div class="clear"></div> 35 <table class="shop_table order_details"> 36 <thead> 37 <tr> 38 <th class="product-name"><?php echo "Dato" ?></th> 39 <th class="product-quantity"><?php echo "Valor"; ?></th> 40 40 41 41 42 </tr>43 </thead>44 <tfoot>42 </tr> 43 </thead> 44 <tfoot> 45 45 46 <tr>47 <th>Tipo de Transacción</th>48 <th>Venta</th>46 <tr> 47 <th>Tipo de Transacción</th> 48 <th>Venta</th> 49 49 50 </tr>51 <tr>52 <th>Nombre del Comercio</th>53 <th><?php echo $this->settings['trade_name']; ?></th>50 </tr> 51 <tr> 52 <th>Nombre del Comercio</th> 53 <th><?php echo $this->settings['trade_name']; ?></th> 54 54 55 </tr>56 <tr>57 <th>URL Comercio</th>58 <th><?php echo $this->settings['url_commerce']; ?></th>55 </tr> 56 <tr> 57 <th>URL Comercio</th> 58 <th><?php echo $this->settings['url_commerce']; ?></th> 59 59 60 </tr>60 </tr> 61 61 62 <tr>63 <th>Código de Autorización</th>64 <th><?php echo $myOrderDetails['TBK_CODIGO_AUTORIZACION'] ?></th>62 <tr> 63 <th>Código de Autorización</th> 64 <th><?php echo $myOrderDetails['TBK_CODIGO_AUTORIZACION'] ?></th> 65 65 66 66 67 </tr>67 </tr> 68 68 69 <tr>70 <th>Final de Tarjeta</th>71 <th><?php echo $myOrderDetails['TBK_FINAL_NUMERO_TARJETA'] ?></th>69 <tr> 70 <th>Final de Tarjeta</th> 71 <th><?php echo $myOrderDetails['TBK_FINAL_NUMERO_TARJETA'] ?></th> 72 72 73 73 74 </tr>74 </tr> 75 75 76 <tr>77 <th>Tipo de pago</th>78 <th><?php79 if ($myOrderDetails['TBK_TIPO_PAGO'] == "VD") {80 echo "Redcompra </th></tr>";81 echo "<tr><td>Tipo de Cuota</td><td>Débito</td></tr>";82 } else {83 echo "Crédito </th></tr>";84 echo '<tr><td>Tipo de Cuota</td><td>';85 switch ($myOrderDetails['TBK_TIPO_PAGO']) {86 case 'VN':87 echo 'Sin Cuotas';88 break;89 case 'VC':90 echo 'Cuotas Normales';91 break;92 case 'SI':93 echo 'Sin interés';94 break;95 case 'CI':96 echo 'Cuotas Comercio';97 break;76 <tr> 77 <th>Tipo de pago</th> 78 <th><?php 79 if ($myOrderDetails['TBK_TIPO_PAGO'] == "VD") { 80 echo "Redcompra </th></tr>"; 81 echo "<tr><td>Tipo de Cuota</td><td>Débito</td></tr>"; 82 } else { 83 echo "Crédito </th></tr>"; 84 echo '<tr><td>Tipo de Cuota</td><td>'; 85 switch ($myOrderDetails['TBK_TIPO_PAGO']) { 86 case 'VN': 87 echo 'Sin Cuotas'; 88 break; 89 case 'VC': 90 echo 'Cuotas Normales'; 91 break; 92 case 'SI': 93 echo 'Sin interés'; 94 break; 95 case 'CI': 96 echo 'Cuotas Comercio'; 97 break; 98 98 99 default: 100 echo $myOrderDetails['TBK_TIPO_PAGO']; 101 break; 102 } 103 } 99 default: 100 echo $myOrderDetails['TBK_TIPO_PAGO']; 101 break; 102 } 103 } 104 ?> 105 106 </td> 107 108 </tr> 109 110 <?php 111 if (!($myOrderDetails['TBK_TIPO_PAGO'] == "VD") || true): 104 112 ?> 113 <tr> 114 <th>Número de Cuotas</th> 115 <th><?php 116 if (!($myOrderDetails['TBK_NUMERO_CUOTAS'] == "0")) { 117 echo $myOrderDetails['TBK_NUMERO_CUOTAS']; 118 } else { 119 echo "00"; 120 } 121 ?></th> 105 122 106 </td> 107 108 </tr> 109 110 <?php 111 if (!($myOrderDetails['TBK_TIPO_PAGO'] == "VD") || true): 112 ?> 113 <tr> 114 <th>Número de Cuotas</th> 115 <th><?php 116 if (!($myOrderDetails['TBK_NUMERO_CUOTAS'] == "0")) { 117 echo $myOrderDetails['TBK_NUMERO_CUOTAS']; 118 } else { 119 echo "00"; 120 } 121 ?></th> 122 123 </tr> 124 <?php 125 endif; 126 ?> 127 </tfoot> 128 </table> 123 </tr> 129 124 <?php 130 125 endif; 131 endif; 132 endif; 126 ?> 127 </tfoot> 128 </table> 129 <?php 130 endif; 131 endif; 132 endif; 133 133 ?> -
webpay-woocommerce-plugin/trunk/readme.txt
r804502 r807735 11 11 Tested up to: 3.6 12 12 13 Stable tag: 2. 1.813 Stable tag: 2.2 14 14 15 15 == Description == … … 19 19 Wiki Home : https://bitbucket.org/ctala/woocommerce-webpay/wiki/Home 20 20 21 Ya ha sido bastante tiempo en el que me han preguntado por esto en los comentarios y al fin decidí liberar el código de manera OpenSource. 22 23 Algunos de ustedes se preguntarán el por qué no cobro por este plugin, tomando en consideración que mucha gente ofrece una buena cantidad por el servicio. Bueno, la respuesta es simple; Creo que junto a la comunidad de desarrolladores podemos mejorar mucho más este código y así todos tener un plugin de una calidad mucho mayor que por la que podríamos pagar ( Suena bien no ? ). 21 24 22 25 26 A considerar : 27 28 *El Código se distribuye bajo GPLV3. 29 *Este código YA es compatible con la última versión de WooCommerce (Version 2.0.12) 30 *El código no presenta garantía de ningún tipo. 31 *Se puso a disposición un Wiki para la instalación 32 *Se puso a disposición un BugTracker para que podamos ver los problemas que vayan saliendo en conjunto. 33 *Se asume que ya se hizo la configuración de los CGI para Transbank 34 *Si necesitan los CGI de Transbank los pueden descargar de : https://bitbucket.org/ctala/webpayconector. Ya deberían estar listos para usarlos. Con estos parto para generar un eCommerce. 35 *Para los que quieren mejorar el código, y nunca han ocupado una herramienta de control de versiones, les recomiendo que lean sobre GIT, además de lo que es un FORK. 36 37 Recuerden cambiar el shortcode de [woocommerce-thankyou] por [webpay-thankyou] cuando corresponda. 23 38 24 39 == Changelog == 25 40 41 = 2.2 = 42 43 Se establece el short-code [webpay-thankyou] para realizar las validaciones necesarias por parte de transbank. Es necesario cambiar en la página de recepción del pedido por [woocommerce-thankyou]. 44 45 46 = 2.1.9 = 47 Se cambian y estandarizan las recepciones de los status según el manual de woocommerce. 48 *Pending – Order received (unpaid) 49 *Failed – Payment failed or was declined (unpaid) 50 *Processing – Payment received and stock has been reduced- the order is awaiting fulfilment 51 *Completed – Order fulfilled and complete – requires no further action 52 *On-Hold – Awaiting payment – stock is reduced, but you need to confirm payment 53 *Cancelled – Cancelled by an admin or the customer – no further action required 54 *Refunded – Refunded by an admin - no further action required 26 55 27 56 = 2.1.8 = 28 57 Arreglada posible duplicidad cuando la orden pasa a on-hold. 58 59 = 2.1.7 = 60 Arreglado el error de callback con las direcciones web largas. Se usan los shortlinks para no tener problemas. 29 61 30 62 = 2.1.6 = -
webpay-woocommerce-plugin/trunk/webpay.php
r804502 r807735 4 4 Description: Sistema de pagos de WooCommerce con WebPay 5 5 Author: Cristian Tala Sánchez 6 Version: 2.1. 86 Version: 2.1.9-DEV 7 7 Author URI: www.cristiantala.cl 8 8 Plugin URI: https://bitbucket.org/ctala/woocommerce-webpay/wiki/Home … … 28 28 register_activation_hook(__FILE__, 'webpay_install'); 29 29 add_action('plugins_loaded', 'init_woocommerce_webpay'); 30 add_shortcode('webpay_thankyou', 'webpayThankYou'); 31 32 33 34 /* 35 * La siguiente función hace posible filtrar el acceso a la página de éxito de woocommerce. 36 */ 37 38 function webpayThankYou() { 39 global $woocommerce; 40 $SUFIJO = "[WEBPAY-THANKYOU]"; 41 /* 42 * Revisamos si los parametros necesarios para ver la página existen. 43 * El plugin en general pasa los parametros de id de la orden, la llave y el status. 44 */ 45 log_me("Entrando al ThankYouPage", $SUFIJO); 46 47 if (!(isset($_GET['order']) && isset($_GET['status']) && isset($_GET['key']))) { 48 ?> 49 <p><?= "No puedes acceder a esta página de manera directa"; ?></p> 50 51 <? 52 break; 53 } else { 54 /* 55 * Si los parametros existen muestro la información si es que el status no es fallido. 56 * Además de la recepción, se que es fallido cuando NO es pagado. 57 * Para los siguientes status NO puedo mostrar esta página si es que el pago es con webpay. 58 * 59 - Pending – Order received (unpaid) 60 - Failed – Payment failed or was declined (unpaid) 61 - On-Hold – Awaiting payment – stock is reduced, but you need to confirm payment 62 - Cancelled – Cancelled by an admin or the customer – no further action required 63 - Refunded – Refunded by an admin - no further action required 64 * 65 * Por lo que solo se puede mostrar si la orden está completada o en proceso Si es que la orden es exitosa. 66 * 67 */ 68 $order_id = explode('_', $_GET['order']); 69 $order_id = (int) $order_id[0]; 70 71 if (!is_numeric($order_id)) { 72 echo "<p>Acaba de ocurrir un error tratando de recuperar la información de la orden</p>"; 73 } 74 $order = new WC_Order($order_id); 75 if ($order) { 76 log_me("ORDEN EXISTENTE", $SUFIJO); 77 if (in_array($order->status, array('failed'))) { 78 log_me("La orden está fallida, se carga la página de manera normal", $SUFIJO); 79 echo do_shortcode('[woocommerce_thankyou]'); 80 } else { 81 /* 82 * Debo corroborar que la orden este en proceso o completada si el pago es con webpay. 83 */ 84 log_me("La transacción no debería ser fallida, se verifica", $SUFIJO); 85 $paymentMethod = $order->order_custom_fields[_payment_method][0]; 86 if ($paymentMethod == "webpay") { 87 log_me("\t -> El pago de la orden fue con WebPay", $SUFIJO); 88 if ($order->status == "completed" || $order->status == "processing") { 89 echo do_shortcode('[woocommerce_thankyou]'); 90 } else { 91 /* 92 * Si este es el caso, se está intentando acceder a la página sin pasar por el ciclo regular. 93 */ 94 echo "<h2>No te encuentras autorizado para acceder a esta página</h2>"; 95 return; 96 } 97 } else { 98 log_me("\t -> El pago de la orden NO fue con WebPay o no se a realizado: $paymentMethod ", $SUFIJO); 99 100 if ($paymentMethod !== null) { 101 echo do_shortcode('[woocommerce_thankyou]'); 102 } else { 103 echo "Esta orden aún no ha sido pagada o procesada. Por favor vuleve cuando lo hayas hecho."; 104 return; 105 } 106 } 107 } 108 } else { 109 //La orden no existía. 110 log_me("ORDEN NO EXISTENTE", $SUFIJO); 111 echo "<p>Lamentablemente la orden buscada no existe o no coincide con la información ingresada</p>"; 112 return; 113 } 114 } 115 log_me("Saliendo al ThankYouPage", $SUFIJO); 116 } 30 117 31 118 /* … … 62 149 public function __construct() { 63 150 151 64 152 if (isset($_REQUEST['page_id'])): 153 65 154 if ($_REQUEST['page_id'] == 'xt_compra') { 66 155 add_action('woocommerce_api_' . strtolower(get_class($this)), array($this, 'xt_compra')); 67 156 } else { 68 //add_action('init', array(&$this, 'check_webpay_response')); 157 69 158 $this->check_webpay_response(); 70 159 } … … 90 179 // Actions 91 180 add_action('woocommerce_update_options_payment_gateways_' . $this->id, array(&$this, 'process_admin_options')); 92 181 93 182 add_action('woocommerce_thankyou_webpay', array(&$this, 'thankyousuccess_page')); 94 183 add_action('woocommerce_receipt_webpay', array(&$this, 'receipt_page')); 95 96 184 } 97 185 … … 186 274 * @return void 187 275 */ 188 189 190 276 function thankyousuccess_page() { 191 277 include_once plugin_dir_path(__FILE__) . '/php/thankYouPage.php'; … … 196 282 echo $this->generate_webpay_form($order); 197 283 } 198 199 200 284 201 285 function process_payment($order_id) { … … 335 419 if ($order->status !== 'completed') { 336 420 if ($status == 'success') { 337 /* $order -> payment_complete(); 338 $woocommerce -> cart -> empty_cart(); 339 $order -> update_status('completed'); */ 340 341 // Mark as on-hold (we're awaiting the cheque) 342 $order->update_status('on-hold'); 421 $woocommerce->cart->empty_cart(); 422 // Mark as Processing, we already received the money. 423 $order->update_status('processing'); 343 424 344 425 // Reduce stock levels … … 387 468 ); 388 469 389 // log_me("INICIO INFO PARA AGREGAR A LA DB EN CHECK RESPONSE"); 390 // log_me($TBK); 391 // log_me("FIN INFO PARA AGREGAR A LA DB EN CHECK RESPONSE"); 392 // 470 393 471 log_me("INSERTANDO EN LA BDD"); 394 472 woocommerce_payment_complete_add_data_webpay($order_id, $TBK); … … 406 484 } 407 485 } catch (Exception $e) { 408 486 409 487 $this->msg = "Ha ocurrido un error procesando el pago."; 410 488 add_action('the_content', array(&$this, 'thankyouContent')); 411 489 } 412 413 490 } 414 491 } else { … … 418 495 } 419 496 420 421 497 function thankyouContent($content) { 422 498 echo $this->msg; … … 495 571 } else { 496 572 log_me("ORDEN EXISTENTE " . $order_id, $sufijo); 497 //CUANDO UNA ORDEN ES PAGADA SE VA A ON HOLD.498 499 if ($order->status == 'completed' ||$order->status == 'on-hold') {500 log_me("ORDEN YA PAGADA ( COMPLETED) EXISTENTE " . $order_id, "\t" . $sufijo);573 //CUANDO UNA ORDEN ES PAGADA SE VA A PROCESSING. 574 575 if ($order->status == 'completed' || $order->status == 'processing' || $order->status == 'refunded' || $order->status == 'canceled') { 576 log_me("ORDEN YA PAGADA (" . $order->status . ") EXISTENTE " . $order_id, "\t" . $sufijo); 501 577 die('RECHAZADO'); 502 578 } else { 503 579 504 580 if ($order->status == 'pending' || $order->status == 'failed') { 505 log_me("ORDEN DE COMPRA NO PAGADA ( PENDING). Se procede con el pago de la orden " . $order_id, $sufijo);581 log_me("ORDEN DE COMPRA NO PAGADA (" . $order->status . "). Se procede con el pago de la orden " . $order_id, $sufijo); 506 582 } else { 507 583 log_me("ORDEN YA PAGADA (" . $order->status . ") EXISTENTE " . $order_id, "\t" . $sufijo); … … 536 612 } 537 613 fclose($fp); 538 //Validaci �n de respuesta de Transbank, solo si es 0 continua con la pagina de cierre614 //Validación de respuesta de Transbank, solo si es 0 continua con la pagina de cierre 539 615 if ($TBK_RESPUESTA == "0") { 540 616 $acepta = true; … … 542 618 $acepta = false; 543 619 } 544 //validaci �n de monto y Orden de compra620 //validación de monto y Orden de compra 545 621 if ($TBK_MONTO == $monto && $TBK_ORDEN_COMPRA == $ordenCompra && $acepta == true) { 546 622 $acepta = true; … … 549 625 } 550 626 551 //Validaci �n MAC627 //Validación MAC 552 628 if ($acepta == true) { 553 629 exec($cmdline, $result, $retint); … … 559 635 ?> 560 636 <html> 637 <?php 638 if ($acepta == true) { 639 ?> 640 ACEPTADO 641 <?php } else { ?> 642 RECHAZADO 643 <?php } exit; ?> 644 </html> 645 561 646 <?php 562 if ($acepta == true) { 563 ?> 564 ACEPTADO 565 <?php } else { ?> 566 RECHAZADO 567 <?php } exit; ?> 568 </html> 569 570 <?php 571 log_me("FINALIZANDO XT_COMPRA", $sufijo); 572 } 573 574 } 575 576 //End of the GateWay Class 577 578 function woocommerce_payment_complete_add_data_webpay($order_id, $TBK) { 579 global $webpay_table_name; 580 global $wpdb; 581 582 $order = new WC_Order($order_id); 583 $order->add_order_note("Pago Completado. Transacción : " . $TBK['TBK_CODIGO_AUTORIZACION'][1]); 584 585 log_me("idOrden : "); 586 log_me($order_id); 587 log_me('TBK:'); 588 log_me($TBK); 589 $rows_affected = $wpdb->insert($webpay_table_name, array( 590 'idOrder' => $order_id, 591 'TBK_ORDEN_COMPRA' => $TBK['TBK_ORDEN_COMPRA'][1], 592 'TBK_TIPO_TRANSACCION' => $TBK['TBK_TIPO_TRANSACCION'][1], 593 'TBK_RESPUESTA' => $TBK['TBK_RESPUESTA'][1], 594 'TBK_MONTO' => $TBK['TBK_MONTO'][1], 595 'TBK_CODIGO_AUTORIZACION' => $TBK['TBK_CODIGO_AUTORIZACION'][1], 596 'TBK_FINAL_NUMERO_TARJETA' => $TBK['TBK_FINAL_NUMERO_TARJETA'][1], 597 'TBK_FECHA_CONTABLE' => $TBK['TBK_FECHA_CONTABLE'][1], 598 'TBK_FECHA_TRANSACCION' => $TBK['TBK_FECHA_TRANSACCION'][1], 599 'TBK_HORA_TRANSACCION' => $TBK['TBK_HORA_TRANSACCION'][1], 600 'TBK_ID_TRANSACCION' => $TBK['TBK_ID_TRANSACCION'][1], 601 'TBK_TIPO_PAGO' => $TBK['TBK_TIPO_PAGO'][1], 602 'TBK_NUMERO_CUOTAS' => $TBK['TBK_NUMERO_CUOTAS'][1], 603 ) 604 ); 605 } 606 607 add_action('woocommerce_payment_complete', 'woocommerce_payment_complete_add_data_webpay', 10, 1); 647 log_me("FINALIZANDO XT_COMPRA", $sufijo); 648 } 649 608 650 } 609 ?> 651 652 //End of the GateWay Class 653 654 function woocommerce_payment_complete_add_data_webpay($order_id, $TBK) { 655 global $webpay_table_name; 656 global $wpdb; 657 658 $order = new WC_Order($order_id); 659 $order->add_order_note("Pago Completado. Transacción : " . $TBK['TBK_CODIGO_AUTORIZACION'][1]); 660 661 log_me("idOrden : "); 662 log_me($order_id); 663 log_me('TBK:'); 664 log_me($TBK); 665 $rows_affected = $wpdb->insert($webpay_table_name, array( 666 'idOrder' => $order_id, 667 'TBK_ORDEN_COMPRA' => $TBK['TBK_ORDEN_COMPRA'][1], 668 'TBK_TIPO_TRANSACCION' => $TBK['TBK_TIPO_TRANSACCION'][1], 669 'TBK_RESPUESTA' => $TBK['TBK_RESPUESTA'][1], 670 'TBK_MONTO' => $TBK['TBK_MONTO'][1], 671 'TBK_CODIGO_AUTORIZACION' => $TBK['TBK_CODIGO_AUTORIZACION'][1], 672 'TBK_FINAL_NUMERO_TARJETA' => $TBK['TBK_FINAL_NUMERO_TARJETA'][1], 673 'TBK_FECHA_CONTABLE' => $TBK['TBK_FECHA_CONTABLE'][1], 674 'TBK_FECHA_TRANSACCION' => $TBK['TBK_FECHA_TRANSACCION'][1], 675 'TBK_HORA_TRANSACCION' => $TBK['TBK_HORA_TRANSACCION'][1], 676 'TBK_ID_TRANSACCION' => $TBK['TBK_ID_TRANSACCION'][1], 677 'TBK_TIPO_PAGO' => $TBK['TBK_TIPO_PAGO'][1], 678 'TBK_NUMERO_CUOTAS' => $TBK['TBK_NUMERO_CUOTAS'][1], 679 ) 680 ); 681 } 682 683 add_action('woocommerce_payment_complete', 'woocommerce_payment_complete_add_data_webpay', 10, 1); 684 } 685 ?>
Note: See TracChangeset
for help on using the changeset viewer.