Changeset 2380710
- Timestamp:
- 09/14/2020 03:26:40 AM (6 years ago)
- Location:
- powers-triggers-of-woo-to-chat/trunk
- Files:
-
- 7 added
- 5 edited
-
admin/class-wwp-admin.php (modified) (3 diffs)
-
admin/views/wwp-contactform7.php (added)
-
admin/views/wwp-settings.php (added)
-
admin/views/wwp-woocommerce.php (added)
-
class-wwp-contactform7-front.php (added)
-
class-wwp-front.php (modified) (9 diffs)
-
class-wwp-woocommerce-front.php (added)
-
include/class-wwp-contactform7.php (added)
-
include/class-wwp-whatsapp.php (modified) (1 diff)
-
include/class-wwp-woocommerce.php (added)
-
readme.txt (modified) (3 diffs)
-
wc-whatsapp-powers.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
powers-triggers-of-woo-to-chat/trunk/admin/class-wwp-admin.php
r2371301 r2380710 3 3 4 4 private $whatsapp; 5 public $triggers = array( 6 'after_checkout' => array( 7 'ativo' => '', 8 'titulo' => 'Assim que o pedido for feito', 9 'descricao' => '', 10 'action' => 'woocommerce_checkout_order_processed', 11 'modelo' => '', 12 ), 13 'processing_order' => array( 14 'ativo' => '', 15 'titulo' => 'O pedido for pago!', 16 'descricao' => '', 17 'action' => 'woocommerce_order_status_processing', 18 'modelo' => '', 19 ), 20 'hold_order' => array( 21 'ativo' => '', 22 'titulo' => 'O pedido estiver em aguardando', 23 'descricao' => 'Configure até 4 gatilhos para enviar mensagens quando o pedido estiver ainda em "aguardando". Escolha o intervalo de cada mensagem baseado na data da criação do pedido.', 24 'action' => 'reminder', 25 'intervalo' => array('off','off','off','off'), 26 'modelo' => array('','','',''), 27 ), 28 'cancel_order' => array( 29 'ativo' => '', 30 'titulo' => 'O pedido for cancelado', 31 'descricao' => '', 32 'action' => 'woocommerce_order_status_cancelled', 33 'modelo' => '', 34 ), 35 ); 5 36 6 37 7 function __construct() { 38 8 39 9 $this->whatsapp = new Woowhatspowers_Whastapp; 40 $this->wpp_load_triggers();41 42 10 //ajax 43 11 add_action( 'wp_ajax_wwp_save_settings', array( $this, 'wwp_save_settings' ) ); 44 add_action( 'admin_menu', array( $this, 'wwp_settings_add_menu' ) ); 12 13 add_action( 'admin_menu', array( $this, 'wwp_add_menu' ) ); 45 14 46 15 } 47 16 48 function wpp_load_custom_status(){ 49 $custom_status = wc_get_order_statuses(); 50 $statusPadrao = array( 'wc-pending','wc-processing','wc-on-hold','wc-completed','wc-cancelled','wc-refunded','wc-failed'); 51 foreach ($custom_status as $key => $status) { 52 if (in_array($key, $statusPadrao)) { continue; } 53 $this->triggers['custom_status_'.$key] = array( 54 'ativo' => '', 55 'titulo' => 'Status customizado: '.$status, 56 'descricao' => '', 57 'action' => $key, 58 'modelo' => '', 59 ); 17 function wwp_add_menu (){ 18 $subMenus = array(); 19 $subMenus[] = array('woowhatspowers','',array( $this, 'wwp_view_woocommerce' ),0); 20 if (is_plugin_active('woocommerce/woocommerce.php')){ 21 $subMenus[] = array('woowhatspowers-woocommerce','Notificações Pedidos',array( $this, 'wwp_view_woocommerce' ),10); 22 } 23 if (is_plugin_active('contact-form-7/wp-contact-form-7.php')){ 24 $subMenus[] = array('woowhatspowers-contact-form-7','Contact Form 7',array( $this, 'wwp_view_contactform7' ),20); 25 } 26 $subMenus[] = array('woowhatspowers-settings','Configurações',array( $this, 'wwp_view_settings' ),100); 27 28 add_menu_page( 'Notificações WhatsApp', 'Notificações WhatsApp', 'manage_options', 'woowhatspowers', $subMenus[1][2], 'dashicons-testimonial'); 29 30 foreach ($subMenus as $menu) { 31 add_submenu_page( 'woowhatspowers', $menu[1], $menu[1],'manage_options', $menu[0],$menu[2],$menu[3]); 60 32 } 61 33 } 62 34 63 function wpp_load_triggers(){ 64 $this->wpp_load_custom_status(); 65 $settings = get_option( 'wwp_triggers', '' ); 66 if (!empty($settings)) { 67 $settings = json_decode($settings); 68 foreach ($this->triggers as $tKey => $tValue) { 69 $this->triggers[$tKey]['ativo'] = isset($settings->$tKey->ativo) ? $settings->$tKey->ativo : ''; 70 if (is_array($this->triggers[$tKey]['modelo']) ) { 71 if (isset($settings->$tKey->modelo) and is_array($settings->$tKey->modelo) ) { 72 $this->triggers[$tKey]['modelo'] = $settings->$tKey->modelo; 73 } 74 } else { 75 $this->triggers[$tKey]['modelo'] = isset($settings->$tKey->modelo) ? $settings->$tKey->modelo : $this->triggers[$tKey]['modelo']; 76 } 77 78 if (isset($this->triggers[$tKey]['intervalo'])) { 79 $this->triggers[$tKey]['intervalo'] = isset($settings->$tKey->intervalo) ? $settings->$tKey->intervalo : $this->triggers[$tKey]['intervalo']; 80 } 81 } 35 36 function wwp_view_settings (){ 37 wp_enqueue_script( 'wwp-admin-script', plugin_dir_url( __FILE__ ) . 'js/script.js', array('jquery'), rand(0,1000), true ); 38 wp_enqueue_style( 'wwp-admin-style', plugin_dir_url( __FILE__ ) . 'css/style.css', '', rand(0,1000), false ); 39 $wwp_key = $this->whatsapp->getKey(); 40 $wwp_code = $this->whatsapp->getCode(); 41 require_once plugin_dir_path(dirname(__FILE__)).'admin/views/wwp-settings.php'; 42 } 43 44 function wwp_view_woocommerce (){ 45 if (!$this->whatsapp->isSettings()) { 46 $this->wwp_view_settings(); 47 return; 82 48 } 49 require_once plugin_dir_path(dirname(__FILE__)).'include/class-wwp-woocommerce.php'; 50 $woo = new Woowhatspowers_Woocommerce(); 51 if ($_POST) { 52 $woo->wwp_save_triggers($_POST); 53 $woo->wpp_load_triggers(); 54 } 55 $triggers = $woo->triggers; 56 57 wp_enqueue_script( 'wwp-admin-script', plugin_dir_url( __FILE__ ) . 'js/script.js', array('jquery'), rand(0,1000), true ); 58 wp_enqueue_style( 'wwp-admin-style', plugin_dir_url( __FILE__ ) . 'css/style.css', '', rand(0,1000), false ); 59 wp_enqueue_script( 'jquery-ui-accordion' ); 60 wp_enqueue_style( 'jquery-ui-style' ); 61 62 require_once plugin_dir_path(dirname(__FILE__)).'admin/views/wwp-woocommerce.php'; 63 } 64 65 function wwp_view_contactform7 (){ 66 if (!$this->whatsapp->isSettings()) { 67 $this->wwp_view_settings(); 68 return; 69 } 70 require_once plugin_dir_path(dirname(__FILE__)).'include/class-wwp-contactform7.php'; 71 $modulo = new Woowhatspowers_Contactform7(); 72 if ($_POST) { 73 $modulo->wwp_save_triggers($_POST); 74 $modulo->wpp_load_triggers(); 75 } 76 $triggers = $modulo->triggers; 83 77 78 wp_enqueue_script( 'wwp-admin-script', plugin_dir_url( __FILE__ ) . 'js/script.js', array('jquery'), rand(0,1000), true ); 79 wp_enqueue_style( 'wwp-admin-style', plugin_dir_url( __FILE__ ) . 'css/style.css', '', rand(0,1000), false ); 80 wp_enqueue_script( 'jquery-ui-accordion' ); 81 wp_enqueue_style( 'jquery-ui-style' ); 82 83 require_once plugin_dir_path(dirname(__FILE__)).'admin/views/wwp-contactform7.php'; 84 84 } 85 85 86 86 87 function wwp_settings_add_menu (){88 add_menu_page( 'Notificações WhatsApp', 'Notificações WhatsApp', 'manage_options', 'woowhatspowers', array( $this, 'wwp_settings_startview' ), 'dashicons-testimonial');89 }90 87 91 function wwp_settings_startview (){ 88 89 90 /*function wwp_settings_startview (){ 92 91 if ($_POST) { 93 92 $this->wwp_save_triggers($_POST); … … 102 101 $triggers = $this->triggers; 103 102 require_once plugin_dir_path(dirname(__FILE__)).'admin/views/wwp-settings-startview.php'; 104 } 103 }*/ 104 105 105 106 106 107 … … 131 132 } 132 133 133 function wwp_save_triggers ($dados){ 134 if (!empty($dados)) { 135 136 $saveTriggers = array(); 137 foreach ($this->triggers as $tKey => $tValue) { 138 if (isset($dados[$tKey.'_modelo']) and count($dados[$tKey.'_modelo'])==1) { 139 $saveTriggers[$tKey]['modelo'] = $dados[$tKey.'_modelo'][0]; 140 } else{ 141 $saveTriggers[$tKey]['modelo'] = $dados[$tKey.'_modelo']; 142 } 143 if (isset($dados[$tKey.'_intervalo']) and count($dados[$tKey.'_intervalo'])==1) { 144 $saveTriggers[$tKey]['intervalo'] = $dados[$tKey.'_intervalo'][0]; 145 } else{ 146 $saveTriggers[$tKey]['intervalo'] = $dados[$tKey.'_intervalo']; 147 } 148 $saveTriggers[$tKey]['action'] = $this->triggers[$tKey]['action']; 149 $saveTriggers[$tKey]['ativo'] = isset($dados[$tKey.'_ativo']) ? $dados[$tKey.'_ativo'] : ''; 150 151 } 152 $saveTriggers = json_encode($saveTriggers); 153 $up = update_option('wwp_triggers', $saveTriggers,FALSE); 154 if (!$up) { 155 $up = add_option('wwp_triggers', $saveTriggers); 156 } 157 } 158 } 134 159 135 } -
powers-triggers-of-woo-to-chat/trunk/class-wwp-front.php
r2370654 r2380710 1 1 <?php 2 class Woowhatspowers_ Front {2 class Woowhatspowers_Woocommerce_Front { 3 3 public $settings; 4 4 private $whatsapp; … … 8 8 $this->whatsapp = new Woowhatspowers_Whastapp; 9 9 $this->log = new Woowhatspowers_log; 10 $this->wwp_load_action(); 10 11 if (is_plugin_active('woocommerce/woocommerce.php')){ 12 $woo = new Woowhatspowers_Woocommerce(); 13 $woo->wwp_load_action(); 14 } 15 11 16 } 12 17 … … 40 45 } 41 46 42 43 47 //ACTION TO CREAT TO SAVE NOTIFY FIELD 44 48 add_action( 'woocommerce_after_order_notes', array( $this, 'wwp_option_field' ) ); 45 49 add_action( 'woocommerce_checkout_update_order_meta', array( $this, 'wwp_save_option_field' ) ); 46 47 48 49 }50 public function wwp_option_field($checkout) {51 echo '<div><h2>' . __('Notificação por Whatsapp') . '</h2>';52 woocommerce_form_field( 'wwp_notify_whatsapp', array(53 'type' => 'checkbox',54 'class' => array('input-checkbox'),55 'label' => __('Aceito ser notificado por whatsapp para este pedido'),56 'required' => false,57 ), 1);58 echo '</div>';59 60 }61 public function wwp_save_option_field( $order_id ) {62 if ( ! empty( $_POST['wwp_notify_whatsapp'] ) ) {63 update_post_meta( $order_id, 'wwp_notify_whatsapp', sanitize_text_field( $_POST['wwp_notify_whatsapp'] ) );64 }65 50 } 66 51 … … 114 99 } 115 100 exit(); 116 117 } 118 101 } 119 102 120 103 public function wwp_do_action($order_id,$trigger) { … … 155 138 $rData['site_url'] = get_site_url(); 156 139 $rData['order_comments'] = $order->get_customer_note(); 157 $rData['order_date_created'] = $order->get_date_created(); 140 $rData['order_date_created'] = $order->get_date_created(); 158 141 159 142 //Metas … … 167 150 $rData['order_total'] = 'R$ '.number_format($rData['order_total'], 2, ',', ' '); 168 151 } 169 170 152 171 153 //itens … … 179 161 $rData['payment_url'] = $payment_data['payment_url']; 180 162 163 //Transportadora 164 if (isset($rData['wc_any_shipping_notify_tracking_code'])) { 165 $rData['correios_tracking_code'] = $rData['wc_any_shipping_notify_tracking_code']; 166 } 167 168 181 169 //Replace Model 182 170 foreach ($rData as $key => $value) { … … 184 172 } 185 173 174 var_dump($rData); 175 exit(); 176 186 177 return $modelo; 187 178 } 179 180 public function get_payment_data( $order = false ) { 181 if ( ! $order && ! $this->order ) { 182 return false; 183 } elseif ( ! $order && $this->order ) { 184 $order = $this->order; 185 } 186 187 $defaults = array( 188 'method_name' => $order->get_payment_method_title(), 189 'payment_url' => $order->needs_payment() ? $order->get_checkout_payment_url() : $order->get_view_order_url() 190 ); 191 192 if ( 'pagseguro' === $order->get_payment_method() && 'Boleto' === $order->get_meta( 'Tipo de pagamento' ) ) { 193 $args = array( 194 'payment_url' => $order->get_meta( 'URL de pagamento.' ), 195 ); 196 } elseif ( 'itau-shopline' === $order->get_payment_method() && class_exists( 'WC_Itau_Shopline' ) ) { 197 $args = array( 198 'payment_url' => WC_Itau_Shopline::get_payment_url( $order->get_order_key() ), 199 'expiry_time' => $order->get_meta( '_wc_itau_shopline_expiry_time' ), 200 ); 201 } elseif ( 'woo-mercado-pago-ticket' === $order->get_payment_method() ) { 202 $args = array( 203 'payment_url' => $order->get_meta( '_transaction_details_ticket' ) 204 ); 205 } elseif ( 'bcash' === $order->get_payment_method() ) { 206 $args = array( 207 'payment_url' => add_query_arg( array( 'order_id' => $order->get_id() ), untrailingslashit( WC()->api_request_url( 'bcash_boleto_reminder' ) ) ) 208 ); 209 } elseif ( 'pagarme-banking-ticket' === $order->get_payment_method() ) { 210 $pagarme = get_post_meta( $order->get_id(), '_wc_pagarme_transaction_data', true ); 211 $args = array( 212 'payment_url' => isset( $pagarme['boleto_url'] ) ? $pagarme['boleto_url'] : $defaults['payment_url'] 213 ); 214 } elseif ( 'woo-moip-official' === $order->get_payment_method() && 'payBoleto' === $order->get_meta( '_moip_payment_type' ) ) { 215 $moip = get_post_meta( $order->get_id(), '_moip_payment_links', true ); 216 $moip = maybe_unserialize( $moip ); 217 $args = array( 218 'payment_url' => isset( $moip->payBoleto->printHref ) ? $moip->payBoleto->printHref : $defaults['payment_url'] 219 ); 220 } elseif ( 'paghiper' === $order->get_payment_method() ) { 221 $paghiper = get_post_meta( $order->get_id(), 'wc_paghiper_data', true ); 222 $paghiper = maybe_unserialize( $paghiper ); 223 $args = array( 224 'payment_url' => isset( $paghiper['urlPdfPagamento'] ) ? $paghiper['urlPdfPagamento'] : $defaults['payment_url'] 225 ); 226 } elseif ( 'mundipagg-banking-ticket' === $order->get_payment_method() ) { 227 $mundipagg = get_post_meta( $order->get_id(), '_mundipagg_banking_ticket_data', true ); 228 $mundipagg = maybe_unserialize( $mundipagg ); 229 $args = array( 230 'payment_url' => isset( $mundipagg['url'] ) ? $mundipagg['url'] : $defaults['payment_url'] 231 ); 232 } elseif ( 'jrossetto_woo_cielo_webservice_boleto' === $order->get_payment_method() ) { 233 $cielo = get_post_meta( $order->get_id(), '_transacao_boletoURL', true ); 234 $args = array( 235 'payment_url' => $cielo ? $cielo : $defaults['payment_url'] 236 ); 237 } elseif ( 'boletofacil' === $order->get_payment_method() ) { 238 $url = get_post_meta( $order->get_id(), 'boletofacil_url', true ); 239 $args = array( 240 'payment_url' => $url ? $url : $defaults['payment_url'] 241 ); 242 } elseif ( 'loja5_woo_itau_shopline' === $order->get_payment_method() ) { 243 $url = get_post_meta( $order->get_id(), 'loja5_woo_itau_shopline_link_boleto', true ); 244 $args = array( 245 'payment_url' => $url ? $url : $defaults['payment_url'] 246 ); 247 } elseif ( 'loja5_woo_bradesco_api_boleto' === $order->get_payment_method() ) { 248 $data = get_post_meta( $order->get_id(), 'loja5_woo_bradesco_api_boleto_dados', true ); 249 $args = array( 250 'payment_url' => isset( $data['link_boleto'] ) ? $data['link_boleto'] : $defaults['payment_url'] 251 ); 252 } elseif ( 'juno-bank-slip' === $order->get_payment_method() ) { 253 $data = $order->get_meta( '_juno_payment_response' ); 254 $args = array( 255 'payment_url' => isset( $data->charges[0]->installmentLink ) ? $data->charges[0]->installmentLink : $defaults['payment_url'], 256 ); 257 } elseif ( 'widepay' === $order->get_payment_method() ) { 258 $url = $order->get_meta( 'URLpagamento' ); 259 $args = array( 260 'payment_url' => $url ? $url : $defaults['payment_url'] 261 ); 262 } elseif ( 'asaas-ticket' === $order->get_payment_method() ) { 263 $data = $order->get_meta( '__ASAAS_ORDER' ); 264 $data = json_decode( $data ); 265 $args = array( 266 'payment_url' => isset( $data->bankSlipUrl ) ? $data->bankSlipUrl : $defaults['payment_url'] 267 ); 268 } elseif ( 'loja5_woo_mercadopago_boleto' === $order->get_payment_method() ) { 269 $data = $order->get_meta( '_mercadopago_transacao' ); 270 $args = array( 271 'payment_url' => isset( $data['transaction_details']['external_resource_url'] ) ? $data['transaction_details']['external_resource_url'] : $defaults['payment_url'] 272 ); 273 } elseif ( 'vindi-bank-slip' === $order->get_payment_method() ) { 274 $url = $order->get_meta( 'vindi_wc_invoice_download_url' ); 275 $args = array( 276 'payment_url' => $url ? $url : $defaults['payment_url'] 277 ); 278 } else { 279 // se o método não está integrado, retorna false 280 return $defaults; 281 } 282 283 $args = wp_parse_args( $args, $defaults ); 284 return $args; 285 } 286 287 288 289 290 public function wwp_option_field($checkout) { 291 echo '<div><h2>' . __('Notificação por Whatsapp') . '</h2>'; 292 woocommerce_form_field( 'wwp_notify_whatsapp', array( 293 'type' => 'checkbox', 294 'class' => array('input-checkbox'), 295 'label' => __('Aceito ser notificado por whatsapp para este pedido'), 296 'required' => false, 297 ), 1); 298 echo '</div>'; 299 300 } 301 public function wwp_save_option_field( $order_id ) { 302 if ( ! empty( $_POST['wwp_notify_whatsapp'] ) ) { 303 update_post_meta( $order_id, 'wwp_notify_whatsapp', sanitize_text_field( $_POST['wwp_notify_whatsapp'] ) ); 304 } 305 } 306 188 307 189 308 public function phone_validation($billing_phone, $code_country){ … … 204 323 } 205 324 206 public function get_payment_data( $order = false ) { 207 if ( ! $order && ! $this->order ) { 208 return false; 209 } elseif ( ! $order && $this->order ) { 210 $order = $this->order; 211 } 212 213 $defaults = array( 214 'method_name' => $order->get_payment_method_title(), 215 'payment_url' => $order->needs_payment() ? $order->get_checkout_payment_url() : $order->get_view_order_url() 216 ); 217 218 if ( 'pagseguro' === $order->get_payment_method() && 'Boleto' === $order->get_meta( 'Tipo de pagamento' ) ) { 219 $args = array( 220 'payment_url' => $order->get_meta( 'URL de pagamento.' ), 221 ); 222 } elseif ( 'itau-shopline' === $order->get_payment_method() && class_exists( 'WC_Itau_Shopline' ) ) { 223 $args = array( 224 'payment_url' => WC_Itau_Shopline::get_payment_url( $order->get_order_key() ), 225 'expiry_time' => $order->get_meta( '_wc_itau_shopline_expiry_time' ), 226 ); 227 } elseif ( 'woo-mercado-pago-ticket' === $order->get_payment_method() ) { 228 $args = array( 229 'payment_url' => $order->get_meta( '_transaction_details_ticket' ) 230 ); 231 } elseif ( 'bcash' === $order->get_payment_method() ) { 232 $args = array( 233 'payment_url' => add_query_arg( array( 'order_id' => $order->get_id() ), untrailingslashit( WC()->api_request_url( 'bcash_boleto_reminder' ) ) ) 234 ); 235 } elseif ( 'pagarme-banking-ticket' === $order->get_payment_method() ) { 236 $pagarme = get_post_meta( $order->get_id(), '_wc_pagarme_transaction_data', true ); 237 $args = array( 238 'payment_url' => isset( $pagarme['boleto_url'] ) ? $pagarme['boleto_url'] : $defaults['payment_url'] 239 ); 240 } elseif ( 'woo-moip-official' === $order->get_payment_method() && 'payBoleto' === $order->get_meta( '_moip_payment_type' ) ) { 241 $moip = get_post_meta( $order->get_id(), '_moip_payment_links', true ); 242 $moip = maybe_unserialize( $moip ); 243 $args = array( 244 'payment_url' => isset( $moip->payBoleto->printHref ) ? $moip->payBoleto->printHref : $defaults['payment_url'] 245 ); 246 } elseif ( 'paghiper' === $order->get_payment_method() ) { 247 $paghiper = get_post_meta( $order->get_id(), 'wc_paghiper_data', true ); 248 $paghiper = maybe_unserialize( $paghiper ); 249 $args = array( 250 'payment_url' => isset( $paghiper['urlPdfPagamento'] ) ? $paghiper['urlPdfPagamento'] : $defaults['payment_url'] 251 ); 252 } elseif ( 'mundipagg-banking-ticket' === $order->get_payment_method() ) { 253 $mundipagg = get_post_meta( $order->get_id(), '_mundipagg_banking_ticket_data', true ); 254 $mundipagg = maybe_unserialize( $mundipagg ); 255 $args = array( 256 'payment_url' => isset( $mundipagg['url'] ) ? $mundipagg['url'] : $defaults['payment_url'] 257 ); 258 } elseif ( 'jrossetto_woo_cielo_webservice_boleto' === $order->get_payment_method() ) { 259 $cielo = get_post_meta( $order->get_id(), '_transacao_boletoURL', true ); 260 $args = array( 261 'payment_url' => $cielo ? $cielo : $defaults['payment_url'] 262 ); 263 } elseif ( 'boletofacil' === $order->get_payment_method() ) { 264 $url = get_post_meta( $order->get_id(), 'boletofacil_url', true ); 265 $args = array( 266 'payment_url' => $url ? $url : $defaults['payment_url'] 267 ); 268 } elseif ( 'loja5_woo_itau_shopline' === $order->get_payment_method() ) { 269 $url = get_post_meta( $order->get_id(), 'loja5_woo_itau_shopline_link_boleto', true ); 270 $args = array( 271 'payment_url' => $url ? $url : $defaults['payment_url'] 272 ); 273 } elseif ( 'loja5_woo_bradesco_api_boleto' === $order->get_payment_method() ) { 274 $data = get_post_meta( $order->get_id(), 'loja5_woo_bradesco_api_boleto_dados', true ); 275 $args = array( 276 'payment_url' => isset( $data['link_boleto'] ) ? $data['link_boleto'] : $defaults['payment_url'] 277 ); 278 } elseif ( 'juno-bank-slip' === $order->get_payment_method() ) { 279 $data = $order->get_meta( '_juno_payment_response' ); 280 $args = array( 281 'payment_url' => isset( $data->charges[0]->installmentLink ) ? $data->charges[0]->installmentLink : $defaults['payment_url'], 282 ); 283 } elseif ( 'widepay' === $order->get_payment_method() ) { 284 $url = $order->get_meta( 'URLpagamento' ); 285 $args = array( 286 'payment_url' => $url ? $url : $defaults['payment_url'] 287 ); 288 } elseif ( 'asaas-ticket' === $order->get_payment_method() ) { 289 $data = $order->get_meta( '__ASAAS_ORDER' ); 290 $data = json_decode( $data ); 291 $args = array( 292 'payment_url' => isset( $data->bankSlipUrl ) ? $data->bankSlipUrl : $defaults['payment_url'] 293 ); 294 } elseif ( 'loja5_woo_mercadopago_boleto' === $order->get_payment_method() ) { 295 $data = $order->get_meta( '_mercadopago_transacao' ); 296 $args = array( 297 'payment_url' => isset( $data['transaction_details']['external_resource_url'] ) ? $data['transaction_details']['external_resource_url'] : $defaults['payment_url'] 298 ); 299 } elseif ( 'vindi-bank-slip' === $order->get_payment_method() ) { 300 $url = $order->get_meta( 'vindi_wc_invoice_download_url' ); 301 $args = array( 302 'payment_url' => $url ? $url : $defaults['payment_url'] 303 ); 304 } else { 305 // se o método não está integrado, retorna false 306 return $defaults; 307 } 308 309 $args = wp_parse_args( $args, $defaults ); 310 return $args; 311 } 325 326 327 312 328 } -
powers-triggers-of-woo-to-chat/trunk/include/class-wwp-whatsapp.php
r2346274 r2380710 27 27 $this->countryCode = $settings->wwp_code; 28 28 } 29 } 30 31 public function isSettings(){ 32 if (empty($this->apikey) or empty($this->countryCode)) { 33 return false; 34 } 35 return true; 29 36 } 30 37 -
powers-triggers-of-woo-to-chat/trunk/readme.txt
r2371301 r2380710 1 1 === Plugin Name === 2 2 Contributors: felipe152 3 Tags: woocommerce and whatsapp , woocommerce , whastsapp , woocommerce integration with whatsapp ,woocommerce Order to whatsapp 3 Tags: woocommerce and whatsapp , woocommerce , whastsapp , woocommerce integration with whatsapp ,woocommerce Order to whatsapp, Contact Form 7 4 4 Requires at least: 4.0.1 5 5 Tested up to: 5.4.2 … … 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html 9 9 10 10 Novidade! Integração com Contact Form 7, para enviar mensagens quando o formulário é submetido! 11 11 Com este plugin você pode enviar mensagens automáticas por whatsapp assim que o pedido for atualizado no Woocommerce. 12 12 … … 38 38 2. Lista de shortcuts. 39 39 3. Mensagem no Whatsapp. 40 3. Integração com Contact Form 7. 41 40 42 41 43 42 44 43 45 == Changelog == 46 * 1.3.0 47 * Nova integração com Contact Form 7; 48 * Nova integração com Claudio Sanches - Correios for WooCommerce; 49 * Nova organização do menu; 44 50 * 1.2.2 45 51 * Suporte ao plugin 'WooCommerce Order Status Manager'; -
powers-triggers-of-woo-to-chat/trunk/wc-whatsapp-powers.php
r2371301 r2380710 4 4 * Plugin URI: https://wordpress.org/plugins/powers-triggers-of-woo-to-chat/ 5 5 * Description: Cria gatilhos para interação do Woocommerce com Whatsapp 6 * Version: 1. 2.26 * Version: 1.3.0 7 7 * Author: Felipe Peixoto 8 8 * Author URI: http://felipepeixoto.tecnologia.ws/ … … 12 12 include('include/class-wwp-whatsapp.php'); 13 13 include('include/class-wwp-log.php'); 14 include('class-wwp-front.php');15 14 16 15 register_activation_hook( __FILE__, 'wwp_active_plugin' ); 17 16 register_deactivation_hook( __FILE__, 'wwp_deactive_plugin' ); 17 18 18 19 19 20 … … 42 43 $wwp_admin = new Woowhatspowers_Admin(); 43 44 } 44 new Woowhatspowers_Front(); 45 46 47 add_action('init', function() { 48 if (is_plugin_active('woocommerce/woocommerce.php')){ 49 include_once('class-wwp-woocommerce-front.php'); 50 new Woowhatspowers_Woocommerce_Front(); 51 } 52 53 if (is_plugin_active('contact-form-7/wp-contact-form-7.php')){ 54 include_once('class-wwp-contactform7-front.php'); 55 new Woowhatspowers_Contactform7_Front(); 56 } 57 }); 58 59 45 60 46 61 ?>
Note: See TracChangeset
for help on using the changeset viewer.