Changeset 2717683
- Timestamp:
- 05/03/2022 05:25:08 PM (4 years ago)
- Location:
- pei-payments/trunk
- Files:
-
- 24 added
- 7 edited
-
CHANGELOG (added)
-
README.md (added)
-
_src (added)
-
_src/PEI.postman_collection.json (added)
-
_src/error-generando-url-pei.jpg (added)
-
_src/pagar-con-pei.jpg (added)
-
_src/respuesta-CheckOutId-existe.jpg (added)
-
assets (added)
-
assets/Banner-07.png (added)
-
assets/Paso01.png (added)
-
assets/Paso02.png (added)
-
assets/Paso03.png (added)
-
assets/Paso04.png (added)
-
assets/Paso05.png (added)
-
assets/Paso06.png (added)
-
assets/images (added)
-
assets/images/mastercard.svg (added)
-
assets/images/visa.svg (added)
-
assets/logo_multimoney_rectangle.png (added)
-
gulpfile.js (added)
-
includes/admin/pei_cc_payment-settings.php (added)
-
includes/admin/pei_payment-settings.php (modified) (1 diff)
-
includes/class-pei_cc_payment-endpoint.php (added)
-
includes/class-pei_cc_payment-ws.php (added)
-
includes/class-pei_cc_payment.php (added)
-
includes/class-pei_payment-checkout-process.php (modified) (1 diff)
-
includes/class-pei_payment-ws.php (modified) (3 diffs)
-
includes/class-pei_payment.php (modified) (2 diffs)
-
languages/pei-payment-gateway.pot (modified) (6 diffs)
-
readme.txt (modified) (1 diff)
-
wc-pei-payment-gateway.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
pei-payments/trunk/includes/admin/pei_payment-settings.php
r2412696 r2717683 2 2 if ( ! defined( 'ABSPATH' ) ) exit; 3 3 4 $wcppw = new pei_Payment_Webhook_Handler();4 $wcppw = new PEI_Payment_Webhook_Handler(); 5 5 $the_webhook = $wcppw->pei_payment_get_webhook_info(); 6 6 $production = __('Producción', 'pei-payment-gateway'); -
pei-payments/trunk/includes/class-pei_payment-checkout-process.php
r2412696 r2717683 2 2 /** 3 3 * Pei Payment Gateway process class 4 * 5 * @since 1.0.0 6 * @version 2.0.0 4 7 */ 5 8 class PEI_Payment_Process { 6 9 function __construct() { 7 $this->responses = apply_filters('pei_payment_response_codes', array( 8 '403' => __('Error en la autenticación.', 'pei-payment-gateway'), // Missing Authentication Token 9 '5002' => __('El monto de la compra es inferior al monto mínimo permitido.', 'pei-payment-gateway'), // 5000.00 Colones 10 '5007' => __('Comercio no tiene una cuenta activa en la moneda elegida.', 'pei-payment-gateway'), // Comercio no tiene una cta activa en esta moneda 11 'ND1' => __('Error desconocido al intentar obtener la URL de pago de Pei.', 'pei-payment-gateway'), 12 'ND2' => __('Error desconocido al procesar el pago.', 'pei-payment-gateway'), 13 'ND3' => __('Error desconocido no identificado.', 'pei-payment-gateway') 14 )); 15 } 10 $this->responses = apply_filters( 'pei_payment_response_codes', array( 11 '403' => __( 'Error en la autenticación.', 'pei-payment-gateway' ), // Missing Authentication Token 12 '404' => __( 'No se encuentra el recurso solicitado.', 'pei-payment-gateway' ), 13 '503' => __( 'El servicio no está disponible.', 'pei-payment-gateway' ), 14 '5002' => __( 'El monto de la compra es inferior al monto mínimo permitido.', 'pei-payment-gateway' ), // 5000.00 Colones 15 '5007' => __( 'Comercio no tiene una cuenta activa en la moneda elegida.', 'pei-payment-gateway' ), // Comercio no tiene una cta activa en esta moneda 16 'ND1' => __( 'Error desconocido al intentar obtener la URL de pago de Pei.', 'pei-payment-gateway' ), 17 'ND2' => __( 'Error desconocido al procesar el pago.', 'pei-payment-gateway' ), 18 'ND3' => __( 'Error desconocido no identificado.', 'pei-payment-gateway' ) 19 ) ); 20 21 $this->process_responses = apply_filters( 'pei_processing_response_codes', array( 22 '000' => __( 'Pago exitoso', 'pei-payment-gateway' ), 23 '010' => __( 'Autenticación exitosa', 'pei-payment-gateway' ), 24 '011' => __( 'Error en la autenticación', 'pei-payment-gateway' ), 25 '012' => __( 'Error al procesar el pago', 'pei-payment-gateway' ), 26 '013' => __( 'Error en la autenticación', 'pei-payment-gateway' ), 27 '101' => __( 'Error de tarjeta', 'pei-payment-gateway' ), 28 '111' => __( 'Error de tarjeta', 'pei-payment-gateway' ), 29 '121' => 'Card Error', 30 '151' => __( 'Error al procesar el pago', 'pei-payment-gateway' ), 31 '201' => 'Card Error', 32 '251' => 'Payment Error', 33 '500' => 'Not Finished', 34 '501' => 'Error', 35 '502' => 'Error', 36 '503' => 'Error', 37 '505' => 'Error checking', 38 '550' => 'Pending Execution', 39 '551' => 'Execution cancelled', 40 '552' => 'Execution expired', 41 '553' => 'Execution denied', 42 '701' => 'Card Error', 43 '702' => 'Card Error', 44 '703' => 'Card Error', 45 '731' => 'Blocked', 46 '751' => 'Blocked', 47 '752' => 'Blocked', 48 '756' => 'Blocked', 49 '757' => 'Blocked', 50 '771' => 'Blocked', 51 '776' => 'Blocked', 52 '940' => 'COF Error', 53 '950' => 'Error', 54 '960' => 'Error', 55 '970' => 'Error', 56 '999' => 'Error' 57 ) ); 58 59 $this->success_codes = apply_filters( 'pei_response_success_codes', array( '000', '010' ) ); 60 61 $this->error_codes = apply_filters( 'pei_response_error_codes', array() ); 62 } 16 63 } 17 64 -
pei-payments/trunk/includes/class-pei_payment-ws.php
r2412696 r2717683 12 12 } 13 13 14 public function pc_get_url($order_id = 0, $params = array()) { 14 /** 15 * Get payment URL 16 * 17 * @since 1.0.0 18 * @version 2.0.0 19 */ 20 public function pc_get_url( $order_id = 0, $params = array() ) { 21 $status = 'ND1'; 15 22 $response = array( 16 23 'response' => false … … 33 40 )); 34 41 35 if (!is_null($response_result = $response_checkout['result'])) { 42 $response_result = isset( $response_checkout['result'] ) ? $response_checkout['result'] : null; 43 $response_error = isset( $response_checkout['error'] ) ? $response_checkout['error'] : null; 44 45 if ( ! is_null( $response_result ) ) { 36 46 $response = array( 37 47 'response' => true, … … 40 50 'is_expired' => (strtotime($response_result['Expiration']) <= strtotime(date_i18n('Y-m-d h:i:s'))) ? true : false 41 51 ); 42 } elseif ( isset($response_checkout['error']) && !is_null($response_checkout['error'])) {52 } elseif ( ! is_null( $response_error ) ) { 43 53 $response_error = $response_checkout['error']; 44 54 $status = isset( $response_error['status'] ) ? $response_error['status'] : $response_checkout['response_code']; 45 55 $message = ( isset( PEI_PROC()->responses[$status] ) ) ? PEI_PROC()->responses[$status] : PEI_PROC()->responses['ND1'] ; 46 $response['message'] = sprintf('<strong>%s % d:</strong> %s', __('Error', 'pei-payment-gateway'), $status, esc_attr($message));56 $response['message'] = sprintf('<strong>%s %s:</strong> %s', __('Error', 'pei-payment-gateway'), $status, esc_attr($message)); 47 57 } else { 48 58 $response['response_checkout'] = json_encode( $response_checkout ); 49 $response['message'] = sprintf('<strong>%s % d:</strong> %s', __('Error', 'pei-payment-gateway'), $status, esc_attr(PEI_PROC()->responses['ND3']));59 $response['message'] = sprintf('<strong>%s %s:</strong> %s', __('Error', 'pei-payment-gateway'), $status, esc_attr( PEI_PROC()->responses[ $status ] ) ); 50 60 } 51 61 -
pei-payments/trunk/includes/class-pei_payment.php
r2412696 r2717683 4 4 /** 5 5 * Class Payment init 6 * 7 * @since 1.0.0 8 * @version 2.0.0 6 9 */ 7 if (class_exists('WC_Payment_Gateway')) { 8 include PEI_PAYMENT_PLUGIN_PATH . '/includes/class-pei_payment-checkout-process.php'; 9 10 class WC_PEI_Payment_Gateway extends WC_Payment_Gateway { 11 public function __construct() { 12 $this->logger = new WC_Logger(); 13 $this->id = PEI_PAYMENT_ID; 14 $this->method_title = __('Pagos con Pei', 'pei-payment-gateway'); 15 $this->method_description = sprintf('%s Versión actual: %s', __('Configuraciones para Pagos con pei.', 'pei-payment-gateway'), PEI_PAYMENT_VERSION); 16 17 // Bool. Can be set to true if you want payment fields to show on the checkout if doing a direct integration, which we are doing in this case 18 $this->has_fields = true; 19 20 // This defines your settings which are loaded with init_settings() 21 $this->init_form_fields(); 22 $this->init_settings(); 23 24 // Turn these settings into variables 25 foreach ( $this->settings as $setting_key => $value ) { 26 $this->$setting_key = $value; 27 } 28 29 $this->is_sandbox = ($this->environment == 'sand') ? true : false; 30 31 // Save settings 32 add_action( 'woocommerce_update_options_payment_gateways_' . $this->id, array( $this, 'process_admin_options' ) ); 10 class WC_PEI_Payment_Gateway extends WC_Payment_Gateway { 11 public function __construct() { 12 $this->logger = new WC_Logger(); 13 $this->id = PEI_PAYMENT_ID; 14 $this->method_title = __('Pagos con Pei', 'pei-payment-gateway'); 15 $this->method_description = sprintf('%s Versión actual: %s', __('Configuraciones para Pagos con pei.', 'pei-payment-gateway'), PEI_PAYMENT_VERSION); 16 17 // Bool. Can be set to true if you want payment fields to show on the checkout if doing a direct integration, which we are doing in this case 18 $this->has_fields = true; 19 20 // This defines your settings which are loaded with init_settings() 21 $this->init_form_fields(); 22 $this->init_settings(); 23 24 // Turn these settings into variables 25 foreach ( $this->settings as $setting_key => $value ) { 26 $this->$setting_key = $value; 27 } 28 29 $this->is_sandbox = ($this->environment == 'sand') ? true : false; 30 31 // Save settings 32 add_action( 'woocommerce_update_options_payment_gateways_' . $this->id, array( $this, 'process_admin_options' ) ); 33 34 // Actions 35 add_action( 'wp_head', array($this, 'pei_payment_styles') ); 36 add_filter( 'woocommerce_get_order_item_totals', array( $this, 'pei_payment_wc_get_order_item_totals' ), 10, 3 ); 37 // add_filter( 'woocommerce_order_is_pending_statuses', array( $this, 'pei_payment_wc_order_is_pending_statuses' ) ); 38 39 // Add message to Thankyou page 40 add_filter( 'woocommerce_thankyou_order_received_text', array( $this, 'pei_payment_wc_thankyou_order_received_text' ), 10, 2 ); 41 } 42 43 public function init_form_fields() { 44 $this->form_fields = require(PEI_PAYMENT_PLUGIN_PATH . '/includes/admin/pei_payment-settings.php'); 45 } 46 47 /** 48 * Generate payment fields 49 */ 50 public function payment_fields() { 51 if ( $this->description ) { 52 echo wpautop( wptexturize( $this->description ) ); 53 } 54 } 55 56 /** 57 * Process payment from the Checkout 58 */ 59 public function process_payment( $order_id ) { 60 $order = wc_get_order($order_id); 61 $status = 'pending'; 62 63 64 /** Get Pei URL **/ 65 $formatted_name = ( !empty( trim( $order->get_formatted_shipping_full_name() ) ) ) ? $order->get_formatted_shipping_full_name() : $order->get_formatted_billing_full_name(); 66 $params = array( 67 'description' => apply_filters('pei_payment_order_description', sprintf(__('Compra de %s en %s', 'pei-payment-gateway'), trim($formatted_name), get_bloginfo('name')), $order), 68 'amount' => (int) $order->get_total(), 69 'callback' => $order->get_checkout_order_received_url() 70 ); 71 $response = PEI_CONN()->pc_get_url($order->get_id(), $params); 72 73 if ( $response['response'] ) { 74 $order->add_order_note( sprintf(__('Checkout iniciado: %s', 'pei-payment-gateway'), $this->method_title) ); 75 wc_reduce_stock_levels($order->get_id()); 76 // Remove cart 77 WC()->cart->empty_cart(); 78 79 $response = array( 80 'result' => 'success', 81 'redirect' => esc_url($response['pei_url']) 82 ); 83 } else { 84 $this->pei_log('Response Error: ' . json_encode($response)); 85 86 if ( isset($response['message']) ) { 87 $order->add_order_note( $response['message'], 1 ); 88 wc_add_notice( $response['message'], 'error' ); 89 } 90 91 if ( isset($response['response_checkout']) ) { 92 $this->pei_log('response_checkout: ' . $response['response_checkout']); 93 $order->add_order_note( $response['response_checkout'] ); 94 } 33 95 34 // Actions 35 add_action( 'wp_head', array($this, 'pei_payment_styles') ); 36 add_filter( 'woocommerce_get_order_item_totals', array( $this, 'pei_payment_wc_get_order_item_totals' ), 10, 3 ); 37 add_filter( 'woocommerce_order_is_pending_statuses', array( $this, 'pei_payment_wc_order_is_pending_statuses' ) ); 38 39 // Add message to Thankyou page 40 add_filter( 'woocommerce_thankyou_order_received_text', array( $this, 'pei_payment_wc_thankyou_order_received_text' ), 10, 2 ); 41 } 42 43 public function init_form_fields() { 44 $this->form_fields = require(PEI_PAYMENT_PLUGIN_PATH . '/includes/admin/pei_payment-settings.php'); 45 } 46 47 /** 48 * Generate payment fields 49 */ 50 public function payment_fields() { 51 if ( $this->description ) { 52 echo wpautop( wptexturize( $this->description ) ); 53 } 54 } 55 56 /** 57 * Process payment from the Checkout 58 */ 59 public function process_payment( $order_id ) { 60 $order = wc_get_order($order_id); 61 $status = 'pending'; 62 63 64 /** Get Pei URL **/ 65 $formatted_name = ( !empty( trim( $order->get_formatted_shipping_full_name() ) ) ) ? $order->get_formatted_shipping_full_name() : $order->get_formatted_billing_full_name(); 66 $params = array( 67 'description' => apply_filters('pei_payment_order_description', sprintf(__('Compra de %s en %s', 'pei-payment-gateway'), trim($formatted_name), get_bloginfo('name')), $order), 68 'amount' => (int) $order->get_total(), 69 'callback' => $order->get_checkout_order_received_url() 96 $response = array( 97 'result' => 'failure', 70 98 ); 71 $response = PEI_CONN()->pc_get_url($order->get_id(), $params); 72 73 if ( $response['response'] ) { 74 $order->add_order_note( sprintf(__('Checkout iniciado: %s', 'pei-payment-gateway'), $this->method_title) ); 75 wc_reduce_stock_levels($order->get_id()); 76 // Remove cart 77 WC()->cart->empty_cart(); 78 79 $response = array( 80 'result' => 'success', 81 'redirect' => esc_url($response['pei_url']) 99 } 100 101 // Set order status 102 $order->update_status( $status ); 103 104 return $response; 105 } 106 107 /** 108 * Styles on Checkout order received 109 */ 110 public function pei_payment_styles() { 111 if ( is_order_received_page() ) { 112 ?> 113 <style type="text/css"> 114 /** Thankyou page **/ 115 .pei-message-wrapper { 116 display: block; 117 padding: 15px; 118 } 119 120 .pei-message-wrapper p { 121 margin: 0; 122 padding: 0; 123 } 124 125 .pei-pending { 126 background: #fff3cd; 127 border: 2px solid #ffeeba; 128 color: #856404; 129 } 130 131 .pei-processing { 132 background-color: #d4edda; 133 border: 2px solid #c3e6cb; 134 color: #155724; 135 } 136 </style> 137 <?php 138 } 139 } 140 141 /** 142 * Show transaction number to order items totals 143 * Validate get_payment_method to only shows when it is requiered 144 */ 145 public function pei_payment_wc_get_order_item_totals( $total_rows, $order, $tax_display ) { 146 $transaction_id = $order->get_transaction_id(); 147 148 if ( $order->get_payment_method() != $this->id ) 149 return $total_rows; 150 151 if ( !empty($transaction_id) ) { 152 foreach ($total_rows as $key => $row) { 153 $new_rows[$key] = $row; 154 if ($key == 'payment_method') { 155 $new_rows[$this->id] = array( 156 'label' => apply_filters('pei_payment_transaction_id_label', __('Transacción:', 'pei-payment-gateway')), 157 'value' => $transaction_id 158 ); 159 } 160 } 161 $total_rows = $new_rows; 162 } 163 164 return $total_rows; 165 } 166 167 /** 168 * Thankyou page response 169 */ 170 public function pei_payment_wc_thankyou_order_received_text( $text, $order ) { 171 if ( $order->get_payment_method() != $this->id ) 172 return $text; 173 174 if ( $order->has_status( 'pending' ) ) { 175 ob_start(); 176 ?> 177 <span class="pei-message-wrapper pei-pending"><?= __('La respuesta del pago de su orden se mantiene pendiente. Le notificaremos cuando el proceso sea completado.', 'pei-payment-gateway') ?></span> 178 <?php 179 $text = ob_get_clean(); 180 } 181 182 if ( $order->has_status( 'processing' ) ) { 183 ob_start(); 184 ?> 185 <span class="pei-message-wrapper pei-processing"><?= __('Su pago usando Pei ha sido recibido. Gracias.', 'pei-payment-gateway') ?></span> 186 <?php 187 $text = ob_get_clean(); 188 } 189 190 return $text; 191 } 192 193 /** 194 * Save array of transaction to DB 195 */ 196 public function pei_payment_save_to_db( $data = array() ) { 197 global $wpdb; 198 $return = array( 199 'response' => false 200 ); 201 202 try { 203 /* BEGIN Insert into database */ 204 $table_transactions = $wpdb->prefix . 'pei_transactions'; 205 $data = array( 206 'user_id' => isset($data['user_id']) ? $data['user_id'] : get_current_user_id(), 207 'amount' => isset($data['amount']) ? $data['amount'] : '', 208 'order_id' => isset($data['order_id']) ? $data['order_id'] : '', 209 'authcode' => isset($data['authcode']) ? $data['authcode'] : '', 210 'transactionid' => isset($data['transactionid']) ? $data['transactionid'] : '', 211 'error' => isset($data['error']) ? $data['error'] : '', 212 'transaction_date' => date_i18n('Y-m-d H:i:s'), 213 'status' => isset($data['status']) ? $data['status'] : '', 214 'payment_method' => 'pei_payment', 215 ); 216 $inserted_id = $wpdb->insert($table_transactions, $data); 217 218 if (!$inserted_id) { 219 throw new Exception(__('Algo salió mal guardando la transacción en la tabla de control.', 'pei-payment-gateway')); 220 } else { 221 $return = array( 222 'response' => true, 223 'message' => __('Transacción guardada en la tabla de control.', 'pei-payment-gateway') 82 224 ); 83 } else { 84 $this->pei_log('Response Error: ' . json_encode($response)); 85 86 if ( isset($response['message']) ) { 87 $order->add_order_note( $response['message'], 1 ); 88 wc_add_notice( $response['message'], 'error' ); 89 } 90 91 if ( isset($response['response_checkout']) ) { 92 $this->pei_log('response_checkout: ' . $response['response_checkout']); 93 $order->add_order_note( $response['response_checkout'] ); 94 } 95 96 $response = array( 97 'result' => 'failure', 98 ); 99 } 100 101 // Set order status 102 $order->update_status( $status ); 103 104 return $response; 105 } 106 107 /** 108 * Styles on Checkout order received 109 */ 110 public function pei_payment_styles() { 111 if ( is_order_received_page() ) { 112 ?> 113 <style type="text/css"> 114 /** Thankyou page **/ 115 .pei-message-wrapper { 116 display: block; 117 padding: 15px; 118 } 119 120 .pei-message-wrapper p { 121 margin: 0; 122 padding: 0; 123 } 124 125 .pei-pending { 126 background: #fff3cd; 127 border: 2px solid #ffeeba; 128 color: #856404; 129 } 130 131 .pei-processing { 132 background-color: #d4edda; 133 border: 2px solid #c3e6cb; 134 color: #155724; 135 } 136 </style> 137 <?php 138 } 139 } 140 141 /** 142 * Show transaction number to order items totals 143 * Validate get_payment_method to only shows when it is requiered 144 */ 145 public function pei_payment_wc_get_order_item_totals( $total_rows, $order, $tax_display ) { 146 $transaction_id = $order->get_transaction_id(); 147 148 if ( $order->get_payment_method() != $this->id ) 149 return $total_rows; 150 151 if ( !empty($transaction_id) ) { 152 foreach ($total_rows as $key => $row) { 153 $new_rows[$key] = $row; 154 if ($key == 'payment_method') { 155 $new_rows[$this->id] = array( 156 'label' => apply_filters('pei_payment_transaction_id_label', __('Transacción:', 'pei-payment-gateway')), 157 'value' => $transaction_id 158 ); 159 } 160 } 161 $total_rows = $new_rows; 162 } 163 164 return $total_rows; 165 } 166 167 /** 168 * Thankyou page response 169 */ 170 public function pei_payment_wc_thankyou_order_received_text( $text, $order ) { 171 if ( $order->get_payment_method() != $this->id ) 172 return $text; 173 174 if ( $order->has_status( 'pending' ) ) { 175 ob_start(); 176 ?> 177 <span class="pei-message-wrapper pei-pending"><?= __('La respuesta del pago de su orden se mantiene pendiente. Le notificaremos cuando el proceso sea completado.', 'pei-payment-gateway') ?></span> 178 <?php 179 $text = ob_get_clean(); 180 } 181 182 if ( $order->has_status( 'processing' ) ) { 183 ob_start(); 184 ?> 185 <span class="pei-message-wrapper pei-processing"><?= __('Su pago usando Pei ha sido recibido. Gracias.', 'pei-payment-gateway') ?></span> 186 <?php 187 $text = ob_get_clean(); 188 } 189 190 return $text; 191 } 192 193 /** 194 * Save array of transaction to DB 195 */ 196 public function pei_payment_save_to_db( $data = array() ) { 197 global $wpdb; 198 $return = array( 199 'response' => false 200 ); 201 202 try { 203 /* BEGIN Insert into database */ 204 $table_transactions = $wpdb->prefix . 'pei_transactions'; 205 $data = array( 206 'user_id' => isset($data['user_id']) ? $data['user_id'] : get_current_user_id(), 207 'amount' => isset($data['amount']) ? $data['amount'] : '', 208 'order_id' => isset($data['order_id']) ? $data['order_id'] : '', 209 'authcode' => isset($data['authcode']) ? $data['authcode'] : '', 210 'transactionid' => isset($data['transactionid']) ? $data['transactionid'] : '', 211 'error' => isset($data['error']) ? $data['error'] : '', 212 'transaction_date' => date_i18n('Y-m-d H:i:s'), 213 'status' => isset($data['status']) ? $data['status'] : '' 214 ); 215 $inserted_id = $wpdb->insert($table_transactions, $data); 216 217 if (!$inserted_id) { 218 throw new Exception(__('Algo salió mal guardando la transacción en la tabla de control.', 'pei-payment-gateway')); 219 } else { 220 $return = array( 221 'response' => true, 222 'message' => __('Transacción guardada en la tabla de control.', 'pei-payment-gateway') 223 ); 224 } 225 $wpdb->flush(); 226 /* END Insert into database */ 227 } catch(Exception $e) { 228 $error_message = $e->getMessage(); 229 $return['message'] = $error_message; 230 $this->pei_log($error_message); 231 } 232 233 return $return; 234 } 235 236 /** 237 * Logger 238 */ 239 public function pei_log( $message ) { 240 $this->logger->add( $this->id, $message . "\n" ); 241 } 225 } 226 $wpdb->flush(); 227 /* END Insert into database */ 228 } catch(Exception $e) { 229 $error_message = $e->getMessage(); 230 $return['message'] = $error_message; 231 $this->pei_log($error_message); 232 } 233 234 return $return; 235 } 236 237 /** 238 * Logger 239 */ 240 public function pei_log( $message ) { 241 $this->logger->add( $this->id, $message . "\n" ); 242 242 } 243 243 } … … 250 250 function pei_payment_override_wc_stock_management() { 251 251 $wcppg = new WC_PEI_Payment_Gateway(); 252 if ( $wcppg->pei_hold_order > 0 ) {252 if ( isset( $wcppg->pei_hold_order ) && $wcppg->pei_hold_order > 0 ) { 253 253 update_option( 'woocommerce_hold_stock_minutes', $wcppg->pei_hold_order ); 254 254 update_option( 'woocommerce_manage_stock', 'yes' ); -
pei-payments/trunk/languages/pei-payment-gateway.pot
r2412696 r2717683 1 # Copyright (C) 202 0 WC Pei Payment Gateway2 # This file is distributed under the same license as the WC Pei Payment Gateway package.1 # Copyright (C) 2022 Gente mas Gente, S.A. 2 # This file is distributed under the GPLv3. 3 3 msgid "" 4 4 msgstr "" 5 "Project-Id-Version: WC Pei Payment Gateway\n" 5 "Project-Id-Version: Pago con pei 2.0.0_Betav3\n" 6 "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/pei-payments\n" 7 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" 8 "Language-Team: LANGUAGE <LL@li.org>\n" 6 9 "MIME-Version: 1.0\n" 7 10 "Content-Type: text/plain; charset=UTF-8\n" 8 11 "Content-Transfer-Encoding: 8bit\n" 9 "X-Poedit-Basepath: ..\n" 10 "X-Poedit-KeywordsList: __;_e;_ex:1,2c;_n:1,2;_n_noop:1,2;_nx:1,2,4c;_nx_noop:1,2,3c;_x:1,2c;esc_attr__;esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c\n" 11 "X-Poedit-SearchPath-0: .\n" 12 "X-Poedit-SearchPathExcluded-0: *.js\n" 13 "X-Poedit-SourceCharset: UTF-8\n" 14 "Plural-Forms: nplurals=2; plural=(n != 1);\n" 15 12 "POT-Creation-Date: 2022-04-05T05:12:41+00:00\n" 13 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 14 "X-Generator: WP-CLI 2.5.0\n" 15 "X-Domain: pei-payment-gateway\n" 16 17 #. Plugin Name of the plugin 18 msgid "Pago con pei" 19 msgstr "" 20 21 #. Plugin URI of the plugin 22 msgid "https://www.go-pei.com/busines/woocommerce/" 23 msgstr "" 24 25 #. Description of the plugin 26 msgid "Acepta pagos SINPE desde cualquier cuenta y sin compartir información innecesaria o privada. Visualiza reportes y sigue el paso de todos los pagos realizados por el botón de pago pei en tu sitio web." 27 msgstr "" 28 29 #. Author of the plugin 30 msgid "Gente mas Gente, S.A." 31 msgstr "" 32 33 #. Author URI of the plugin 34 msgid "https://www.grupogente.com/" 35 msgstr "" 36 37 #: includes/admin/pei_cc_payment-settings.php:5 16 38 #: includes/admin/pei_payment-settings.php:6 17 39 msgid "Producción" 18 40 msgstr "" 19 41 42 #: includes/admin/pei_cc_payment-settings.php:6 20 43 #: includes/admin/pei_payment-settings.php:7 21 44 msgid "Sandbox" 22 45 msgstr "" 23 46 47 #: includes/admin/pei_cc_payment-settings.php:7 48 msgid "Código/BusinessId" 49 msgstr "" 50 51 #: includes/admin/pei_cc_payment-settings.php:8 52 msgid "API Key" 53 msgstr "" 54 55 #: includes/admin/pei_cc_payment-settings.php:13 24 56 #: includes/admin/pei_payment-settings.php:11 25 57 msgid "Habilitar / Deshabilitar" 26 58 msgstr "" 27 59 60 #: includes/admin/pei_cc_payment-settings.php:15 28 61 #: includes/admin/pei_payment-settings.php:13 29 62 msgid "Habilitar pasarela de pagos" 30 63 msgstr "" 31 64 65 #: includes/admin/pei_cc_payment-settings.php:19 32 66 #: includes/admin/pei_payment-settings.php:17 33 67 msgid "Título" 34 68 msgstr "" 35 69 70 #: includes/admin/pei_cc_payment-settings.php:21 36 71 #: includes/admin/pei_payment-settings.php:19 37 72 msgid "Título de la pasarela a mostrar durando el proceso de finalización de pago." 38 73 msgstr "" 39 74 40 #: includes/admin/pei_payment-settings.php:20 41 msgid "Pagar con Pei" 42 msgstr "" 43 75 #: includes/admin/pei_cc_payment-settings.php:22 76 msgid "Pagar con tarjeta crédito/débito (Multimoney)" 77 msgstr "" 78 79 #: includes/admin/pei_cc_payment-settings.php:25 44 80 #: includes/admin/pei_payment-settings.php:23 45 81 msgid "Descripción" 46 82 msgstr "" 47 83 84 #: includes/admin/pei_cc_payment-settings.php:27 48 85 #: includes/admin/pei_payment-settings.php:25 49 86 msgid "Descripción del método de pago a mostrar durante el proceso de finalización de pago." 50 87 msgstr "" 51 88 89 #: includes/admin/pei_cc_payment-settings.php:28 90 msgid "Pague seguro usando su tarjeta de Crédito o Débito." 91 msgstr "" 92 93 #: includes/admin/pei_cc_payment-settings.php:31 94 #: includes/admin/pei_payment-settings.php:34 95 msgid "Credenciales del API" 96 msgstr "" 97 98 #: includes/admin/pei_cc_payment-settings.php:33 99 msgid "Ingrese las credenciales del API de Pei para procesar los pagos." 100 msgstr "" 101 102 #: includes/admin/pei_cc_payment-settings.php:36 103 #: includes/admin/pei_payment-settings.php:39 104 msgid "Ambiente" 105 msgstr "" 106 107 #: includes/admin/pei_cc_payment-settings.php:43 108 #: includes/admin/pei_payment-settings.php:46 109 msgid "Elija el ambiente a utilizar para procesar el pago." 110 msgstr "" 111 112 #: includes/admin/pei_cc_payment-settings.php:48 113 #: includes/admin/pei_cc_payment-settings.php:53 114 msgid "Ingrese el %s proporcionado por Pei." 115 msgstr "" 116 117 #: includes/admin/pei_payment-settings.php:20 118 msgid "Pagar con pei" 119 msgstr "" 120 52 121 #: includes/admin/pei_payment-settings.php:26 53 msgid "Usando tus cuentas IBAN registradas en pei"122 msgid "Usando sus cuentas IBAN registradas en pei." 54 123 msgstr "" 55 124 … … 58 127 msgstr "" 59 128 60 #: includes/admin/pei_payment-settings.php:3461 msgid "Credenciales del API"62 msgstr ""63 64 129 #: includes/admin/pei_payment-settings.php:36 65 msgid "Ingrese las credenciales del API de Pei para procesar los pagos." 66 msgstr "" 67 68 #: includes/admin/pei_payment-settings.php:39 69 msgid "Ambiente" 70 msgstr "" 71 72 #: includes/admin/pei_payment-settings.php:46 73 msgid "Elija el ambiente a utilizar para procesar el pago." 74 msgstr "" 75 76 #: includes/admin/pei_payment-settings.php:49, includes/admin/pei_payment-settings.php:65 130 msgid "Ingrese las credenciales del API de pei para procesar los pagos." 131 msgstr "" 132 133 #: includes/admin/pei_payment-settings.php:49 134 #: includes/admin/pei_payment-settings.php:65 77 135 msgid "URL del API en (%s)" 78 136 msgstr "" 79 137 80 #: includes/admin/pei_payment-settings.php:51, includes/admin/pei_payment-settings.php:67 81 msgid "URL para conectar con el API de Pei en %s." 82 msgstr "" 83 84 #: includes/admin/pei_payment-settings.php:55, includes/admin/pei_payment-settings.php:71 138 #: includes/admin/pei_payment-settings.php:51 139 #: includes/admin/pei_payment-settings.php:67 140 msgid "URL para conectar con el API de pei en %s." 141 msgstr "" 142 143 #: includes/admin/pei_payment-settings.php:55 144 #: includes/admin/pei_payment-settings.php:71 85 145 msgid "BusinessId (%s)" 86 146 msgstr "" 87 147 88 #: includes/admin/pei_payment-settings.php:57, includes/admin/pei_payment-settings.php:73 89 msgid "Ingrese el BusinessId para %s proporcionado por Pei." 90 msgstr "" 91 92 #: includes/admin/pei_payment-settings.php:60, includes/admin/pei_payment-settings.php:76 148 #: includes/admin/pei_payment-settings.php:57 149 #: includes/admin/pei_payment-settings.php:73 150 msgid "Ingrese el BusinessId para %s proporcionado por pei." 151 msgstr "" 152 153 #: includes/admin/pei_payment-settings.php:60 154 #: includes/admin/pei_payment-settings.php:76 93 155 msgid "API Key (%s)" 94 156 msgstr "" 95 157 96 #: includes/admin/pei_payment-settings.php:62, includes/admin/pei_payment-settings.php:78 97 msgid "Ingrese el API Key para %s proporcionado por Pei.." 158 #: includes/admin/pei_payment-settings.php:62 159 #: includes/admin/pei_payment-settings.php:78 160 msgid "Ingrese el API Key para %s proporcionado por pei.." 98 161 msgstr "" 99 162 … … 103 166 104 167 #: includes/admin/pei_payment-settings.php:83 105 msgid "Administre el estado de las órdenes basado en la respuesta de Pei."168 msgid "Administre el estado de las órdenes basado en la respuesta de pei." 106 169 msgstr "" 107 170 … … 114 177 msgstr "" 115 178 116 #: includes/class-pei_payment-checkout-process.php:8 179 #: includes/class-pei_cc_payment-endpoint.php:98 180 msgid "Intentar pagar nuevamente" 181 msgstr "" 182 183 #: includes/class-pei_cc_payment-endpoint.php:115 184 #: includes/class-pei_payment-webhook.php:132 185 msgid "Su pago fue rechazado y su orden ha fallado." 186 msgstr "" 187 188 #: includes/class-pei_cc_payment-endpoint.php:116 189 #: includes/class-pei_cc_payment-endpoint.php:124 190 #: includes/class-pei_payment-webhook.php:127 191 msgid "Referencia del banco" 192 msgstr "" 193 194 #: includes/class-pei_cc_payment-endpoint.php:117 195 msgid "Código de error" 196 msgstr "" 197 198 #: includes/class-pei_cc_payment-endpoint.php:121 199 #: includes/class-pei_payment-webhook.php:125 200 msgid "Su pago ha sido aceptado y su orden se encuentra en proceso." 201 msgstr "" 202 203 #: includes/class-pei_cc_payment-endpoint.php:123 204 msgid "Código de estado" 205 msgstr "" 206 207 #: includes/class-pei_cc_payment-endpoint.php:128 208 msgid "Ver el detalle de orden" 209 msgstr "" 210 211 #: includes/class-pei_cc_payment-endpoint.php:148 212 msgid "Error al procesar su pago. Intente nuevamente." 213 msgstr "" 214 215 #: includes/class-pei_cc_payment-endpoint.php:166 216 msgid "Ocurrió algún problema al procesar su pago." 217 msgstr "" 218 219 #: includes/class-pei_cc_payment-ws.php:69 220 #: includes/class-pei_cc_payment-ws.php:72 221 #: includes/class-pei_payment-ws.php:56 222 #: includes/class-pei_payment-ws.php:59 223 msgid "Error" 224 msgstr "" 225 226 #: includes/class-pei_cc_payment.php:11 227 msgid "Pagos con tarjeta crédito/débito vía Multimoney" 228 msgstr "" 229 230 #: includes/class-pei_cc_payment.php:12 231 msgid "Configuraciones para Pasarela de pagos Pei para aceptar pagos con tarjeta." 232 msgstr "" 233 234 #: includes/class-pei_cc_payment.php:79 235 #: includes/class-pei_payment.php:67 236 msgid "Compra de %s en %s" 237 msgstr "" 238 239 #: includes/class-pei_cc_payment.php:94 240 #: includes/class-pei_payment.php:74 241 msgid "Checkout iniciado: %s" 242 msgstr "" 243 244 #: includes/class-pei_cc_payment.php:145 245 #: includes/class-pei_payment.php:156 246 msgid "Transacción:" 247 msgstr "" 248 249 #: includes/class-pei_cc_payment.php:182 250 #: includes/class-pei_payment.php:219 251 msgid "Algo salió mal guardando la transacción en la tabla de control." 252 msgstr "" 253 254 #: includes/class-pei_cc_payment.php:186 255 #: includes/class-pei_payment.php:223 256 msgid "Transacción guardada en la tabla de control." 257 msgstr "" 258 259 #: includes/class-pei_payment-checkout-process.php:11 117 260 msgid "Error en la autenticación." 118 261 msgstr "" 119 262 120 #: includes/class-pei_payment-checkout-process.php:9 263 #: includes/class-pei_payment-checkout-process.php:12 264 msgid "No se encuentra el recurso solicitado." 265 msgstr "" 266 267 #: includes/class-pei_payment-checkout-process.php:13 268 msgid "El servicio no está disponible." 269 msgstr "" 270 271 #: includes/class-pei_payment-checkout-process.php:14 121 272 msgid "El monto de la compra es inferior al monto mínimo permitido." 122 273 msgstr "" 123 274 124 #: includes/class-pei_payment-checkout-process.php:1 0275 #: includes/class-pei_payment-checkout-process.php:15 125 276 msgid "Comercio no tiene una cuenta activa en la moneda elegida." 126 277 msgstr "" 127 278 128 #: includes/class-pei_payment-checkout-process.php:1 1279 #: includes/class-pei_payment-checkout-process.php:16 129 280 msgid "Error desconocido al intentar obtener la URL de pago de Pei." 130 281 msgstr "" 131 282 132 #: includes/class-pei_payment-checkout-process.php:1 2283 #: includes/class-pei_payment-checkout-process.php:17 133 284 msgid "Error desconocido al procesar el pago." 134 285 msgstr "" 135 286 136 #: includes/class-pei_payment-checkout-process.php:1 3287 #: includes/class-pei_payment-checkout-process.php:18 137 288 msgid "Error desconocido no identificado." 289 msgstr "" 290 291 #: includes/class-pei_payment-checkout-process.php:22 292 msgid "Pago exitoso" 293 msgstr "" 294 295 #: includes/class-pei_payment-checkout-process.php:23 296 msgid "Autenticación exitosa" 297 msgstr "" 298 299 #: includes/class-pei_payment-checkout-process.php:24 300 #: includes/class-pei_payment-checkout-process.php:26 301 msgid "Error en la autenticación" 302 msgstr "" 303 304 #: includes/class-pei_payment-checkout-process.php:25 305 #: includes/class-pei_payment-checkout-process.php:30 306 msgid "Error al procesar el pago" 307 msgstr "" 308 309 #: includes/class-pei_payment-checkout-process.php:27 310 #: includes/class-pei_payment-checkout-process.php:28 311 msgid "Error de tarjeta" 138 312 msgstr "" 139 313 … … 146 320 msgstr "" 147 321 148 #: includes/class-pei_payment-webhook.php:132149 msgid "Su pago fue rechazado y su orden ha fallado."150 msgstr ""151 152 #: includes/class-pei_payment-webhook.php:125153 msgid "Su pago ha sido aceptado y su orden se encuentra en proceso."154 msgstr ""155 156 322 #: includes/class-pei_payment-webhook.php:126 157 323 msgid "ID" 158 324 msgstr "" 159 325 160 #: includes/class-pei_payment-webhook.php:127161 msgid "Referencia del banco"162 msgstr ""163 164 326 #: includes/class-pei_payment-webhook.php:155 165 msgid "El siguiente URL de webhook %1$s debes colocarlo en tu cuenta de pei Business en la sección de URL de notificaciones. Si tienes alguna duda puedes escribirnos a %2$s." 166 msgstr "" 167 168 #: includes/class-pei_payment-ws.php:49, includes/class-pei_payment-ws.php:46 169 msgid "Error" 327 msgid "El siguiente URL de webhook %1$s debes colocarlo en tu cuenta de pei Business en la sección de URL de notificaciones. Si tienes alguna duda puedes escribirnos a %2$s ." 170 328 msgstr "" 171 329 … … 178 336 msgstr "" 179 337 180 #: includes/class-pei_payment.php:67 181 msgid "Compra de %s en %s" 182 msgstr "" 183 184 #: includes/class-pei_payment.php:74 185 msgid "Checkout iniciado: %s" 186 msgstr "" 187 188 #: includes/class-pei_payment.php:156 189 msgid "Transacción:" 190 msgstr "" 191 192 #: includes/class-pei_payment.php:174 338 #: includes/class-pei_payment.php:177 193 339 msgid "La respuesta del pago de su orden se mantiene pendiente. Le notificaremos cuando el proceso sea completado." 194 340 msgstr "" 195 341 196 #: includes/class-pei_payment.php:18 2342 #: includes/class-pei_payment.php:185 197 343 msgid "Su pago usando Pei ha sido recibido. Gracias." 198 344 msgstr "" 199 345 200 #: includes/class-pei_payment.php:219 201 msgid "Transacción guardada en la tabla de control." 202 msgstr "" 203 204 #: includes/class-pei_payment.php:215 205 msgid "Algo salió mal guardando la transacción en la tabla de control." 206 msgstr "" 207 208 #: includes/pei_payment-misc.php:7, includes/pei_payment-misc.php:7 346 #: wc-pei-payment-gateway.php:56 347 msgid "%s requiere %sWooCommerce%s para ser instalado y activado." 348 msgstr "" 349 350 #: wc-pei-payment-gateway.php:192 209 351 msgid "Pagos con pei" 210 352 msgstr "" 211 353 212 #: includes/pei_payment-misc.php:17 354 #: wc-pei-payment-gateway.php:195 355 msgid "Pagos vía Multimoney" 356 msgstr "" 357 358 #: wc-pei-payment-gateway.php:195 359 msgid "Pagos con tarjeta vía Multimoney" 360 msgstr "" 361 362 #: wc-pei-payment-gateway.php:205 213 363 msgid "Ajustes" 214 364 msgstr "" 215 216 #: wc-pei-payment-gateway.php:50217 msgid "%s requiere %sWooCommerce%s para ser instalado y activado."218 msgstr "" -
pei-payments/trunk/readme.txt
r2412697 r2717683 97 97 98 98 == Changelog == 99 * 2.0.0 100 - New: Nueva opción para aceptar pagos con tarjeta de Crédito/Débito 101 - Update: Columna para tabla de transacciones para identificar el tipo de transacción 99 102 103 * 1.0.0 104 - Versión inicial 105 - Pagos usando Pei 106 - Tabla de bitácora para controlar las transacciones 100 107 101 108 == Upgrade Notice == -
pei-payments/trunk/wc-pei-payment-gateway.php
r2412696 r2717683 4 4 * Plugin URI: https://www.go-pei.com/busines/woocommerce/ 5 5 * Description: Acepta pagos SINPE desde cualquier cuenta y sin compartir información innecesaria o privada. Visualiza reportes y sigue el paso de todos los pagos realizados por el botón de pago pei en tu sitio web. 6 * Version: 1.0.06 * Version: 2.0.0 7 7 * Requires at least: 4.4 8 * Tested up to: 5. 5.18 * Tested up to: 5.9.3 9 9 * WC requires at least: 3.0 10 * WC tested up to: 4.5.210 * WC tested up to: 6.3.1 11 11 * Author: Gente mas Gente, S.A. 12 12 * Author URI: https://www.grupogente.com/ 13 * Text Domain: pei-payment s13 * Text Domain: pei-payment-gateway 14 14 * Domain Path: /languages 15 15 * License: GPLv3 16 16 */ 17 17 18 if (!defined('ABSPATH')) exit; 18 19 19 if (!defined('PEI_PAYMENT_VERSION')) 20 define('PEI_PAYMENT_VERSION', '1.0.0'); 21 22 if (!defined('PEI_PAYMENT_ID')) 23 define('PEI_PAYMENT_ID', 'pei_payment'); 24 25 if (!defined('PEI_PAYMENT_PLUGIN_FILE')) 26 define('PEI_PAYMENT_PLUGIN_FILE', plugin_basename(__FILE__)); 27 28 if (!defined('PEI_PAYMENT_PLUGIN_PATH')) 29 define('PEI_PAYMENT_PLUGIN_PATH', untrailingslashit(plugin_dir_path(__FILE__))); 30 31 if (!defined('PEI_PAYMENT_PLUGIN_URL')) 32 define('PEI_PAYMENT_PLUGIN_URL', plugin_dir_url(__FILE__)); 33 34 /** 35 ** Load misc. and other files 36 **/ 20 if ( ! defined( 'PEI_PAYMENT_VERSION' ) ) { 21 define( 'PEI_PAYMENT_VERSION', '2.0.0' ); 22 } 23 24 if ( ! defined( 'PEI_PAYMENT_ID' ) ) { 25 define( 'PEI_PAYMENT_ID', 'pei_payment' ); 26 } 27 28 if ( ! defined( 'PEI_PAYMENT_PLUGIN_FILE' ) ) { 29 define( 'PEI_PAYMENT_PLUGIN_FILE', plugin_basename( __FILE__ ) ); 30 } 31 32 if ( ! defined( 'PEI_PAYMENT_PLUGIN_PATH' ) ) { 33 define( 'PEI_PAYMENT_PLUGIN_PATH', untrailingslashit( plugin_dir_path( __FILE__ ) ) ); 34 } 35 36 if ( ! defined( 'PEI_PAYMENT_PLUGIN_URL' ) ) { 37 define( 'PEI_PAYMENT_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); 38 } 39 40 /** 41 * Load misc. and other files 42 */ 37 43 include PEI_PAYMENT_PLUGIN_PATH . '/includes/class-pei_payment-ws.php'; 38 39 /** 40 ** Check if WooCommerce is active 41 **/ 44 include PEI_PAYMENT_PLUGIN_PATH . '/includes/class-pei_cc_payment-ws.php'; 45 46 /** 47 * Check if WooCommerce is active 48 */ 42 49 function pei_payment_gateway_missing_wc_notice() { 43 50 if ( current_user_can( 'activate_plugins' ) ) : … … 60 67 61 68 /** 62 ** WebHook Notice63 **/69 * WebHook Notice 70 */ 64 71 function pei_payment_gateway_wc_webhook_notice() { 65 72 $wcppw = new PEI_Payment_Webhook_Handler(); … … 78 85 79 86 /** 80 ** Pei Payment Gateway init 81 **/ 87 * Pei Payment Gateway init 88 * 89 * @since 1.0.0 90 * @version 2.0.0 91 */ 82 92 function pei_payment_gateway_init() { 83 if ( !in_array('woocommerce/woocommerce.php', apply_filters('active_plugins', get_option('active_plugins')))) {84 add_action( 'admin_notices', 'pei_payment_gateway_missing_wc_notice');93 if ( !in_array( 'woocommerce/woocommerce.php', get_option( 'active_plugins' ) ) ) { 94 add_action( 'admin_notices', 'pei_payment_gateway_missing_wc_notice' ); 85 95 return; 86 96 } 97 98 if ( ! class_exists( 'WC_Payment_Gateway' ) ) return; 87 99 88 100 /** Init Payment Gateway **/ 89 101 include PEI_PAYMENT_PLUGIN_PATH . '/includes/class-pei_payment.php'; 90 102 include PEI_PAYMENT_PLUGIN_PATH . '/includes/class-pei_payment-webhook.php'; 91 if (!class_exists('WC_PEI_Payment_Gateway')) return; 103 include PEI_PAYMENT_PLUGIN_PATH . '/includes/class-pei_cc_payment.php'; 104 include PEI_PAYMENT_PLUGIN_PATH . '/includes/class-pei_cc_payment-endpoint.php'; 105 include PEI_PAYMENT_PLUGIN_PATH . '/includes/class-pei_payment-checkout-process.php'; 106 107 if ( ! class_exists( 'WC_PEI_Payment_Gateway' ) || ! class_exists( 'WC_PEI_CC_Payment_Gateway' ) ) return; 92 108 93 109 function pei_payment_gateway_class($methods) { 94 110 $methods[] = 'WC_PEI_Payment_Gateway'; 111 $methods[] = 'WC_PEI_CC_Payment_Gateway'; 95 112 96 113 return $methods; 97 114 } 98 add_filter( 'woocommerce_payment_gateways', 'pei_payment_gateway_class');115 add_filter( 'woocommerce_payment_gateways', 'pei_payment_gateway_class' ); 99 116 100 117 /** Load language **/ 101 load_plugin_textdomain( 'pei-payment-gateway', false, plugin_basename(dirname(__FILE__)) . '/languages');118 load_plugin_textdomain( 'pei-payment-gateway', false, plugin_basename( dirname( __FILE__ ) ) . '/languages' ); 102 119 103 120 /** WebHook URL **/ 104 add_action( 'admin_notices', 'pei_payment_gateway_wc_webhook_notice');121 add_action( 'admin_notices', 'pei_payment_gateway_wc_webhook_notice' ); 105 122 106 123 /** Create Transaction table **/ 107 124 $site_option_version = get_site_option('pei_payment_gateway_version'); 108 if ( $site_option_version != PEI_PAYMENT_VERSION || empty($site_option_version)) {125 if ( $site_option_version != PEI_PAYMENT_VERSION || empty( $site_option_version ) ) { 109 126 pei_payment_gateway_install(); 110 127 } 111 } 112 add_action('plugins_loaded', 'pei_payment_gateway_init'); 113 114 /** 115 ** Create table and save payment gateway version 116 ** Table to store all processed transactions for this payment gateway 117 **/ 128 129 $site_update_table = get_site_option( 'pei_payment_table_transactions_updated' ); 130 if ( version_compare( PEI_PAYMENT_VERSION, '1.1', '>' ) && empty( $site_update_table ) ) { 131 pei_payment_alter_transactions_table(); 132 } 133 134 flush_rewrite_rules(); 135 } 136 add_action( 'plugins_loaded', 'pei_payment_gateway_init' ); 137 138 /** 139 * Create table and save payment gateway version 140 * Table to store all processed transactions for this payment gateway 141 */ 118 142 function pei_payment_gateway_install() { 119 143 global $wpdb; … … 141 165 142 166 /** 167 * Alter column status for previous installed plugins 168 * 169 * @version 2.0.0 170 */ 171 function pei_payment_alter_transactions_table() { 172 global $wpdb; 173 174 $table_bitacora = $wpdb->prefix . 'pei_transactions'; 175 $sql = "ALTER TABLE " . $table_bitacora; 176 $sql .= " ADD payment_method varchar(20) NULL DEFAULT NULL,"; 177 $sql .= " CHANGE COLUMN `status` `status` varchar(5) NULL DEFAULT NULL;"; 178 $result = $wpdb->query( $sql ); 179 180 if ( $result ) { 181 update_option( 'pei_payment_table_transactions_updated', PEI_PAYMENT_VERSION ); 182 } else { 183 update_option( 'pei_payment_table_transactions_updated_error', $sql ); 184 } 185 } 186 187 /** 143 188 * Add setting links to WC 144 189 */ … … 147 192 'woocommerce', __('Pagos con pei', 'pei-payment-gateway'), __('Pagos con pei', 'pei-payment-gateway'), 'manage_options', admin_url('admin.php?page=wc-settings&tab=checkout§ion=' . PEI_PAYMENT_ID) 148 193 ); 149 } 150 add_action('admin_menu', 'pei_payment_gateway_admin_submenu'); 194 add_submenu_page( 195 'woocommerce', __('Pagos vía Multimoney', 'pei-payment-gateway'), __('Pagos con tarjeta vía Multimoney', 'pei-payment-gateway'), 'manage_options', admin_url('admin.php?page=wc-settings&tab=checkout§ion=pei_cc_payment') 196 ); 197 } 198 add_action( 'admin_menu', 'pei_payment_gateway_admin_submenu' ); 151 199 152 200 /** … … 161 209 return array_merge($plugin_links, $links); 162 210 } 163 add_filter( 'plugin_action_links_' . PEI_PAYMENT_PLUGIN_FILE, 'pei_payment_gateway_links');211 add_filter( 'plugin_action_links_' . PEI_PAYMENT_PLUGIN_FILE, 'pei_payment_gateway_links' );
Note: See TracChangeset
for help on using the changeset viewer.