Plugin Directory

Changeset 2589980


Ignore:
Timestamp:
08/27/2021 06:19:52 PM (4 years ago)
Author:
appmaxplataforma
Message:

Fazendo uma correção na aba de pagamento com pix.

Location:
appmax-woocommerce/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • appmax-woocommerce/trunk/appmax-woocommerce.php

    r2589822 r2589980  
    144144        public function awc_show_pix_qrcode( $order )
    145145        {
    146             if ( $order->get_meta( '_appmax_type_payment' ) == AWC_Payment_Type::AWC_PIX ) {
     146            if ( $order->get_meta( '_appmax_type_payment' ) == AWC_Payment_Type::AWC_PIX && $order->get_meta('_appmax_woocommerce_transaction_data') ) {
    147147               
    148148                $pix_template = dirname( __FILE__ ) . '/templates/views/checkout/pix/pix-payment.php';
  • appmax-woocommerce/trunk/assets/js/my-scripts/awc_pix.js

    r2589822 r2589980  
    66    });
    77
    8     $(function () {
     8    if (document.getElementById("pix-order-id")) {
    99
    1010        const key = "c8db72fbdb177a2a4a8a";
     
    8282
    8383        });
    84 
    85     });
     84    }
    8685
    8786    function formatDate(currentMinutes) {
     
    9594        }).join(':');
    9695    }
    97 
    9896}(jQuery));
  • appmax-woocommerce/trunk/assets/js/my-scripts/awc_pix.min.js

    r2589822 r2589980  
    1 !function(e){"use strict";e(function(){e("#cpf_pix").mask("999.999.999-99")}),e(function(){const t=new Pusher("c8db72fbdb177a2a4a8a",{cluster:"us2",encrypted:!0});t.logToConsole=0;const o=document.getElementById("pix-order-id").value,n=t.subscribe(`pix.notification.${o}`),a=document.getElementById("wrapper");window.localStorage[`${o}`]&&(a.innerHTML="<h2>Pagamento confirmado!</h2>");const c=document.getElementById("pix_emv"),i=document.getElementById("get-qrcode"),d=document.getElementById("countdown");if(e("#get-qrcode").on("click",function(e){e.preventDefault(),c.select(),navigator.clipboard.writeText(c.value),i.classList.add("disabled"),i.textContent="Código copiado com sucesso!"}),!window.localStorage[`${o}`]){const e=document.getElementById("expiration_date").value;let t=new Date(e).getTime();const o=setInterval(function(){let e=(new Date).getTime(),n=t-e,a=Math.floor(n%864e5/36e5),c=Math.floor(n%36e5/6e4),i=Math.floor(n%6e4/1e3);d.innerHTML=`${a}:${c}:${i}`.split(":").map(e=>(e<10&&(e="0"+e),e)).join(":"),n<0&&(clearInterval(o),document.getElementById("wrapper").innerHTML="<h2>Atingido o tempo limite para pagamento.</h2>")},1e3)}const r=document.getElementById("wp_order_id").value;n.bind("pix.order-paid",function(t){window.localStorage[`${o}`]=!0,a.innerHTML="<h2>Pagamento confirmado!</h2>",e.ajax({type:"POST",dataType:"json",url:woocommerce_params.ajax_url,data:{action:"update_order_status",order_id:r},success:function(e){console.log(e)}})})})}(jQuery);
     1!function(e){"use strict";if(e(function(){e("#cpf_pix").mask("999.999.999-99")}),document.getElementById("pix-order-id")){const t=new Pusher("c8db72fbdb177a2a4a8a",{cluster:"us2",encrypted:!0});t.logToConsole=0;const o=document.getElementById("pix-order-id").value,n=t.subscribe(`pix.notification.${o}`),a=document.getElementById("wrapper");window.localStorage[`${o}`]&&(a.innerHTML="<h2>Pagamento confirmado!</h2>");const d=document.getElementById("pix_emv"),i=document.getElementById("get-qrcode"),c=document.getElementById("countdown");if(e("#get-qrcode").on("click",function(e){e.preventDefault(),d.select(),navigator.clipboard.writeText(d.value),i.classList.add("disabled"),i.textContent="Código copiado com sucesso!"}),!window.localStorage[`${o}`]){const e=document.getElementById("expiration_date").value;let t=new Date(e).getTime();const o=setInterval(function(){let e=(new Date).getTime(),n=t-e,a=Math.floor(n%864e5/36e5),d=Math.floor(n%36e5/6e4),i=Math.floor(n%6e4/1e3);c.innerHTML=`${a}:${d}:${i}`.split(":").map(e=>(e<10&&(e="0"+e),e)).join(":"),n<0&&(clearInterval(o),document.getElementById("wrapper").innerHTML="<h2>Atingido o tempo limite para pagamento.</h2>")},1e3)}const r=document.getElementById("wp_order_id").value;n.bind("pix.order-paid",function(t){window.localStorage[`${o}`]=!0,a.innerHTML="<h2>Pagamento confirmado!</h2>",e.ajax({type:"POST",dataType:"json",url:woocommerce_params.ajax_url,data:{action:"update_order_status",order_id:r},success:function(e){console.log(e)}})})}}(jQuery);
  • appmax-woocommerce/trunk/templates/views/pix/pix-payment.php

    r2589822 r2589980  
    11<fieldset>
     2    <input id="pix-order-id" type="hidden" value="<?php echo $order->get_meta('_appmax_woocommerce_transaction_data')["post_payment"]["order_id"]; ?>">
     3    <input id="wp_order_id" type="hidden" value="<?php echo $order->get_meta('_appmax_woocommerce_transaction_id'); ?>">
     4    <input id="expiration_date" type="hidden" value="<?php echo $order->get_meta('_appmax_woocommerce_transaction_data')["post_payment"]["pix_expiration_date"] ?>">
    25    <div id="wrapper">
    36        <div class="text-header">
    47            <div>
    5                 <input id="pix-order-id" type="hidden" value="<?php echo $order->get_meta('_appmax_woocommerce_transaction_data')["post_payment"]["order_id"]; ?>">
    6                 <input id="wp_order_id" type="hidden" value="<?php echo $order->get_meta('_appmax_woocommerce_transaction_id'); ?>">
    7                 <input id="expiration_date" type="hidden" value="<?php echo $order->get_meta('_appmax_woocommerce_transaction_data')["post_payment"]["pix_expiration_date"] ?>">
    88                <h2>Seu pedido foi reservado!</h2>
    99                <h2>Efetue o pagamento dentro de <span id="countdown"></span>
Note: See TracChangeset for help on using the changeset viewer.