Plugin Directory

Changeset 2380710


Ignore:
Timestamp:
09/14/2020 03:26:40 AM (6 years ago)
Author:
felipe152
Message:

1.3.0

Location:
powers-triggers-of-woo-to-chat/trunk
Files:
7 added
5 edited

Legend:

Unmodified
Added
Removed
  • powers-triggers-of-woo-to-chat/trunk/admin/class-wwp-admin.php

    r2371301 r2380710  
    33
    44    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   
    366
    377    function __construct() {
    388
    399        $this->whatsapp = new Woowhatspowers_Whastapp;
    40         $this->wpp_load_triggers();
    41 
    4210        //ajax
    4311        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' ) );
    4514
    4615    }
    4716
    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]);
    6032        }
    6133    }
    6234
    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;
    8248        }
     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;
    8377       
     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';
    8484    }
    8585
    8686
    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     }
    9087
    91     function wwp_settings_startview (){
     88
     89
     90    /*function wwp_settings_startview (){
    9291        if ($_POST) {
    9392            $this->wwp_save_triggers($_POST);
     
    102101        $triggers = $this->triggers;
    103102        require_once plugin_dir_path(dirname(__FILE__)).'admin/views/wwp-settings-startview.php';
    104     }
     103    }*/
     104
     105
    105106
    106107
     
    131132    }
    132133
    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   
    159135}
  • powers-triggers-of-woo-to-chat/trunk/class-wwp-front.php

    r2370654 r2380710  
    11<?php
    2 class Woowhatspowers_Front {
     2class Woowhatspowers_Woocommerce_Front {
    33    public $settings;
    44    private $whatsapp;
     
    88        $this->whatsapp = new Woowhatspowers_Whastapp;
    99        $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       
    1116    }
    1217
     
    4045        }
    4146
    42 
    4347        //ACTION TO CREAT TO SAVE NOTIFY FIELD
    4448        add_action( 'woocommerce_after_order_notes', array( $this, 'wwp_option_field' ) );
    4549        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         }
    6550    }
    6651
     
    11499        }
    115100        exit();
    116        
    117     }
    118 
     101    }
    119102
    120103    public function wwp_do_action($order_id,$trigger) {
     
    155138        $rData['site_url'] = get_site_url();
    156139        $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();     
    158141       
    159142        //Metas
     
    167150            $rData['order_total'] = 'R$ '.number_format($rData['order_total'], 2, ',', ' ');
    168151        }
    169        
    170152
    171153        //itens
     
    179161        $rData['payment_url'] = $payment_data['payment_url'];
    180162
     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
    181169        //Replace Model
    182170        foreach ($rData as $key => $value) {
     
    184172        }
    185173
     174        var_dump($rData);
     175        exit();
     176
    186177        return $modelo;
    187178    }
     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
    188307
    189308    public function phone_validation($billing_phone, $code_country){
     
    204323    }
    205324
    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   
    312328}
  • powers-triggers-of-woo-to-chat/trunk/include/class-wwp-whatsapp.php

    r2346274 r2380710  
    2727            $this->countryCode = $settings->wwp_code;
    2828        }
     29    }
     30
     31    public function isSettings(){
     32        if (empty($this->apikey) or empty($this->countryCode)) {
     33            return false;
     34        }
     35        return true;
    2936    }
    3037
  • powers-triggers-of-woo-to-chat/trunk/readme.txt

    r2371301 r2380710  
    11=== Plugin Name ===
    22Contributors: felipe152
    3 Tags: woocommerce and whatsapp , woocommerce , whastsapp , woocommerce integration with whatsapp ,woocommerce Order to whatsapp
     3Tags: woocommerce and whatsapp , woocommerce , whastsapp , woocommerce integration with whatsapp ,woocommerce Order to whatsapp, Contact Form 7
    44Requires at least: 4.0.1
    55Tested up to: 5.4.2
     
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
    99
    10 
     10Novidade! Integração com Contact Form 7, para enviar mensagens quando o formulário é submetido!
    1111Com este plugin você pode enviar mensagens automáticas por whatsapp assim que o pedido for atualizado no Woocommerce.
    1212
     
    38382. Lista de shortcuts.
    39393. Mensagem no Whatsapp.
     403. Integração com Contact Form 7.
     41
    4042
    4143
    4244
    4345== 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;
    4450* 1.2.2
    4551* Suporte ao plugin 'WooCommerce Order Status Manager';
  • powers-triggers-of-woo-to-chat/trunk/wc-whatsapp-powers.php

    r2371301 r2380710  
    44 * Plugin URI:  https://wordpress.org/plugins/powers-triggers-of-woo-to-chat/
    55 * Description: Cria gatilhos para interação do Woocommerce com Whatsapp
    6  * Version:     1.2.2
     6 * Version:     1.3.0
    77 * Author:      Felipe Peixoto
    88 * Author URI:  http://felipepeixoto.tecnologia.ws/
     
    1212include('include/class-wwp-whatsapp.php');
    1313include('include/class-wwp-log.php');
    14 include('class-wwp-front.php');
    1514
    1615register_activation_hook( __FILE__, 'wwp_active_plugin' );
    1716register_deactivation_hook( __FILE__, 'wwp_deactive_plugin' );
     17
     18
    1819
    1920
     
    4243    $wwp_admin = new Woowhatspowers_Admin();
    4344}
    44 new Woowhatspowers_Front();
     45
     46
     47add_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
    4560
    4661?>
Note: See TracChangeset for help on using the changeset viewer.