Plugin Directory

Changeset 3249916


Ignore:
Timestamp:
03/03/2025 07:34:07 PM (13 months ago)
Author:
bycoders
Message:

Update to version 1.6.5 from GitHub

Location:
paypal-brasil-para-woocommerce
Files:
10 edited
1 copied

Legend:

Unmodified
Added
Removed
  • paypal-brasil-para-woocommerce/tags/1.6.5/includes/class-wc-paypal-logger.php

    r3235591 r3249916  
    9999    {
    100100        $fieldsToMask = ["address_line_1", "address_line_2", "admin_area_1", "admin_area_2", "country_code", "postal_code", "email_address", "surname", "national_number", "tax_id", "tax_id_type", "email", "full_name", "document", "documentType", "phone"];
     101
     102
     103        // Caso contenha um debug_id, executa um filtro especial
     104        if (isset($data['debug_id'])) {
     105            return $this->filterDataPaypalError($data);
     106        }
     107
     108
    101109        foreach ($data as $key => &$value) {
    102110            // Se a chave estiver na lista de campos para mascarar e o valor for uma string, aplique a máscara
     
    108116            if (is_array($value)) {
    109117                $value = $this->filterData($value);
     118            }
     119        }
     120
     121        return $data;
     122    }
     123
     124    function filterDataPaypalError(array $data): array
     125    {
     126        if (!isset($data['debug_id']) || empty($data['details'])) {
     127            return $data;
     128        }
     129
     130        foreach ($data['details'] as &$detail) {
     131            if (!empty($detail['value']) && is_string($detail['value'])) {
     132                $detail['value'] = $this->maskString($detail['value']);
    110133            }
    111134        }
  • paypal-brasil-para-woocommerce/tags/1.6.5/includes/payment-methods/class-paypal-brasil-bcdc-gateway.php

    r3246453 r3249916  
    513513        try{
    514514            $execution_response = $this->api->execute_payment($order_id, array(), 'bcdc');
    515             WC_PAYPAL_LOGGER::log("Payment capture is completed.",$this->id,'info', $execution_response);
     515            WC_PAYPAL_LOGGER::log("Payment capture is completed.",$this->id,'info', $execution_response, array('action'=> 'CAPTURE_ORDER'));
     516
    516517        }catch(PayPal_Brasil_API_Exception $ex){
    517518            $data = $ex->getData();
     
    898899        if ($order) {
    899900            $billing_data = [
    900                 'postcode' => $order->get_shipping_postcode(),
    901                 'address' => $order->get_shipping_address_1(),
    902                 'address_2' => $order->get_shipping_address_2(),
    903                 'city' => $order->get_shipping_city(),
    904                 'state' => $order->get_shipping_state(),
    905                 'country' => $order->get_shipping_country(),
    906                 'neighborhood' => get_post_meta($order->get_id(), '_billing_neighborhood', true),
    907                 'number' => get_post_meta($order->get_id(), '_billing_number', true),
    908                 'first_name' => $order->get_billing_first_name(),
    909                 'last_name' => $order->get_billing_last_name(),
    910                 'person_type' => get_post_meta($order->get_id(), '_billing_persontype', true),
    911                 'cpf' => get_post_meta($order->get_id(), '_billing_cpf', true),
    912                 'cnpj' => get_post_meta($order->get_id(), '_billing_cnpj', true),
    913                 'phone' => get_post_meta($order->get_id(), '_billing_cellphone', true) ?: $order->get_billing_phone(),
     901                'postcode' => $order->get_billing_postcode() ?? $order->get_shipping_postcode(),
     902                'address' => $order->get_billing_address_1() ?? $order->get_shipping_address_1(),
     903                'address_2' => $order->get_billing_address_2() ?? $order->get_shipping_address_2(),
     904                'city' => $order->get_billing_city()  ?? $order->get_shipping_city(),
     905                'state' => $order->get_billing_state() ?? $order->get_shipping_state(),
     906                'country' => $order->get_billing_country() ?? $order->get_shipping_country(),
     907                'neighborhood' => $order->get_meta('_billing_neighborhood',true,"view"),
     908                'number' => $order->get_meta('_billing_number',true,"view"),
     909                'first_name' => $order->get_billing_first_name()  ?? $order->get_shipping_first_name(),
     910                'last_name' => $order->get_billing_last_name()  ?? $order->get_shipping_last_name(),
     911                'person_type' => $order->get_meta('_billing_persontype',true,"view"),
     912                'cpf' => $order->get_meta('_billing_cpf',true,"view"),
     913                'cnpj' => $order->get_meta('_billing_cnpj',true,"view"),
     914                'phone' => $order->get_meta('_billing_cellphone',true,"view") ?: $order->get_billing_phone(),
    914915                'email' => $order->get_billing_email(),
    915916            ];
     
    973974        }
    974975
    975         $billing_data['wc-bcdc-brasil-selected'] = filter_var($post_data['wc-bcdc-brasil-selected'], FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE);
     976        $billing_data['wc-bcdc-brasil-selected'] = isset($post_data) ? filter_var($post_data['wc-bcdc-brasil-selected'], FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE) : false;
    976977        $billing_data['can_create_payment'] = $can_create_payment;
    977978
     
    15341535            $result = $this->api->create_payment($payment_data, array(), 'bcdc');
    15351536
     1537            if (!isset($result['payment_source']['paypal']['address']) || !isset($result['payer']['address'])) {
     1538                WC_PAYPAL_LOGGER::log("Order created without address.", $this->id, "warning", $result);
     1539            } else {
     1540                WC_PAYPAL_LOGGER::log("Order body", $this->id, "info", $result);
     1541            }
     1542           
    15361543            return $result;
    15371544            // Catch any PayPal error.
  • paypal-brasil-para-woocommerce/tags/1.6.5/includes/payment-methods/class-paypal-brasil-plus-gateway.php

    r3245859 r3249916  
    700700        if ($order) {
    701701            $billing_cellphone = get_post_meta($order->get_id(), '_billing_cellphone', true);
    702             $data['postcode'] = $order->get_shipping_postcode();
    703             $data['address'] = $order->get_shipping_address_1();
    704             $data['address_2'] = $order->get_shipping_address_2();
    705             $data['city'] = $order->get_shipping_city();
    706             $data['state'] = $order->get_shipping_state();
    707             $data['country'] = $order->get_shipping_country();
    708             $data['neighborhood'] = get_post_meta($order->get_id(), '_billing_neighborhood', true);
    709             $data['number'] = get_post_meta($order->get_id(), '_billing_number', true);
    710             $data['first_name'] = $order->get_billing_first_name();
    711             $data['last_name'] = $order->get_billing_last_name();
    712             $data['person_type'] = get_post_meta($order->get_id(), '_billing_persontype', true);
    713             $data['cpf'] = get_post_meta($order->get_id(), '_billing_cpf', true);
    714             $data['cnpj'] = get_post_meta($order->get_id(), '_billing_cnpj', true);
     702            $data['postcode'] = $order->get_billing_postcode() ?? $order->get_shipping_postcode();
     703            $data['address'] = $order->get_billing_address_1() ?? $order->get_shipping_address_1();
     704            $data['address_2'] = $order->get_billing_address_2() ?? $order->get_shipping_address_2();
     705            $data['city'] = $order->get_billing_city()  ?? $order->get_shipping_city();
     706            $data['state'] = $order->get_billing_state() ?? $order->get_shipping_state();
     707            $data['country'] = $order->get_billing_country() ?? $order->get_shipping_country();
     708            $data['neighborhood'] = $order->get_meta('_billing_neighborhood',true,"view");
     709            $data['number'] = $order->get_meta('_billing_number',true,"view");
     710            $data['first_name'] = $order->get_billing_first_name()  ?? $order->get_shipping_first_name();
     711            $data['last_name'] = $order->get_billing_last_name()  ?? $order->get_shipping_last_name();
     712            $data['person_type'] = $order->get_meta('_billing_persontype',true,"view");
     713            $data['cpf'] = $order->get_meta('_billing_cpf',true,"view");
     714            $data['cnpj'] = $order->get_meta('_billing_cnpj',true,"view");
    715715            $data['phone'] = $billing_cellphone ? $billing_cellphone : $order->get_billing_phone();
    716716            $data['email'] = $order->get_billing_email();
  • paypal-brasil-para-woocommerce/tags/1.6.5/paypal-brasil-para-woocommerce.php

    r3246453 r3249916  
    44 * Plugin Name: PayPal Brasil para WooCommerce
    55 * Description: Adicione facilmente opções de pagamento do PayPal à sua loja do WooCommerce.
    6  * Version: 1.6.4
     6 * Version: 1.6.5
    77 * Author: PayPal
    88 * Author URI: https://paypal.com.br
     
    3030    // Define files.
    3131    define( 'PAYPAL_PAYMENTS_MAIN_FILE', __FILE__ );
    32     define( 'PAYPAL_PAYMENTS_VERSION', '1.6.4' );
     32    define( 'PAYPAL_PAYMENTS_VERSION', '1.6.5' );
    3333    define('WC_PAYPAL_PLUGIN_SLUG','paypal-brasil-para-woocommerce');
    3434
  • paypal-brasil-para-woocommerce/tags/1.6.5/readme.txt

    r3246453 r3249916  
    55Requires at least: 4.4
    66Tested up to: 6.7.2
    7 Stable tag: 1.6.4
     7Stable tag: 1.6.5
    88Requires PHP: 7.0
    99License: GPLv2 or later
     
    9090
    9191== Changelog ==
     92
     93= 1.6.5 =
     94* Fix error payment from page of individual payment.
     95* Fix PHP warnings.
    9296
    9397= 1.6.4 =
     
    260264== Upgrade Notice ==
    261265
    262 = 1.6.4 =
    263 * Fix error on checkout experience with other payments.
     266= 1.6.5 =
     267* Fix error payment from page of individual payment.
     268* Fix PHP warnings.
    264269
    265270== Screenshots ==
  • paypal-brasil-para-woocommerce/trunk/includes/class-wc-paypal-logger.php

    r3235591 r3249916  
    9999    {
    100100        $fieldsToMask = ["address_line_1", "address_line_2", "admin_area_1", "admin_area_2", "country_code", "postal_code", "email_address", "surname", "national_number", "tax_id", "tax_id_type", "email", "full_name", "document", "documentType", "phone"];
     101
     102
     103        // Caso contenha um debug_id, executa um filtro especial
     104        if (isset($data['debug_id'])) {
     105            return $this->filterDataPaypalError($data);
     106        }
     107
     108
    101109        foreach ($data as $key => &$value) {
    102110            // Se a chave estiver na lista de campos para mascarar e o valor for uma string, aplique a máscara
     
    108116            if (is_array($value)) {
    109117                $value = $this->filterData($value);
     118            }
     119        }
     120
     121        return $data;
     122    }
     123
     124    function filterDataPaypalError(array $data): array
     125    {
     126        if (!isset($data['debug_id']) || empty($data['details'])) {
     127            return $data;
     128        }
     129
     130        foreach ($data['details'] as &$detail) {
     131            if (!empty($detail['value']) && is_string($detail['value'])) {
     132                $detail['value'] = $this->maskString($detail['value']);
    110133            }
    111134        }
  • paypal-brasil-para-woocommerce/trunk/includes/payment-methods/class-paypal-brasil-bcdc-gateway.php

    r3246453 r3249916  
    513513        try{
    514514            $execution_response = $this->api->execute_payment($order_id, array(), 'bcdc');
    515             WC_PAYPAL_LOGGER::log("Payment capture is completed.",$this->id,'info', $execution_response);
     515            WC_PAYPAL_LOGGER::log("Payment capture is completed.",$this->id,'info', $execution_response, array('action'=> 'CAPTURE_ORDER'));
     516
    516517        }catch(PayPal_Brasil_API_Exception $ex){
    517518            $data = $ex->getData();
     
    898899        if ($order) {
    899900            $billing_data = [
    900                 'postcode' => $order->get_shipping_postcode(),
    901                 'address' => $order->get_shipping_address_1(),
    902                 'address_2' => $order->get_shipping_address_2(),
    903                 'city' => $order->get_shipping_city(),
    904                 'state' => $order->get_shipping_state(),
    905                 'country' => $order->get_shipping_country(),
    906                 'neighborhood' => get_post_meta($order->get_id(), '_billing_neighborhood', true),
    907                 'number' => get_post_meta($order->get_id(), '_billing_number', true),
    908                 'first_name' => $order->get_billing_first_name(),
    909                 'last_name' => $order->get_billing_last_name(),
    910                 'person_type' => get_post_meta($order->get_id(), '_billing_persontype', true),
    911                 'cpf' => get_post_meta($order->get_id(), '_billing_cpf', true),
    912                 'cnpj' => get_post_meta($order->get_id(), '_billing_cnpj', true),
    913                 'phone' => get_post_meta($order->get_id(), '_billing_cellphone', true) ?: $order->get_billing_phone(),
     901                'postcode' => $order->get_billing_postcode() ?? $order->get_shipping_postcode(),
     902                'address' => $order->get_billing_address_1() ?? $order->get_shipping_address_1(),
     903                'address_2' => $order->get_billing_address_2() ?? $order->get_shipping_address_2(),
     904                'city' => $order->get_billing_city()  ?? $order->get_shipping_city(),
     905                'state' => $order->get_billing_state() ?? $order->get_shipping_state(),
     906                'country' => $order->get_billing_country() ?? $order->get_shipping_country(),
     907                'neighborhood' => $order->get_meta('_billing_neighborhood',true,"view"),
     908                'number' => $order->get_meta('_billing_number',true,"view"),
     909                'first_name' => $order->get_billing_first_name()  ?? $order->get_shipping_first_name(),
     910                'last_name' => $order->get_billing_last_name()  ?? $order->get_shipping_last_name(),
     911                'person_type' => $order->get_meta('_billing_persontype',true,"view"),
     912                'cpf' => $order->get_meta('_billing_cpf',true,"view"),
     913                'cnpj' => $order->get_meta('_billing_cnpj',true,"view"),
     914                'phone' => $order->get_meta('_billing_cellphone',true,"view") ?: $order->get_billing_phone(),
    914915                'email' => $order->get_billing_email(),
    915916            ];
     
    973974        }
    974975
    975         $billing_data['wc-bcdc-brasil-selected'] = filter_var($post_data['wc-bcdc-brasil-selected'], FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE);
     976        $billing_data['wc-bcdc-brasil-selected'] = isset($post_data) ? filter_var($post_data['wc-bcdc-brasil-selected'], FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE) : false;
    976977        $billing_data['can_create_payment'] = $can_create_payment;
    977978
     
    15341535            $result = $this->api->create_payment($payment_data, array(), 'bcdc');
    15351536
     1537            if (!isset($result['payment_source']['paypal']['address']) || !isset($result['payer']['address'])) {
     1538                WC_PAYPAL_LOGGER::log("Order created without address.", $this->id, "warning", $result);
     1539            } else {
     1540                WC_PAYPAL_LOGGER::log("Order body", $this->id, "info", $result);
     1541            }
     1542           
    15361543            return $result;
    15371544            // Catch any PayPal error.
  • paypal-brasil-para-woocommerce/trunk/includes/payment-methods/class-paypal-brasil-plus-gateway.php

    r3245859 r3249916  
    700700        if ($order) {
    701701            $billing_cellphone = get_post_meta($order->get_id(), '_billing_cellphone', true);
    702             $data['postcode'] = $order->get_shipping_postcode();
    703             $data['address'] = $order->get_shipping_address_1();
    704             $data['address_2'] = $order->get_shipping_address_2();
    705             $data['city'] = $order->get_shipping_city();
    706             $data['state'] = $order->get_shipping_state();
    707             $data['country'] = $order->get_shipping_country();
    708             $data['neighborhood'] = get_post_meta($order->get_id(), '_billing_neighborhood', true);
    709             $data['number'] = get_post_meta($order->get_id(), '_billing_number', true);
    710             $data['first_name'] = $order->get_billing_first_name();
    711             $data['last_name'] = $order->get_billing_last_name();
    712             $data['person_type'] = get_post_meta($order->get_id(), '_billing_persontype', true);
    713             $data['cpf'] = get_post_meta($order->get_id(), '_billing_cpf', true);
    714             $data['cnpj'] = get_post_meta($order->get_id(), '_billing_cnpj', true);
     702            $data['postcode'] = $order->get_billing_postcode() ?? $order->get_shipping_postcode();
     703            $data['address'] = $order->get_billing_address_1() ?? $order->get_shipping_address_1();
     704            $data['address_2'] = $order->get_billing_address_2() ?? $order->get_shipping_address_2();
     705            $data['city'] = $order->get_billing_city()  ?? $order->get_shipping_city();
     706            $data['state'] = $order->get_billing_state() ?? $order->get_shipping_state();
     707            $data['country'] = $order->get_billing_country() ?? $order->get_shipping_country();
     708            $data['neighborhood'] = $order->get_meta('_billing_neighborhood',true,"view");
     709            $data['number'] = $order->get_meta('_billing_number',true,"view");
     710            $data['first_name'] = $order->get_billing_first_name()  ?? $order->get_shipping_first_name();
     711            $data['last_name'] = $order->get_billing_last_name()  ?? $order->get_shipping_last_name();
     712            $data['person_type'] = $order->get_meta('_billing_persontype',true,"view");
     713            $data['cpf'] = $order->get_meta('_billing_cpf',true,"view");
     714            $data['cnpj'] = $order->get_meta('_billing_cnpj',true,"view");
    715715            $data['phone'] = $billing_cellphone ? $billing_cellphone : $order->get_billing_phone();
    716716            $data['email'] = $order->get_billing_email();
  • paypal-brasil-para-woocommerce/trunk/paypal-brasil-para-woocommerce.php

    r3246453 r3249916  
    44 * Plugin Name: PayPal Brasil para WooCommerce
    55 * Description: Adicione facilmente opções de pagamento do PayPal à sua loja do WooCommerce.
    6  * Version: 1.6.4
     6 * Version: 1.6.5
    77 * Author: PayPal
    88 * Author URI: https://paypal.com.br
     
    3030    // Define files.
    3131    define( 'PAYPAL_PAYMENTS_MAIN_FILE', __FILE__ );
    32     define( 'PAYPAL_PAYMENTS_VERSION', '1.6.4' );
     32    define( 'PAYPAL_PAYMENTS_VERSION', '1.6.5' );
    3333    define('WC_PAYPAL_PLUGIN_SLUG','paypal-brasil-para-woocommerce');
    3434
  • paypal-brasil-para-woocommerce/trunk/readme.txt

    r3246453 r3249916  
    55Requires at least: 4.4
    66Tested up to: 6.7.2
    7 Stable tag: 1.6.4
     7Stable tag: 1.6.5
    88Requires PHP: 7.0
    99License: GPLv2 or later
     
    9090
    9191== Changelog ==
     92
     93= 1.6.5 =
     94* Fix error payment from page of individual payment.
     95* Fix PHP warnings.
    9296
    9397= 1.6.4 =
     
    260264== Upgrade Notice ==
    261265
    262 = 1.6.4 =
    263 * Fix error on checkout experience with other payments.
     266= 1.6.5 =
     267* Fix error payment from page of individual payment.
     268* Fix PHP warnings.
    264269
    265270== Screenshots ==
Note: See TracChangeset for help on using the changeset viewer.