Plugin Directory

Changeset 2512925


Ignore:
Timestamp:
04/11/2021 05:23:31 PM (5 years ago)
Author:
felipe152
Message:
  • 1.6.2
  • Novo status para gatilho de pedido no woocommerce e melhorias gerais
Location:
powers-triggers-of-woo-to-chat/trunk
Files:
5 edited

Legend:

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

    r2509693 r2512925  
    1212       
    1313        add_filter( 'wwp_replace_woocommerce_modelo', array($this,'wwp_tracking_filter' ), 10, 2 );
    14        
     14        if(isset($_GET['wwp_do_reminder'])){
     15            $this->wwp_do_reminder();
     16            exit();
     17        }
    1518    }
    1619
     
    5356
    5457    public function wwp_do_reminder (){
    55         date_default_timezone_set(get_option('timezone_string'));
     58        date_default_timezone_set(get_option('timezone_string','America/Sao_Paulo'));
    5659        $settings = $this->settings;
    5760        $intervalos = $settings->hold_order->intervalo;
     
    6366            'meta_key' => 'wwp_notify_whatsapp',
    6467            'meta_compare' => '==',
    65             'meta_value' =>  1
     68            'meta_value' =>  1,
     69            'limit' => 999
    6670        ));
    6771
     
    273277            'payment_url' => isset( $moip->payBoleto->printHref ) ? $moip->payBoleto->printHref : $defaults['payment_url']
    274278          );
    275         } elseif ( 'paghiper' === $order->get_payment_method() ) {
     279        } elseif ( in_array($order->get_payment_method(), ['paghiper', 'paghiper_billet', 'paghiper_pix'])) {
    276280          $paghiper = get_post_meta( $order->get_id(), 'wc_paghiper_data', true );
    277281          $paghiper = maybe_unserialize( $paghiper );
    278           $args = array(
    279             'payment_url' => isset( $paghiper['url_slip_pdf'] ) ? $paghiper['url_slip_pdf'] : $defaults['payment_url']
     282          $url = isset( $paghiper['url_slip_pdf'] ) ? $paghiper['url_slip_pdf'] : '';
     283          $url = isset( $paghiper['pix_url'] ) ? $paghiper['pix_url'] : '';
     284          $args = array(
     285            'payment_url' => $url!='' ? $url : $defaults['payment_url']
    280286          );
    281287        } elseif ( 'mundipagg-banking-ticket' === $order->get_payment_method() ) {
  • powers-triggers-of-woo-to-chat/trunk/include/class-wwp-whatsapp.php

    r2509693 r2512925  
    1 <?php class Woowhatspowers_Whastapp{private $urlBase;private $apikey;private $countryCode;private $testnumber;public $lastResp;public function __construct(){$this->urlBase='http://116.203.92.59/api/';$this->setSettings();}public function getKey(){return $this->apikey;}public function getCode(){return $this->countryCode;}public function getTestnumber(){return $this->testnumber;}public function setSettings(){$settings=get_option('wwp_settings','');if(!empty($settings)){$settings=json_decode($settings);$this->apikey=$settings->wwp_key;$this->countryCode=$settings->wwp_code;$this->testnumber=isset($settings->wwp_testnumber)?$settings->wwp_testnumber:'';}}public function isSettings(){if(empty($this->apikey)or empty($this->countryCode)){return false;}return true;}public function saveKey($key){$up=update_option('wwp_key_code',sanitize_text_field(trim($key)),FALSE);if(!$up){$up=add_option('wwp_key_code',sanitize_text_field(trim($key)));}$this->apikey=$key;}public function testaConexao(){$resp=$this->checkNumber('+5511980376890');if($resp===FALSE){return false;}return true;}public function checkNumber($phone_no){if(!isset($phone_no)){return false;}$modo='check_number';$data=array("phone_no"=>$phone_no,);$resposta=$this->sendCurl($modo,$data);if(empty($resposta[0])){return $resposta[1];}return false;}public function phone_validation($billing_phone){if(empty($billing_phone)){return false;}$code_country=$this->getCode();$nom=trim($billing_phone);$nom=filter_var($nom,FILTER_SANITIZE_NUMBER_INT);$nom=str_replace("-","",$nom);$nom=str_replace("(","",$nom);$nom=str_replace(")","",$nom);$nom=str_replace(" ","",$nom);if(substr($nom,0,strlen($code_country))==$code_country){$nom='+'.$nom;}if(strpos($nom,'+'.$code_country)===FALSE){$nom='+'.$code_country.$nom;}return $nom;}public function sendMessage($phone_no='',$message=''){if(empty($phone_no)or empty($message)){return FALSE;}$phone_no=$this->phone_validation($phone_no);if($phone_no==FALSE){return FALSE;}$modo='async_send_message';$parsArr=array('phone_no'=>$phone_no,'message'=>$message);$send=$this->sendCurl($modo,$parsArr);if(!empty($send[0])or $send[1]['response']['code']!=200){return FALSE;}return TRUE;}private function sendCurl($modo='check_number',$pars=''){if(!is_array($pars)){return array('erro','Falta de parametros');}$pars['key']=$this->apikey;$url=$this->urlBase.$modo;$args=array('timeout'=>30,'headers'=>['Content-Type'=>'application/json',],'body'=>wp_json_encode($pars));$response=wp_remote_post($url,$args);if(!is_wp_error($response)&&isset($response['response']['code'])&&$response['response']['code']==200){$error='';$output=$response;}else{$error=$response['response']['code'];$output=$response->get_error_message();}$this->lastResp=array($error,$output);return $this->lastResp;}} ?>
     1<?php class Woowhatspowers_Whastapp{private $urlBase;private $apikey;private $countryCode;private $testnumber;public $lastResp;public function __construct(){$this->urlBase='http://116.203.92.59/api/';$this->setSettings();}public function getKey(){return $this->apikey;}public function getCode(){return $this->countryCode;}public function getTestnumber(){return $this->testnumber;}public function setSettings(){$settings=get_option('wwp_settings','');if(!empty($settings)){$settings=json_decode($settings);$this->apikey=$settings->wwp_key;$this->countryCode=$settings->wwp_code;$this->testnumber=isset($settings->wwp_testnumber)?$settings->wwp_testnumber:'';}}public function isSettings(){if(empty($this->apikey)or empty($this->countryCode)){return false;}return true;}public function saveKey($key){$up=update_option('wwp_key_code',sanitize_text_field(trim($key)),FALSE);if(!$up){$up=add_option('wwp_key_code',sanitize_text_field(trim($key)));}$this->apikey=$key;}public function testaConexao(){$resp=$this->checkNumber('+5511980376890');if($resp===FALSE){return false;}return true;}public function checkNumber($phone_no){if(!isset($phone_no)){return false;}$modo='check_number';$data=array("phone_no"=>$phone_no,);$resposta=$this->sendCurl($modo,$data);if(empty($resposta[0])){return $resposta[1];}return false;}public function phone_validation($billing_phone){if(empty($billing_phone)){return false;}$code_country=$this->getCode();$nom=trim($billing_phone);$nom=filter_var($nom,FILTER_SANITIZE_NUMBER_INT);$nom=str_replace("-","",$nom);$nom=str_replace("(","",$nom);$nom=str_replace(")","",$nom);$nom=str_replace(" ","",$nom);if(substr($nom,0,strlen($code_country))==$code_country){$nom='+'.$nom;}if(strpos($nom,'+'.$code_country)===FALSE){$nom='+'.$code_country.$nom;}return $nom;}public function clearMessage($message){if(empty($message)){return FALSE;}return preg_replace('/[\{].*?[\}]/','',$message);}public function sendMessage($phone_no='',$message=''){if(empty($phone_no)or empty($message)){return FALSE;}$phone_no=$this->phone_validation($phone_no);$message=$this->clearMessage($message);if($phone_no==FALSE){return FALSE;}$modo='async_send_message';$parsArr=array('phone_no'=>$phone_no,'message'=>$message);$send=$this->sendCurl($modo,$parsArr);if(!empty($send[0])or $send[1]['response']['code']!=200){return FALSE;}return TRUE;}private function sendCurl($modo='check_number',$pars=''){if(!is_array($pars)){return array('erro','Falta de parametros');}$pars['key']=$this->apikey;$url=$this->urlBase.$modo;$args=array('timeout'=>30,'headers'=>['Content-Type'=>'application/json',],'body'=>wp_json_encode($pars));$response=wp_remote_post($url,$args);if(!is_wp_error($response)&&isset($response['response']['code'])&&$response['response']['code']==200){$error='';$output=$response;}else{$error=$response['response']['code'];$output=$response->get_error_message();}$this->lastResp=array($error,$output);return $this->lastResp;}} ?>
  • powers-triggers-of-woo-to-chat/trunk/include/class-wwp-woocommerce.php

    r2380710 r2512925  
    1515            'action' => 'woocommerce_order_status_processing',
    1616            'modelo' => '',
    17         ), 
     17        ),
    1818        'hold_order' => array(
    1919            'ativo' => '',
     
    3131            'modelo' => '',
    3232        ), 
     33        'completed_order' => array(
     34            'ativo' => '',
     35            'titulo' => 'O pedido for concluido!',
     36            'descricao' => '',
     37            'action' => 'woocommerce_order_status_completed',
     38            'modelo' => '',
     39        ),
    3340    );
    3441
  • powers-triggers-of-woo-to-chat/trunk/readme.txt

    r2509693 r2512925  
    5454
    5555== Changelog ==
     56* 1.6.2
     57* Novo status para gatilho de pedido no woocommerce
    5658* 1.6.1
    57 * Correções de bugs
     59* Correções de bugs e novo status para gatilho de woocommerce
    5860* 1.6.0 
    5961* Nova integração ! Crie ações com qualquer evento do plugin Autonami Marketing Automations Connectors;
  • powers-triggers-of-woo-to-chat/trunk/wc-whatsapp-powers.php

    r2509693 r2512925  
    44 * Plugin URI:  https://wordpress.org/plugins/powers-triggers-of-woo-to-chat/
    55 * Description: Automatiza envio de mensagens Whatsapp.
    6  * Version:     1.6.1
     6 * Version:     1.6.2
    77 * Author:      Felipe Peixoto
    88 * Author URI:  http://felipepeixoto.tecnologia.ws/projetos/plugins-para-wordpress/notificacoes-de-pedidos-por-whatsapp/
Note: See TracChangeset for help on using the changeset viewer.