Changeset 804502
- Timestamp:
- 11/14/2013 07:20:24 PM (12 years ago)
- Location:
- webpay-woocommerce-plugin
- Files:
-
- 1 added
- 3 edited
-
tags/2.1.7 (added)
-
trunk/php/thankYouPage.php (modified) (1 diff)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/webpay.php (modified) (18 diffs)
Legend:
- Unmodified
- Added
- Removed
-
webpay-woocommerce-plugin/trunk/php/thankYouPage.php
r746318 r804502 1 1 <?php 2 if ($description = $this->get_description())3 echo wpautop(wptexturize(wp_kses_post($description)));4 2 5 echo '<h2>' . __('Our Details', 'woocommerce') . '</h2>'; 3 if (isset($_REQUEST['status'])): 4 if ($_REQUEST['status'] == "failure"): 5 echo '<h2>' . __('Un error ha ocurrido', 'webpay') . '</h2>'; 6 6 7 echo '<ul class="order_details bacs_details">'; 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> 8 40 9 $fields = apply_filters('woocommerce_bacs_fields', array(10 'account_name' => __('Account Name', 'woocommerce'),11 'account_number' => __('Account Number', 'woocommerce'),12 'sort_code' => __('Sort Code', 'woocommerce'),13 'bank_name' => __('Bank Name', 'woocommerce'),14 'iban' => __('IBAN', 'woocommerce'),15 'bic' => __('BIC', 'woocommerce')16 ));17 41 18 foreach ($fields as $key => $value) { 19 if (!empty($this->$key)) { 20 echo '<li class="' . esc_attr($key) . '">' . esc_attr($value) . ': <strong>' . wptexturize($this->$key) . '</strong></li>'; 21 } 22 } 42 </tr> 43 </thead> 44 <tfoot> 23 45 24 echo '</ul>'; 46 <tr> 47 <th>Tipo de Transacción</th> 48 <th>Venta</th> 49 50 </tr> 51 <tr> 52 <th>Nombre del Comercio</th> 53 <th><?php echo $this->settings['trade_name']; ?></th> 54 55 </tr> 56 <tr> 57 <th>URL Comercio</th> 58 <th><?php echo $this->settings['url_commerce']; ?></th> 59 60 </tr> 61 62 <tr> 63 <th>Código de Autorización</th> 64 <th><?php echo $myOrderDetails['TBK_CODIGO_AUTORIZACION'] ?></th> 65 66 67 </tr> 68 69 <tr> 70 <th>Final de Tarjeta</th> 71 <th><?php echo $myOrderDetails['TBK_FINAL_NUMERO_TARJETA'] ?></th> 72 73 74 </tr> 75 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 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): 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> 129 <?php 130 endif; 131 endif; 132 endif; 25 133 ?> -
webpay-woocommerce-plugin/trunk/readme.txt
r760435 r804502 11 11 Tested up to: 3.6 12 12 13 Stable tag: 2.1. 713 Stable tag: 2.1.8 14 14 15 15 == Description == … … 21 21 22 22 23 23 24 == Changelog == 24 25 25 26 26 = 2.1. 7=27 Arreglad o el error de callback con las direcciones web largas. Se usan los shortlinks para no tener problemas.27 = 2.1.8 = 28 Arreglada posible duplicidad cuando la orden pasa a on-hold. 28 29 29 30 = 2.1.6 = -
webpay-woocommerce-plugin/trunk/webpay.php
r760435 r804502 4 4 Description: Sistema de pagos de WooCommerce con WebPay 5 5 Author: Cristian Tala Sánchez 6 Version: 2.1. 76 Version: 2.1.8 7 7 Author URI: www.cristiantala.cl 8 8 Plugin URI: https://bitbucket.org/ctala/woocommerce-webpay/wiki/Home … … 63 63 64 64 if (isset($_REQUEST['page_id'])): 65 if ($_REQUEST['page_id'] == 'xt_compra') 66 { 67 add_action( 'woocommerce_api_' . strtolower( get_class( $this ) ), array( $this, 'xt_compra' ) ); 65 if ($_REQUEST['page_id'] == 'xt_compra') { 66 add_action('woocommerce_api_' . strtolower(get_class($this)), array($this, 'xt_compra')); 68 67 } else { 69 68 //add_action('init', array(&$this, 'check_webpay_response')); 70 $this->check_webpay_response();69 $this->check_webpay_response(); 71 70 } 72 endif; 71 endif; 73 72 $this->id = 'webpay'; 74 73 $this->has_fields = false; … … 91 90 // Actions 92 91 add_action('woocommerce_update_options_payment_gateways_' . $this->id, array(&$this, 'process_admin_options')); 93 //add_action('woocommerce_thankyou_webpay', array(&$this, 'thankyou_page'));94 add_action('woocommerce_thankyou_webpay', array(&$this, 'thankyousuccess_page'));92 93 add_action('woocommerce_thankyou_webpay', array(&$this, 'thankyousuccess_page')); 95 94 add_action('woocommerce_receipt_webpay', array(&$this, 'receipt_page')); 96 // Customer Emails 97 // add_action('woocommerce_email_before_order_table', array($this, 'email_instructions'), 10, 2); 95 98 96 } 99 97 … … 149 147 'description' => "URL of success page" 150 148 ), 151 'trade_name' => array(149 'trade_name' => array( 152 150 'title' => __('Nombre del Comercio', 'woocommerce'), 153 151 'type' => 'text', 154 152 'description' => __('Trade Name like : EmpresasCTM', 'woocommerce') 155 153 ), 156 'url_commerce' => array(154 'url_commerce' => array( 157 155 'title' => __('URL Comercio', 'woocommerce'), 158 156 'type' => 'text', … … 188 186 * @return void 189 187 */ 190 function thankyou_page() { 191 192 if (isset($_REQUEST['status'])): 193 194 if ($_REQUEST['status'] == "failure"): 195 echo '<h2>' . __('Un error ha ocurrido', 'webpay') . '</h2>'; 196 197 $TBK_ID_SESION 198 = $_POST["TBK_ID_SESION"]; 199 $TBK_ORDEN_COMPRA 200 = $_POST["TBK_ORDEN_COMPRA"]; 201 ?> 202 203 <CENTER> 204 <B>TRANSACCIÓN FRACASADA !!!</B> 205 <TABLE> 206 <TR><TH>FRACASO</TH></TR> 207 <TR><TD> 208 TBK_ID_SESION=<?php ECHO $TBK_ID_SESION; ?><BR> 209 TBK_ORDEN_COMPRA=<?php ECHO $TBK_ORDEN_COMPRA; ?><BR> 210 </TD></TR> 211 </TABLE> 212 </CENTER> 213 214 <? 215 else: 216 ?> 217 218 <CENTER> 219 <B>TRANSACCIÓN Exitosa !!!</B> 220 <TABLE> 221 <TR><TH>Éxito</TH></TR> 222 <TR><TD> 223 TBK_ID_SESION=<?php ECHO $TBK_ID_SESION; ?><BR> 224 TBK_ORDEN_COMPRA=<?php ECHO $TBK_ORDEN_COMPRA; ?><BR> 225 </TD></TR> 226 </TABLE> 227 </CENTER> 228 229 <? 230 if ($description = $this->get_description()) 231 echo wpautop(wptexturize(wp_kses_post($description))); 232 233 echo '<h2>' . __('Our Details', 'woocommerce') . '</h2>'; 234 235 echo '<ul class="order_details bacs_details">'; 236 237 $fields = apply_filters('woocommerce_bacs_fields', array( 238 'account_name' => __('Account Name', 'woocommerce'), 239 'account_number' => __('Account Number', 'woocommerce'), 240 'sort_code' => __('Sort Code', 'woocommerce'), 241 'bank_name' => __('Bank Name', 'woocommerce'), 242 'iban' => __('IBAN', 'woocommerce'), 243 'bic' => __('BIC', 'woocommerce') 244 )); 245 246 foreach ($fields as $key => $value) { 247 if (!empty($this->$key)) { 248 echo '<li class="' . esc_attr($key) . '">' . esc_attr($value) . ': <strong>' . wptexturize($this->$key) . '</strong></li>'; 249 } 250 } 251 252 echo '</ul>'; 253 endif; 254 endif; 255 } 256 257 function thankyousuccess_page() { 258 if (isset($_REQUEST['status'])): 259 if ($_REQUEST['status'] == "failure"): 260 echo '<h2>' . __('Un error ha ocurrido', 'webpay') . '</h2>'; 261 262 $TBK_ID_SESION 263 = $_REQUEST["TBK_ID_SESION"]; 264 $TBK_ORDEN_COMPRA 265 = $_REQUEST["TBK_ORDEN_COMPRA"]; 266 ?> 267 <CENTER> 268 <B>TRANSACCIÓN FRACASADA !!!</B> 269 <TABLE> 270 <TR><TH>FRACASO</TH></TR> 271 <TR><TD> 272 TBK_ID_SESION=<?php echo $TBK_ID_SESION; ?><BR> 273 TBK_ORDEN_COMPRA=<?php echo $TBK_ORDEN_COMPRA; ?><BR> 274 </TD></TR> 275 </TABLE> 276 </CENTER> 277 <?php 278 else: 279 //IF IT IS A WEBPAY PAYMENT 280 global $webpay_table_name; 281 global $wpdb; 282 $order_id = explode('_', $_REQUEST['order']); 283 $order_id = (int) $order_id[0]; 284 $paramArr = array(); 285 $myOrderDetails = $wpdb->get_row("SELECT * FROM $webpay_table_name WHERE idOrder = $order_id", ARRAY_A); 286 if ($myOrderDetails): 287 ?> 288 <h2 class="related_products_title order_confirmed"><?= "Información Extra de la Transacción"; ?></h2> 289 <div class="clear"></div> 290 <table class="shop_table order_details"> 291 <thead> 292 <tr> 293 <th class="product-name"><?php echo "Dato" ?></th> 294 <th class="product-quantity"><?php echo "Valor"; ?></th> 295 296 297 </tr> 298 </thead> 299 <tfoot> 300 301 <tr> 302 <th>Tipo de Transacción</th> 303 <th>Venta</th> 304 305 </tr> 306 <tr> 307 <th>Nombre del Comercio</th> 308 <th><?php echo $this->settings['trade_name']; ?></th> 309 310 </tr> 311 <tr> 312 <th>URL Comercio</th> 313 <th><?php echo $this->settings['url_commerce']; ?></th> 314 315 </tr> 316 317 <tr> 318 <th>Código de Autorización</th> 319 <th><?php echo $myOrderDetails['TBK_CODIGO_AUTORIZACION'] ?></th> 320 321 322 </tr> 323 324 <tr> 325 <th>Final de Tarjeta</th> 326 <th><?php echo $myOrderDetails['TBK_FINAL_NUMERO_TARJETA'] ?></th> 327 328 329 </tr> 330 331 <tr> 332 <th>Tipo de pago</th> 333 <th><?php 334 if ($myOrderDetails['TBK_TIPO_PAGO'] == "VD") { 335 echo "Redcompra </th></tr>"; 336 echo "<tr><td>Tipo de Cuota</td><td>Débito</td></tr>"; 337 } else { 338 echo "Crédito </th></tr>"; 339 echo '<tr><td>Tipo de Cuota</td><td>'; 340 switch ($myOrderDetails['TBK_TIPO_PAGO']) { 341 case 'VN': 342 echo 'Sin Cuotas'; 343 break; 344 case 'VC': 345 echo 'Cuotas Normales'; 346 break; 347 case 'SI': 348 echo 'Sin interés'; 349 break; 350 case 'CI': 351 echo 'Cuotas Comercio'; 352 break; 353 354 default: 355 echo $myOrderDetails['TBK_TIPO_PAGO']; 356 break; 357 } 358 } 359 ?> 360 361 </td> 362 363 </tr> 364 365 <?php 366 if (!($myOrderDetails['TBK_TIPO_PAGO'] == "VD") || true): 367 ?> 368 <tr> 369 <th>Número de Cuotas</th> 370 <th><?php 371 if (!($myOrderDetails['TBK_NUMERO_CUOTAS'] == "0")) { 372 echo $myOrderDetails['TBK_NUMERO_CUOTAS']; 373 } else { 374 echo "00"; 375 } 376 ?></th> 377 378 </tr> 379 <?php 380 endif; 381 ?> 382 </tfoot> 383 </table> 384 <?php 385 endif; 386 endif; 387 endif; 388 } 188 189 190 function thankyousuccess_page() { 191 include_once plugin_dir_path(__FILE__) . '/php/thankYouPage.php'; 192 } 389 193 390 194 function receipt_page($order) { … … 393 197 } 394 198 395 // function thankyou_page() { 396 // if ($description = $this->get_description()) 397 // echo wpautop(wptexturize($description)); 398 // } 399 // 400 // function receipt_page($order) { 401 // echo '<p>' . __('Gracias por tu pedido, por favor haz click a continuación para pagar con webpay', 'woocommerce') . '</p>'; 402 // echo $this->generate_webpay_form($order); 403 // } 199 404 200 405 201 function process_payment($order_id) { 406 202 $sufijo = "[WEBPAY - PROCESS - PAYMENT]"; 407 log_me("Iniciando el proceso de pago para $order_id", $sufijo);203 log_me("Iniciando el proceso de pago para $order_id", $sufijo); 408 204 $order = &new WC_Order($order_id); 409 205 return array('result' => 'success', 'redirect' => add_query_arg('order', $order->id, add_query_arg('key', $order->order_key, get_permalink(get_option('woocommerce_pay_page_id')))) … … 413 209 public function generate_webpay_form($order_id) { 414 210 global $woocommerce; 415 global $webpay_comun_folder;211 global $webpay_comun_folder; 416 212 $SUFIJO = "[WEBPAY - FORM]"; 417 213 418 214 $order = &new WC_Order($order_id); 419 $redirect_url = get_site_url() . "/?page_id=".($this->redirect_page_id);215 $redirect_url = get_site_url() . "/?page_id=" . ($this->redirect_page_id); 420 216 $order_id = $order_id; 421 217 422 log_me("REDIRECT_URL ".$redirect_url,$SUFIJO);218 log_me("REDIRECT_URL " . $redirect_url, $SUFIJO); 423 219 $order_key = $order->order_key; 424 220 … … 430 226 $filename = __FILE__; 431 227 432 $myPath = $webpay_comun_folder .DIRECTORY_SEPARATOR."dato$TBK_ID_SESION.log";228 $myPath = $webpay_comun_folder . DIRECTORY_SEPARATOR . "dato$TBK_ID_SESION.log"; 433 229 434 230 log_me("Se utilizará $myPath para guardar los datos", $SUFIJO); … … 446 242 log_me("ARCHIVO CERRADO", $SUFIJO); 447 243 448 log_me("Argumentos", $SUFIJO);244 log_me("Argumentos", $SUFIJO); 449 245 $ccavenue_args = array( 450 246 'TBK_TIPO_TRANSACCION' => "TR_NORMAL", … … 452 248 'TBK_ORDEN_COMPRA' => $TBK_ORDEN_COMPRA, 453 249 'TBK_ID_SESION' => $TBK_ID_SESION, 454 'TBK_URL_EXITO' => $redirect_url . "&status=success&order=$order_id&key=$order_key",455 'TBK_URL_FRACASO' => $redirect_url . "&status=failure&order=$order_id&key=$order_key",250 'TBK_URL_EXITO' => $redirect_url . "&status=success&order=$order_id&key=$order_key", 251 'TBK_URL_FRACASO' => $redirect_url . "&status=failure&order=$order_id&key=$order_key", 456 252 ); 457 253 log_me($ccavenue_args); 458 459 254 255 460 256 $woopayment = array(); 461 257 foreach ($ccavenue_args as $key => $value) { … … 521 317 function check_webpay_response() { 522 318 global $woocommerce; 523 global $webpay_comun_folder;319 global $webpay_comun_folder; 524 320 $SUFIJO = "[WEBPAY - RESPONSE]"; 525 321 … … 567 363 568 364 //Archivo previamente generado para rescatar la información. 569 $myPath = $webpay_comun_folder .DIRECTORY_SEPARATOR."MAC01Normal$TBK_ID_SESION.txt";365 $myPath = $webpay_comun_folder . DIRECTORY_SEPARATOR . "MAC01Normal$TBK_ID_SESION.txt"; 570 366 /* * **************** FIN CONFIGURACION **************** */ 571 367 //Rescate de los valores informados por transbank … … 606 402 } 607 403 } else { 608 $this->msg = ' order already completed.';404 $this->msg = 'Esta orden ya ha sido completada.'; 609 405 add_action('the_content', array(&$this, 'thankyouContent')); 610 406 } 611 407 } catch (Exception $e) { 612 // $errorOccurred = true; 613 $this->msg = "Error occured while processing your request"; 408 409 $this->msg = "Ha ocurrido un error procesando el pago."; 410 add_action('the_content', array(&$this, 'thankyouContent')); 614 411 } 615 //add_action('the_content', array(&$this, 'thankyouContent'));412 616 413 } 617 414 } else { … … 621 418 } 622 419 623 /** 624 * Process the payment and return the result 625 * 626 * @access public 627 * @param int $order_id 628 * @return array 629 */ 630 // function process_payment($order_id) { 631 // global $woocommerce; 632 // 633 // $order = new WC_Order($order_id); 634 // 635 // // Mark as on-hold (we're awaiting the payment) 636 // $order->update_status('on-hold', __('Awaiting BACS payment', 'woocommerce')); 637 // 638 // // Reduce stock levels 639 // $order->reduce_order_stock(); 640 // 641 // // Remove cart 642 // $woocommerce->cart->empty_cart(); 643 // 644 // // Return thankyou redirect 645 // return array( 646 // 'result' => 'success', 647 // 'redirect' => add_query_arg('key', $order->order_key, add_query_arg('order', $order->id, get_permalink(woocommerce_get_page_id('thanks')))) 648 // ); 649 // } 650 651 420 652 421 function thankyouContent($content) { 653 //echo $this->msg;422 echo $this->msg; 654 423 } 655 424 … … 659 428 global $woocommerce; 660 429 global $webpay_comun_folder; 661 $sufijo = "[XT_COMPRA]";662 log_me("Iniciando xt_compra", $sufijo);430 $sufijo = "[XT_COMPRA]"; 431 log_me("Iniciando xt_compra", $sufijo); 663 432 664 433 //rescate de datos de POST. … … 721 490 //Si la orden de compra no tiene status es debido a que no existe 722 491 723 if ($order->status == '') 724 { 492 if ($order->status == '') { 725 493 log_me("ORDEN NO EXISTENTE " . $order_id, $sufijo); 726 494 die('RECHAZADO'); 727 } 728 else 729 { 495 } else { 730 496 log_me("ORDEN EXISTENTE " . $order_id, $sufijo); 731 497 //CUANDO UNA ORDEN ES PAGADA SE VA A ON HOLD. 732 498 733 if ($order->status == 'completed') 734 { 499 if ($order->status == 'completed'||$order->status == 'on-hold') { 735 500 log_me("ORDEN YA PAGADA (COMPLETED) EXISTENTE " . $order_id, "\t" . $sufijo); 736 501 die('RECHAZADO'); 737 } 738 else 739 { 740 741 if ($order->status == 'pending' || $order->status == 'failed') 742 { 502 } else { 503 504 if ($order->status == 'pending' || $order->status == 'failed') { 743 505 log_me("ORDEN DE COMPRA NO PAGADA (PENDING). Se procede con el pago de la orden " . $order_id, $sufijo); 744 } else 745 { 506 } else { 746 507 log_me("ORDEN YA PAGADA (" . $order->status . ") EXISTENTE " . $order_id, "\t" . $sufijo); 747 508 die('RECHAZADO'); … … 752 513 753 514 /* * **************** CONFIGURAR AQUI ****************** */ 754 $myPath = $webpay_comun_folder .DIRECTORY_SEPARATOR."dato$TBK_ID_SESION.log";515 $myPath = $webpay_comun_folder . DIRECTORY_SEPARATOR . "dato$TBK_ID_SESION.log"; 755 516 //GENERA ARCHIVO PARA MAC 756 $filename_txt = $webpay_comun_folder .DIRECTORY_SEPARATOR."MAC01Normal$TBK_ID_SESION.txt";517 $filename_txt = $webpay_comun_folder . DIRECTORY_SEPARATOR . "MAC01Normal$TBK_ID_SESION.txt"; 757 518 // Ruta Checkmac 758 519 $cmdline = $this->macpath . "/tbk_check_mac.cgi $filename_txt"; … … 798 559 ?> 799 560 <html> 561 <?php 562 if ($acepta == true) { 563 ?> 564 ACEPTADO 565 <?php } else { ?> 566 RECHAZADO 567 <?php } exit; ?> 568 </html> 569 800 570 <?php 801 if ($acepta == true) { 802 ?> 803 ACEPTADO 804 <?php } else { ?> 805 RECHAZADO 806 <?php } exit; ?> 807 </html> 808 809 <?php 810 log_me("FINALIZANDO XT_COMPRA",$sufijo); 811 } 812 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); 813 608 } 814 815 //End of the GateWay Class 816 817 function woocommerce_payment_complete_add_data_webpay($order_id, $TBK) { 818 global $webpay_table_name; 819 global $wpdb; 820 821 $order = new WC_Order($order_id); 822 $order->add_order_note("Pago Completado. Transacción : ".$TBK['TBK_CODIGO_AUTORIZACION'][1]); 823 824 log_me("idOrden : "); 825 log_me($order_id); 826 log_me('TBK:'); 827 log_me($TBK); 828 $rows_affected = $wpdb->insert($webpay_table_name, array( 829 'idOrder' => $order_id, 830 'TBK_ORDEN_COMPRA' => $TBK['TBK_ORDEN_COMPRA'][1], 831 'TBK_TIPO_TRANSACCION' => $TBK['TBK_TIPO_TRANSACCION'][1], 832 'TBK_RESPUESTA' => $TBK['TBK_RESPUESTA'][1], 833 'TBK_MONTO' => $TBK['TBK_MONTO'][1], 834 'TBK_CODIGO_AUTORIZACION' => $TBK['TBK_CODIGO_AUTORIZACION'][1], 835 'TBK_FINAL_NUMERO_TARJETA' => $TBK['TBK_FINAL_NUMERO_TARJETA'][1], 836 'TBK_FECHA_CONTABLE' => $TBK['TBK_FECHA_CONTABLE'][1], 837 'TBK_FECHA_TRANSACCION' => $TBK['TBK_FECHA_TRANSACCION'][1], 838 'TBK_HORA_TRANSACCION' => $TBK['TBK_HORA_TRANSACCION'][1], 839 'TBK_ID_TRANSACCION' => $TBK['TBK_ID_TRANSACCION'][1], 840 'TBK_TIPO_PAGO' => $TBK['TBK_TIPO_PAGO'][1], 841 'TBK_NUMERO_CUOTAS' => $TBK['TBK_NUMERO_CUOTAS'][1], 842 ) 843 ); 844 } 845 846 add_action('woocommerce_payment_complete', 'woocommerce_payment_complete_add_data_webpay', 10, 1); 847 } 848 ?> 609 ?>
Note: See TracChangeset
for help on using the changeset viewer.