Plugin Directory

Changeset 1977545


Ignore:
Timestamp:
11/20/2018 04:26:22 PM (7 years ago)
Author:
businesspay
Message:
  • Add | Inserted Default Authentication Key and API to sandbox mode.
  • Add | Admin panel antifraud product info.
  • Add | Antifraud product Realtime Decision compatibility.
  • Add | Async antifraud webhook consult status.
  • Fix | Void index.php created in each plugin folder.
  • Fix | Performance and code structure improvement.
Location:
woo-businesspay/trunk
Files:
8 added
8 edited

Legend:

Unmodified
Added
Removed
  • woo-businesspay/trunk/includes/woocommerce-businesspay-gateway.php

    r1969509 r1977545  
    1212        $installment_minimum_value, $billet_logo_url, $billet_number_days, $billet_instruction_1, $sandbox, $debug,
    1313        $authority, $auth_id, $auth_last, $auth_next, $auth_interval, $auth_vendor_id, $enable_client, $enable_install,
    14         $antifraud_entity_code_demo, $antifraud_entity_code_live, $antifraud_app_id_demo, $antifraud_app_id_live,
    15         $auth_api, $auth_scope, $auth_version, $auth_schema, $auth_gateway, $auth_validate, $auth_summary,
    16         $default_session_interval, $default_billet_expiration_days, $logger;
     14        $antifraud_product_id, $antifraud_login_demo, $antifraud_login_live, $antifraud_password_demo,
     15        $antifraud_password_live, $antifraud_app_id_demo, $antifraud_app_id_live, $antifraud_auth_token,
     16        $antifraud_auth_expiration, $auth_api, $auth_scope, $auth_version, $auth_schema, $auth_gateway, $auth_validate,
     17        $auth_summary, $default_session_interval, $default_billet_expiration_days, $logger;
    1718
    1819    public
     
    3233        $this->gateway_live_version   = 'v1';
    3334        $this->antifraud_demo_url     = 'https://homologacao.clearsale.com.br';
    34         $this->antifraud_live_url     = 'https://integracao.clearsale.com.br';
    35         $this->antifraud_demo_version = 'v2';
    36         $this->antifraud_live_version = '';
     35        $this->antifraud_live_url     = 'https://api.clearsale.com.br';
     36        $this->antifraud_demo_version = 'v1';
     37        $this->antifraud_live_version = 'v1';
    3738
    3839        $this->init_form_fields();
     
    7273
    7374        //Auth
    74         $this->auth_id                    = get_option( 'businesspay_auth_id' );
    75         $this->auth_vendor_id             = '1';
    76         $this->enable_client              = get_option( 'businesspay_enable_client' );
    77         $this->enable_install             = get_option( 'businesspay_enable_install' );
    78         $this->enable_antifraud           = get_option( 'businesspay_enable_antifraud' );
    79         $this->antifraud_entity_code_demo = get_option( 'businesspay_antifraud_entity_code_demo' );
    80         $this->antifraud_entity_code_live = get_option( 'businesspay_antifraud_entity_code_live' );
    81         $this->antifraud_app_id_demo      = get_option( 'businesspay_antifraud_app_id_demo' );
    82         $this->antifraud_app_id_live      = get_option( 'businesspay_antifraud_app_id_live' );
    83         $this->default_session_interval   = '12';
     75        $this->auth_id                   = get_option( 'businesspay_auth_id' );
     76        $this->auth_vendor_id            = '1';
     77        $this->enable_client             = get_option( 'businesspay_enable_client' );
     78        $this->enable_install            = get_option( 'businesspay_enable_install' );
     79        $this->enable_antifraud          = get_option( 'businesspay_enable_antifraud' );
     80        $this->antifraud_product_id      = get_option( 'businesspay_antifraud_product_id' );
     81        $this->antifraud_login_demo      = get_option( 'businesspay_antifraud_login_demo' );
     82        $this->antifraud_login_live      = get_option( 'businesspay_antifraud_login_live' );
     83        $this->antifraud_password_demo   = get_option( 'businesspay_antifraud_password_demo' );
     84        $this->antifraud_password_live   = get_option( 'businesspay_antifraud_password_live' );
     85        $this->antifraud_app_id_demo     = get_option( 'businesspay_antifraud_app_id_demo' );
     86        $this->antifraud_app_id_live     = get_option( 'businesspay_antifraud_app_id_live' );
     87        $this->antifraud_auth_token      = get_option( 'businesspay_antifraud_auth_token' );
     88        $this->antifraud_auth_expiration = get_option( 'businesspay_antifraud_auth_expiration' );
     89        $this->default_session_interval  = '12';
    8490
    8591        $this->auth_api      = 'wp-json';
     
    9399
    94100        //Actions
    95         add_action( 'woocommerce_api_wc_' . $this->id, array( $this, 'gateway_callback' ) );
     101        add_action( 'woocommerce_api_wc_' . $this->id, array( $this, 'webhook_callback' ) );
    96102        add_action( 'woocommerce_update_options_payment_gateways_' . $this->id, array(
    97103            $this,
     
    157163        $install_str   = ( $this->enable_install ) ? $icon_ok . esc_html__( 'Installation Enabled', 'woocommerce-businesspay' ) : $icon_nok . esc_html__( 'Installation Disabled', 'woocommerce-businesspay' );
    158164        $antifraud_str = ( $this->enable_antifraud ) ? $icon_ok . esc_html__( 'Antifraud Enabled', 'woocommerce-businesspay' ) : $icon_nok . esc_html__( 'Antifraud Disabled', 'woocommerce-businesspay' );
     165        $product_str   = ( ! empty( $this->antifraud_product_id ) ) ? $icon_ok . $this->get_antifraud_order_product_name() : $icon_nok . esc_html__( 'Product not configured', 'woocommerce-businesspay' );
    159166
    160167        $client_title    = esc_html__( 'Client Account:', 'woocommerce-businesspay' );
    161168        $install_title   = esc_html__( 'Client Installation:', 'woocommerce-businesspay' );
    162169        $antifraud_title = esc_html__( 'Client Antifraud:', 'woocommerce-businesspay' );
     170        $product_title   = esc_html__( 'Antifraud Product:', 'woocommerce-businesspay' );
    163171
    164172        $html_row_str = sprintf( $html_row, $client_title, $client_str, $client_str );
    165173        $html_row_str .= sprintf( $html_row, $install_title, $install_str, $install_str );
    166174        $html_row_str .= sprintf( $html_row, $antifraud_title, $antifraud_str, $antifraud_str );
     175
     176        if ( $this->enable_antifraud ) {
     177            $html_row_str .= sprintf( $html_row, $product_title, $product_str, $product_str );
     178        }
    167179
    168180        echo $html_table_start . $html_row_str . $html_table_end;
     
    212224                'title'             => esc_html__( 'Authentication API', 'woocommerce-businesspay' ),
    213225                'description'       => esc_html__( 'Use your BusinessPay Authentication API', 'woocommerce-businesspay' ),
    214                 'default'           => '',
     226                'default'           => 'BUSINESSPAY',
    215227                'custom_attributes' => array( 'required' => 'required' ),
    216228                'desc_tip'          => true,
     
    220232                'title'             => esc_html__( 'Authentication Key', 'woocommerce-businesspay' ),
    221233                'description'       => esc_html__( 'Use your BusinessPay Authentication Key', 'woocommerce-businesspay' ),
    222                 'default'           => '',
     234                'default'           => 'FECE839A97AFC57D88B2',
    223235                'custom_attributes' => array( 'required' => 'required' ),
    224236                'desc_tip'          => true,
     
    375387                'description' => esc_html__( 'Enable BusinessPay Sandbox', 'woocommerce-businesspay' ),
    376388                'class'       => 'wc-bp-sandbox',
    377                 'default'     => 'no',
     389                'default'     => 'yes',
    378390                'desc_tip'    => true,
    379391            ),
     
    406418            case 'card':
    407419                //Number
    408                 $number = str_replace( ' ', '', $this->get_gateway_card_number( $fields ) );
     420                $number = str_replace( ' ', '', $this->get_gateway_payment_card_info_number( $fields ) );
    409421                if ( strlen( $number ) < 15 ) {
    410422                    ++ $error_num;
     
    419431
    420432                //Name
    421                 $name = trim( $this->get_gateway_card_holder_name( $fields ) );
     433                $name = trim( $this->get_gateway_payment_card_info_holder_name( $fields ) );
    422434                if ( strlen( $name ) < 6 ) {
    423435                    ++ $error_num;
     
    432444
    433445                //Expiry
    434                 $temp_date       = explode( '/', $this->get_gateway_card_expiry( $fields ) );
     446                $temp_date       = explode( '/', $this->get_gateway_payment_card_info_expiry( $fields ) );
    435447                $bp_expiry_month = trim( $temp_date[0] );
    436448                $bp_expire_year  = trim( $temp_date[1] );
     
    451463
    452464                //CVC
    453                 $bp_cvc = $this->get_gateway_card_cvv( $fields );
     465                $bp_cvc = $this->get_gateway_payment_card_info_cvv( $fields );
    454466                if ( strlen( $bp_cvc ) < 3 ) {
    455467                    ++ $error_num;
     
    464476
    465477                //Installments
    466                 $bp_installments = $this->get_gateway_card_installments( $fields );
     478                $bp_installments = $this->get_gateway_payment_card_installments( $fields );
    467479                if ( $bp_installments == '0' ) {
    468480                    ++ $error_num;
     
    471483
    472484                //Document
    473                 $bp_doc = str_replace( array( '.', '-', '/' ), '', $this->get_gateway_card_document( $fields ) );
     485                $bp_doc = str_replace( array(
     486                    '.',
     487                    '-',
     488                    '/'
     489                ), '', $this->get_gateway_payment_card_document( $fields ) );
    474490                if ( strlen( $bp_doc ) != 11 && strlen( $bp_doc ) != 14 ) {
    475491                    ++ $error_num;
     
    488504                break;
    489505            case 'transfer':
    490                 $bp_transf = $this->get_gateway_transfer_bank( $fields );
     506                $bp_transf = $this->get_gateway_payment_transfer_provider( $fields );
    491507                if ( $bp_transf == '' ) {
    492508                    ++ $error_num;
     
    501517                break;
    502518            case 'billet':
    503                 $bp_billet = $this->get_gateway_billet_bank( $fields );
     519                $bp_billet = $this->get_gateway_payment_billet_provider( $fields );
    504520                if ( $bp_billet == '' ) {
    505521                    ++ $error_num;
     
    525541        if ( $this->validate_fields() ) {
    526542            try {
    527                 $order        = new WC_Order( $order_id );
    528                 $payment_type = $this->get_gateway_selected_tab( $fields );
    529                 switch ( $payment_type ) {
    530                     case 'card':
    531                         if ( $this->get_gateway_card_installments( $fields ) == 'debit' ) {
    532                             $order->set_payment_method_title( esc_html__( 'BusinessPay | Debit Card', 'woocommerce-businesspay' ) );
    533                             $response = $this->gateway_authorization_debit( $order );
    534                         } else {
    535                             $order->set_payment_method_title( esc_html__( 'BusinessPay | Credit Card', 'woocommerce-businesspay' ) );
    536                             $response = $this->gateway_authorization_credit( $order );
    537                         }
    538                         break;
    539                     case 'transfer':
    540                         $order->set_payment_method_title( esc_html__( 'BusinessPay | Bank Transfer', 'woocommerce-businesspay' ) );
    541                         $response = $this->gateway_transaction_transfer( $order );
    542                         break;
    543                     case 'billet':
    544                         $order->set_payment_method_title( esc_html__( 'BusinessPay | Billet', 'woocommerce-businesspay' ) );
    545                         $response = $this->gateway_transaction_billet( $order );
    546                         break;
    547                     default:
    548                         $response = $result;
    549                         break;
    550                 }
     543                $order  = new WC_Order( $order_id );
     544                $method = $this->get_gateway_selected_method( $fields );
     545                if ( $method == 'debit' ) {
     546                    $order->set_payment_method_title( esc_html__( 'BusinessPay | Debit Card', 'woocommerce-businesspay' ) );
     547                } elseif ( $method == 'credit' ) {
     548                    $order->set_payment_method_title( esc_html__( 'BusinessPay | Credit Card', 'woocommerce-businesspay' ) );
     549                } elseif ( $method == 'transfer' ) {
     550                    $order->set_payment_method_title( esc_html__( 'BusinessPay | Bank Transfer', 'woocommerce-businesspay' ) );
     551                } elseif ( $method == 'billet' ) {
     552                    $order->set_payment_method_title( esc_html__( 'BusinessPay | Billet', 'woocommerce-businesspay' ) );
     553                }
     554
     555                $response = $this->gateway_do_authorization( $order, $method );
    551556                if ( $response['result'] == 'success' ) {
    552557                    WC()->cart->empty_cart();
    553558                    $result = $response;
    554559                } else {
    555                     $order->update_status( 'failed', $response['messages'] );
     560                    $this->update_order_status( $order, 'failed', $response['messages'] );
    556561                    wc_add_notice( $response['messages'], 'error' );
    557562                }
     
    565570
    566571
    567     //TRANSACTIONS
    568 
    569     private function gateway_transaction_transfer( $order ) {
     572    //GATEWAY CALLS
     573
     574    private function gateway_do_authorization( $order, $method ) {
    570575        $result = array( 'result' => 'failure', 'messages' => '' );
    571576        $fields = $_POST;
    572577        try {
    573             $provider     = $this->get_gateway_transfer_bank( $fields );
    574             $postback_url = $this->get_postback_url();
    575 
    576             $body     = array(
    577                 'referenceId' => $this->get_order_id( $order ),
    578                 'amount'      => str_replace( '.', '', $order->order_total ),
    579                 'description' => esc_html__( 'Woocommerce Order', 'woocommerce-businesspay' ),
    580                 'postBackUrl' => $postback_url,
    581                 'customer'    => array(
    582                     'name'     => $this->get_gateway_customer_name( $fields ),
    583                     'document' => $this->get_gateway_customer_document( $fields ),
    584                     'email'    => $this->get_gateway_customer_email( $fields ),
    585                     'address'  => array(
    586                         'address'    => $this->get_gateway_customer_address( $fields ),
    587                         'number'     => $this->get_gateway_customer_address_number( $fields ),
    588                         'complement' => $this->get_gateway_customer_address_complement( $fields ),
    589                         'district'   => $this->get_gateway_customer_address_district( $fields ),
    590                         'zipcode'    => $this->get_gateway_customer_address_zipcode( $fields ),
    591                         'city'       => $this->get_gateway_customer_address_city( $fields ),
    592                         'state'      => $this->get_gateway_customer_address_state( $fields )
     578            $body = '';
     579            if ( $method == 'debit' || $method == 'credit' ) {
     580                $body = array(
     581                    'referenceId' => $this->get_gateway_order_reference_id( $order ),
     582                    'amount'      => $this->get_gateway_order_amount( $order ),
     583                    'description' => $this->get_gateway_order_description(),
     584                    'postBackUrl' => $this->get_gateway_order_postback_url(),
     585                    'customer'    => array(
     586                        'name'     => $this->get_gateway_customer_name( $fields ),
     587                        'document' => $this->get_gateway_customer_document( $fields ),
     588                    ),
     589                    'payment'     => array(
     590                        'card' => array(
     591                            'type'           => $this->get_gateway_payment_type( $fields ),
     592                            'capture'        => $this->get_gateway_payment_card_capture(),
     593                            'installments'   => $this->get_gateway_payment_card_installments( $fields ),
     594                            'interestType'   => $this->get_gateway_payment_card_interest_type(),
     595                            'authenticate'   => $this->get_gateway_payment_card_authenticate(),
     596                            'saveCard'       => $this->get_gateway_payment_card_save(),
     597                            'recurrent'      => $this->get_gateway_payment_card_recurrent(),
     598                            'softDescriptor' => $this->get_gateway_payment_card_soft_descriptor(),
     599                            'cardInfo'       => array(
     600                                'number'          => $this->get_gateway_payment_card_info_number( $fields ),
     601                                'expirationMonth' => $this->get_gateway_payment_card_info_expiry_month( $fields ),
     602                                'expirationYear'  => $this->get_gateway_payment_card_info_expiry_year( $fields ),
     603                                'cvv'             => $this->get_gateway_payment_card_info_cvv( $fields ),
     604                                'brand'           => $this->get_gateway_payment_card_info_brand( $fields ),
     605                                'holderName'      => $this->get_gateway_payment_card_info_holder_name( $fields ),
     606                            )
     607                        )
    593608                    )
    594                 ),
    595                 'payment'     => array(
    596                     'electronicTransfer' => array(
    597                         'provider' => $provider
     609                );
     610            } elseif ( $method == 'transfer' ) {
     611                $body = array(
     612                    'referenceId' => $this->get_gateway_order_reference_id( $order ),
     613                    'amount'      => $this->get_gateway_order_amount( $order ),
     614                    'description' => $this->get_gateway_order_description(),
     615                    'postBackUrl' => $this->get_gateway_order_postback_url(),
     616                    'customer'    => array(
     617                        'name'     => $this->get_gateway_customer_name( $fields ),
     618                        'document' => $this->get_gateway_customer_document( $fields ),
     619                        'email'    => $this->get_gateway_customer_email( $fields ),
     620                        'address'  => array(
     621                            'address'    => $this->get_gateway_customer_address( $fields ),
     622                            'number'     => $this->get_gateway_customer_address_number( $fields ),
     623                            'complement' => $this->get_gateway_customer_address_complement( $fields ),
     624                            'district'   => $this->get_gateway_customer_address_district( $fields ),
     625                            'zipcode'    => $this->get_gateway_customer_address_zipcode( $fields ),
     626                            'city'       => $this->get_gateway_customer_address_city( $fields ),
     627                            'state'      => $this->get_gateway_customer_address_state( $fields )
     628                        )
     629                    ),
     630                    'payment'     => array(
     631                        'electronicTransfer' => array(
     632                            'provider' => $this->get_gateway_payment_transfer_provider( $fields )
     633                        )
    598634                    )
    599                 )
    600             );
     635                );
     636            } elseif ( $method == 'billet' ) {
     637                $body = array(
     638                    'referenceId' => $this->get_gateway_order_reference_id( $order ),
     639                    'amount'      => $this->get_gateway_order_amount( $order ),
     640                    'description' => $this->get_gateway_order_description(),
     641                    'postBackUrl' => $this->get_gateway_order_postback_url(),
     642                    'customer'    => array(
     643                        'name'     => $this->get_gateway_customer_name( $fields ),
     644                        'document' => $this->get_gateway_customer_document( $fields ),
     645                        'email'    => $this->get_gateway_customer_email( $fields ),
     646                        'address'  => array(
     647                            'address'    => $this->get_gateway_customer_address( $fields ),
     648                            'number'     => $this->get_gateway_customer_address_number( $fields ),
     649                            'complement' => $this->get_gateway_customer_address_complement( $fields ),
     650                            'district'   => $this->get_gateway_customer_address_district( $fields ),
     651                            'zipcode'    => $this->get_gateway_customer_address_zipcode( $fields ),
     652                            'city'       => $this->get_gateway_customer_address_city( $fields ),
     653                            'state'      => $this->get_gateway_customer_address_state( $fields )
     654                        )
     655                    ),
     656                    'payment'     => array(
     657                        'bankSlip' => array(
     658                            'expirationDate' => $this->get_gateway_payment_billet_expiration_date(),
     659                            'instructions'   => $this->get_gateway_payment_billet_instruction(),
     660                            'guarantor'      => $this->get_gateway_payment_billet_guarantor(),
     661                            'provider'       => $this->get_gateway_payment_billet_provider( $fields )
     662                        )
     663                    )
     664                );
     665            }
     666
    601667            $response = $this->gateway_api_request( 'POST', '/transactions', $body );
    602668
     669            if ( ! isset( $response->result ) ) {
     670                $this->gateway_insert_order_metadata( $order, $response );
     671                $res_status = $this->gateway_insert_order_status( $order, $response );
     672
     673                if ( $res_status['result'] == 'success' ) {
     674                    $this->antifraud_maybe_do_analysis( $order, $response );
     675                }
     676                $result = $res_status;
     677            }
     678        } catch ( Exception $e ) {
     679            $this->logger( 'Gateway Authorization Error', $e->getMessage() );
     680        }
     681
     682        return $result;
     683    }
     684
     685    private function gateway_do_capture( $order ) {
     686        $result = array( 'result' => 'failure', 'messages' => '' );
     687        try {
     688            $order_id       = $this->get_order_id( $order );
     689            $transaction_id = get_post_meta( $order_id, '_businesspay-transaction-id', true );
     690            $body           = array( 'transactionId' => $transaction_id );
     691
     692            $response = $this->gateway_api_request( 'PUT', '/transactions/' . $transaction_id . '/capture', $body );
    603693            if ( ! isset( $response->result ) ) {
    604694                $this->gateway_insert_order_metadata( $order, $response );
     
    606696            }
    607697        } catch ( Exception $e ) {
    608             $this->logger( 'Gateway Authorization Error', $e->getMessage() );
     698            $this->logger( 'Gateway API Consult Status Error', $e->getMessage() );
    609699        }
    610700
    611701        return $result;
    612702    }
    613 
    614     private function gateway_transaction_billet( $order ) {
    615         $result = array( 'result' => 'failure', 'messages' => '' );
    616         $fields = $_POST;
    617         try {
    618             $provider     = $this->get_gateway_billet_bank( $fields );
    619             $postback_url = $this->get_postback_url();
    620 
    621             $expirate = $this->get_billet_expiration( $this->billet_number_days );
    622 
    623             $body = array(
    624                 'referenceId' => $this->get_order_id( $order ),
    625                 'amount'      => str_replace( '.', '', $order->order_total ),
    626                 'description' => esc_html__( 'Woocommerce Order', 'woocommerce-businesspay' ),
    627                 'postBackUrl' => $postback_url,
    628                 'customer'    => array(
    629                     'name'     => $this->get_gateway_customer_name( $fields ),
    630                     'document' => $this->get_gateway_customer_document( $fields ),
    631                     'email'    => $this->get_gateway_customer_email( $fields ),
    632                     'address'  => array(
    633                         'address'    => $this->get_gateway_customer_address( $fields ),
    634                         'number'     => $this->get_gateway_customer_address_number( $fields ),
    635                         'complement' => $this->get_gateway_customer_address_complement( $fields ),
    636                         'district'   => $this->get_gateway_customer_address_district( $fields ),
    637                         'zipcode'    => $this->get_gateway_customer_address_zipcode( $fields ),
    638                         'city'       => $this->get_gateway_customer_address_city( $fields ),
    639                         'state'      => $this->get_gateway_customer_address_state( $fields )
    640                     )
    641                 ),
    642                 'payment'     => array(
    643                     'bankSlip' => array(
    644                         'expirationDate' => $expirate->format( 'Y-m-d' ),
    645                         'instructions'   => $this->billet_instruction_1,
    646                         'guarantor'      => 'Comprador',
    647                         'provider'       => $provider
    648                     )
    649                 )
    650             );
    651 
    652             $response = $this->gateway_api_request( 'POST', '/transactions', $body );
    653 
    654             if ( ! isset( $response->result ) ) {
    655                 $this->gateway_insert_order_metadata( $order, $response );
    656                 $result = $this->gateway_insert_order_status( $order, $response );
    657             }
    658         } catch ( Exception $e ) {
    659             $this->logger( 'Gateway Authorization Error', $e->getMessage() );
    660         }
    661 
    662         return $result;
    663     }
    664 
    665 
    666     //AUTHORIZATIONS
    667 
    668     private function gateway_authorization_debit( $order ) {
    669         $result = array( 'result' => 'failure', 'messages' => '' );
    670         $fields = $_POST;
    671         try {
    672             $body = array(
    673                 'referenceId' => $this->get_order_id( $order ),
    674                 'amount'      => str_replace( '.', '', $order->order_total ),
    675                 'description' => esc_html__( 'Woocommerce Order', 'woocommerce-businesspay' ),
    676                 'postBackUrl' => $this->get_postback_url(),
    677                 'customer'    => array(
    678                     'name'     => $this->get_gateway_card_holder_name( $fields ),
    679                     'document' => $this->get_gateway_card_document( $fields ),
    680                 ),
    681                 'payment'     => array(
    682                     'card' => array(
    683                         'type'           => 2,
    684                         //1: Crédito. 2: Débito
    685                         'capture'        => $this->enable_antifraud ? 'false' : 'true',
    686                         'installments'   => 1,
    687                         'interestType'   => 3,
    688                         //3: Parcelado loja. 4: Parcelado Administrador
    689                         'authenticate'   => 1,
    690                         //1: Somente transações autenticadas. 2: Autenticadas e não autenticadas. 3: Autorizar sem autenticação.
    691                         'saveCard'       => 'false',
    692                         'recurrent'      => 'false',
    693                         'softDescriptor' => $this->name_in_invoice,
    694                         'cardInfo'       => array(
    695                             'number'          => $this->get_gateway_card_number( $fields ),
    696                             'expirationMonth' => $this->get_gateway_card_expiry_month( $fields ),
    697                             'expirationYear'  => $this->get_gateway_card_expiry_year( $fields ),
    698                             'cvv'             => $this->get_gateway_card_cvv( $fields ),
    699                             'brand'           => $this->get_brand_name( $this->get_gateway_card_brand( $fields ) ),
    700                             'holderName'      => $this->get_gateway_card_holder_name( $fields ),
    701                         )
    702                     )
    703                 )
    704             );
    705 
    706             $response = $this->gateway_api_request( 'POST', '/transactions', $body );
    707             if ( ! isset( $response->result ) ) {
    708                 $this->gateway_insert_order_metadata( $order, $response );
    709                 $response = $this->gateway_insert_order_status( $order, $response );
    710                 $this->logger( 'Gateway Authorization DEBIT | result', $response );
    711 
    712                 if ( $this->enable_antifraud && $response['result'] == 'success' ) {
    713                     $this->antifraud_authorization_card( $order );
    714                 }
    715                 $result = $response;
    716             }
    717         } catch ( Exception $e ) {
    718             $this->logger( 'Gateway Authorization Error', $e->getMessage() );
    719         }
    720 
    721         return $result;
    722     }
    723 
    724     private function gateway_authorization_credit( $order ) {
    725         $result = array( 'result' => 'failure', 'messages' => '' );
    726         $fields = $_POST;
    727         try {
    728             $body = array(
    729                 'referenceId' => $this->get_order_id( $order ),
    730                 'amount'      => str_replace( '.', '', $order->order_total ),
    731                 'description' => esc_html__( 'Woocommerce Order', 'woocommerce-businesspay' ),
    732                 'postBackUrl' => $this->get_postback_url(),
    733                 'customer'    => array(
    734                     'name'     => $this->get_gateway_card_holder_name( $fields ),
    735                     'document' => $this->get_gateway_card_document( $fields ),
    736                 ),
    737                 'payment'     => array(
    738                     'card' => array(
    739                         'type'           => 1,
    740                         //1: Crédito. 2: Débito
    741                         'capture'        => $this->enable_antifraud ? 'false' : 'true',
    742                         'installments'   => $this->get_gateway_card_installments( $fields ),
    743                         'interestType'   => 3,
    744                         //3: Parcelado loja. 4: Parcelado Administrador
    745                         'authenticate'   => 3,
    746                         //1: Somente transações autenticadas. 2: Autenticadas e não autenticadas. 3: Autorizar sem autenticação.
    747                         'saveCard'       => 'false',
    748                         'recurrent'      => 'false',
    749                         'softDescriptor' => $this->name_in_invoice,
    750                         'cardInfo'       => array(
    751                             'number'          => $this->get_gateway_card_number( $fields ),
    752                             'expirationMonth' => $this->get_gateway_card_expiry_month( $fields ),
    753                             'expirationYear'  => $this->get_gateway_card_expiry_year( $fields ),
    754                             'cvv'             => $this->get_gateway_card_cvv( $fields ),
    755                             'brand'           => $this->get_brand_name( $this->get_gateway_card_brand( $fields ) ),
    756                             'holderName'      => $this->get_gateway_card_holder_name( $fields ),
    757                         )
    758                     )
    759                 )
    760             );
    761 
    762             $response = $this->gateway_api_request( 'POST', '/transactions', $body );
    763             if ( ! isset( $response->result ) ) {
    764                 $this->gateway_insert_order_metadata( $order, $response );
    765                 $response = $this->gateway_insert_order_status( $order, $response );
    766                 $this->logger( 'Gateway Authorization CREDIT | result', $response );
    767 
    768                 if ( $this->enable_antifraud && $response['result'] == 'success' ) {
    769                     $this->antifraud_authorization_card( $order );
    770                 }
    771                 $result = $response;
    772             }
    773         } catch ( Exception $e ) {
    774             $this->logger( 'Gateway Authorization Error', $e->getMessage() );
    775         }
    776 
    777         return $result;
    778     }
    779 
    780     private function antifraud_authorization_card( $order ) {
    781         $result    = array( 'result' => 'failure', 'messages' => '' );
    782         $do_retry  = true;
    783         $retry_num = 0;
    784         while ( $retry_num < 3 && $do_retry ) {
    785             $retry_num ++;
    786             try {
    787                 $xml       = new DOMDocument( '1.0', 'utf-8' );
    788                 $body      = $xml->appendChild( $xml->createElement( 'ClearSale' ) );
    789                 $af_orders = $body->appendChild( $xml->createElement( 'Orders' ) );
    790                 $af_order  = $af_orders->appendChild( $xml->createElement( 'Order' ) );
    791 
    792                 //ORDER
    793                 $af_order->appendChild( $xml->createElement( 'ID' ) )->appendChild( $xml->createTextNode( $this->get_order_id( $order ) ) );
    794                 $af_order->appendChild( $xml->createElement( 'FingerPrint' ) )->appendChild( $xml->createElement( 'SessionID' ) )->appendChild( $xml->createTextNode( $this->get_antifraud_order_fingerprint() ) );
    795                 $af_order->appendChild( $xml->createElement( 'Date' ) )->appendChild( $xml->createTextNode( $this->get_antifraud_order_date( $order ) ) );
    796                 $af_order->appendChild( $xml->createElement( 'Email' ) )->appendChild( $xml->createTextNode( $this->get_antifraud_order_email( $order ) ) );
    797                 //$af_order->appendChild($xml->createElement('B2B_B2C'))->appendChild($xml->createTextNode('B2C'));
    798                 $af_order->appendChild( $xml->createElement( 'ShippingPrice' ) )->appendChild( $xml->createTextNode( $this->get_antifraud_order_shipping_price( $order ) ) );
    799                 $af_order->appendChild( $xml->createElement( 'TotalItems' ) )->appendChild( $xml->createTextNode( $this->get_antifraud_order_total_items( $order ) ) );
    800                 $af_order->appendChild( $xml->createElement( 'TotalOrder' ) )->appendChild( $xml->createTextNode( $this->get_total_order( $order ) ) );
    801                 $af_order->appendChild( $xml->createElement( 'QtyInstallments' ) )->appendChild( $xml->createTextNode( $this->get_antifraud_order_qtd_installments( $order ) ) );
    802                 //$af_order->appendChild($xml->createElement('DeliveryTimeCD'))->appendChild($xml->createTextNode(''));
    803                 $af_order->appendChild( $xml->createElement( 'IP' ) )->appendChild( $xml->createTextNode( $this->get_antifraud_order_ip( $order ) ) );
    804                 //$af_order->appendChild($xml->createElement('ShippingType'))->appendChild($xml->createTextNode(''));
    805                 //$af_order->appendChild($xml->createElement('Gift'))->appendChild($xml->createTextNode('0'));
    806                 //$af_order->appendChild($xml->createElement('GiftMessage'))->appendChild($xml->createTextNode(''));
    807                 $af_order->appendChild( $xml->createElement( 'Obs' ) )->appendChild( $xml->createTextNode( $this->get_antifraud_order_obs( $order ) ) );
    808                 $af_order->appendChild( $xml->createElement( 'Status' ) )->appendChild( $xml->createTextNode( '0' ) );
    809                 $af_order->appendChild( $xml->createElement( 'Reanalise' ) )->appendChild( $xml->createTextNode( $this->get_antifraud_order_reanalyze( $order ) ) );
    810                 //$af_order->appendChild($xml->createElement('SlaCustom'))->appendChild($xml->createTextNode(''));
    811                 $af_order->appendChild( $xml->createElement( 'Origin' ) )->appendChild( $xml->createTextNode( $this->get_antifraud_install_origin() ) );
    812                 $af_order->appendChild( $xml->createElement( 'ChannelID' ) )->appendChild( $xml->createTextNode( $this->get_antifraud_install_channel_id() ) );
    813                 //$af_order->appendChild($xml->createElement('ReservationDate'))->appendChild($xml->createTextNode(''));
    814                 //$af_order->appendChild($xml->createElement('Nationality'))->appendChild($xml->createTextNode(''));
    815                 //$af_order->appendChild($xml->createElement('Product'))->appendChild($xml->createTextNode('4'));
    816                 //$af_order->appendChild($xml->createElement('ListTypeID'))->appendChild($xml->createTextNode('1'));
    817                 //$af_order->appendChild($xml->createElement('ListID'))->appendChild($xml->createTextNode(''));
    818 
    819                 //BILLING
    820                 $af_billing_data = $af_order->appendChild( $xml->createElement( 'BillingData' ) );
    821                 //$af_billing_data->appendChild($xml->createElement('ID'))->appendChild($xml->createTextNode(''));
    822                 $af_billing_data->appendChild( $xml->createElement( 'Type' ) )->appendChild( $xml->createTextNode( $this->get_antifraud_billing_person_type( $order ) ) );
    823                 $af_billing_data->appendChild( $xml->createElement( 'LegalDocument1' ) )->appendChild( $xml->createTextNode( $this->get_antifraud_billing_document( $order ) ) );
    824                 //$af_billing_data->appendChild($xml->createElement('LegalDocument2'))->appendChild($xml->createTextNode(''));
    825                 $af_billing_data->appendChild( $xml->createElement( 'Name' ) )->appendChild( $xml->createTextNode( $this->get_antifraud_billing_name( $order ) ) );
    826                 //$af_billing_data->appendChild($xml->createElement('BirthDate'))->appendChild($xml->createTextNode(''));
    827                 $af_billing_data->appendChild( $xml->createElement( 'Email' ) )->appendChild( $xml->createTextNode( $this->get_antifraud_billing_email( $order ) ) );
    828                 //$af_billing_data->appendChild($xml->createElement('Gender'))->appendChild($xml->createTextNode(''));
    829 
    830                 $af_billing_address = $af_billing_data->appendChild( $xml->createElement( 'Address' ) );
    831                 $af_billing_address->appendChild( $xml->createElement( 'Street' ) )->appendChild( $xml->createTextNode( $this->get_antifraud_billing_street( $order ) ) );
    832                 $af_billing_address->appendChild( $xml->createElement( 'Number' ) )->appendChild( $xml->createTextNode( $this->get_antifraud_billing_street_number( $order ) ) );
    833                 $af_billing_address->appendChild( $xml->createElement( 'Comp' ) )->appendChild( $xml->createTextNode( $this->get_antifraud_billing_complement( $order ) ) );
    834                 $af_billing_address->appendChild( $xml->createElement( 'County' ) )->appendChild( $xml->createTextNode( $this->get_antifraud_billing_county( $order ) ) );
    835                 $af_billing_address->appendChild( $xml->createElement( 'City' ) )->appendChild( $xml->createTextNode( $this->get_antifraud_billing_city( $order ) ) );
    836                 $af_billing_address->appendChild( $xml->createElement( 'State' ) )->appendChild( $xml->createTextNode( $this->get_antifraud_billing_state( $order ) ) );
    837                 $af_billing_address->appendChild( $xml->createElement( 'Country' ) )->appendChild( $xml->createTextNode( $this->get_antifraud_billing_country( $order ) ) );
    838                 $af_billing_address->appendChild( $xml->createElement( 'ZipCode' ) )->appendChild( $xml->createTextNode( $this->get_antifraud_billing_zipcode( $order ) ) );
    839                 //$af_billing_address->appendChild($xml->createElement('Reference'))->appendChild($xml->createTextNode(''));
    840 
    841                 $af_billing_phones = $af_billing_data->appendChild( $xml->createElement( 'Phones' ) );
    842                 $af_billing_phone  = $af_billing_phones->appendChild( $xml->createElement( 'Phone' ) );
    843                 $af_billing_phone->appendChild( $xml->createElement( 'Type' ) )->appendChild( $xml->createTextNode( $this->get_antifraud_billing_phone_type( $order ) ) );
    844                 $af_billing_phone->appendChild( $xml->createElement( 'DDI' ) )->appendChild( $xml->createTextNode( '55' ) );
    845                 $af_billing_phone->appendChild( $xml->createElement( 'DDD' ) )->appendChild( $xml->createTextNode( $this->get_antifraud_billing_phone_ddd( $order ) ) );
    846                 $af_billing_phone->appendChild( $xml->createElement( 'Number' ) )->appendChild( $xml->createTextNode( $this->get_antifraud_billing_phone_number( $order ) ) );
    847                 //$af_billing_phone->appendChild($xml->createElement('Extension'))->appendChild($xml->createTextNode(''));
    848 
    849                 //SHIPPING
    850                 $af_shipping_data = $af_order->appendChild( $xml->createElement( 'ShippingData' ) );
    851                 //$af_shipping_data->appendChild($xml->createElement('ID'))->appendChild($xml->createTextNode(''));
    852                 $af_shipping_data->appendChild( $xml->createElement( 'Type' ) )->appendChild( $xml->createTextNode( $this->get_antifraud_shipping_person_type( $order ) ) );
    853                 $af_shipping_data->appendChild( $xml->createElement( 'LegalDocument1' ) )->appendChild( $xml->createTextNode( $this->get_antifraud_shipping_document( $order ) ) );
    854                 //$af_shipping_data->appendChild($xml->createElement('LegalDocument2'))->appendChild($xml->createTextNode(''));
    855                 $af_shipping_data->appendChild( $xml->createElement( 'Name' ) )->appendChild( $xml->createTextNode( $this->get_antifraud_shipping_name( $order ) ) );
    856                 //$af_shipping_data->appendChild($xml->createElement('BirthDate'))->appendChild($xml->createTextNode(''));
    857                 $af_shipping_data->appendChild( $xml->createElement( 'Email' ) )->appendChild( $xml->createTextNode( $this->get_antifraud_shipping_email( $order ) ) );
    858                 //$af_shipping_data->appendChild($xml->createElement('Gender'))->appendChild($xml->createTextNode(''));
    859 
    860                 $af_shipping_address = $af_shipping_data->appendChild( $xml->createElement( 'Address' ) );
    861                 $af_shipping_address->appendChild( $xml->createElement( 'Street' ) )->appendChild( $xml->createTextNode( $this->get_antifraud_shipping_street( $order ) ) );
    862                 $af_shipping_address->appendChild( $xml->createElement( 'Number' ) )->appendChild( $xml->createTextNode( $this->get_antifraud_shipping_street_number( $order ) ) );
    863                 $af_shipping_address->appendChild( $xml->createElement( 'Comp' ) )->appendChild( $xml->createTextNode( $this->get_antifraud_shipping_complement( $order ) ) );
    864                 $af_shipping_address->appendChild( $xml->createElement( 'County' ) )->appendChild( $xml->createTextNode( $this->get_antifraud_shipping_county( $order ) ) );
    865                 $af_shipping_address->appendChild( $xml->createElement( 'City' ) )->appendChild( $xml->createTextNode( $this->get_antifraud_shipping_city( $order ) ) );
    866                 $af_shipping_address->appendChild( $xml->createElement( 'State' ) )->appendChild( $xml->createTextNode( $this->get_antifraud_shipping_state( $order ) ) );
    867                 $af_shipping_address->appendChild( $xml->createElement( 'Country' ) )->appendChild( $xml->createTextNode( $this->get_antifraud_shipping_country( $order ) ) );
    868                 $af_shipping_address->appendChild( $xml->createElement( 'ZipCode' ) )->appendChild( $xml->createTextNode( $this->get_antifraud_shipping_zipcode( $order ) ) );
    869                 //$af_shipping_address->appendChild($xml->createElement('Reference'))->appendChild($xml->createTextNode(''));
    870 
    871                 $af_shipping_phones = $af_shipping_data->appendChild( $xml->createElement( 'Phones' ) );
    872                 $af_shipping_phone  = $af_shipping_phones->appendChild( $xml->createElement( 'Phone' ) );
    873                 $af_shipping_phone->appendChild( $xml->createElement( 'Type' ) )->appendChild( $xml->createTextNode( $this->get_antifraud_shipping_phone_type( $order ) ) );
    874                 $af_shipping_phone->appendChild( $xml->createElement( 'DDI' ) )->appendChild( $xml->createTextNode( '55' ) );
    875                 $af_shipping_phone->appendChild( $xml->createElement( 'DDD' ) )->appendChild( $xml->createTextNode( $this->get_antifraud_shipping_phone_ddd( $order ) ) );
    876                 $af_shipping_phone->appendChild( $xml->createElement( 'Number' ) )->appendChild( $xml->createTextNode( $this->get_antifraud_shipping_phone_number( $order ) ) );
    877                 //$af_shipping_phone->appendChild($xml->createElement('Extension'))->appendChild($xml->createTextNode(''));
    878 
    879                 //PAYMENT
    880                 $af_payments = $af_order->appendChild( $xml->createElement( 'Payments' ) );
    881                 $af_payment  = $af_payments->appendChild( $xml->createElement( 'Payment' ) );
    882                 //$af_payment->appendChild($xml->createElement('Sequential'))->appendChild($xml->createTextNode(''));
    883                 $af_payment->appendChild( $xml->createElement( 'Date' ) )->appendChild( $xml->createTextNode( $this->get_antifraud_payment_date( $order ) ) );
    884                 $af_payment->appendChild( $xml->createElement( 'Amount' ) )->appendChild( $xml->createTextNode( $this->get_antifraud_payment_amount( $order ) ) );
    885                 $af_payment->appendChild( $xml->createElement( 'PaymentTypeID' ) )->appendChild( $xml->createTextNode( $this->get_antifraud_payment_type_id( $order ) ) );
    886                 $af_payment->appendChild( $xml->createElement( 'QtyInstallments' ) )->appendChild( $xml->createTextNode( $this->get_antifraud_payment_qtd_installments( $order ) ) );
    887                 //$af_payment->appendChild($xml->createElement('Interest'))->appendChild($xml->createTextNode(''));
    888                 //$af_payment->appendChild($xml->createElement('InterestValue'))->appendChild($xml->createTextNode(''));
    889                 //$af_payment->appendChild($xml->createElement('CardNumber'))->appendChild($xml->createTextNode(''));
    890                 $af_payment->appendChild( $xml->createElement( 'CardBin' ) )->appendChild( $xml->createTextNode( $this->get_antifraud_payment_card_bin( $order ) ) );
    891                 $af_payment->appendChild( $xml->createElement( 'CardEndNumber' ) )->appendChild( $xml->createTextNode( $this->get_antifraud_payment_card_end( $order ) ) );
    892                 $af_payment->appendChild( $xml->createElement( 'CardType' ) )->appendChild( $xml->createTextNode( $this->get_antifraud_payment_card_type( $order ) ) );
    893                 $af_payment->appendChild( $xml->createElement( 'CardExpirationDate' ) )->appendChild( $xml->createTextNode( $this->get_antifraud_payment_card_expiration( $order ) ) );
    894                 $af_payment->appendChild( $xml->createElement( 'Name' ) )->appendChild( $xml->createTextNode( $this->get_antifraud_payment_card_holder_name( $order ) ) );
    895                 $af_payment->appendChild( $xml->createElement( 'LegalDocument' ) )->appendChild( $xml->createTextNode( $this->get_antifraud_payment_card_legal_document( $order ) ) );
    896 
    897                 $af_payment_address = $af_payment->appendChild( $xml->createElement( 'Address' ) );
    898                 $af_payment_address->appendChild( $xml->createElement( 'Street' ) )->appendChild( $xml->createTextNode( $this->get_antifraud_billing_street( $order ) ) );
    899                 $af_payment_address->appendChild( $xml->createElement( 'Number' ) )->appendChild( $xml->createTextNode( $this->get_antifraud_billing_street_number( $order ) ) );
    900                 $af_payment_address->appendChild( $xml->createElement( 'Comp' ) )->appendChild( $xml->createTextNode( $this->get_antifraud_billing_complement( $order ) ) );
    901                 $af_payment_address->appendChild( $xml->createElement( 'County' ) )->appendChild( $xml->createTextNode( $this->get_antifraud_billing_county( $order ) ) );
    902                 $af_payment_address->appendChild( $xml->createElement( 'City' ) )->appendChild( $xml->createTextNode( $this->get_antifraud_billing_city( $order ) ) );
    903                 $af_payment_address->appendChild( $xml->createElement( 'State' ) )->appendChild( $xml->createTextNode( $this->get_antifraud_billing_state( $order ) ) );
    904                 $af_payment_address->appendChild( $xml->createElement( 'Country' ) )->appendChild( $xml->createTextNode( $this->get_antifraud_billing_country( $order ) ) );
    905                 $af_payment_address->appendChild( $xml->createElement( 'ZipCode' ) )->appendChild( $xml->createTextNode( $this->get_antifraud_billing_zipcode( $order ) ) );
    906                 //$af_payment_address->appendChild($xml->createElement('Reference'))->appendChild($xml->createTextNode(''));
    907 
    908                 //$af_payment->appendChild($xml->createElement('Nsu'))->appendChild($xml->createTextNode(''));
    909                 $af_payment->appendChild( $xml->createElement( 'Currency' ) )->appendChild( $xml->createTextNode( '986' ) );
    910 
    911                 //ITEMS
    912                 $af_items_xml   = $af_order->appendChild( $xml->createElement( 'Items' ) );
    913                 $af_items_order = $order->get_items();
    914 
    915                 foreach ( $af_items_order as $af_item_order ) {
    916                     $af_item_xml = $af_items_xml->appendChild( $xml->createElement( 'Item' ) );
    917 
    918                     $af_item_xml->appendChild( $xml->createElement( 'ID' ) )->appendChild( $xml->createTextNode( $this->get_antifraud_item_id( $af_item_order ) ) );
    919                     $af_item_xml->appendChild( $xml->createElement( 'Name' ) )->appendChild( $xml->createTextNode( $this->get_antifraud_item_name( $af_item_order ) ) );
    920                     $af_item_xml->appendChild( $xml->createElement( 'Qty' ) )->appendChild( $xml->createTextNode( $this->get_antifraud_item_qty( $af_item_order ) ) );
    921                     $af_item_xml->appendChild( $xml->createElement( 'Gift' ) )->appendChild( $xml->createTextNode( $this->get_antifraud_item_gift() ) );
    922                     $af_item_xml->appendChild( $xml->createElement( 'CategoryID' ) )->appendChild( $xml->createTextNode( $this->get_antifraud_item_category_id( $af_item_order ) ) );
    923                     $af_item_xml->appendChild( $xml->createElement( 'CategoryName' ) )->appendChild( $xml->createTextNode( $this->get_antifraud_item_category_name( $af_item_order ) ) );
    924                 }
    925 
    926                 //PURCHASE INFO
    927                 $af_purchase_info = $af_order->appendChild( $xml->createElement( 'PurchaseInformationData' ) );
    928                 //$af_purchase_info->appendChild($xml->createElement('LastDateInsertedMail'))->appendChild($xml->createTextNode(''));
    929                 //$af_purchase_info->appendChild($xml->createElement('LastDateChangePassword'))->appendChild($xml->createTextNode(''));
    930                 //$af_purchase_info->appendChild($xml->createElement('LastDateChangePhone'))->appendChild($xml->createTextNode(''));
    931                 //$af_purchase_info->appendChild($xml->createElement('LastDateChangeMobilePhone'))->appendChild($xml->createTextNode(''));
    932                 //$af_purchase_info->appendChild($xml->createElement('LastDateInsertedAddress'))->appendChild($xml->createTextNode(''));
    933                 $af_purchase_info->appendChild( $xml->createElement( 'PurchaseLogged' ) )->appendChild( $xml->createTextNode( ( is_user_logged_in() ) ? '1' : '0' ) );
    934                 //$af_purchase_info->appendChild($xml->createElement('PurchaseLoggedWithFacebook'))->appendChild($xml->createTextNode(''));
    935 
    936                 $xml->formatOutput = ( $this->debug == 'yes' );
    937 
    938                 $response = $this->antifraud_api_request( 'POST', 'SendOrders', $xml->saveXML() );
    939                 if ( ! $response->result == 'failure' ) {
    940                     $this->antifraud_insert_order_reanalyze( $order );
    941                     $metadata_result = $this->antifraud_insert_order_metadata( $order, $response );
    942                     if ( ! $metadata_result->result == 'failure' ) {
    943                         $result   = $metadata_result;
    944                         $do_retry = false;
    945                     }
    946                 }
    947             } catch ( Exception $e ) {
    948                 $this->logger( 'Antifraud Authorization Card Error', $e->getMessage() );
    949             }
    950         }
    951 
    952         return $result;
    953     }
    954 
    955 
    956     //API REQUEST
    957703
    958704    private function gateway_api_request( $method, $endpoint, $body ) {
    959705        $result = array( 'result' => 'failure', 'messages' => '' );
    960706        try {
    961             $payload = array(
    962                 'method'    => $method,
    963                 'sslverify' => true,
    964                 'timeout'   => 60,
    965                 'headers'   => array(
    966                     'Content-Type'      => 'application/json',
    967                     'authenticationApi' => $this->authentication_api,
    968                     'authenticationKey' => $this->authentication_key
    969                 ),
    970                 'body'      => json_encode( $body )
    971             );
    972 
    973             $url = ( $this->sandbox == 'yes' ) ? $this->gateway_demo_url . '/' . $this->gateway_demo_version : $this->gateway_live_url . '/' . $this->gateway_live_version;
    974             $this->logger( 'API Gateway Request | URL', $url );
    975             $this->logger( 'API Gateway Request | BODY', $body );
    976 
    977             $response = wp_safe_remote_post( $url . $endpoint, $payload );
    978 
    979             if ( ! is_wp_error( $response ) ) {
    980                 $response_json = wp_remote_retrieve_body( $response );
    981                 $decoded_json  = json_decode( $response_json );
    982                 $this->logger( 'API Gateway Response | JSON', $decoded_json );
    983                 if ( ! empty( $decoded_json ) ) {
    984                     $result = $decoded_json;
    985                 } else {
    986                     wc_add_notice( esc_html__( 'The credentials for this virtual store are not valid on the BusinessPay server.', 'woocommerce-businesspay' ), 'error' );
    987                 }
    988             } else {
    989                 wc_add_notice( esc_html__( 'Could not receive a valid server response. Please try again.', 'woocommerce-businesspay' ), 'error' );
    990             }
    991         } catch ( Exception $e ) {
    992             $this->logger( 'Gateway Api Request Error', $e->getMessage() );
    993         }
    994 
    995         return $result;
    996     }
    997 
    998     private function antifraud_api_request( $method, $endpoint, $xml ) {
    999         $result = array( 'result' => 'failure', 'messages' => '' );
    1000         try {
    1001             $entity  = ( $this->debug == 'yes' ) ? $this->antifraud_entity_code_demo : $this->antifraud_entity_code_live;
    1002             $ssl_ver = ( $this->sandbox == 'yes' ) ? 'false' : 'true';
    1003             $payload = array(
    1004                 'method'    => $method,
    1005                 'sslverify' => $ssl_ver,
    1006                 'timeout'   => 60,
    1007                 'headers'   => array(
    1008                     'Content-Type' => 'application/x-www-form-urlencoded',
    1009                 ),
    1010                 'body'      => array(
    1011                     'entityCode' => $entity,
    1012                     'xml'        => $xml
    1013                 )
    1014             );
    1015 
    1016             $url = ( $this->sandbox == 'yes' ) ? $this->antifraud_demo_url . '/integracao' . $this->antifraud_demo_version : $this->antifraud_live_url . $this->antifraud_live_version;
    1017             $this->logger( 'API Antifraud Request | URL', $url );
    1018             $this->logger( 'API Antifraud Request | Payload', $payload );
    1019 
    1020             $response = wp_safe_remote_post( $url . '/service.asmx/' . $endpoint, $payload );
    1021 
    1022             if ( ! is_wp_error( $response ) ) {
    1023                 $response_body = wp_remote_retrieve_body( $response );
    1024                 if ( ! empty( $response_body ) ) {
    1025                     $result = $response_body;
    1026                 } else {
    1027                     wc_add_notice( esc_html__( 'The credentials for this virtual store are not valid on the BusinessPay server. Please try again.', 'woocommerce-businesspay' ), 'error' );
    1028                 }
    1029             } else {
    1030                 wc_add_notice( esc_html__( 'Could not receive a valid server response. Please try again.', 'woocommerce-businesspay' ), 'error' );
    1031             }
    1032         } catch ( Exception $e ) {
    1033             $this->logger( 'Antifraud API Request Error', $e->getMessage() );
    1034         }
    1035 
    1036         return $result;
    1037     }
    1038 
    1039 
    1040     //METADATA
    1041 
    1042     private function gateway_insert_order_metadata( $order, $response ) {
    1043         try {
    1044             if ( ! strlen( $response->error->message ) > 0 ) {
    1045                 $this->gateway_remove_order_metadata( $order );
    1046 
    1047                 $oid = $this->get_order_id( $order );
    1048                 if ( isset( $response->payment->card ) ) {
    1049                     if ( $response->payment->card->type == '1' ) {
    1050                         update_post_meta( $oid, '_businesspay-transaction-type', 'credit-card' );
    1051                     } elseif ( $response->payment->card->type == '2' ) {
    1052                         update_post_meta( $oid, '_businesspay-transaction-type', 'debit-card' );
    1053                     }
    1054                     update_post_meta( $oid, '_businesspay-transaction-id', $response->transactionId );
    1055                     update_post_meta( $oid, '_businesspay-transaction-date', $response->dtTransaction );
    1056                     update_post_meta( $oid, '_businesspay-transaction-status', $response->status );
    1057                     update_post_meta( $oid, '_businesspay-transaction-status-message', $this->gateway_woocommerce_message( $order, $response ) );
    1058                     update_post_meta( $oid, '_businesspay-card-type', $response->payment->card->type );
    1059                     update_post_meta( $oid, '_businesspay-card-brand', $response->payment->card->cardInfo->brand );
    1060                     update_post_meta( $oid, '_businesspay-card-interest-type', $response->payment->card->interestType );
    1061                     update_post_meta( $oid, '_businesspay-card-installments', $response->payment->card->installments );
    1062                     update_post_meta( $oid, '_businesspay-card-capture', $response->payment->card->capture );
    1063                     update_post_meta( $oid, '_businesspay-card-captured-amount', $response->payment->card->capturedAmount );
    1064                     update_post_meta( $oid, '_businesspay-card-pre-authorization', $response->payment->card->preAuthorization );
    1065                     update_post_meta( $oid, '_businesspay-card-authenticate', $response->payment->card->authenticate );
    1066                     update_post_meta( $oid, '_businesspay-card-recurrent', $response->payment->card->recurrent );
    1067                     update_post_meta( $oid, '_businesspay-card-provider', $response->payment->card->provider );
    1068                     update_post_meta( $oid, '_businesspay-card-provider-version', $response->payment->card->providerVersion );
    1069                     update_post_meta( $oid, '_businesspay-card-authentication-eci', $response->payment->card->authenticationECI );
    1070                     update_post_meta( $oid, '_businesspay-card-authorization-code', $response->payment->card->codAuthorization );
    1071                     update_post_meta( $oid, '_businesspay-card-provider-reference', $response->payment->card->providerReference );
    1072                     update_post_meta( $oid, '_businesspay-card-provider-code', $response->payment->card->providerCode );
    1073                     update_post_meta( $oid, '_businesspay-card-provider-message', $response->payment->card->providerMessage );
    1074                     update_post_meta( $oid, '_businesspay-card-cardinfo-number', $response->payment->card->cardInfo->number );
    1075                     update_post_meta( $oid, '_businesspay-card-cardinfo-expiration-month', $response->payment->card->cardInfo->expirationMonth );
    1076                     update_post_meta( $oid, '_businesspay-card-cardinfo-expiration-year', $response->payment->card->cardInfo->expirationYear );
    1077                     update_post_meta( $oid, '_businesspay-customer-name', $response->customer->name );
    1078                     update_post_meta( $oid, '_businesspay-customer-document', $response->customer->document );
    1079                 } elseif ( isset( $response->payment->electronicTransfer ) ) {
    1080                     update_post_meta( $oid, '_businesspay-transaction-type', 'bank-transfer' );
    1081                     update_post_meta( $oid, '_businesspay-transaction-id', $response->transactionId );
    1082                     update_post_meta( $oid, '_businesspay-transaction-date', $response->dtTransaction );
    1083                     update_post_meta( $oid, '_businesspay-transaction-status', $response->status );
    1084                     update_post_meta( $oid, '_businesspay-transaction-status-message', $this->gateway_woocommerce_message( $order, $response ) );
    1085                     update_post_meta( $oid, '_businesspay-customer-name', $response->customer->name );
    1086                     update_post_meta( $oid, '_businesspay-customer-document', $response->customer->document );
    1087                     update_post_meta( $oid, '_businesspay-electronic-transfer-provider', $response->payment->electronicTransfer->provider );
    1088                     update_post_meta( $oid, '_businesspay-electronic-transfer-provider-reference', $response->payment->electronicTransfer->providerReference );
    1089                     update_post_meta( $oid, '_businesspay-electronic-transfer-payment-date', $response->payment->electronicTransfer->paymentDate );
    1090                     update_post_meta( $oid, '_businesspay-electronic-transfer-payment-amount', $response->payment->electronicTransfer->paymentAmount );
    1091                 } elseif ( isset( $response->payment->bankSlip ) ) {
    1092                     update_post_meta( $oid, '_businesspay-transaction-type', 'billet' );
    1093                     update_post_meta( $oid, '_businesspay-transaction-id', $response->transactionId );
    1094                     update_post_meta( $oid, '_businesspay-transaction-date', $response->dtTransaction );
    1095                     update_post_meta( $oid, '_businesspay-transaction-status', $response->status );
    1096                     update_post_meta( $oid, '_businesspay-transaction-status-message', $this->gateway_woocommerce_message( $order, $response ) );
    1097                     update_post_meta( $oid, '_businesspay-customer-name', $response->customer->name );
    1098                     update_post_meta( $oid, '_businesspay-customer-document', $response->customer->document );
    1099                     update_post_meta( $oid, '_businesspay-bankslip-provider-reference', $response->payment->bankSlip->providerReference );
    1100                     update_post_meta( $oid, '_businesspay-bankslip-provider-code', $response->payment->bankSlip->providerCode );
    1101                     update_post_meta( $oid, '_businesspay-bankslip-provider-message', $response->payment->bankSlip->providerMessage );
    1102                     update_post_meta( $oid, '_businesspay-bankslip-emission-date', $response->payment->bankSlip->emissionDate );
    1103                     update_post_meta( $oid, '_businesspay-bankslip-expiration-date', $response->payment->bankSlip->expirationDate );
    1104                     update_post_meta( $oid, '_businesspay-bankslip-instructions', $response->payment->bankSlip->instructions );
    1105                     update_post_meta( $oid, '_businesspay-bankslip-guarantor', $response->payment->bankSlip->guarantor );
    1106                     update_post_meta( $oid, '_businesspay-bankslip-provider', $response->payment->bankSlip->provider );
    1107                     update_post_meta( $oid, '_businesspay-bankslip-payment-date', $response->payment->bankSlip->paymentDate );
    1108                     update_post_meta( $oid, '_businesspay-bankslip-payment-amount', $response->payment->bankSlip->paymentAmount );
    1109                 }
    1110                 $this->set_summary_info( $order );
    1111             }
    1112         } catch ( Exception $e ) {
    1113             $this->logger( 'Gateway Insert Order Metadata Error', $e->getMessage() );
    1114         }
    1115     }
    1116 
    1117     private function gateway_insert_order_status( $order, $response ) {
    1118         $result = array( 'result' => 'failure', 'messages' => '' );
    1119         try {
    1120             $res_status  = $this->gateway_woocommerce_status( $order, $response );
    1121             $res_result  = $this->gateway_woocommerce_result( $response );
    1122             $res_message = $this->gateway_woocommerce_message( $order, $response );
    1123 
    1124             if ( $res_result == 'success' ) {
    1125                 $res_note = esc_html__( 'BusinessPay Status: ', 'woocommerce-businesspay' ) . $res_message;
    1126                 $order->set_transaction_id( $response->transactionId );
    1127                 $order->update_status( $res_status, $res_note );
    1128 
    1129                 if ( isset( $response->payment->electronicTransfer->url ) ) {
    1130                     $return_url = $response->payment->electronicTransfer->url;
    1131                 } elseif ( isset( $response->payment->bankSlip->url ) ) {
    1132                     $return_url = $response->payment->bankSlip->url;
    1133                 } else {
    1134                     $return_url = $this->get_return_url( $order );
    1135                 }
    1136                 $result = array(
    1137                     'result'   => 'success',
    1138                     'redirect' => $return_url
    1139                 );
    1140             } else {
    1141                 $result = array(
    1142                     'result'   => $res_result,
    1143                     'messages' => $res_message
    1144                 );
    1145                 $order->update_status( 'failed', $res_message );
    1146             }
    1147         } catch ( Exception $e ) {
    1148             $this->logger( 'Gateway Insert Order Status Error', $e->getMessage() );
    1149         }
    1150 
    1151         return $result;
    1152     }
    1153 
    1154     private function antifraud_insert_order_metadata( $order, $response ) {
    1155         $af_xml = new DOMDocument();
    1156         $af_xml->loadXML( trim( $response ) );
    1157         $content_text   = (string) $af_xml->textContent;
    1158         $content_text   = mb_convert_encoding( $content_text, 'utf-8', mb_detect_encoding( $content_text ) );
    1159         $content_text_2 = str_replace( 'utf-16', 'utf-8', $content_text );
    1160 
    1161         $af_xml_2 = new DOMDocument();
    1162         $af_xml_2->loadXML( $content_text_2 );
    1163 
    1164         $transaction_id   = $af_xml_2->getElementsByTagName( 'TransactionID' );
    1165         $transaction_date = current_time( 'mysql' );
    1166         $status_code      = $af_xml_2->getElementsByTagName( 'StatusCode' );
    1167         $message          = $af_xml_2->getElementsByTagName( 'Message' );
    1168         $id               = $af_xml_2->getElementsByTagName( 'ID' );
    1169         $status           = $af_xml_2->getElementsByTagName( 'Status' );
    1170 
    1171         $this->logger( 'API Antifraud Response | Transaction ID', $transaction_id[0]->nodeValue );
    1172         $this->logger( 'API Antifraud Response | Transaction Date', $transaction_date );
    1173         $this->logger( 'API Antifraud Response | StatusCode', $status_code[0]->nodeValue );
    1174         $this->logger( 'API Antifraud Response | Message', $message[0]->nodeValue );
    1175         $this->logger( 'API Antifraud Response | ID', $id[0]->nodeValue );
    1176         $this->logger( 'API Antifraud Response | Status', $status[0]->nodeValue );
    1177 
    1178         $oid = $this->get_order_id( $order );
    1179         $this->antifraud_remove_order_metadata( $order );
    1180         update_post_meta( $oid, '_businesspay-antifraud-transaction-id', $transaction_id[0]->nodeValue );
    1181         update_post_meta( $oid, '_businesspay-antifraud-transaction-date', $transaction_date );
    1182         update_post_meta( $oid, '_businesspay-antifraud-status-code', $status_code[0]->nodeValue );
    1183         update_post_meta( $oid, '_businesspay-antifraud-message', $message[0]->nodeValue );
    1184         update_post_meta( $oid, '_businesspay-antifraud-id', $id[0]->nodeValue );
    1185         update_post_meta( $oid, '_businesspay-antifraud-status', $status[0]->nodeValue );
    1186     }
    1187 
    1188     private function gateway_remove_order_metadata( $order ) {
    1189         $oid = $this->get_order_id( $order );
    1190         $tid = get_post_meta( $oid, '_businesspay-transaction-type', true );
    1191         if ( strlen( $tid ) > 0 ) {
    1192             //All fields managed by BusinessPay
    1193             delete_post_meta( $oid, '_businesspay-transaction-type' );
    1194             delete_post_meta( $oid, '_businesspay-transaction-date' );
    1195             delete_post_meta( $oid, '_businesspay-transaction-status' );
    1196             delete_post_meta( $oid, '_businesspay-transaction-status-message' );
    1197             delete_post_meta( $oid, '_businesspay-card-type' );
    1198             delete_post_meta( $oid, '_businesspay-card-brand' );
    1199             delete_post_meta( $oid, '_businesspay-card-interest-type' );
    1200             delete_post_meta( $oid, '_businesspay-card-installments' );
    1201             delete_post_meta( $oid, '_businesspay-card-capture' );
    1202             delete_post_meta( $oid, '_businesspay-card-captured-amount' );
    1203             delete_post_meta( $oid, '_businesspay-card-pre-authorization' );
    1204             delete_post_meta( $oid, '_businesspay-card-authenticate' );
    1205             delete_post_meta( $oid, '_businesspay-card-recurrent' );
    1206             delete_post_meta( $oid, '_businesspay-card-provider' );
    1207             delete_post_meta( $oid, '_businesspay-card-provider-version' );
    1208             delete_post_meta( $oid, '_businesspay-card-authentication-eci' );
    1209             delete_post_meta( $oid, '_businesspay-card-authorization-code' );
    1210             delete_post_meta( $oid, '_businesspay-card-provider-reference' );
    1211             delete_post_meta( $oid, '_businesspay-card-provider-code' );
    1212             delete_post_meta( $oid, '_businesspay-card-provider-message' );
    1213             delete_post_meta( $oid, '_businesspay-card-cardinfo-number' );
    1214             delete_post_meta( $oid, '_businesspay-card-cardinfo-expiration-month' );
    1215             delete_post_meta( $oid, '_businesspay-card-cardinfo-expiration-year' );
    1216             delete_post_meta( $oid, '_businesspay-customer-name' );
    1217             delete_post_meta( $oid, '_businesspay-customer-document' );
    1218             delete_post_meta( $oid, '_businesspay-electronic-transfer-provider' );
    1219             delete_post_meta( $oid, '_businesspay-electronic-transfer-provider-reference' );
    1220             delete_post_meta( $oid, '_businesspay-electronic-transfer-payment-date' );
    1221             delete_post_meta( $oid, '_businesspay-electronic-transfer-payment-amount' );
    1222             delete_post_meta( $oid, '_businesspay-bankslip-provider-reference' );
    1223             delete_post_meta( $oid, '_businesspay-bankslip-provider-code' );
    1224             delete_post_meta( $oid, '_businesspay-bankslip-provider-message' );
    1225             delete_post_meta( $oid, '_businesspay-bankslip-emission-date' );
    1226             delete_post_meta( $oid, '_businesspay-bankslip-expiration-date' );
    1227             delete_post_meta( $oid, '_businesspay-bankslip-instructions' );
    1228             delete_post_meta( $oid, '_businesspay-bankslip-guarantor' );
    1229             delete_post_meta( $oid, '_businesspay-bankslip-provider' );
    1230             delete_post_meta( $oid, '_businesspay-bankslip-payment-date' );
    1231             delete_post_meta( $oid, '_businesspay-bankslip-payment-amount' );
    1232         }
    1233     }
    1234 
    1235     private function antifraud_remove_order_metadata( $order ) {
    1236         $oid = $this->get_order_id( $order );
    1237         delete_post_meta( $oid, '_businesspay-antifraud-transaction-id' );
    1238         delete_post_meta( $oid, '_businesspay-antifraud-transaction-date' );
    1239         delete_post_meta( $oid, '_businesspay-antifraud-status-code' );
    1240         delete_post_meta( $oid, '_businesspay-antifraud-message' );
    1241         delete_post_meta( $oid, '_businesspay-antifraud-id' );
    1242         delete_post_meta( $oid, '_businesspay-antifraud-status' );
    1243     }
    1244 
    1245     private function antifraud_insert_order_reanalyze( $order ) {
    1246         update_post_meta( $this->get_order_id( $order ), '_businesspay-antifraud-reanalyze', '1' );
    1247     }
    1248 
    1249 
    1250     //STATUS
    1251 
    1252     private function gateway_woocommerce_status( $order, $response ) {
    1253         try {
    1254             switch ( $response->status ) {
    1255                 case 0: //TRANSACAO INICIADA
    1256                     $result = 'on-hold';
    1257                     break;
    1258                 case 1: //AGUARDANDO PAGAMENTO
    1259                     $result = 'pending';
    1260                     break;
    1261                 case 2: //EFETIVADA
    1262                     $result = 'on-hold';
    1263                     break;
    1264                 case 3: //EM ANALISE
    1265                     $result = 'on-hold';
    1266                     break;
    1267                 case 4: //EXPIRADA
    1268                     $result = 'failed';
    1269                     break;
    1270                 case 5: //AUTORIZADA
    1271                     $result = 'on-hold';
    1272                     break;
    1273                 case 6: //CONFIRMADA
    1274                     $result = 'processing';
    1275                     break;
    1276                 case 7: //NEGADA
    1277                     $result = 'failed';
    1278                     break;
    1279                 case 8: //CANCELAMENTO EM ANDAMENTO
    1280                     $result = 'failed';
    1281                     break;
    1282                 case 9: //CANCELADA
    1283                     $result = 'cancelled';
    1284                     break;
    1285                 case 10: //PENDENTE DE CONFIRMAÇÃO
    1286                     $result = 'on-hold';
    1287                     break;
    1288                 case 11: //FALHA NA COMUNICAÇÃO COM FORNECEDOR
    1289                     $result = 'failed';
    1290                     break;
    1291                 default:
    1292                     $result = 'failed';
    1293                     break;
    1294             }
    1295 
    1296             //Verify billet & transfer payment amount
    1297             if ( $result == 'processing' ) {
    1298                 //Using card with antifraud
    1299                 if ( isset( $response->payment->card ) && $this->enable_antifraud ) {
    1300                     $result = 'on-hold';
    1301                 } else {
    1302                     $bp_paid_total = $this->get_gateway_payment_amount( $response );
    1303                     if ( ! empty( $bp_paid_total ) ) {
    1304                         $bp_order_total = str_replace( array( ',', '.' ), '', $this->get_total_order( $order ) );
    1305                         $bp_balance     = $bp_order_total - $bp_paid_total;
    1306                         if ( $bp_balance > 0 ) {
    1307                             $result = 'on-hold';
    1308                         }
    1309                     }
    1310                 }
    1311             }
    1312         } catch ( Exception $e ) {
    1313             $this->logger( 'Gateway Woocommerce Status Error', $e->getMessage() );
    1314         }
    1315         $this->logger( 'WooCommerce Status | STATUS', $result );
    1316 
    1317         return $result;
    1318     }
    1319 
    1320     private function gateway_woocommerce_result( $response ) {
    1321         $result = 'failure';
    1322         try {
    1323             switch ( $response->status ) {
    1324                 case 0: //TRANSACAO INICIADA
    1325                     $result = 'success';
    1326                     break;
    1327                 case 1: //AGUARDANDO PAGAMENTO
    1328                     $result = 'success';
    1329                     break;
    1330                 case 2: //EFETIVADA
    1331                     $result = 'success';
    1332                     break;
    1333                 case 3: //EM ANALISE
    1334                     $result = 'success';
    1335                     break;
    1336                 case 4: //EXPIRADA
    1337                     $result = 'failure';
    1338                     break;
    1339                 case 5: //AUTORIZADA
    1340                     $result = 'success';
    1341                     break;
    1342                 case 6: //CONFIRMADA
    1343                     $result = 'success';
    1344                     break;
    1345                 case 7: //NEGADA
    1346                     $result = 'failure';
    1347                     break;
    1348                 case 8: //CANCELAMENTO EM ANDAMENTO
    1349                     $result = 'failure';
    1350                     break;
    1351                 case 9: //CANCELADA
    1352                     $result = 'failure';
    1353                     break;
    1354                 case 10: //PENDENTE DE CONFIRMAÇÃO
    1355                     $result = 'success';
    1356                     break;
    1357                 case 11: //FALHA NA COMUNICAÇÃO COM FORNECEDOR
    1358                     $result = 'failure';
    1359                     break;
    1360                 default:
    1361                     $result = 'failure';
    1362                     break;
    1363             }
    1364         } catch ( Exception $e ) {
    1365             $this->logger( 'Gateway Woocommerce Result Error', $e->getMessage() );
    1366         }
    1367         $this->logger( 'WooCommerce Status | RESULT', $result );
    1368 
    1369         return $result;
    1370     }
    1371 
    1372     private function gateway_woocommerce_message( $order, $response ) {
    1373         $result = 'failure';
    1374         try {
    1375             switch ( $response->status ) {
    1376                 case 0: //TRANSACAO INICIADA
    1377                     $result = esc_html__( 'Transaction started but not confirmed.', 'woocommerce-businesspay' );
    1378                     break;
    1379                 case 1: //AGUARDANDO PAGAMENTO
    1380                     $result = esc_html__( 'Awating payment.', 'woocommerce-businesspay' );
    1381                     break;
    1382                 case 2: //EFETIVADA
    1383                     $result = esc_html__( 'Transaction effectivated.', 'woocommerce-businesspay' );
    1384                     break;
    1385                 case 3: //EM ANALISE
    1386                     $result = esc_html__( 'Transaction under analysis.', 'woocommerce-businesspay' );
    1387                     break;
    1388                 case 4: //EXPIRADA
    1389                     $result = esc_html__( 'Transaction expired.', 'woocommerce-businesspay' );
    1390                     break;
    1391                 case 5: //AUTORIZADA
    1392                     $result = esc_html__( 'Transaction authorized.', 'woocommerce-businesspay' );
    1393                     break;
    1394                 case 6: //CONFIRMADA
    1395                     $result = esc_html__( 'Transaction confirmed.', 'woocommerce-businesspay' );
    1396                     break;
    1397                 case 7: //NEGADA
    1398                     $result = esc_html__( 'Transaction denied.', 'woocommerce-businesspay' );
    1399                     break;
    1400                 case 8: //CANCELAMENTO EM ANDAMENTO
    1401                     $result = esc_html__( 'Cancellation in progress.', 'woocommerce-businesspay' );
    1402                     break;
    1403                 case 9: //CANCELADA
    1404                     $result = esc_html__( 'Transaction Canceled.', 'woocommerce-businesspay' );
    1405                     break;
    1406                 case 10: //PENDENTE DE CONFIRMAÇÃO
    1407                     $result = esc_html__( 'Transaction pending of confirmation.', 'woocommerce-businesspay' );
    1408                     break;
    1409                 case 11: //FALHA NA COMUNICAÇÃO COM FORNECEDOR
    1410                     $result = esc_html__( 'Failure to communicate with the provider.', 'woocommerce-businesspay' );
    1411                     break;
    1412                 default:
    1413                     $result = esc_html__( 'No valid server response.', 'woocommerce-businesspay' );
    1414                     break;
    1415             }
    1416 
    1417             //Verify billet & transfer payment amount
    1418             if ( $result == 'processing' ) {
    1419                 //Using card with antifraud
    1420                 if ( isset( $response->payment->card ) && $this->enable_antifraud ) {
    1421                     $result = esc_html__( 'The order will be analyzed by antifraud software', 'woocommerce-businesspay' );
    1422                 } else {
    1423                     $bp_paid_total = $this->get_gateway_payment_amount( $response );
    1424                     if ( ! empty( $bp_paid_total ) ) {
    1425                         $bp_order_total = str_replace( array( ',', '.' ), '', $this->get_total_order( $order ) );
    1426                         $bp_balance     = $bp_order_total - $bp_paid_total;
    1427                         if ( $bp_balance > 0 ) {
    1428                             $result = esc_html__( 'payment made less than the value of the order.', 'woocommerce-businesspay' );
    1429                         }
    1430                     }
    1431                 }
    1432             }
    1433         } catch ( Exception $e ) {
    1434             $this->logger( 'Gateway Woocommerce Message Error', $e->getMessage() );
    1435         }
    1436         $this->logger( 'WooCommerce Status | MESSAGE', $result );
    1437 
    1438         return $result;
    1439     }
    1440 
    1441 
    1442     //CALLBACK
    1443 
    1444     public function gateway_callback() {
    1445         $callback = file_get_contents( "php://input" );
    1446         $json     = json_decode( $callback );
    1447         $this->logger( 'API Notification | Body', $json );
    1448 
    1449         if ( isset( $json->referenceId ) ) { //Gateway
    1450             $this->gateway_api_consult_status( $json->referenceId, $json->transactionId );
    1451             //} elseif ( isset( $json->code ) ) { //Antifraud
    1452         } else {
    1453             $this->antifraud_api_consult_status( $json );
    1454         }
    1455     }
    1456 
    1457     private function gateway_api_consult_status( $order_id, $transactionId ) {
    1458         $result = false;
    1459         try {
    1460             $order = wc_get_order( $order_id );
    1461             if ( ! is_wp_error( $order ) ) {
    1462                 $body     = array( 'transactionId' => $transactionId );
    1463                 $response = $this->gateway_api_request( 'GET', '/transactions/' . $transactionId, $body );
    1464                 if ( ! isset( $response->result ) ) {
    1465                     $this->gateway_insert_order_metadata( $order, $response );
    1466                     $result = $this->gateway_insert_order_status( $order, $response );
    1467                 }
    1468             }
    1469         } catch ( Exception $e ) {
    1470             $this->logger( 'Gateway API Consult Status Error', $e->getMessage() );
    1471         }
    1472 
    1473         return $result;
    1474     }
    1475 
    1476     private function antifraud_api_consult_status( $json ) {
    1477         $this->logger( 'ANTIFRAUD CALLBACK', $json );
    1478 
    1479         return '';
    1480     }
    1481 
    1482 
    1483     //ADMIN
    1484 
    1485     public function businesspay_admin_panel_gateway() {
    1486         wc_get_template( 'businesspay-panel-gateway.php', array( 'bpConfig' => $this ), 'woocommerce/businesspay/', WC_BusinessPay::get_templates_path() );
    1487     }
    1488 
    1489     public function businesspay_admin_panel_antifraud() {
    1490         wc_get_template( 'businesspay-panel-antifraud.php', array( 'bpConfig' => $this ), 'woocommerce/businesspay/', WC_BusinessPay::get_templates_path() );
    1491     }
    1492 
    1493 
    1494     //GETTERS
    1495 
    1496     private function get_admin_url() {
    1497         if ( version_compare( WC_BusinessPay::get_woo_version(), '2.1', '>=' ) ) {
    1498             return admin_url( 'admin.php?page=wc-settings&tab=checkout&section=businesspay_gateway' );
    1499         }
    1500 
    1501         return admin_url( 'admin.php?page=woocommerce_settings&tab=payment_gateways&section=WC_BusinessPay_Gateway' );
    1502     }
    1503 
    1504     private function get_blog_domain() {
    1505         return str_replace( array( 'http://', 'https://', 'www.' ), '', get_option( 'siteurl' ) );
    1506     }
    1507 
    1508     private function get_blog_name() {
    1509         return get_bloginfo( 'name' );
    1510     }
    1511 
    1512     public function get_cart_total() {
    1513         if ( version_compare( WC_BusinessPay::get_woo_version(), '3.2.0', '>=' ) ) {
    1514             $cart_total = WC()->cart->get_cart_contents_total();
    1515         } else {
    1516             global $woocommerce;
    1517             $cart_total = $woocommerce->cart->total;
    1518         }
    1519 
    1520         return $cart_total;
    1521     }
    1522 
    1523     public function get_order_id( $order ) {
    1524         return $order->get_id();
    1525     }
    1526 
    1527     public function get_total_order( $order ) {
    1528         return $order->get_total();
    1529     }
    1530 
    1531     public function get_currency_symbol() {
    1532         return get_woocommerce_currency_symbol();
    1533     }
    1534 
    1535     private function get_postback_url() {
    1536         if ( version_compare( WC()->version, '2.1', '>=' ) ) {
    1537             $site_url = home_url( '/wc-api/WC_BusinessPay_Gateway/' );
    1538         } else {
    1539             $site_url = home_url( '/?wc-api=WC_BusinessPay_Gateway' );
    1540         }
    1541 
    1542         return $site_url;
    1543     }
    1544 
    1545     private function get_brand_name( $brand ) {
    1546         $result = '';
    1547         $brand  = strtolower( str_replace( array( ' ' ), '', $brand ) );
    1548         switch ( $brand ) {
    1549             case 'visa':
    1550                 $result = 'Visa';
    1551                 break;
    1552             case 'mastercard':
    1553                 $result = 'Mastercard';
    1554                 break;
    1555             case 'amex':
    1556                 $result = 'American Express';
    1557                 break;
    1558             case 'elo':
    1559                 $result = 'Elo';
    1560                 break;
    1561             case 'hipercard':
    1562                 $result = 'Hipercard';
    1563                 break;
    1564             case 'hiper':
    1565                 $result = 'Hiper';
    1566                 break;
    1567             case 'aura':
    1568                 $result = 'Aura';
    1569                 break;
    1570             case 'discover':
    1571                 $result = 'Discover';
    1572                 break;
    1573             case 'jcb':
    1574                 $result = 'JCB';
    1575                 break;
    1576         }
    1577 
    1578         return $result;
    1579     }
    1580 
    1581     public function get_date_format() {
    1582         return 'Y-m-d H:i:s';
    1583     }
    1584 
    1585     private function get_date_interval( $date_start, $interval, $measure ) {
    1586         $result = $date_start;
    1587         try {
    1588             if ( empty( $interval ) ) {
    1589                 $interval = $this->default_session_interval;
    1590             }
    1591 
    1592             switch ( $measure ) {
    1593                 case 'days' :
    1594                     $interval_spec = 'P' . $interval . 'D';
    1595                     break;
    1596                 case 'hours':
    1597                     $interval_spec = 'PT' . $interval . 'H';
    1598                     break;
    1599                 default     :
    1600                     $interval_spec = 'PT' . $interval . 'H';
    1601                     break;
    1602             }
    1603 
    1604             $date_interval = new DateTime( 'now', new DateTimeZone( get_option( 'timezone_string' ) ) );
    1605             $date_interval->add( new DateInterval( $interval_spec ) );
    1606             $result = $date_interval->format( $this->get_date_format() );
    1607         } catch ( Exception $e ) {
    1608             $this->logger( 'Get Date Interval Error', $e->getMessage() );
    1609         }
    1610 
    1611         return $result;
    1612     }
    1613 
    1614     private function get_billet_expiration( $interval ) {
    1615         if ( empty( $interval ) ) {
    1616             $interval = $this->default_billet_expiration_days;
    1617         }
    1618         try {
    1619             $expiration    = new DateTime();
    1620             $interval_spec = 'P' . $interval . 'D';
    1621             $expiration->add( new DateInterval( $interval_spec ) );
    1622             $result = $expiration;
    1623         } catch ( Exception $e ) {
    1624             $result = false;
    1625             $this->logger( 'Get Billet Expiration Error', $e->getMessage() );
    1626         }
    1627 
    1628         return $result;
    1629     }
    1630 
    1631     private function get_session() {
    1632         $today     = current_time( 'mysql' );
    1633         $auth_last = get_option( 'businesspay_auth_last' );
    1634         $auth_next = get_option( 'businesspay_auth_next' );
    1635         $this->logger( 'Session Info | $today', $today );
    1636         $this->logger( 'Session Info | $auth_last', $auth_last );
    1637         $this->logger( 'Session Info | $auth_next', $auth_next );
    1638 
    1639         $session = ( $auth_last == '' ) || ( $auth_next == '' ) || ( strtotime( $auth_next ) < strtotime( $today ) );
    1640 
    1641         if ( $session ) {
    1642             $this->get_session_info();
    1643         }
    1644 
    1645         $client  = get_option( 'businesspay_enable_client' );
    1646         $install = get_option( 'businesspay_enable_install' );
    1647 
    1648         return ( $client && $install );
    1649     }
    1650 
    1651     private function get_session_info() {
    1652         try {
    1653             if ( ! empty( $this->authentication_api ) && ! empty( $this->authentication_key ) ) {
    1654                 $action = $this->auth_schema . '://' . $this->auth_gateway . '.' . $this->authority . '.com.br';
    1655                 $action .= '/' . $this->auth_api . '/' . $this->auth_scope . '/' . $this->auth_version . '/' . $this->auth_validate;
    1656 
    1657                 $body = array(
    1658                     'vendor_id'      => $this->auth_vendor_id,
    1659                     'name'           => substr( get_bloginfo( 'name' ), 0, 50 ),
    1660                     'domain'         => str_replace( array(
    1661                         'http://',
    1662                         'https://',
    1663                         'www.'
    1664                     ), '', get_option( 'siteurl' ) ),
    1665                     'mode_api'       => ( $this->sandbox == 'yes' ) ? 'demo' : 'live',
    1666                     'postback_url'   => $this->get_postback_url(),
    1667                     'version_api'    => ( $this->sandbox == 'yes' ) ? str_replace( 'v', '', $this->gateway_demo_version ) : str_replace( 'v', '', $this->gateway_live_version ),
    1668                     'version_wp'     => get_bloginfo( 'version' ),
    1669                     'version_plugin' => WC_BusinessPay::VERSION,
    1670                     'version_php'    => WC_BusinessPay::get_php_version(),
    1671                     'version_woo'    => WC_BusinessPay::get_woo_version()
    1672                 );
    1673 
     707            if ( ! empty( $body ) ) {
    1674708                $payload = array(
    1675                     'method'    => 'POST',
     709                    'method'    => $method,
    1676710                    'sslverify' => true,
    1677711                    'timeout'   => 60,
     
    1684718                );
    1685719
    1686                 $this->logger( 'Session Info | Request', $payload );
    1687 
    1688                 $response = wp_safe_remote_post( $action, $payload );
    1689 
    1690                 $this->logger( 'Session Info | Response', $response );
     720                $url = ( $this->sandbox == 'yes' ) ? $this->gateway_demo_url . '/' . $this->gateway_demo_version : $this->gateway_live_url . '/' . $this->gateway_live_version;
     721                $this->logger( 'API Gateway Request | URL', $url );
     722                $this->logger( 'API Gateway Request | BODY', $body );
     723
     724                $response = wp_safe_remote_post( $url . $endpoint, $payload );
    1691725
    1692726                if ( ! is_wp_error( $response ) ) {
    1693                     $response_body = wp_remote_retrieve_body( $response );
    1694                     $response_body = $this->clear_response( $response_body );
    1695 
    1696                     if ( ! empty( $response_body ) ) {
    1697                         $response = json_decode( $response_body );
    1698 
    1699                         $today = current_time( 'mysql' );
    1700                         $next  = $this->get_date_interval( $today, $response->auth_interval, 'hours' );
    1701 
    1702                         if ( ! empty( $today ) ) {
    1703                             $this->set_option_auth_last($today);
    1704                         }
    1705 
    1706                         if ( ! empty( $next ) ) {
    1707                             $this->set_option_auth_next($next);
    1708                         }
    1709 
    1710                         if ( ! empty( $response->auth_interval ) ) {
    1711                             $this->set_option_auth_id( $response->id );
    1712                             $this->set_option_auth_interval( $response->auth_interval );
    1713                             $this->set_option_enable_client( $response->client_enabled );
    1714                             $this->set_option_enable_install( $response->install_enabled );
    1715                             $this->set_option_enable_antifraud( $response->antifraud_enabled );
    1716                         }
    1717 
    1718                         if ( ! empty( $response->antifraud_entity_code_demo ) ) {
    1719                             $this->set_option_antifraud_entity_code_demo( $response->antifraud_entity_code_demo );
    1720                             $this->set_option_antifraud_entity_code_live( $response->antifraud_entity_code_live );
    1721                             $this->set_option_antifraud_app_id_demo( $response->antifraud_app_id_demo );
    1722                             $this->set_option_antifraud_app_id_live( $response->antifraud_app_id_live );
     727                    $response_json = json_decode( wp_remote_retrieve_body( $response ) );
     728                    $this->logger( 'API Gateway Response | JSON', $response_json );
     729                    if ( ! empty( $response_json ) ) {
     730                        $result = $response_json;
     731                    } else {
     732                        wc_add_notice( esc_html__( 'The credentials for this virtual store are not valid on the BusinessPay server.', 'woocommerce-businesspay' ), 'error' );
     733                    }
     734                } else {
     735                    wc_add_notice( esc_html__( 'Could not receive a valid server response. Please try again.', 'woocommerce-businesspay' ), 'error' );
     736                }
     737            }
     738        } catch ( Exception $e ) {
     739            $this->logger( 'Gateway Api Request Error', $e->getMessage() );
     740        }
     741
     742        return $result;
     743    }
     744
     745    private function gateway_insert_order_metadata( $order, $response ) {
     746        try {
     747            if ( ! strlen( $response->error->message ) > 0 ) {
     748                $order_id = $this->get_order_id( $order );
     749                $this->gateway_remove_order_metadata( $order_id );
     750
     751                if ( isset( $response->payment->card ) ) {
     752                    if ( $response->payment->card->type == '1' ) {
     753                        update_post_meta( $order_id, '_businesspay-transaction-type', 'credit-card' );
     754                    } elseif ( $response->payment->card->type == '2' ) {
     755                        update_post_meta( $order_id, '_businesspay-transaction-type', 'debit-card' );
     756                    }
     757                    update_post_meta( $order_id, '_businesspay-transaction-id', $response->transactionId );
     758                    update_post_meta( $order_id, '_businesspay-transaction-date', $response->dtTransaction );
     759                    update_post_meta( $order_id, '_businesspay-transaction-status', $response->status );
     760                    update_post_meta( $order_id, '_businesspay-transaction-status-message', $this->gateway_woocommerce_message( $order, $response ) );
     761                    update_post_meta( $order_id, '_businesspay-card-type', $response->payment->card->type );
     762                    update_post_meta( $order_id, '_businesspay-card-brand', $response->payment->card->cardInfo->brand );
     763                    update_post_meta( $order_id, '_businesspay-card-interest-type', $response->payment->card->interestType );
     764                    update_post_meta( $order_id, '_businesspay-card-installments', $response->payment->card->installments );
     765                    update_post_meta( $order_id, '_businesspay-card-capture', $response->payment->card->capture );
     766                    update_post_meta( $order_id, '_businesspay-card-captured-amount', $response->payment->card->capturedAmount );
     767                    update_post_meta( $order_id, '_businesspay-card-pre-authorization', $response->payment->card->preAuthorization );
     768                    update_post_meta( $order_id, '_businesspay-card-authenticate', $response->payment->card->authenticate );
     769                    update_post_meta( $order_id, '_businesspay-card-recurrent', $response->payment->card->recurrent );
     770                    update_post_meta( $order_id, '_businesspay-card-provider', $response->payment->card->provider );
     771                    update_post_meta( $order_id, '_businesspay-card-provider-version', $response->payment->card->providerVersion );
     772                    update_post_meta( $order_id, '_businesspay-card-authentication-eci', $response->payment->card->authenticationECI );
     773                    update_post_meta( $order_id, '_businesspay-card-authorization-code', $response->payment->card->codAuthorization );
     774                    update_post_meta( $order_id, '_businesspay-card-provider-reference', $response->payment->card->providerReference );
     775                    update_post_meta( $order_id, '_businesspay-card-provider-code', $response->payment->card->providerCode );
     776                    update_post_meta( $order_id, '_businesspay-card-provider-message', $response->payment->card->providerMessage );
     777                    update_post_meta( $order_id, '_businesspay-card-cardinfo-number', $response->payment->card->cardInfo->number );
     778                    update_post_meta( $order_id, '_businesspay-card-cardinfo-expiration-month', $response->payment->card->cardInfo->expirationMonth );
     779                    update_post_meta( $order_id, '_businesspay-card-cardinfo-expiration-year', $response->payment->card->cardInfo->expirationYear );
     780                    update_post_meta( $order_id, '_businesspay-customer-name', $response->customer->name );
     781                    update_post_meta( $order_id, '_businesspay-customer-document', $response->customer->document );
     782                } elseif ( isset( $response->payment->electronicTransfer ) ) {
     783                    update_post_meta( $order_id, '_businesspay-transaction-type', 'bank-transfer' );
     784                    update_post_meta( $order_id, '_businesspay-transaction-id', $response->transactionId );
     785                    update_post_meta( $order_id, '_businesspay-transaction-date', $response->dtTransaction );
     786                    update_post_meta( $order_id, '_businesspay-transaction-status', $response->status );
     787                    update_post_meta( $order_id, '_businesspay-transaction-status-message', $this->gateway_woocommerce_message( $order, $response ) );
     788                    update_post_meta( $order_id, '_businesspay-customer-name', $response->customer->name );
     789                    update_post_meta( $order_id, '_businesspay-customer-document', $response->customer->document );
     790                    update_post_meta( $order_id, '_businesspay-electronic-transfer-provider', $response->payment->electronicTransfer->provider );
     791                    update_post_meta( $order_id, '_businesspay-electronic-transfer-provider-reference', $response->payment->electronicTransfer->providerReference );
     792                    update_post_meta( $order_id, '_businesspay-electronic-transfer-payment-date', $response->payment->electronicTransfer->paymentDate );
     793                    update_post_meta( $order_id, '_businesspay-electronic-transfer-payment-amount', $response->payment->electronicTransfer->paymentAmount );
     794                } elseif ( isset( $response->payment->bankSlip ) ) {
     795                    update_post_meta( $order_id, '_businesspay-transaction-type', 'billet' );
     796                    update_post_meta( $order_id, '_businesspay-transaction-id', $response->transactionId );
     797                    update_post_meta( $order_id, '_businesspay-transaction-date', $response->dtTransaction );
     798                    update_post_meta( $order_id, '_businesspay-transaction-status', $response->status );
     799                    update_post_meta( $order_id, '_businesspay-transaction-status-message', $this->gateway_woocommerce_message( $order, $response ) );
     800                    update_post_meta( $order_id, '_businesspay-customer-name', $response->customer->name );
     801                    update_post_meta( $order_id, '_businesspay-customer-document', $response->customer->document );
     802                    update_post_meta( $order_id, '_businesspay-bankslip-provider-reference', $response->payment->bankSlip->providerReference );
     803                    update_post_meta( $order_id, '_businesspay-bankslip-provider-code', $response->payment->bankSlip->providerCode );
     804                    update_post_meta( $order_id, '_businesspay-bankslip-provider-message', $response->payment->bankSlip->providerMessage );
     805                    update_post_meta( $order_id, '_businesspay-bankslip-emission-date', $response->payment->bankSlip->emissionDate );
     806                    update_post_meta( $order_id, '_businesspay-bankslip-expiration-date', $response->payment->bankSlip->expirationDate );
     807                    update_post_meta( $order_id, '_businesspay-bankslip-instructions', $response->payment->bankSlip->instructions );
     808                    update_post_meta( $order_id, '_businesspay-bankslip-guarantor', $response->payment->bankSlip->guarantor );
     809                    update_post_meta( $order_id, '_businesspay-bankslip-provider', $response->payment->bankSlip->provider );
     810                    update_post_meta( $order_id, '_businesspay-bankslip-payment-date', $response->payment->bankSlip->paymentDate );
     811                    update_post_meta( $order_id, '_businesspay-bankslip-payment-amount', $response->payment->bankSlip->paymentAmount );
     812                }
     813                $this->set_summary_info( $order );
     814            }
     815        } catch ( Exception $e ) {
     816            $this->logger( 'Gateway Insert Order Metadata Error', $e->getMessage() );
     817        }
     818    }
     819
     820    private function gateway_insert_order_status( $order, $response ) {
     821        $result = array( 'result' => 'failure', 'messages' => '' );
     822        try {
     823            $res_status  = $this->gateway_woocommerce_status( $order, $response );
     824            $res_result  = $this->gateway_woocommerce_result( $response );
     825            $res_message = $this->gateway_woocommerce_message( $order, $response );
     826
     827            if ( $res_result == 'success' ) {
     828                $res_note = esc_html__( 'BusinessPay Status: ', 'woocommerce-businesspay' ) . $res_message;
     829                $order->set_transaction_id( $response->transactionId );
     830                $this->update_order_status( $order, $res_status, $res_note );
     831
     832                $result = array(
     833                    'result'   => 'success',
     834                    'redirect' => $this->get_response_url( $order, $response ),
     835                );
     836            } else {
     837                $result = array(
     838                    'result'   => $res_result,
     839                    'messages' => $res_message
     840                );
     841                $this->update_order_status( $order, 'failed', $res_message );
     842            }
     843        } catch ( Exception $e ) {
     844            $this->logger( 'Gateway Insert Order Status Error', $e->getMessage() );
     845        }
     846
     847        return $result;
     848    }
     849
     850    private function gateway_remove_order_metadata( $order_id ) {
     851        $tid = get_post_meta( $order_id, '_businesspay-transaction-type', true );
     852        if ( strlen( $tid ) > 0 ) {
     853            delete_post_meta( $order_id, '_businesspay-transaction-type' );
     854            delete_post_meta( $order_id, '_businesspay-transaction-date' );
     855            delete_post_meta( $order_id, '_businesspay-transaction-status' );
     856            delete_post_meta( $order_id, '_businesspay-transaction-status-message' );
     857            delete_post_meta( $order_id, '_businesspay-card-type' );
     858            delete_post_meta( $order_id, '_businesspay-card-brand' );
     859            delete_post_meta( $order_id, '_businesspay-card-interest-type' );
     860            delete_post_meta( $order_id, '_businesspay-card-installments' );
     861            delete_post_meta( $order_id, '_businesspay-card-capture' );
     862            delete_post_meta( $order_id, '_businesspay-card-captured-amount' );
     863            delete_post_meta( $order_id, '_businesspay-card-pre-authorization' );
     864            delete_post_meta( $order_id, '_businesspay-card-authenticate' );
     865            delete_post_meta( $order_id, '_businesspay-card-recurrent' );
     866            delete_post_meta( $order_id, '_businesspay-card-provider' );
     867            delete_post_meta( $order_id, '_businesspay-card-provider-version' );
     868            delete_post_meta( $order_id, '_businesspay-card-authentication-eci' );
     869            delete_post_meta( $order_id, '_businesspay-card-authorization-code' );
     870            delete_post_meta( $order_id, '_businesspay-card-provider-reference' );
     871            delete_post_meta( $order_id, '_businesspay-card-provider-code' );
     872            delete_post_meta( $order_id, '_businesspay-card-provider-message' );
     873            delete_post_meta( $order_id, '_businesspay-card-cardinfo-number' );
     874            delete_post_meta( $order_id, '_businesspay-card-cardinfo-expiration-month' );
     875            delete_post_meta( $order_id, '_businesspay-card-cardinfo-expiration-year' );
     876            delete_post_meta( $order_id, '_businesspay-customer-name' );
     877            delete_post_meta( $order_id, '_businesspay-customer-document' );
     878            delete_post_meta( $order_id, '_businesspay-electronic-transfer-provider' );
     879            delete_post_meta( $order_id, '_businesspay-electronic-transfer-provider-reference' );
     880            delete_post_meta( $order_id, '_businesspay-electronic-transfer-payment-date' );
     881            delete_post_meta( $order_id, '_businesspay-electronic-transfer-payment-amount' );
     882            delete_post_meta( $order_id, '_businesspay-bankslip-provider-reference' );
     883            delete_post_meta( $order_id, '_businesspay-bankslip-provider-code' );
     884            delete_post_meta( $order_id, '_businesspay-bankslip-provider-message' );
     885            delete_post_meta( $order_id, '_businesspay-bankslip-emission-date' );
     886            delete_post_meta( $order_id, '_businesspay-bankslip-expiration-date' );
     887            delete_post_meta( $order_id, '_businesspay-bankslip-instructions' );
     888            delete_post_meta( $order_id, '_businesspay-bankslip-guarantor' );
     889            delete_post_meta( $order_id, '_businesspay-bankslip-provider' );
     890            delete_post_meta( $order_id, '_businesspay-bankslip-payment-date' );
     891            delete_post_meta( $order_id, '_businesspay-bankslip-payment-amount' );
     892        }
     893    }
     894
     895    //GATEWAY STATUS
     896
     897    private function gateway_woocommerce_status( $order, $response ) {
     898        try {
     899            switch ( $response->status ) {
     900                case 0: //TRANSACAO INICIADA
     901                    $result = 'on-hold';
     902                    break;
     903                case 1: //AGUARDANDO PAGAMENTO
     904                    $result = 'on-hold';
     905                    break;
     906                case 2: //EFETIVADA
     907                    $result = 'failed';
     908                    break;
     909                case 3: //EM ANALISE
     910                    $result = 'on-hold';
     911                    break;
     912                case 4: //EXPIRADA
     913                    $result = 'cancelled';
     914                    break;
     915                case 5: //AUTORIZADA
     916                    $result = 'on-hold';
     917                    break;
     918                case 6: //CONFIRMADA
     919                    $result = 'processing';
     920                    break;
     921                case 7: //NEGADA
     922                    $result = 'failed';
     923                    break;
     924                case 8: //CANCELAMENTO EM ANDAMENTO
     925                    $result = 'on-hold';
     926                    break;
     927                case 9: //CANCELADA
     928                    $result = 'cancelled';
     929                    break;
     930                case 10: //PENDENTE DE CONFIRMAÇÃO
     931                    $result = 'on-hold';
     932                    break;
     933                case 11: //FALHA NA COMUNICAÇÃO COM FORNECEDOR
     934                    $result = 'failed';
     935                    break;
     936                default:
     937                    $result = 'failed';
     938                    break;
     939            }
     940
     941            //Verify billet & transfer payment amount
     942            if ( $result == 'processing' ) {
     943                $paid_wrong = false;
     944                $paid_total = $this->get_gateway_payment_amount( $response );
     945                if ( ! empty( $paid_total ) ) {
     946                    $order_total = str_replace( array( ',', '.' ), '', $this->get_total_order( $order ) );
     947                    $balance     = $order_total - $paid_total;
     948                    if ( $balance > 0 ) {
     949                        $paid_wrong = true;
     950                    }
     951                } else {
     952                    $paid_wrong = true;
     953                }
     954
     955                if ( $paid_wrong ) {
     956                    $result = 'on-hold';
     957                }
     958            }
     959        } catch ( Exception $e ) {
     960            $this->logger( 'Gateway Woocommerce Status Error', $e->getMessage() );
     961        }
     962
     963        return $result;
     964    }
     965
     966    private function gateway_woocommerce_result( $response ) {
     967        $result = 'failure';
     968        try {
     969            switch ( $response->status ) {
     970                case 0: //TRANSACAO INICIADA
     971                    $result = 'success';
     972                    break;
     973                case 1: //AGUARDANDO PAGAMENTO
     974                    $result = 'success';
     975                    break;
     976                case 2: //EFETIVADA
     977                    $result = 'failure';
     978                    break;
     979                case 3: //EM ANALISE
     980                    $result = 'success';
     981                    break;
     982                case 4: //EXPIRADA
     983                    $result = 'failure';
     984                    break;
     985                case 5: //AUTORIZADA
     986                    $result = 'success';
     987                    break;
     988                case 6: //CONFIRMADA
     989                    $result = 'success';
     990                    break;
     991                case 7: //NEGADA
     992                    $result = 'failure';
     993                    break;
     994                case 8: //CANCELAMENTO EM ANDAMENTO
     995                    $result = 'failure';
     996                    break;
     997                case 9: //CANCELADA
     998                    $result = 'failure';
     999                    break;
     1000                case 10: //PENDENTE DE CONFIRMAÇÃO
     1001                    $result = 'success';
     1002                    break;
     1003                case 11: //FALHA NA COMUNICAÇÃO COM FORNECEDOR
     1004                    $result = 'failure';
     1005                    break;
     1006                default:
     1007                    $result = 'failure';
     1008                    break;
     1009            }
     1010        } catch ( Exception $e ) {
     1011            $this->logger( 'Gateway Woocommerce Result Error', $e->getMessage() );
     1012        }
     1013
     1014        return $result;
     1015    }
     1016
     1017    private function gateway_woocommerce_message( $order, $response ) {
     1018        $result = 'failure';
     1019        try {
     1020            switch ( $response->status ) {
     1021                case 0: //TRANSACAO INICIADA
     1022                    $result = esc_html__( 'Transaction started but not confirmed.', 'woocommerce-businesspay' );
     1023                    break;
     1024                case 1: //AGUARDANDO PAGAMENTO
     1025                    $result = esc_html__( 'Awating payment.', 'woocommerce-businesspay' );
     1026                    break;
     1027                case 2: //EFETIVADA
     1028                    $result = esc_html__( 'Transaction effectivated.', 'woocommerce-businesspay' );
     1029                    break;
     1030                case 3: //EM ANALISE
     1031                    $result = esc_html__( 'Transaction under analysis.', 'woocommerce-businesspay' );
     1032                    break;
     1033                case 4: //EXPIRADA
     1034                    $result = esc_html__( 'Transaction expired.', 'woocommerce-businesspay' );
     1035                    break;
     1036                case 5: //AUTORIZADA
     1037                    $result = esc_html__( 'Transaction authorized.', 'woocommerce-businesspay' );
     1038                    break;
     1039                case 6: //CONFIRMADA
     1040                    $result = esc_html__( 'Transaction confirmed.', 'woocommerce-businesspay' );
     1041                    break;
     1042                case 7: //NEGADA
     1043                    $result = esc_html__( 'Transaction denied.', 'woocommerce-businesspay' );
     1044                    break;
     1045                case 8: //CANCELAMENTO EM ANDAMENTO
     1046                    $result = esc_html__( 'Cancellation in progress.', 'woocommerce-businesspay' );
     1047                    break;
     1048                case 9: //CANCELADA
     1049                    $result = esc_html__( 'Transaction Canceled.', 'woocommerce-businesspay' );
     1050                    break;
     1051                case 10: //PENDENTE DE CONFIRMAÇÃO
     1052                    $result = esc_html__( 'Transaction pending of confirmation.', 'woocommerce-businesspay' );
     1053                    break;
     1054                case 11: //FALHA NA COMUNICAÇÃO COM FORNECEDOR
     1055                    $result = esc_html__( 'Failure to communicate with the provider.', 'woocommerce-businesspay' );
     1056                    break;
     1057                default:
     1058                    $result = esc_html__( 'No valid server response.', 'woocommerce-businesspay' );
     1059                    break;
     1060            }
     1061
     1062            //Verify billet & transfer payment amount
     1063            if ( $result == 'processing' ) {
     1064                $paid_wrong = false;
     1065                $paid_total = $this->get_gateway_payment_amount( $response );
     1066                if ( ! empty( $paid_total ) ) {
     1067                    $order_total = str_replace( array( ',', '.' ), '', $this->get_total_order( $order ) );
     1068                    $balance     = $order_total - $paid_total;
     1069                    if ( $balance > 0 ) {
     1070                        $paid_wrong = true;
     1071                    }
     1072                } else {
     1073                    $paid_wrong = true;
     1074                }
     1075
     1076                if ( $paid_wrong ) {
     1077                    $result = esc_html__( 'payment made less than the value of the order.', 'woocommerce-businesspay' );
     1078                }
     1079            }
     1080        } catch ( Exception $e ) {
     1081            $this->logger( 'Gateway Woocommerce Message Error', $e->getMessage() );
     1082        }
     1083
     1084        return $result;
     1085    }
     1086
     1087
     1088    //ANTIFRAUD CALLS
     1089
     1090    private function antifraud_maybe_renew_token() {
     1091        $result = false;
     1092        try {
     1093            $today      = current_time( 'mysql' );
     1094            $token      = get_option( 'businesspay_antifraud_auth_token' );
     1095            $expiration = get_option( 'businesspay_antifraud_auth_expiration' );
     1096            $this->logger( 'Antifraud Token | today', $today );
     1097            $this->logger( 'Antifraud Token | token', $token );
     1098            $this->logger( 'Antifraud Token | expiration', $expiration );
     1099
     1100            $renew = ( $token == '' ) || ( $expiration == '' ) || ( strtotime( $expiration ) < strtotime( $today ) );
     1101
     1102            if ( $renew ) {
     1103                $retry_num = 0;
     1104                while ( $retry_num < 3 ) {
     1105                    $retry_num ++;
     1106                    $body = array(
     1107                        'Name'     => ( $this->debug == 'yes' ) ? $this->antifraud_login_demo : $this->antifraud_login_live,
     1108                        'Password' => ( $this->debug == 'yes' ) ? $this->antifraud_password_demo : $this->antifraud_password_live
     1109                    );
     1110
     1111                    $payload = array(
     1112                        'method'    => 'POST',
     1113                        'sslverify' => true,
     1114                        'timeout'   => 60,
     1115                        'headers'   => array(
     1116                            'cache-control' => 'no-cache',
     1117                            'Content-Type'  => 'application/json',
     1118                        ),
     1119                        'body'      => json_encode( $body )
     1120                    );
     1121
     1122                    $url = ( $this->sandbox == 'yes' ) ? $this->antifraud_demo_url . '/api/' . $this->antifraud_demo_version . '/authenticate' : $this->antifraud_live_url . '/' . $this->antifraud_live_version . '/authenticate';
     1123
     1124                    $this->logger( 'Antifraud Token | $url', $url );
     1125                    $this->logger( 'Antifraud Token | PAYLOAD', $payload );
     1126                    $response = wp_safe_remote_post( $url, $payload );
     1127
     1128                    $this->logger( 'Antifraud Token | Response', $response );
     1129
     1130                    if ( ! is_wp_error( $response ) ) {
     1131                        $response = json_decode( wp_remote_retrieve_body( $response ) );
     1132                        if ( ! empty( $response ) ) {
     1133                            $this->set_option_antifraud_auth_token( $response->Token );
     1134                            $this->set_option_antifraud_auth_expiration( $response->ExpirationDate );
     1135                            $retry_num = 3;
     1136                            $result    = true;
    17231137                        }
    17241138                    }
    17251139                }
     1140            } else {
     1141                $result = true;
    17261142            }
    17271143        } catch ( Exception $e ) {
    1728             $this->logger( 'Get Session Info Error', $e->getMessage() );
    1729         }
    1730     }
    1731 
    1732     private function get_session_id() {
    1733         $result = session_id();
    1734         if ( empty( $result ) ) {
    1735             session_start();
    1736             $result = session_id();
     1144            $this->logger( 'Antifraud Renew Token Error', $e->getMessage() );
    17371145        }
    17381146
     
    17401148    }
    17411149
    1742 
    1743     //GATEWAY GETTERS
     1150    private function antifraud_maybe_do_analysis( $order, $gateway_response ) {
     1151        if ( $this->enable_antifraud && $gateway_response->status == 5 ) {
     1152            $oid              = $this->get_order_id( $order );
     1153            $transaction_type = get_post_meta( $oid, '_businesspay-transaction-type', true );
     1154            if ( $transaction_type == 'credit-card' || $transaction_type == 'debit-card' ) {
     1155                $this->antifraud_do_analysis( $order );
     1156            }
     1157        }
     1158    }
     1159
     1160    private function antifraud_do_analysis( $order ) {
     1161        $result = array( 'result' => 'failure', 'messages' => '' );
     1162        if ( $this->antifraud_maybe_renew_token() ) {
     1163            $retry_num = 0;
     1164            while ( $retry_num < 3 ) {
     1165                $retry_num ++;
     1166                try {
     1167                    $af_items_order = $order->get_items();
     1168                    $arr_items      = array();
     1169
     1170                    foreach ( $af_items_order as $af_item_order ) {
     1171                        $arr_item = array(
     1172                            'code'         => $this->get_antifraud_item_id( $af_item_order ),
     1173                            'name'         => $this->get_antifraud_item_name( $af_item_order ),
     1174                            'value'        => $this->get_antifraud_item_value( $af_item_order ),
     1175                            'amount'       => $this->get_antifraud_item_amount( $af_item_order ),
     1176                            'categoryID'   => $this->get_antifraud_item_category_id( $af_item_order ),
     1177                            'categoryName' => $this->get_antifraud_item_category_name( $af_item_order ),
     1178                        );
     1179                        array_push( $arr_items, $arr_item );
     1180                    }
     1181
     1182                    $arr_order = array(
     1183                        'code'                 => $this->get_antifraud_order_id( $order ),
     1184                        'sessionID'            => $this->get_antifraud_order_fingerprint(),
     1185                        'date'                 => $this->get_antifraud_order_date( $order ),
     1186                        'email'                => $this->get_antifraud_order_email( $order ),
     1187                        'itemValue'            => $this->get_antifraud_order_total_items( $order ),
     1188                        'totalValue'           => $this->get_antifraud_order_total_order( $order ),
     1189                        'numberOfInstallments' => $this->get_antifraud_order_qtd_installments( $order ),
     1190                        'ip'                   => $this->get_antifraud_order_ip( $order ),
     1191                        'observation'          => $this->get_antifraud_order_obs( $order ),
     1192                        'origin'               => $this->get_antifraud_order_origin(),
     1193                        'channelID'            => $this->get_antifraud_order_channel_id(),
     1194                        'product'              => $this->get_antifraud_order_product_id(),
     1195                        'billing'              => array(
     1196                            'clientID'        => $this->get_antifraud_billing_client_id( $order ),
     1197                            'type'            => $this->get_antifraud_billing_person_type( $order ),
     1198                            'primaryDocument' => $this->get_antifraud_billing_document( $order ),
     1199                            'name'            => $this->get_antifraud_billing_name( $order ),
     1200                            'email'           => $this->get_antifraud_billing_email( $order ),
     1201                            'address'         => array(
     1202                                'street'                => $this->get_antifraud_billing_street( $order ),
     1203                                'number'                => $this->get_antifraud_billing_street_number( $order ),
     1204                                'additionalInformation' => $this->get_antifraud_billing_complement( $order ),
     1205                                'county'                => $this->get_antifraud_billing_county( $order ),
     1206                                'city'                  => $this->get_antifraud_billing_city( $order ),
     1207                                'state'                 => $this->get_antifraud_billing_state( $order ),
     1208                                'zipcode'               => $this->get_antifraud_billing_zipcode( $order ),
     1209                                'country'               => $this->get_antifraud_billing_country( $order ),
     1210                            ),
     1211                            'phones'          => array(
     1212                                array(
     1213                                    'type'   => $this->get_antifraud_billing_phone_type( $order ),
     1214                                    'ddi'    => $this->get_antifraud_billing_phone_ddi(),
     1215                                    'ddd'    => $this->get_antifraud_billing_phone_ddd( $order ),
     1216                                    'number' => $this->get_antifraud_billing_phone_number( $order ),
     1217                                ),
     1218                            ),
     1219                        ),
     1220                        'shipping'             => array(
     1221                            'clientID'        => $this->get_antifraud_shipping_client_id( $order ),
     1222                            'type'            => $this->get_antifraud_shipping_person_type( $order ),
     1223                            'primaryDocument' => $this->get_antifraud_shipping_document( $order ),
     1224                            'name'            => $this->get_antifraud_shipping_name( $order ),
     1225                            'email'           => $this->get_antifraud_shipping_email( $order ),
     1226                            'address'         => array(
     1227                                'street'                => $this->get_antifraud_shipping_street( $order ),
     1228                                'number'                => $this->get_antifraud_shipping_street_number( $order ),
     1229                                'additionalInformation' => $this->get_antifraud_shipping_complement( $order ),
     1230                                'county'                => $this->get_antifraud_shipping_county( $order ),
     1231                                'city'                  => $this->get_antifraud_shipping_city( $order ),
     1232                                'state'                 => $this->get_antifraud_shipping_state( $order ),
     1233                                'zipcode'               => $this->get_antifraud_shipping_zipcode( $order ),
     1234                                'country'               => $this->get_antifraud_shipping_country( $order ),
     1235                            ),
     1236                            'phones'          => array(
     1237                                array(
     1238                                    'type'   => $this->get_antifraud_shipping_phone_type( $order ),
     1239                                    'ddi'    => $this->get_antifraud_shipping_phone_ddi(),
     1240                                    'ddd'    => $this->get_antifraud_shipping_phone_ddd( $order ),
     1241                                    'number' => $this->get_antifraud_shipping_phone_number( $order ),
     1242                                ),
     1243                            ),
     1244                            'price'           => $this->get_antifraud_shipping_delivery_price( $order ),
     1245                        ),
     1246                        'payments'             => array(
     1247                            array(
     1248                                'date'         => $this->get_antifraud_payment_date( $order ),
     1249                                'value'        => $this->get_antifraud_payment_value( $order ),
     1250                                'type'         => $this->get_antifraud_payment_type( $order ),
     1251                                'installments' => $this->get_antifraud_payment_qtd_installments( $order ),
     1252                                'card'         => array(
     1253                                    'bin'          => $this->get_antifraud_payment_card_bin( $order ),
     1254                                    'end'          => $this->get_antifraud_payment_card_end( $order ),
     1255                                    'type'         => $this->get_antifraud_payment_card_type( $order ),
     1256                                    'validityDate' => $this->get_antifraud_payment_card_expiration( $order ),
     1257                                    'ownerName'    => $this->get_antifraud_payment_card_holder_name( $order ),
     1258                                    'document'     => $this->get_antifraud_payment_card_legal_document( $order ),
     1259                                ),
     1260                            ),
     1261                        ),
     1262                        'items'                => $arr_items
     1263                    );
     1264
     1265                    $response = $this->antifraud_api_request( 'POST', 'orders', $arr_order );
     1266                    if ( ! $response->result == 'failure' ) {
     1267                        $this->antifraud_insert_order_metadata( $order, $response );
     1268                        $response  = $this->antifraud_insert_order_status( $order, $response );
     1269                        $retry_num = 3;
     1270                        $result    = $response;
     1271                    }
     1272                } catch ( Exception $e ) {
     1273                    $this->logger( 'Antifraud Authorization Card Error', $e->getMessage() );
     1274                }
     1275            }
     1276        } else {
     1277            $this->logger( 'Antifraud Do Analysis', 'Antifraud Renew Token Error' );
     1278        }
     1279
     1280        return $result;
     1281    }
     1282
     1283    private function antifraud_api_request( $method, $endpoint, $body ) {
     1284        $result = array( 'result' => 'failure', 'messages' => '' );
     1285        try {
     1286            $payload = array(
     1287                'method'    => $method,
     1288                'sslverify' => true,
     1289                'timeout'   => 60,
     1290                'headers'   => array(
     1291                    'Content-Type'  => 'application/json',
     1292                    'Authorization' => 'Bearer ' . $this->antifraud_auth_token,
     1293                ),
     1294                'body'      => json_encode( $body )
     1295            );
     1296
     1297            $url = ( $this->sandbox == 'yes' ) ? $this->antifraud_demo_url . '/api/' . $this->antifraud_demo_version . '/' . $endpoint : $this->antifraud_live_url . '/' . $this->antifraud_live_version . '/' . $endpoint;
     1298
     1299            $this->logger( 'API Antifraud Request | Body', $body );
     1300            $response = wp_safe_remote_post( $url, $payload );
     1301
     1302            if ( ! is_wp_error( $response ) ) {
     1303                $response_json = json_decode( wp_remote_retrieve_body( $response ) );
     1304                $this->logger( 'API Antifraud Response | JSON', $response_json );
     1305                if ( ! empty( $response_json ) ) {
     1306                    $result = $response_json;
     1307                } else {
     1308                    wc_add_notice( esc_html__( 'The credentials for this virtual store are not valid on the BusinessPay server. Please try again.', 'woocommerce-businesspay' ), 'error' );
     1309                }
     1310            } else {
     1311                wc_add_notice( esc_html__( 'Could not receive a valid server response. Please try again.', 'woocommerce-businesspay' ), 'error' );
     1312            }
     1313        } catch ( Exception $e ) {
     1314            $this->logger( 'Antifraud API Request Error', $e->getMessage() );
     1315        }
     1316
     1317        return $result;
     1318    }
     1319
     1320    private function antifraud_insert_order_metadata( $order, $response ) {
     1321        try {
     1322            if ( ! isset( $response->Message ) ) {
     1323                $order_id = $this->get_order_id( $order );
     1324                $this->antifraud_remove_order_metadata( $order_id );
     1325
     1326                update_post_meta( $order_id, '_businesspay-antifraud-transaction-date', current_time( 'mysql' ) );
     1327
     1328                if ( isset( $response->packageID ) ) {
     1329                    update_post_meta( $order_id, '_businesspay-antifraud-transaction-id', $response->packageID );
     1330                }
     1331
     1332                if ( isset( $response->orders[0]->status ) ) {
     1333                    update_post_meta( $order_id, '_businesspay-antifraud-status-code', $response->orders[0]->status );
     1334                    update_post_meta( $order_id, '_businesspay-antifraud-message', $this->antifraud_woocommerce_message( $response ) );
     1335                }
     1336
     1337                if ( isset( $response->orders[0]->score ) ) {
     1338                    update_post_meta( $order_id, '_businesspay-antifraud-score', $response->orders[0]->score );
     1339                }
     1340            }
     1341        } catch ( Exception $e ) {
     1342            $this->logger( 'Gateway Insert Order Metadata Error', $e->getMessage() );
     1343        }
     1344    }
     1345
     1346    private function antifraud_insert_order_status( $order, $response ) {
     1347        $result = array( 'result' => 'failure', 'messages' => '' );
     1348        try {
     1349            $res_status  = $this->antifraud_woocommerce_status( $response );
     1350            $res_result  = $this->antifraud_woocommerce_result( $response );
     1351            $res_message = $this->antifraud_woocommerce_message( $response );
     1352
     1353            if ( $res_result == 'success' ) {
     1354                $res_note = esc_html__( 'Antifraud Status: ', 'woocommerce-businesspay' ) . $res_message;
     1355                $this->update_order_status( $order, $res_status, $res_note );
     1356
     1357                $analysis = $response->orders[0]->status;
     1358                if ( in_array( $analysis, array( 'APA', 'APM', 'APP' ) ) ) {
     1359                    $this->gateway_do_capture( $order );
     1360                }
     1361            } else {
     1362                $result = array(
     1363                    'result'   => $res_result,
     1364                    'messages' => $res_message
     1365                );
     1366                $this->update_order_status( $order, 'failed', $res_message );
     1367            }
     1368        } catch ( Exception $e ) {
     1369            $this->logger( 'Antifraud Insert Order Status Error', $e->getMessage() );
     1370        }
     1371
     1372        return $result;
     1373    }
     1374
     1375    private function antifraud_remove_order_metadata( $order_id ) {
     1376        delete_post_meta( $order_id, '_businesspay-antifraud-transaction-date' );
     1377        delete_post_meta( $order_id, '_businesspay-antifraud-transaction-id' );
     1378        delete_post_meta( $order_id, '_businesspay-antifraud-status-code' );
     1379        delete_post_meta( $order_id, '_businesspay-antifraud-score' );
     1380        delete_post_meta( $order_id, '_businesspay-antifraud-message' );
     1381    }
     1382
     1383    //ANTIFRAUD STATUS
     1384
     1385    private function antifraud_woocommerce_status( $response ) {
     1386        $result = 'failed';
     1387        try {
     1388            switch ( $response->orders[0]->status ) {
     1389                case 'APA': //APROVAÇÃO AUTOMÁTICA
     1390                    $result = 'on-hold';
     1391                    break;
     1392                case 'AMA': //ANÁLISE MANUAL
     1393                    $result = 'on-hold';
     1394                    break;
     1395                case 'APM': //APROVAÇÃO MANUAL
     1396                    $result = 'on-hold';
     1397                    break;
     1398                case 'APP': //APROVAÇÃO POR POLÍTICA
     1399                    $result = 'on-hold';
     1400                    break;
     1401                case 'CAN': //CANCELADO PELO CLIENTE
     1402                    $result = 'cancelled';
     1403                    break;
     1404                case 'FRD': //FRAUDE CONFIRMADA
     1405                    $result = 'failed';
     1406                    break;
     1407                case 'NVO': //NOVO
     1408                    $result = 'on-hold';
     1409                    break;
     1410                case 'RPA': //REPROVAÇÃO AUTOMÁTICA
     1411                    $result = 'failed';
     1412                    break;
     1413                case 'RPM': //REPROVAÇÃO SEM SUSPEITA
     1414                    $result = 'failed';
     1415                    break;
     1416                case 'RPP': //REPROVAÇÃO POR POLÍTICA
     1417                    $result = 'failed';
     1418                    break;
     1419                case 'SUS': //SUSPENSÃO MANUAL
     1420                    $result = 'failed';
     1421                    break;
     1422                default:
     1423                    $result = 'failed';
     1424                    break;
     1425            }
     1426        } catch ( Exception $e ) {
     1427            $this->logger( 'Antifraud Woocommerce Status Error', $e->getMessage() );
     1428        }
     1429
     1430        return $result;
     1431    }
     1432
     1433    private function antifraud_woocommerce_result( $response ) {
     1434        $result = 'failure';
     1435        try {
     1436            switch ( $response->orders[0]->status ) {
     1437                case 'APA': //APROVAÇÃO AUTOMÁTICA
     1438                    $result = 'success';
     1439                    break;
     1440                case 'AMA': //ANÁLISE MANUAL
     1441                    $result = 'success';
     1442                    break;
     1443                case 'APM': //APROVAÇÃO MANUAL
     1444                    $result = 'success';
     1445                    break;
     1446                case 'APP': //APROVAÇÃO POR POLÍTICA
     1447                    $result = 'success';
     1448                    break;
     1449                case 'CAN': //CANCELADO PELO CLIENTE
     1450                    $result = 'success';
     1451                    break;
     1452                case 'FRD': //FRAUDE CONFIRMADA
     1453                    $result = 'success';
     1454                    break;
     1455                case 'NVO': //NOVO
     1456                    $result = 'success';
     1457                    break;
     1458                case 'RPA': //REPROVAÇÃO AUTOMÁTICA
     1459                    $result = 'success';
     1460                    break;
     1461                case 'RPM': //REPROVAÇÃO SEM SUSPEITA
     1462                    $result = 'success';
     1463                    break;
     1464                case 'RPP': //REPROVAÇÃO POR POLÍTICA
     1465                    $result = 'success';
     1466                    break;
     1467                case 'SUS': //SUSPENSÃO MANUAL
     1468                    $result = 'success';
     1469                    break;
     1470                default:
     1471                    $result = 'failure';
     1472                    break;
     1473            }
     1474        } catch ( Exception $e ) {
     1475            $this->logger( 'Gateway Woocommerce Result Error', $e->getMessage() );
     1476        }
     1477
     1478        return $result;
     1479    }
     1480
     1481    private function antifraud_woocommerce_message( $response ) {
     1482        $result = 'failure';
     1483        try {
     1484            switch ( $response->orders[0]->status ) {
     1485                case 'APA': //APROVAÇÃO AUTOMÁTICA
     1486                    $result = esc_html__( 'Order was automatically approved according to parameters defined in the automatic approval rule.', 'woocommerce-businesspay' );
     1487                    break;
     1488                case 'AMA': //ANÁLISE MANUAL
     1489                    $result = esc_html__( 'Order is queued for analysis.', 'woocommerce-businesspay' );
     1490                    break;
     1491                case 'APM': //APROVAÇÃO MANUAL
     1492                    $result = esc_html__( 'Order manually approved by decision-making of an analyst.', 'woocommerce-businesspay' );
     1493                    break;
     1494                case 'APP': //APROVAÇÃO POR POLÍTICA
     1495                    $result = esc_html__( 'Order approved automatically by client-established policy or antifraud software rule.', 'woocommerce-businesspay' );
     1496                    break;
     1497                case 'CAN': //CANCELADO PELO CLIENTE
     1498                    $result = esc_html__( 'Canceled by customer or duplicated order.', 'woocommerce-businesspay' );
     1499                    break;
     1500                case 'FRD': //FRAUDE CONFIRMADA
     1501                    $result = esc_html__( 'Order imputed as fraud confirmed by contact with the card administrator and / or contact with the card holder or CPF of the registry that is unaware of the purchase.', 'woocommerce-businesspay' );
     1502                    break;
     1503                case 'NVO': //NOVO
     1504                    $result = esc_html__( 'Order imported and not classified Score by the analyzer yet.', 'woocommerce-businesspay' );
     1505                    break;
     1506                case 'RPA': //REPROVAÇÃO AUTOMÁTICA
     1507                    $result = esc_html__( 'Order Automatically Disapproved by some type of business rule that needs to be applied.', 'woocommerce-businesspay' );
     1508                    break;
     1509                case 'RPM': //REPROVAÇÃO SEM SUSPEITA
     1510                    $result = esc_html__( 'Order disapproved without suspicion by lack of contact with the client within the agreed period and / or social security number of restrictive policies (Irregular, SUS or Canceled).', 'woocommerce-businesspay' );
     1511                    break;
     1512                case 'RPP': //REPROVAÇÃO POR POLÍTICA
     1513                    $result = esc_html__( 'Order disapproved automatically by policy established by customer or antifraud software.', 'woocommerce-businesspay' );
     1514                    break;
     1515                case 'SUS': //SUSPENSÃO MANUAL
     1516                    $result = esc_html__( 'Order automatically approved by policy established by the customer or antifraud software.', 'woocommerce-businesspay' );
     1517                    break;
     1518                default:
     1519                    $result = 'failure';
     1520                    break;
     1521            }
     1522        } catch ( Exception $e ) {
     1523            $this->logger( 'Gateway Woocommerce Message Error', $e->getMessage() );
     1524        }
     1525
     1526        return $result;
     1527    }
     1528
     1529
     1530    //WEBHOOK CALLBACK
     1531
     1532    public function webhook_callback() {
     1533        $contents = file_get_contents( "php://input" );
     1534        $json     = json_decode( $contents );
     1535        $this->logger( 'API Notification | Body', $json );
     1536
     1537        if ( isset( $json->transactionId ) && isset( $json->referenceId ) ) {
     1538            $this->gateway_maybe_consult_status( $json->referenceId, $json->transactionId );
     1539        } elseif ( isset( $json->code ) && isset( $json->date ) && isset( $json->type ) ) {
     1540            $this->antifraud_maybe_consult_status( $json->code, $json->type );
     1541        } else {
     1542            $this->logger( 'WebHook Callback Error', 'Fields not detected. Suspicious call.' );
     1543        }
     1544    }
     1545
     1546    private function gateway_maybe_consult_status( $order_id, $transactionId ) {
     1547        $result = false;
     1548        try {
     1549            $order = wc_get_order( $order_id );
     1550            if ( ! is_wp_error( $order ) ) {
     1551                if ( $transactionId == $order->get_transaction_id() ) {
     1552                    $body     = array( 'transactionId' => $transactionId );
     1553                    $response = $this->gateway_api_request( 'GET', '/transactions/' . $transactionId, $body );
     1554                    if ( ! isset( $response->result ) ) {
     1555                        $this->gateway_insert_order_metadata( $order, $response );
     1556                        $res_status = $this->gateway_insert_order_status( $order, $response );
     1557
     1558                        if ( $res_status['result'] == 'success' ) {
     1559                            $this->antifraud_maybe_do_analysis( $order, $response );
     1560                        }
     1561                        $result = $res_status;
     1562                    }
     1563                } else {
     1564                    $this->logger( 'Gateway Webhook consult status error', 'Incorrect Transaction ID' );
     1565                }
     1566            }
     1567        } catch ( Exception $e ) {
     1568            $this->logger( 'Gateway API Consult Status Error', $e->getMessage() );
     1569        }
     1570
     1571        return $result;
     1572    }
     1573
     1574    private function antifraud_maybe_consult_status( $order_id, $type ) {
     1575        $result = false;
     1576        try {
     1577            $order = wc_get_order( $order_id );
     1578            if ( ! is_wp_error( $order ) ) {
     1579                if ( $type == 'status' ) {
     1580                    $body     = '';
     1581                    $response = $this->antifraud_api_request( 'GET', '/orders/' . $order_id . '/status', $body );
     1582                    if ( ! isset( $response->result ) ) {
     1583                        $this->antifraud_insert_order_metadata( $order, $response );
     1584                        $result = $this->antifraud_insert_order_status( $order, $response );
     1585                    }
     1586                } else {
     1587                    $this->logger( 'Antifraud Webhook consult status error', 'Incorrect type value' );
     1588                }
     1589            }
     1590        } catch ( Exception $e ) {
     1591            $this->logger( 'Antifraud API Consult Status Error', $e->getMessage() );
     1592        }
     1593
     1594        return $result;
     1595    }
     1596
     1597
     1598    //ADMIN METABOXES
     1599
     1600    public function businesspay_admin_panel_gateway() {
     1601        wc_get_template( 'businesspay-panel-gateway.php', array( 'bpConfig' => $this ), 'woocommerce/businesspay/', WC_BusinessPay::get_templates_path() );
     1602    }
     1603
     1604    public function businesspay_admin_panel_antifraud() {
     1605        wc_get_template( 'businesspay-panel-antifraud.php', array( 'bpConfig' => $this ), 'woocommerce/businesspay/', WC_BusinessPay::get_templates_path() );
     1606    }
     1607
     1608
     1609    //GATEWAY GETTERS - Order
     1610
     1611    private function get_gateway_selected_method( $fields ) {
     1612        $payment_type = $this->get_gateway_selected_tab( $fields );
     1613        $method       = $payment_type;
     1614        if ( $payment_type == 'card' ) {
     1615            $installments = $this->get_gateway_payment_card_installments( $fields );
     1616            if ( $installments == 'debit' ) {
     1617                $method = $installments;
     1618            } else {
     1619                $method = 'credit';
     1620            }
     1621        }
     1622
     1623        return $method;
     1624    }
    17441625
    17451626    private function get_gateway_selected_tab( $fields ) {
     
    17471628    }
    17481629
    1749     private function get_gateway_card_number( $fields ) {
     1630    private function get_gateway_order_reference_id( $order ) {
     1631        return $this->get_order_id( $order );
     1632    }
     1633
     1634    private function get_gateway_order_amount( $order ) {
     1635        return str_replace( '.', '', $order->order_total );
     1636    }
     1637
     1638    private function get_gateway_order_description() {
     1639        return esc_html__( 'Woocommerce Order', 'woocommerce-businesspay' );
     1640    }
     1641
     1642    private function get_gateway_order_postback_url() {
     1643        return $this->get_postback_url();
     1644    }
     1645
     1646    //GATEWAY GETTERS - Payment
     1647
     1648    private function get_gateway_payment_type( $fields ) {
     1649        $installments = sanitize_text_field( $fields['businesspay_installments'] );
     1650        if ( $installments == 'debit' ) {
     1651            $type = '2';
     1652        } else {
     1653            $type = '1';
     1654        }
     1655
     1656        return $type;
     1657    }
     1658
     1659    private function get_gateway_payment_card_capture() {
     1660        return $this->enable_antifraud ? 'false' : 'true';
     1661    }
     1662
     1663    private function get_gateway_payment_card_save() {
     1664        //Save card to create token
     1665        return 'false';
     1666    }
     1667
     1668    private function get_gateway_payment_card_interest_type() {
     1669        //3: Parcelado loja. 4: Parcelado Administrador
     1670        return 3;
     1671    }
     1672
     1673    private function get_gateway_payment_card_authenticate() {
     1674        //1: Somente transações autenticadas. 2: Autenticadas e não autenticadas. 3: Autorizar sem autenticação.
     1675        return 1;
     1676    }
     1677
     1678    private function get_gateway_payment_card_recurrent() {
     1679        return 'false';
     1680    }
     1681
     1682    private function get_gateway_payment_card_soft_descriptor() {
     1683        return $this->name_in_invoice;
     1684    }
     1685
     1686    private function get_gateway_payment_card_info_number( $fields ) {
    17501687        return str_replace( ' ', '', sanitize_text_field( $fields['businesspay_card_number'] ) );
    17511688    }
    17521689
    1753     private function get_gateway_card_brand( $fields ) {
    1754         return sanitize_text_field( $fields['businesspay_card_brand'] );
    1755     }
    1756 
    1757     private function get_gateway_card_holder_name( $fields ) {
     1690    private function get_gateway_payment_card_info_brand( $fields ) {
     1691        $brand = strtolower( str_replace( array( ' ' ), '', sanitize_text_field( $fields['businesspay_card_brand'] ) ) );
     1692
     1693        switch ( $brand ) {
     1694            case 'visa':
     1695                $result = 'Visa';
     1696                break;
     1697            case 'mastercard':
     1698                $result = 'Mastercard';
     1699                break;
     1700            case 'amex':
     1701                $result = 'American Express';
     1702                break;
     1703            case 'elo':
     1704                $result = 'Elo';
     1705                break;
     1706            case 'hipercard':
     1707                $result = 'Hipercard';
     1708                break;
     1709            case 'hiper':
     1710                $result = 'Hiper';
     1711                break;
     1712            case 'aura':
     1713                $result = 'Aura';
     1714                break;
     1715            case 'discover':
     1716                $result = 'Discover';
     1717                break;
     1718            case 'jcb':
     1719                $result = 'JCB';
     1720                break;
     1721            default:
     1722                $result = '';
     1723                break;
     1724        }
     1725
     1726        return $result;
     1727    }
     1728
     1729    private function get_gateway_payment_card_info_holder_name( $fields ) {
    17581730        return sanitize_text_field( $fields['businesspay_holder_name'] );
    17591731    }
    17601732
    1761     private function get_gateway_card_expiry( $fields ) {
     1733    private function get_gateway_payment_card_info_expiry( $fields ) {
    17621734        return sanitize_text_field( $fields['businesspay_expiry'] );
    17631735    }
    17641736
    1765     private function get_gateway_card_expiry_month( $fields ) {
    1766         $temp_date = explode( '/', $this->get_gateway_card_expiry( $fields ) );
     1737    private function get_gateway_payment_card_info_expiry_month( $fields ) {
     1738        $temp_date = explode( '/', $this->get_gateway_payment_card_info_expiry( $fields ) );
    17671739
    17681740        return trim( $temp_date[0] );
    17691741    }
    17701742
    1771     private function get_gateway_card_expiry_year( $fields ) {
    1772         $temp_date = explode( '/', $this->get_gateway_card_expiry( $fields ) );
     1743    private function get_gateway_payment_card_info_expiry_year( $fields ) {
     1744        $temp_date = explode( '/', $this->get_gateway_payment_card_info_expiry( $fields ) );
    17731745
    17741746        return trim( $temp_date[1] );
    17751747    }
    17761748
    1777     private function get_gateway_card_cvv( $fields ) {
     1749    private function get_gateway_payment_card_info_cvv( $fields ) {
    17781750        return sanitize_text_field( $fields['businesspay_cvv'] );
    17791751    }
    17801752
    1781     private function get_gateway_card_installments( $fields ) {
    1782         return sanitize_text_field( $fields['businesspay_installments'] );
    1783     }
    1784 
    1785     private function get_gateway_card_document( $fields ) {
     1753    private function get_gateway_payment_card_installments( $fields ) {
     1754        $installments = sanitize_text_field( $fields['businesspay_installments'] );
     1755        if ( $installments == 'debit' ) {
     1756            $installments = '1';
     1757        }
     1758
     1759        return $installments;
     1760    }
     1761
     1762    private function get_gateway_payment_card_document( $fields ) {
    17861763        return str_replace( array( '.', '/', '-', ' ' ), '', sanitize_text_field( $fields['businesspay_doc'] ) );
    17871764    }
    17881765
    1789     private function get_gateway_transfer_bank( $fields ) {
    1790         return sanitize_text_field( $fields['businesspay_transfer_bank'] );
    1791     }
    1792 
    1793     private function get_gateway_billet_bank( $fields ) {
    1794         return sanitize_text_field( $fields['businesspay_billet_bank'] );
    1795     }
    1796 
    1797     private function get_gateway_billing_neighborhood( $fields ) {
    1798         return sanitize_text_field( $fields['billing_neighborhood'] );
    1799     }
    1800 
    1801     private function get_gateway_customer_name( $fields ) {
    1802         return sanitize_text_field( $fields['billing_first_name'] . ' ' . $fields['billing_last_name'] );
    1803     }
    1804 
    1805     private function get_gateway_customer_document( $fields ) {
    1806         return sanitize_text_field( $fields['billing_cpf'] );
    1807     }
    1808 
    1809     private function get_gateway_customer_email( $fields ) {
    1810         return sanitize_email( $fields['billing_email'] );
    1811     }
    1812 
    1813     private function get_gateway_customer_address( $fields ) {
    1814         return sanitize_text_field( $fields['billing_address_1'] );
    1815     }
    1816 
    1817     private function get_gateway_customer_address_number( $fields ) {
    1818         return sanitize_text_field( $fields['billing_number'] );
    1819     }
    1820 
    1821     private function get_gateway_customer_address_complement( $fields ) {
    1822         return sanitize_text_field( $fields['billing_address_2'] );
    1823     }
    1824 
    1825     private function get_gateway_customer_address_district( $fields ) {
    1826         return sanitize_text_field( $fields['billing_neighborhood'] );
    1827     }
    1828 
    1829     private function get_gateway_customer_address_zipcode( $fields ) {
    1830         return str_replace( '-', '', sanitize_text_field( $fields['billing_postcode'] ) );
    1831     }
    1832 
    1833     private function get_gateway_customer_address_city( $fields ) {
    1834         return sanitize_text_field( $fields['billing_city'] );
    1835     }
    1836 
    1837     private function get_gateway_customer_address_state( $fields ) {
    1838         return sanitize_text_field( $fields['billing_state'] );
     1766    private function get_gateway_payment_billet_expiration_date() {
     1767        $interval = $this->billet_number_days;
     1768        if ( empty( $interval ) ) {
     1769            $interval = $this->default_billet_expiration_days;
     1770        }
     1771        try {
     1772            $expiration    = new DateTime();
     1773            $interval_spec = 'P' . $interval . 'D';
     1774            $expiration->add( new DateInterval( $interval_spec ) );
     1775            $result = $expiration->format( 'Y-m-d' );
     1776        } catch ( Exception $e ) {
     1777            $result = false;
     1778            $this->logger( 'Get Billet Expiration Error', $e->getMessage() );
     1779        }
     1780
     1781        return $result;
     1782    }
     1783
     1784    private function get_gateway_payment_billet_instruction() {
     1785        return $this->billet_instruction_1;
     1786    }
     1787
     1788    private function get_gateway_payment_billet_guarantor() {
     1789        return 'Comprador';
    18391790    }
    18401791
     
    18521803    }
    18531804
    1854 
    1855     //ANTIFRAUD GETTERS
     1805    private function get_gateway_payment_transfer_provider( $fields ) {
     1806        return sanitize_text_field( $fields['businesspay_transfer_bank'] );
     1807    }
     1808
     1809    private function get_gateway_payment_billet_provider( $fields ) {
     1810        return sanitize_text_field( $fields['businesspay_billet_bank'] );
     1811    }
     1812
     1813    //GATEWAY GETTERS - Customer
     1814
     1815    private function get_gateway_customer_name( $fields ) {
     1816        $payment_type = $this->get_gateway_selected_tab( $fields );
     1817        $name         = '';
     1818        switch ( $payment_type ) {
     1819            case 'card':
     1820                $name = $this->get_gateway_payment_card_info_holder_name( $fields );
     1821                break;
     1822            case 'transfer':
     1823                $name = sanitize_text_field( $fields['billing_first_name'] . ' ' . $fields['billing_last_name'] );
     1824                break;
     1825            case 'billet':
     1826                $name = sanitize_text_field( $fields['billing_first_name'] . ' ' . $fields['billing_last_name'] );
     1827                break;
     1828        }
     1829
     1830        return $name;
     1831    }
     1832
     1833    private function get_gateway_customer_document( $fields ) {
     1834        $payment_type = $this->get_gateway_selected_tab( $fields );
     1835        $doc          = '';
     1836        switch ( $payment_type ) {
     1837            case 'card':
     1838                $doc = $this->get_gateway_payment_card_document( $fields );
     1839                break;
     1840            case 'transfer':
     1841                $doc = sanitize_text_field( $fields['billing_cpf'] );
     1842                break;
     1843            case 'billet':
     1844                $doc = sanitize_text_field( $fields['billing_cpf'] );
     1845                break;
     1846        }
     1847
     1848        return $doc;
     1849    }
     1850
     1851    private function get_gateway_customer_email( $fields ) {
     1852        return sanitize_email( $fields['billing_email'] );
     1853    }
     1854
     1855    private function get_gateway_customer_address( $fields ) {
     1856        return sanitize_text_field( $fields['billing_address_1'] );
     1857    }
     1858
     1859    private function get_gateway_customer_address_number( $fields ) {
     1860        return sanitize_text_field( $fields['billing_number'] );
     1861    }
     1862
     1863    private function get_gateway_customer_address_complement( $fields ) {
     1864        return sanitize_text_field( $fields['billing_address_2'] );
     1865    }
     1866
     1867    private function get_gateway_customer_address_district( $fields ) {
     1868        return sanitize_text_field( $fields['billing_neighborhood'] );
     1869    }
     1870
     1871    private function get_gateway_customer_address_zipcode( $fields ) {
     1872        return str_replace( '-', '', sanitize_text_field( $fields['billing_postcode'] ) );
     1873    }
     1874
     1875    private function get_gateway_customer_address_city( $fields ) {
     1876        return sanitize_text_field( $fields['billing_city'] );
     1877    }
     1878
     1879    private function get_gateway_customer_address_state( $fields ) {
     1880        return sanitize_text_field( $fields['billing_state'] );
     1881    }
     1882
     1883    //GATEWAY GETTERS - Billing
     1884
     1885    private function get_gateway_billing_neighborhood( $fields ) {
     1886        return sanitize_text_field( $fields['billing_neighborhood'] );
     1887    }
     1888
     1889
     1890    //ANTIFRAUD GETTERS - Order
     1891
     1892    private function get_antifraud_order_id( $order ) {
     1893        return (string) $this->get_order_id( $order );
     1894    }
    18561895
    18571896    private function get_antifraud_order_fingerprint() {
     
    18671906    }
    18681907
    1869     private function get_antifraud_order_shipping_price( $order ) {
    1870         return $order->get_shipping_total();
    1871     }
    1872 
    18731908    private function get_antifraud_order_total_items( $order ) {
    1874         return $order->get_item_count();
     1909        return $order->get_subtotal();
     1910    }
     1911
     1912    private function get_antifraud_order_total_order( $order ) {
     1913        return (float) $order->get_total();
    18751914    }
    18761915
    18771916    private function get_antifraud_order_qtd_installments( $order ) {
    1878         return sanitize_text_field( get_post_meta( $this->get_order_id( $order ), '_businesspay-card-installments', true ) );
     1917        return (integer) sanitize_text_field( get_post_meta( $this->get_order_id( $order ), '_businesspay-card-installments', true ) );
    18791918    }
    18801919
     
    18871926    }
    18881927
    1889     private function get_antifraud_order_reanalyze( $order ) {
    1890         $reanalyze = get_post_meta( $this->get_order_id( $order ), '_businesspay-antifraud-reanalyze', true );
    1891         if ( empty( $reanalyze ) ) {
    1892             $reanalyze = '0';
    1893         }
    1894 
    1895         return $reanalyze;
     1928    private function get_antifraud_order_origin() {
     1929        return sanitize_text_field( $this->get_blog_domain() );
     1930    }
     1931
     1932    private function get_antifraud_order_channel_id() {
     1933        return sanitize_text_field( $this->get_blog_name() );
     1934    }
     1935
     1936    private function get_antifraud_order_product_id() {
     1937        return (integer) $this->antifraud_product_id;
     1938    }
     1939
     1940    private function get_antifraud_order_product_name() {
     1941        switch ( $this->antifraud_product_id ) {
     1942            case '1':
     1943                $result = 'Realtime Decision';
     1944                break;
     1945            case '2':
     1946                $result = 'Total ClearSale';
     1947                break;
     1948            case '3':
     1949                $result = 'Total Garantido';
     1950                break;
     1951            case '4':
     1952                $result = 'Application';
     1953                break;
     1954            default:
     1955                $result = '';
     1956                break;
     1957        }
     1958
     1959        return $result;
     1960    }
     1961
     1962    //ANTIFRAUD GETTERS - Billing
     1963
     1964    private function get_antifraud_billing_client_id( $order ) {
     1965        return sanitize_text_field( $order->get_user_id() );
    18961966    }
    18971967
    18981968    private function get_antifraud_billing_person_type( $order ) {
    1899         return sanitize_text_field( $order->get_meta( '_billing_persontype' ) );
     1969        return (integer) sanitize_text_field( $order->get_meta( '_billing_persontype' ) );
    19001970    }
    19011971
     
    19161986
    19171987    private function get_antifraud_billing_name( $order ) {
    1918         $name = sanitize_text_field( $order->get_billing_first_name() . ' ' . $order->get_billing_last_name() );
    1919 
    1920         return $name;
     1988        return sanitize_text_field( $order->get_billing_first_name() . ' ' . $order->get_billing_last_name() );
    19211989    }
    19221990
     
    19602028        $phone = str_replace( array( '(', ')', ' ', '-' ), '', sanitize_text_field( $order->get_billing_phone() ) );
    19612029        if ( strlen( $phone ) >= 11 ) {
    1962             $result = '6';
     2030            $result = 6;
    19632031        } //Celular
    1964         elseif ( $this->get_antifraud_billing_person_type( $this->get_order_id( $order ) ) == '1' ) { //Pessoa física
    1965             $result = '1'; //Residencial
     2032        elseif ( $this->get_antifraud_billing_person_type( $order ) == 1 ) { //Pessoa física
     2033            $result = 1; //Residencial
    19662034        } else { //Pessoa jurídica
    1967             $result = '2'; //Comercial
     2035            $result = 2; //Comercial
    19682036        }
    19692037
    19702038        return $result;
     2039    }
     2040
     2041    private function get_antifraud_billing_phone_ddi() {
     2042        return 55;
    19712043    }
    19722044
     
    19762048        $ddd   = str_replace( array( '(', ')' ), '', $ddd );
    19772049
    1978         return $ddd;
     2050        return (integer) $ddd;
    19792051    }
    19802052
     
    19842056        $phone = str_replace( array( '(', ')', ' ', '-' ), '', $phone );
    19852057
    1986         return $phone;
     2058        return (integer) $phone;
     2059    }
     2060
     2061    //ANTIFRAUD GETTERS - Shipping
     2062
     2063    private function get_antifraud_shipping_client_id( $order ) {
     2064        return sanitize_text_field( $order->get_user_id() );
    19872065    }
    19882066
    19892067    private function get_antifraud_shipping_person_type( $order ) {
    1990         return sanitize_text_field( $order->get_meta( '_billing_persontype' ) );
     2068        return (integer) sanitize_text_field( $order->get_meta( '_billing_persontype' ) );
    19912069    }
    19922070
     
    21062184
    21072185    private function get_antifraud_shipping_phone_type( $order ) {
    2108         $zip = trim( sanitize_text_field( $order->get_shipping_postcode() ) );
    2109         if ( empty( $zip ) ) {
    2110             $phone = sanitize_text_field( $order->get_billing_phone() );
    2111             $phone = str_replace( array( '(', ')', ' ', '-' ), '', $phone );
    2112             if ( strlen( $phone ) >= 11 ) {
    2113                 $result = '6';
    2114             } //Celular
    2115             else {
    2116                 $ptype = $this->get_antifraud_shipping_person_type( $order );
    2117                 if ( $ptype == '1' ) { //Pessoa física
    2118                     $result = '1'; //Residencial
    2119                 } else { //Pessoa jurídica
    2120                     $result = '2'; //Comercial
    2121                 }
    2122             }
     2186        $phone = str_replace( array( '(', ')', ' ', '-' ), '', sanitize_text_field( $order->get_billing_phone() ) );
     2187        if ( strlen( $phone ) >= 11 ) {
     2188            $result = 6;
     2189        } //Celular
     2190        elseif ( $this->get_antifraud_billing_person_type( $order ) == 1 ) { //Pessoa física
     2191            $result = 1; //Residencial
     2192        } else { //Pessoa jurídica
     2193            $result = 2; //Comercial
    21232194        }
    21242195
    21252196        return $result;
     2197    }
     2198
     2199    private function get_antifraud_shipping_phone_ddi() {
     2200        return 55;
    21262201    }
    21272202
     
    21312206        $ddd   = str_replace( array( '(', ')' ), '', $ddd );
    21322207
    2133         return $ddd;
     2208        return (integer) $ddd;
    21342209    }
    21352210
     
    21392214        $phone = str_replace( array( '(', ')', ' ', '-' ), '', $phone );
    21402215
    2141         return $phone;
    2142     }
     2216        return (integer) $phone;
     2217    }
     2218
     2219    private function get_antifraud_shipping_delivery_price( $order ) {
     2220        return (float) $order->get_total_shipping();
     2221    }
     2222
     2223    //ANTIFRAUD GETTERS - Payment
    21432224
    21442225    private function get_antifraud_payment_date( $order ) {
     
    21462227    }
    21472228
    2148     private function get_antifraud_payment_amount( $order ) {
    2149         return $order->get_total();
    2150     }
    2151 
    2152     private function get_antifraud_payment_type_id( $order ) {
     2229    private function get_antifraud_payment_value( $order ) {
     2230        return (float) $order->get_total();
     2231    }
     2232
     2233    private function get_antifraud_payment_type( $order ) {
    21532234        $card_type = sanitize_text_field( get_post_meta( $this->get_order_id( $order ), '_businesspay-card-type', true ) );
    21542235        if ( $card_type == '2' ) {
     
    21562237        }
    21572238
    2158         return $card_type;
     2239        return (integer) $card_type;
    21592240    }
    21602241
    21612242    private function get_antifraud_payment_qtd_installments( $order ) {
    2162         return sanitize_text_field( get_post_meta( $this->get_order_id( $order ), '_businesspay-card-installments', true ) );
     2243        return (integer) sanitize_text_field( get_post_meta( $this->get_order_id( $order ), '_businesspay-card-installments', true ) );
    21632244    }
    21642245
     
    21802261        switch ( $card_type ) {
    21812262            case 'DINERS CLUB'      :
    2182                 $card_num = '1';
     2263                $card_num = 1;
    21832264                break;
    21842265            case 'DINERSCLUB'       :
    2185                 $card_num = '1';
     2266                $card_num = 1;
    21862267                break;
    21872268            case 'DINERS'           :
    2188                 $card_num = '1';
     2269                $card_num = 1;
    21892270                break;
    21902271            case 'MASTER CARD'      :
    2191                 $card_num = '2';
     2272                $card_num = 2;
    21922273                break;
    21932274            case 'MASTERCARD'       :
    2194                 $card_num = '2';
     2275                $card_num = 2;
    21952276                break;
    21962277            case 'MASTER'           :
    2197                 $card_num = '2';
     2278                $card_num = 2;
    21982279                break;
    21992280            case 'VISA'             :
    2200                 $card_num = '3';
     2281                $card_num = 3;
    22012282                break;
    22022283            case 'AMERICAN EXPRESS' :
    2203                 $card_num = '5';
     2284                $card_num = 5;
    22042285                break;
    22052286            case 'AMERICANEXPRESS'  :
    2206                 $card_num = '5';
     2287                $card_num = 5;
    22072288                break;
    22082289            case 'AMEX'             :
    2209                 $card_num = '5';
     2290                $card_num = 5;
    22102291                break;
    22112292            case 'HIPER CARD'       :
    2212                 $card_num = '6';
     2293                $card_num = 6;
    22132294                break;
    22142295            case 'HIPERCARD'        :
    2215                 $card_num = '6';
     2296                $card_num = 6;
    22162297                break;
    22172298            case 'HIPER'            :
    2218                 $card_num = '6';
     2299                $card_num = 6;
    22192300                break;
    22202301            case 'AURA'             :
    2221                 $card_num = '7';
     2302                $card_num = 7;
    22222303                break;
    22232304            default                 :
    2224                 $card_num = '4';
     2305                $card_num = 4;
    22252306                break; //outros
    22262307        }
     
    22442325    }
    22452326
     2327    //ANTIFRAUD GETTERS - Item
     2328
    22462329    private function get_antifraud_item_id( $order_item ) {
    22472330        return sanitize_text_field( $order_item['product_id'] );
     
    22522335    }
    22532336
    2254     private function get_antifraud_item_qty( $order_item ) {
    2255         return sanitize_text_field( $order_item['qty'] );
    2256     }
    2257 
    2258     private function get_antifraud_item_gift() {
    2259         return '0';
     2337    private function get_antifraud_item_value( $order_item ) {
     2338        return (float) sanitize_text_field( $order_item->get_subtotal() );
     2339    }
     2340
     2341    private function get_antifraud_item_amount( $order_item ) {
     2342        return (integer) sanitize_text_field( $order_item['qty'] );
    22602343    }
    22612344
     
    22702353
    22712354        return $cats[0]->name;
    2272     }
    2273 
    2274     private function get_antifraud_install_origin() {
    2275         return sanitize_text_field( $this->get_blog_domain() );
    2276     }
    2277 
    2278     private function get_antifraud_install_channel_id() {
    2279         return sanitize_text_field( $this->get_blog_name() );
    22802355    }
    22812356
     
    23182393    }
    23192394
    2320     private function set_option_antifraud_entity_code_demo( $value ) {
    2321         update_option( 'businesspay_antifraud_entity_code_demo', $value );
    2322         $this->antifraud_entity_code_demo = $value;
    2323     }
    2324 
    2325     private function set_option_antifraud_entity_code_live( $value ) {
    2326         update_option( 'businesspay_antifraud_entity_code_live', $value );
    2327         $this->antifraud_entity_code_live = $value;
     2395    private function set_option_antifraud_login_demo( $value ) {
     2396        update_option( 'businesspay_antifraud_login_demo', $value );
     2397        $this->antifraud_login_demo = $value;
     2398    }
     2399
     2400    private function set_option_antifraud_login_live( $value ) {
     2401        update_option( 'businesspay_antifraud_login_live', $value );
     2402        $this->antifraud_login_live = $value;
     2403    }
     2404
     2405    private function set_option_antifraud_password_demo( $value ) {
     2406        update_option( 'businesspay_antifraud_password_demo', $value );
     2407        $this->antifraud_password_demo = $value;
     2408    }
     2409
     2410    private function set_option_antifraud_password_live( $value ) {
     2411        update_option( 'businesspay_antifraud_password_live', $value );
     2412        $this->antifraud_password_live = $value;
    23282413    }
    23292414
     
    23362421        update_option( 'businesspay_antifraud_app_id_live', $value );
    23372422        $this->antifraud_app_id_live = $value;
     2423    }
     2424
     2425    private function set_option_antifraud_product_id( $value ) {
     2426        update_option( 'businesspay_antifraud_product_id', $value );
     2427        $this->antifraud_product_id = $value;
     2428    }
     2429
     2430    private function set_option_antifraud_auth_token( $value ) {
     2431        update_option( 'businesspay_antifraud_auth_token', $value );
     2432        $this->antifraud_auth_token = $value;
     2433    }
     2434
     2435    private function set_option_antifraud_auth_expiration( $value ) {
     2436        $expiration = new DateTime( str_replace( 'T', ' ', $value ) );
     2437        $expiration->modify( '-1 minutes' );
     2438        update_option( 'businesspay_antifraud_auth_expiration', $expiration->format( $this->get_date_format() ) );
     2439        $this->antifraud_auth_expiration = $expiration;
    23382440    }
    23392441
     
    24282530
    24292531
    2430     //ANTIFRAUD SETTERS
     2532    //GETTERS
     2533
     2534    private function get_admin_url() {
     2535        if ( version_compare( WC_BusinessPay::get_woo_version(), '2.1', '>=' ) ) {
     2536            return admin_url( 'admin.php?page=wc-settings&tab=checkout&section=businesspay_gateway' );
     2537        }
     2538
     2539        return admin_url( 'admin.php?page=woocommerce_settings&tab=payment_gateways&section=WC_BusinessPay_Gateway' );
     2540    }
     2541
     2542    private function get_blog_domain() {
     2543        return str_replace( array( 'http://', 'https://', 'www.' ), '', get_option( 'siteurl' ) );
     2544    }
     2545
     2546    private function get_blog_name() {
     2547        return get_bloginfo( 'name' );
     2548    }
     2549
     2550    public function get_cart_total() {
     2551        if ( version_compare( WC_BusinessPay::get_woo_version(), '3.2.0', '>=' ) ) {
     2552            $cart_total = WC()->cart->get_cart_contents_total();
     2553        } else {
     2554            global $woocommerce;
     2555            $cart_total = $woocommerce->cart->total;
     2556        }
     2557
     2558        return $cart_total;
     2559    }
     2560
     2561    public function get_order_id( $order ) {
     2562        return $order->get_id();
     2563    }
     2564
     2565    public function get_total_order( $order ) {
     2566        return $order->get_total();
     2567    }
     2568
     2569    public function get_currency_symbol() {
     2570        return get_woocommerce_currency_symbol();
     2571    }
     2572
     2573    private function get_postback_url() {
     2574        if ( version_compare( WC()->version, '2.1', '>=' ) ) {
     2575            $site_url = home_url( '/wc-api/WC_BusinessPay_Gateway/' );
     2576        } else {
     2577            $site_url = home_url( '/?wc-api=WC_BusinessPay_Gateway' );
     2578        }
     2579
     2580        return $site_url;
     2581    }
     2582
     2583    public function get_date_format() {
     2584        return 'Y-m-d H:i:s';
     2585    }
     2586
     2587    private function get_date_interval( $date_start, $interval, $measure ) {
     2588        $result = $date_start;
     2589        try {
     2590            if ( empty( $interval ) ) {
     2591                $interval = $this->default_session_interval;
     2592            }
     2593
     2594            switch ( $measure ) {
     2595                case 'days' :
     2596                    $interval_spec = 'P' . $interval . 'D';
     2597                    break;
     2598                case 'hours':
     2599                    $interval_spec = 'PT' . $interval . 'H';
     2600                    break;
     2601                default     :
     2602                    $interval_spec = 'PT' . $interval . 'H';
     2603                    break;
     2604            }
     2605
     2606            $date_interval = new DateTime( 'now', new DateTimeZone( get_option( 'timezone_string' ) ) );
     2607            $date_interval->add( new DateInterval( $interval_spec ) );
     2608            $result = $date_interval->format( $this->get_date_format() );
     2609        } catch ( Exception $e ) {
     2610            $this->logger( 'Get Date Interval Error', $e->getMessage() );
     2611        }
     2612
     2613        return $result;
     2614    }
     2615
     2616    private function get_session() {
     2617        $today     = current_time( 'mysql' );
     2618        $auth_last = get_option( 'businesspay_auth_last' );
     2619        $auth_next = get_option( 'businesspay_auth_next' );
     2620
     2621        $session = ( $auth_last == '' ) || ( $auth_next == '' ) || ( strtotime( $auth_next ) < strtotime( $today ) );
     2622
     2623        if ( $session ) {
     2624            $this->get_session_info();
     2625        }
     2626
     2627        $client  = get_option( 'businesspay_enable_client' );
     2628        $install = get_option( 'businesspay_enable_install' );
     2629
     2630        return ( $client && $install );
     2631    }
     2632
     2633    private function get_session_info() {
     2634        try {
     2635            if ( ! empty( $this->authentication_api ) && ! empty( $this->authentication_key ) ) {
     2636                $action = $this->auth_schema . '://' . $this->auth_gateway . '.' . $this->authority . '.com.br';
     2637                $action .= '/' . $this->auth_api . '/' . $this->auth_scope . '/' . $this->auth_version . '/' . $this->auth_validate;
     2638
     2639                $body = array(
     2640                    'vendor_id'      => $this->auth_vendor_id,
     2641                    'name'           => substr( get_bloginfo( 'name' ), 0, 50 ),
     2642                    'domain'         => str_replace( array(
     2643                        'http://',
     2644                        'https://',
     2645                        'www.'
     2646                    ), '', get_option( 'siteurl' ) ),
     2647                    'mode_api'       => ( $this->sandbox == 'yes' ) ? 'demo' : 'live',
     2648                    'postback_url'   => $this->get_postback_url(),
     2649                    'version_api'    => ( $this->sandbox == 'yes' ) ? str_replace( 'v', '', $this->gateway_demo_version ) : str_replace( 'v', '', $this->gateway_live_version ),
     2650                    'version_wp'     => get_bloginfo( 'version' ),
     2651                    'version_plugin' => WC_BusinessPay::VERSION,
     2652                    'version_php'    => WC_BusinessPay::get_php_version(),
     2653                    'version_woo'    => WC_BusinessPay::get_woo_version()
     2654                );
     2655
     2656                $payload = array(
     2657                    'method'    => 'POST',
     2658                    'sslverify' => true,
     2659                    'timeout'   => 60,
     2660                    'headers'   => array(
     2661                        'Content-Type'      => 'application/json',
     2662                        'authenticationApi' => $this->authentication_api,
     2663                        'authenticationKey' => $this->authentication_key
     2664                    ),
     2665                    'body'      => json_encode( $body )
     2666                );
     2667
     2668                $this->logger( 'Session Info | Request', $payload );
     2669
     2670                $response = wp_safe_remote_post( $action, $payload );
     2671
     2672                $this->logger( 'Session Info | Response', $response );
     2673
     2674                if ( ! is_wp_error( $response ) ) {
     2675                    $response_body = wp_remote_retrieve_body( $response );
     2676                    $response_body = $this->clear_response( $response_body );
     2677
     2678                    if ( ! empty( $response_body ) ) {
     2679                        $response = json_decode( $response_body );
     2680                        if ( ! empty( $response->auth_interval ) ) {
     2681                            $today = current_time( 'mysql' );
     2682                            $next  = $this->get_date_interval( $today, $response->auth_interval, 'hours' );
     2683
     2684                            $this->set_option_auth_last( $today );
     2685                            $this->set_option_auth_next( $next );
     2686                            $this->set_option_auth_id( $response->id );
     2687                            $this->set_option_auth_interval( $response->auth_interval );
     2688                            $this->set_option_enable_client( $response->client_enabled );
     2689                            $this->set_option_enable_install( $response->install_enabled );
     2690                            $this->set_option_enable_antifraud( $response->antifraud_enabled );
     2691                            $this->set_option_antifraud_product_id( $response->antifraud_product_id );
     2692                            $this->set_option_antifraud_login_demo( $response->antifraud_login_demo );
     2693                            $this->set_option_antifraud_login_live( $response->antifraud_login_live );
     2694                            $this->set_option_antifraud_password_demo( $response->antifraud_password_demo );
     2695                            $this->set_option_antifraud_password_live( $response->antifraud_password_live );
     2696                            $this->set_option_antifraud_app_id_demo( $response->antifraud_app_id_demo );
     2697                            $this->set_option_antifraud_app_id_live( $response->antifraud_app_id_live );
     2698                        }
     2699                    }
     2700                }
     2701            }
     2702        } catch ( Exception $e ) {
     2703            $this->logger( 'Get Session Info Error', $e->getMessage() );
     2704        }
     2705    }
     2706
     2707    private function get_session_id() {
     2708        $result = session_id();
     2709        if ( empty( $result ) ) {
     2710            session_start();
     2711            $result = session_id();
     2712        }
     2713
     2714        return $result;
     2715    }
     2716
     2717    private function get_response_url( $order, $response ) {
     2718        if ( isset( $response->payment->electronicTransfer->url ) ) {
     2719            $url = $response->payment->electronicTransfer->url;
     2720        } elseif ( isset( $response->payment->bankSlip->url ) ) {
     2721            $url = $response->payment->bankSlip->url;
     2722        } else {
     2723            $url = $this->get_return_url( $order );
     2724        }
     2725
     2726        return $url;
     2727    }
    24312728
    24322729
     
    25462843    private function clear_response( $response ) {
    25472844        return strstr( $response, '{' ); //clear response body hack
     2845    }
     2846
     2847    private function update_order_status( $order, $status, $note ) {
     2848        if ( $order->get_status() == $status ) {
     2849            $order->add_order_note( $note );
     2850        } else {
     2851            $order->update_status( $status, $note );
     2852        }
    25482853    }
    25492854
     
    26782983        echo sprintf( '<div class="error"><p><strong>%s</strong> %s</p></div>', $msg1, $msg2 );
    26792984    }
     2985
    26802986}
  • woo-businesspay/trunk/languages/woocommerce-businesspay-pt_BR.po

    r1966668 r1977545  
    33"Project-Id-Version: WooCommerce BusinessPay\n"
    44"Report-Msgid-Bugs-To: \n"
    5 "POT-Creation-Date: 2018-10-31 17:48+0000\n"
    6 "PO-Revision-Date: 2018-10-31 18:04+0000\n"
     5"POT-Creation-Date: 2018-11-20 16:10+0000\n"
     6"PO-Revision-Date: 2018-11-20 16:11+0000\n"
    77"Last-Translator: webmaster <webmaster@hypelab.com.br>\n"
    88"Language-Team: Português do Brasil\n"
     
    1212"Content-Type: text/plain; charset=UTF-8\n"
    1313"Content-Transfer-Encoding: 8bit\n"
    14 "X-Generator: Loco https://localise.biz/"
     14"X-Generator: Loco https://localise.biz/\n"
     15"X-Loco-Version: 2.2.0; wp-4.9.8"
    1516
    1617#: templates/missing-woocommerce-template.php:18
     
    2627msgstr "Instalar WooCommerce"
    2728
    28 #: templates/businesspay-panel-gateway.php:19
    29 #: templates/businesspay-panel-antifraud.php:19
     29#: templates/businesspay-panel-gateway.php:18
     30#: templates/businesspay-panel-antifraud.php:20
    3031msgid "\\a\\t"
    3132msgstr "\\à\\s"
    3233
    33 #: templates/businesspay-panel-gateway.php:26
    34 #: includes/woocommerce-businesspay-gateway.php:317
     34#: templates/businesspay-panel-gateway.php:25
     35#: includes/woocommerce-businesspay-gateway.php:329
    3536msgid "Debit Card"
    3637msgstr "Cartão de débito"
    3738
    38 #: templates/businesspay-panel-gateway.php:28
     39#: templates/businesspay-panel-gateway.php:27
    3940#: templates/frontend-template.php:87
    4041msgid "At sight via debit"
    4142msgstr "À vista via débito em conta"
    4243
    43 #: templates/businesspay-panel-gateway.php:31
    44 #: includes/woocommerce-businesspay-gateway.php:228
     44#: templates/businesspay-panel-gateway.php:30
     45#: includes/woocommerce-businesspay-gateway.php:240
    4546msgid "Credit Card"
    4647msgstr "Cartão de crédito"
    4748
    48 #: templates/businesspay-panel-gateway.php:33
     49#: templates/businesspay-panel-gateway.php:32
    4950msgid "Unknown Brand"
    5051msgstr "Bandeira desconhecida"
    5152
    52 #: templates/businesspay-panel-gateway.php:39
     53#: templates/businesspay-panel-gateway.php:38
    5354#: templates/frontend-template.php:95
    5455msgid "In "
    5556msgstr "Em "
    5657
    57 #: templates/businesspay-panel-gateway.php:39
     58#: templates/businesspay-panel-gateway.php:38
    5859#: templates/frontend-template.php:95
    5960msgid "x of "
    6061msgstr "x de "
    6162
    62 #: templates/businesspay-panel-gateway.php:39
     63#: templates/businesspay-panel-gateway.php:38
    6364#: templates/frontend-template.php:95
    6465msgid " on credit card"
    6566msgstr " no cartão de crédito"
    6667
    67 #: templates/businesspay-panel-gateway.php:43
     68#: templates/businesspay-panel-gateway.php:42
    6869msgid "Bank Transference"
    6970msgstr "Transferência bancária"
    7071
    71 #: templates/businesspay-panel-gateway.php:49
    72 #: templates/businesspay-panel-gateway.php:57
    73 #: templates/businesspay-panel-gateway.php:79
    74 #: templates/businesspay-panel-gateway.php:87
     72#: templates/businesspay-panel-gateway.php:48
     73#: templates/businesspay-panel-gateway.php:56
     74#: templates/businesspay-panel-gateway.php:78
     75#: templates/businesspay-panel-gateway.php:86
    7576msgid "Unavailable"
    7677msgstr "Indisponível"
    7778
    78 #: templates/businesspay-panel-gateway.php:65
     79#: templates/businesspay-panel-gateway.php:64
    7980#: templates/frontend-template.php:26
    80 #: includes/woocommerce-businesspay-gateway.php:333
     81#: includes/woocommerce-businesspay-gateway.php:345
    8182msgid "Billet"
    8283msgstr "Boleto"
    8384
    84 #: templates/businesspay-panel-gateway.php:94
     85#: templates/businesspay-panel-gateway.php:93
    8586msgid "Unknown"
    8687msgstr "Desconhecido"
    8788
    88 #: templates/businesspay-panel-gateway.php:103
     89#: templates/businesspay-panel-gateway.php:102
    8990msgid "Transaction Information"
    9091msgstr "Informações da Transação"
    9192
    92 #: templates/businesspay-panel-gateway.php:104
    93 #: templates/businesspay-panel-antifraud.php:33
     93#: templates/businesspay-panel-gateway.php:103
    9494msgid "Token: "
    9595msgstr "Token:"
    9696
    97 #: templates/businesspay-panel-gateway.php:106
    98 #: templates/businesspay-panel-antifraud.php:37
     97#: templates/businesspay-panel-gateway.php:105
     98#: templates/businesspay-panel-antifraud.php:36
    9999msgid "Date: "
    100100msgstr "Data: "
    101101
    102 #: templates/businesspay-panel-gateway.php:108
    103 #: templates/businesspay-panel-antifraud.php:39
     102#: templates/businesspay-panel-gateway.php:107
     103#: templates/businesspay-panel-antifraud.php:38
    104104msgid "Status: "
    105105msgstr "Status: "
    106106
    107 #: templates/businesspay-panel-gateway.php:110
     107#: templates/businesspay-panel-gateway.php:109
    108108msgid "Payment Information"
    109109msgstr "Informações do pagamento"
    110110
    111 #: templates/businesspay-panel-gateway.php:111
     111#: templates/businesspay-panel-gateway.php:110
    112112msgid "Type: "
    113113msgstr "Tipo: "
    114114
    115 #: templates/businesspay-panel-gateway.php:114
     115#: templates/businesspay-panel-gateway.php:113
    116116msgid "Brand: "
    117117msgstr "Bandeira: "
    118118
    119 #: templates/businesspay-panel-gateway.php:116
     119#: templates/businesspay-panel-gateway.php:115
    120120msgid "Installments: "
    121121msgstr "Parcelas: "
    122122
    123 #: templates/businesspay-panel-gateway.php:119
     123#: templates/businesspay-panel-gateway.php:118
    124124msgid "Origin Bank: "
    125125msgstr "Banco de origem: "
    126126
    127 #: templates/businesspay-panel-gateway.php:121
     127#: templates/businesspay-panel-gateway.php:120
    128128msgid "Reference Code: "
    129129msgstr "Código de referência: "
    130130
    131 #: templates/businesspay-panel-gateway.php:123
    132 #: templates/businesspay-panel-gateway.php:135
     131#: templates/businesspay-panel-gateway.php:122
     132#: templates/businesspay-panel-gateway.php:134
    133133msgid "Payment Date: "
    134134msgstr "Data do pagamento: "
    135135
    136 #: templates/businesspay-panel-gateway.php:125
    137 #: templates/businesspay-panel-gateway.php:137
     136#: templates/businesspay-panel-gateway.php:124
     137#: templates/businesspay-panel-gateway.php:136
    138138msgid "Payment Amount: "
    139139msgstr "Valor pago: "
    140140
    141 #: templates/businesspay-panel-gateway.php:127
     141#: templates/businesspay-panel-gateway.php:126
    142142msgid "Provider Bank: "
    143143msgstr "Banco emissor: "
    144144
    145 #: templates/businesspay-panel-gateway.php:129
     145#: templates/businesspay-panel-gateway.php:128
    146146msgid "Provider Reference: "
    147147msgstr "Referência do emissor: "
    148148
    149 #: templates/businesspay-panel-gateway.php:131
     149#: templates/businesspay-panel-gateway.php:130
    150150msgid "Emission Date: "
    151151msgstr "Data de emissão: "
    152152
    153 #: templates/businesspay-panel-gateway.php:133
     153#: templates/businesspay-panel-gateway.php:132
    154154msgid "Expiration Date: "
    155155msgstr "Data de expiração: "
     
    202202msgstr "depende de um certificado SSL ativo para funcionar!"
    203203
    204 #: templates/businesspay-panel-antifraud.php:32
     204#: templates/businesspay-panel-antifraud.php:33
    205205msgid "Analysis Information"
    206 msgstr ""
    207 
    208 #: templates/businesspay-panel-antifraud.php:35
     206msgstr "Dados da Análise"
     207
     208#: templates/businesspay-panel-antifraud.php:34
    209209msgid "ID: "
    210210msgstr "ID: "
    211211
    212 #: templates/businesspay-panel-antifraud.php:41
     212#: templates/businesspay-panel-antifraud.php:40
     213msgid "Score: "
     214msgstr "Score: "
     215
     216#: templates/businesspay-panel-antifraud.php:42
    213217msgid "Message: "
    214 msgstr ""
     218msgstr "Mensagem: "
    215219
    216220#: templates/frontend-template.php:16
     
    219223
    220224#: templates/frontend-template.php:21
    221 #: includes/woocommerce-businesspay-gateway.php:325
     225#: includes/woocommerce-businesspay-gateway.php:337
    222226msgid "Bank Transfer"
    223227msgstr "Transferência"
     
    305309msgstr "Esta compra está sendo feita no Brasil"
    306310
    307 #: includes/woocommerce-businesspay-gateway.php:25
     311#: includes/woocommerce-businesspay-gateway.php:26
    308312msgid "BusinessPay"
    309313msgstr "BusinessPay"
    310314
    311 #: includes/woocommerce-businesspay-gateway.php:26
     315#: includes/woocommerce-businesspay-gateway.php:27
    312316msgid "Accept payments using BusinessPay Gateway."
    313317msgstr "Receba pagamentos usando o BusinessPay."
    314318
    315 #: includes/woocommerce-businesspay-gateway.php:156
     319#: includes/woocommerce-businesspay-gateway.php:162
    316320msgid "Account Enabled"
    317321msgstr "Conta habilitada."
    318322
    319 #: includes/woocommerce-businesspay-gateway.php:156
     323#: includes/woocommerce-businesspay-gateway.php:162
    320324msgid "Account Disabled"
    321325msgstr "Conta inativa ou inexistente."
    322326
    323 #: includes/woocommerce-businesspay-gateway.php:157
     327#: includes/woocommerce-businesspay-gateway.php:163
    324328msgid "Installation Enabled"
    325329msgstr "Instalação habilitada."
    326330
    327 #: includes/woocommerce-businesspay-gateway.php:157
     331#: includes/woocommerce-businesspay-gateway.php:163
    328332msgid "Installation Disabled"
    329333msgstr "Instalação não registrada."
    330334
    331 #: includes/woocommerce-businesspay-gateway.php:158
     335#: includes/woocommerce-businesspay-gateway.php:164
    332336msgid "Antifraud Enabled"
    333337msgstr "Antifraude habilitado."
    334338
    335 #: includes/woocommerce-businesspay-gateway.php:158
     339#: includes/woocommerce-businesspay-gateway.php:164
    336340msgid "Antifraud Disabled"
    337341msgstr "Antifraude desabilitado."
    338342
    339 #: includes/woocommerce-businesspay-gateway.php:160
     343#: includes/woocommerce-businesspay-gateway.php:165
     344msgid "Product not configured"
     345msgstr "Produto não configurado"
     346
     347#: includes/woocommerce-businesspay-gateway.php:167
    340348msgid "Client Account:"
    341349msgstr "Conta do cliente:"
    342350
    343 #: includes/woocommerce-businesspay-gateway.php:161
     351#: includes/woocommerce-businesspay-gateway.php:168
    344352msgid "Client Installation:"
    345353msgstr "Instalação do cliente:"
    346354
    347 #: includes/woocommerce-businesspay-gateway.php:162
     355#: includes/woocommerce-businesspay-gateway.php:169
    348356msgid "Client Antifraud:"
    349357msgstr "Antifraude do cliente:"
    350358
    351 #: includes/woocommerce-businesspay-gateway.php:171
     359#: includes/woocommerce-businesspay-gateway.php:170
     360msgid "Antifraud Product:"
     361msgstr "Produto Antifraude: "
     362
     363#: includes/woocommerce-businesspay-gateway.php:183
    352364msgid "Antifraud by "
    353365msgstr "Antifraude por "
    354366
    355 #: includes/woocommerce-businesspay-gateway.php:180
     367#: includes/woocommerce-businesspay-gateway.php:192
    356368msgid "BusinessPay Payment Gateway"
    357369msgstr "BusinessPay"
    358370
    359 #: includes/woocommerce-businesspay-gateway.php:185
     371#: includes/woocommerce-businesspay-gateway.php:197
    360372msgid "Enable BusinessPay"
    361373msgstr "Habilita checkout BusinessPay"
    362374
    363 #: includes/woocommerce-businesspay-gateway.php:186
     375#: includes/woocommerce-businesspay-gateway.php:198
    364376msgid "Enable BusinessPay Gateway Plugin"
    365377msgstr "Habilita plugin de pagamentos BusinessPay"
    366378
    367 #: includes/woocommerce-businesspay-gateway.php:187
     379#: includes/woocommerce-businesspay-gateway.php:199
    368380msgid "Enable BusinessPay gateway plugin options."
    369381msgstr "Habilita opções do plugin de pagamentos BusinessPay"
    370382
    371 #: includes/woocommerce-businesspay-gateway.php:193
     383#: includes/woocommerce-businesspay-gateway.php:205
    372384msgid "Title"
    373385msgstr "Título"
    374386
    375 #: includes/woocommerce-businesspay-gateway.php:194
     387#: includes/woocommerce-businesspay-gateway.php:206
    376388msgid "Payment method title seen on the checkout page."
    377389msgstr "Título do método de pagamento visto na página de checkout."
    378390
    379 #: includes/woocommerce-businesspay-gateway.php:195
     391#: includes/woocommerce-businesspay-gateway.php:207
    380392msgid "BusinessPay | Payments via credit card, debit and billet."
    381393msgstr "BusinessPay | Pagamentos via cartão de crédito, débito e boleto."
    382394
    383 #: includes/woocommerce-businesspay-gateway.php:200
     395#: includes/woocommerce-businesspay-gateway.php:212
    384396msgid "Description"
    385397msgstr "Descrição"
    386398
    387 #: includes/woocommerce-businesspay-gateway.php:201
     399#: includes/woocommerce-businesspay-gateway.php:213
    388400msgid "Payment method description seen on the checkout page."
    389401msgstr "Descrição do método de pagamento visto na página de checkout."
    390402
    391 #: includes/woocommerce-businesspay-gateway.php:202
     403#: includes/woocommerce-businesspay-gateway.php:214
    392404msgid "Pay using BusinessPay, a secure experience of online buys."
    393405msgstr "Pague usando BusinessPay, uma experiência segura de compras online."
    394406
    395 #: includes/woocommerce-businesspay-gateway.php:207
     407#: includes/woocommerce-businesspay-gateway.php:219
    396408msgid "Gateway Settings"
    397409msgstr "Configurações do gateway"
    398410
    399 #: includes/woocommerce-businesspay-gateway.php:212
     411#: includes/woocommerce-businesspay-gateway.php:224
    400412msgid "Authentication API"
    401413msgstr "Usuário da API"
    402414
    403 #: includes/woocommerce-businesspay-gateway.php:213
     415#: includes/woocommerce-businesspay-gateway.php:225
    404416msgid "Use your BusinessPay Authentication API"
    405417msgstr "Insira seu usuário da API BusinessPay"
    406418
    407 #: includes/woocommerce-businesspay-gateway.php:220
     419#: includes/woocommerce-businesspay-gateway.php:232
    408420msgid "Authentication Key"
    409421msgstr "Chave da API"
    410422
    411 #: includes/woocommerce-businesspay-gateway.php:221
     423#: includes/woocommerce-businesspay-gateway.php:233
    412424msgid "Use your BusinessPay Authentication Key"
    413425msgstr "Insira sua chave da API BusinessPay"
    414426
    415 #: includes/woocommerce-businesspay-gateway.php:229
     427#: includes/woocommerce-businesspay-gateway.php:241
    416428msgid "Enable credit card payments with BusinessPay"
    417429msgstr "Habilita pagamentos com cartão de crédito"
    418430
    419 #: includes/woocommerce-businesspay-gateway.php:230
     431#: includes/woocommerce-businesspay-gateway.php:242
    420432msgid "Enable credit card payment with BusinessPay on checkout page"
    421433msgstr "Habilita cartão de crédito com BusinessPay na página de checkout"
    422434
    423 #: includes/woocommerce-businesspay-gateway.php:235
     435#: includes/woocommerce-businesspay-gateway.php:247
    424436msgid "Credit Card Settings"
    425437msgstr "Configurações de cartão de crédito"
    426438
    427 #: includes/woocommerce-businesspay-gateway.php:241
     439#: includes/woocommerce-businesspay-gateway.php:253
    428440msgid "Name in Invoice"
    429441msgstr "Nome na fatura"
    430442
    431 #: includes/woocommerce-businesspay-gateway.php:242
     443#: includes/woocommerce-businesspay-gateway.php:254
    432444msgid ""
    433445"Name in Invoice to identify Shop. Its important to avoid gateway chargebacks."
     
    436448"chargebacks no Gateway."
    437449
    438 #: includes/woocommerce-businesspay-gateway.php:249
     450#: includes/woocommerce-businesspay-gateway.php:261
    439451msgid "Invoice Prefix"
    440452msgstr "Prefixo da fatura"
    441453
    442 #: includes/woocommerce-businesspay-gateway.php:250
     454#: includes/woocommerce-businesspay-gateway.php:262
    443455msgid "Shop prefix to identify invoice shop origin"
    444456msgstr "Prefixo da loja para identificar a loja de origem do pedido"
    445457
    446 #: includes/woocommerce-businesspay-gateway.php:256
     458#: includes/woocommerce-businesspay-gateway.php:268
    447459msgid "Installments"
    448460msgstr "Parcelamento"
    449461
    450 #: includes/woocommerce-businesspay-gateway.php:258
     462#: includes/woocommerce-businesspay-gateway.php:270
    451463msgid "Enable Installments"
    452464msgstr "Habilita parcelamento com cartão de crédito"
    453465
    454 #: includes/woocommerce-businesspay-gateway.php:262
     466#: includes/woocommerce-businesspay-gateway.php:274
    455467msgid "Installments Settings"
    456468msgstr "Configurações de parcelamento"
    457469
    458 #: includes/woocommerce-businesspay-gateway.php:267
     470#: includes/woocommerce-businesspay-gateway.php:279
    459471msgid "Minimum Installment"
    460472msgstr "Parcelamento mínimo"
    461473
    462 #: includes/woocommerce-businesspay-gateway.php:269
     474#: includes/woocommerce-businesspay-gateway.php:281
    463475msgid "Indicate the minimum installments."
    464476msgstr "Indica o mínimo de parcelas."
    465477
    466 #: includes/woocommerce-businesspay-gateway.php:288
     478#: includes/woocommerce-businesspay-gateway.php:300
    467479msgid "Maximum Installment"
    468480msgstr "Parcelamento máximo"
    469481
    470 #: includes/woocommerce-businesspay-gateway.php:290
     482#: includes/woocommerce-businesspay-gateway.php:302
    471483msgid "Indicate the Maximum installments."
    472484msgstr "Indica o máximo de parcelas."
    473485
    474 #: includes/woocommerce-businesspay-gateway.php:309
     486#: includes/woocommerce-businesspay-gateway.php:321
    475487msgid "Minimum Value"
    476488msgstr "Valor mínimo"
    477489
    478 #: includes/woocommerce-businesspay-gateway.php:310
     490#: includes/woocommerce-businesspay-gateway.php:322
    479491msgid "Minimum value by installment"
    480492msgstr "Valor mínimo por parcela"
    481493
    482 #: includes/woocommerce-businesspay-gateway.php:318
     494#: includes/woocommerce-businesspay-gateway.php:330
    483495msgid "Enable debit card payments with BusinessPay"
    484496msgstr "Habilita pagamentos por cartão de débito"
    485497
    486 #: includes/woocommerce-businesspay-gateway.php:319
     498#: includes/woocommerce-businesspay-gateway.php:331
    487499msgid "Enable debit card payment on checkout page"
    488500msgstr "Habilita cartão de débito na página de checkout"
    489501
    490 #: includes/woocommerce-businesspay-gateway.php:326
     502#: includes/woocommerce-businesspay-gateway.php:338
    491503msgid "Enable bank transfer payments with BusinessPay"
    492504msgstr "Habilita pagamentos por transferência bancária"
    493505
    494 #: includes/woocommerce-businesspay-gateway.php:327
     506#: includes/woocommerce-businesspay-gateway.php:339
    495507msgid "Enable bank transfer payment on checkout page"
    496508msgstr "Habilita pagamentos por transferência bancária na página de checkout"
    497509
    498 #: includes/woocommerce-businesspay-gateway.php:334
     510#: includes/woocommerce-businesspay-gateway.php:346
    499511msgid "Enable billet payments with BusinessPay"
    500512msgstr "Habilita pagamentos por boleto bancário"
    501513
    502 #: includes/woocommerce-businesspay-gateway.php:335
     514#: includes/woocommerce-businesspay-gateway.php:347
    503515msgid "Enable billet payment on checkout page"
    504516msgstr "Habilita pagamento por boleto na página de checkout"
    505517
    506 #: includes/woocommerce-businesspay-gateway.php:340
     518#: includes/woocommerce-businesspay-gateway.php:352
    507519msgid "Billet Settings"
    508520msgstr "Configurações de boleto"
    509521
    510 #: includes/woocommerce-businesspay-gateway.php:346
     522#: includes/woocommerce-businesspay-gateway.php:358
    511523msgid "Custom Logo URL"
    512524msgstr "URL do logotipo customizado"
    513525
    514 #: includes/woocommerce-businesspay-gateway.php:347
     526#: includes/woocommerce-businesspay-gateway.php:359
    515527msgid "URL logo image to be shown on the billet"
    516528msgstr "URL da imagem do logotipo a ser exibido no boleto"
    517529
    518 #: includes/woocommerce-businesspay-gateway.php:352
     530#: includes/woocommerce-businesspay-gateway.php:364
    519531msgid "Number of Days"
    520532msgstr "Dias para vencimento"
    521533
    522 #: includes/woocommerce-businesspay-gateway.php:354
     534#: includes/woocommerce-businesspay-gateway.php:366
    523535msgid "Days of expiry of the billet after printed."
    524536msgstr "Dias para expiração do boleto após impresso."
    525537
    526 #: includes/woocommerce-businesspay-gateway.php:361
     538#: includes/woocommerce-businesspay-gateway.php:373
    527539msgid "Instruction Line"
    528540msgstr "Linha de instrução"
    529541
    530 #: includes/woocommerce-businesspay-gateway.php:362
     542#: includes/woocommerce-businesspay-gateway.php:374
    531543msgid "Billet instruction line"
    532544msgstr "Linha de instrução do boleto"
    533545
    534 #: includes/woocommerce-businesspay-gateway.php:367
     546#: includes/woocommerce-businesspay-gateway.php:379
    535547msgid "Tools"
    536548msgstr "Ferramentas"
    537549
    538 #: includes/woocommerce-businesspay-gateway.php:373
     550#: includes/woocommerce-businesspay-gateway.php:385
    539551msgid "BusinessPay Sandbox"
    540552msgstr "Ambiente de testes"
    541553
    542 #: includes/woocommerce-businesspay-gateway.php:374
     554#: includes/woocommerce-businesspay-gateway.php:386
    543555msgid "Enable BusinessPay sandbox mode"
    544556msgstr "Habilita ambiente de testes do BusinessPay"
    545557
    546 #: includes/woocommerce-businesspay-gateway.php:375
     558#: includes/woocommerce-businesspay-gateway.php:387
    547559msgid "Enable BusinessPay Sandbox"
    548560msgstr "Habilita sandbox do BusinessPay"
    549561
    550 #: includes/woocommerce-businesspay-gateway.php:382
     562#: includes/woocommerce-businesspay-gateway.php:394
    551563msgid "Debug"
    552564msgstr "Log de erros"
    553565
    554 #: includes/woocommerce-businesspay-gateway.php:383
     566#: includes/woocommerce-businesspay-gateway.php:395
    555567msgid "Enable logging"
    556568msgstr "Habilitar log de erros do WooCommerce"
    557569
    558 #: includes/woocommerce-businesspay-gateway.php:389
     570#: includes/woocommerce-businesspay-gateway.php:401
    559571msgid "Status"
    560572msgstr "Status"
    561573
    562 #: includes/woocommerce-businesspay-gateway.php:411
     574#: includes/woocommerce-businesspay-gateway.php:423
    563575msgid "Card number must be at least 16 characters."
    564576msgstr "O campo Número do cartão deve conter pelo menos 15 caracteres."
    565577
    566 #: includes/woocommerce-businesspay-gateway.php:414
     578#: includes/woocommerce-businesspay-gateway.php:426
    567579msgid "The Card Number field must be numeric."
    568580msgstr "O campo Número do cartão deve ser numérico."
    569581
    570 #: includes/woocommerce-businesspay-gateway.php:417
     582#: includes/woocommerce-businesspay-gateway.php:429
    571583msgid "Invalid card number."
    572584msgstr "Número de cartão inválido."
    573585
    574 #: includes/woocommerce-businesspay-gateway.php:424
     586#: includes/woocommerce-businesspay-gateway.php:436
    575587msgid "The Name field can not be less than 6 characters."
    576588msgstr "O campo Nome não pode conter menos que 6 caracteres."
    577589
    578 #: includes/woocommerce-businesspay-gateway.php:427
     590#: includes/woocommerce-businesspay-gateway.php:439
    579591msgid "The Name field can not be greater than 25 characters."
    580592msgstr "O campo Nome não pode conter mais que 25 caracteres."
    581593
    582 #: includes/woocommerce-businesspay-gateway.php:430
     594#: includes/woocommerce-businesspay-gateway.php:442
    583595msgid "The Name field can not have numbers."
    584596msgstr "O campo Nome não pode conter números."
    585597
    586 #: includes/woocommerce-businesspay-gateway.php:440
     598#: includes/woocommerce-businesspay-gateway.php:452
    587599msgid "The Month of Expiration field must have 2 digits."
    588600msgstr "O valor do mês de expiração deve conter 2 dígitos."
    589601
    590 #: includes/woocommerce-businesspay-gateway.php:443
     602#: includes/woocommerce-businesspay-gateway.php:455
    591603msgid "The Month of Expiration field must be numeric."
    592604msgstr "O valor do mês de expiração deve ser numérico."
    593605
    594 #: includes/woocommerce-businesspay-gateway.php:446
     606#: includes/woocommerce-businesspay-gateway.php:458
    595607msgid "The Year of Expiration field must be numeric."
    596608msgstr "O valor do ano de expiração deve ser numérico."
    597609
    598 #: includes/woocommerce-businesspay-gateway.php:449
     610#: includes/woocommerce-businesspay-gateway.php:461
    599611msgid "The Year of Expiration field must have 4 digits."
    600612msgstr "O valor do ano de expiração deve conter 4 dígitos."
    601613
    602 #: includes/woocommerce-businesspay-gateway.php:456
    603 #: includes/woocommerce-businesspay-gateway.php:462
     614#: includes/woocommerce-businesspay-gateway.php:468
     615#: includes/woocommerce-businesspay-gateway.php:474
    604616msgid "The CVC field must have 3 or 4 digits."
    605617msgstr "O campo CVC deve conter 3 ou 4 dígitos."
    606618
    607 #: includes/woocommerce-businesspay-gateway.php:459
     619#: includes/woocommerce-businesspay-gateway.php:471
    608620msgid "The CVC field must be numeric."
    609621msgstr "O campo CVC deve ser numérico."
    610622
    611 #: includes/woocommerce-businesspay-gateway.php:469
     623#: includes/woocommerce-businesspay-gateway.php:481
    612624msgid "Please select a installment option."
    613625msgstr "Por favor selecione uma opção de parcelamento."
    614626
    615 #: includes/woocommerce-businesspay-gateway.php:476
     627#: includes/woocommerce-businesspay-gateway.php:492
    616628msgid "The Document field must have 11 digits for CPF or 14 digits for CNPJ."
    617629msgstr ""
     
    619631"dígitos para CNPJ."
    620632
    621 #: includes/woocommerce-businesspay-gateway.php:479
     633#: includes/woocommerce-businesspay-gateway.php:495
    622634msgid "The Document field must be numeric."
    623635msgstr "O campo CPF ou CNPJ do portador deve ser numérico."
    624636
    625 #: includes/woocommerce-businesspay-gateway.php:482
     637#: includes/woocommerce-businesspay-gateway.php:498
    626638msgid "The Document field as CPF is invalid."
    627639msgstr "O valor do campo CPF ou CNPJ do portador como CPF é inválido."
    628640
    629 #: includes/woocommerce-businesspay-gateway.php:485
     641#: includes/woocommerce-businesspay-gateway.php:501
    630642msgid "The Document field as CNPJ is invalid."
    631643msgstr "O valor do campo CPF ou CNPJ do portador como CNPJ é inválido."
    632644
    633 #: includes/woocommerce-businesspay-gateway.php:493
     645#: includes/woocommerce-businesspay-gateway.php:509
    634646msgid "Please select a origin transfer bank option."
    635647msgstr "Por favor selecione o banco de origem da transferência."
    636648
    637 #: includes/woocommerce-businesspay-gateway.php:499
    638 #: includes/woocommerce-businesspay-gateway.php:512
     649#: includes/woocommerce-businesspay-gateway.php:515
     650#: includes/woocommerce-businesspay-gateway.php:528
    639651msgid "The Neighborhood field need to be filled."
    640652msgstr "O campo Bairro é obrigatório."
    641653
    642 #: includes/woocommerce-businesspay-gateway.php:506
     654#: includes/woocommerce-businesspay-gateway.php:522
    643655msgid "Please select a origin billet bank option."
    644656msgstr "Por favor selecione o banco emissor do boleto."
    645657
    646 #: includes/woocommerce-businesspay-gateway.php:532
     658#: includes/woocommerce-businesspay-gateway.php:546
    647659msgid "BusinessPay | Debit Card"
    648660msgstr "BusinessPay | Cartão de débito"
    649661
    650 #: includes/woocommerce-businesspay-gateway.php:535
     662#: includes/woocommerce-businesspay-gateway.php:548
    651663msgid "BusinessPay | Credit Card"
    652664msgstr "BusinessPay | Cartão de crédito"
    653665
    654 #: includes/woocommerce-businesspay-gateway.php:540
     666#: includes/woocommerce-businesspay-gateway.php:550
    655667msgid "BusinessPay | Bank Transfer"
    656668msgstr "BusinessPay | Transferência bancária"
    657669
    658 #: includes/woocommerce-businesspay-gateway.php:544
     670#: includes/woocommerce-businesspay-gateway.php:552
    659671msgid "BusinessPay | Billet"
    660672msgstr "BusinessPay | Boleto"
    661673
    662 #: includes/woocommerce-businesspay-gateway.php:555
    663 #: includes/woocommerce-businesspay-gateway.php:1138
    664 msgid ""
    665 "BusinessPay: There was an error performing the transaction. Please contact "
    666 "us."
    667 msgstr ""
    668 "BusinessPay: Ocorreu um erro ao executar a transação. Por favor entre em "
    669 "contato conosco."
    670 
    671 #: includes/woocommerce-businesspay-gateway.php:556
    672 #: includes/woocommerce-businesspay-gateway.php:983
    673 #: includes/woocommerce-businesspay-gateway.php:1024
    674 msgid "Could not receive a valid server response. Please try again."
    675 msgstr ""
    676 "Não foi possível receber uma resposta válida do servidor. Por favor tente "
    677 "novamente."
    678 
    679 #: includes/woocommerce-businesspay-gateway.php:579
    680 #: includes/woocommerce-businesspay-gateway.php:626
    681 #: includes/woocommerce-businesspay-gateway.php:675
    682 #: includes/woocommerce-businesspay-gateway.php:729
    683 msgid "Woocommerce Order"
    684 msgstr "Pedido do WooCommerce"
    685 
    686 #: includes/woocommerce-businesspay-gateway.php:980
     674#: includes/woocommerce-businesspay-gateway.php:732
    687675msgid ""
    688676"The credentials for this virtual store are not valid on the BusinessPay "
     
    690678msgstr "As credenciais desta loja virtual não são válidas neste servidor."
    691679
    692 #: includes/woocommerce-businesspay-gateway.php:1021
     680#: includes/woocommerce-businesspay-gateway.php:735
     681#: includes/woocommerce-businesspay-gateway.php:1311
     682msgid "Could not receive a valid server response. Please try again."
     683msgstr ""
     684"Não foi possível receber uma resposta válida do servidor. Por favor tente "
     685"novamente."
     686
     687#: includes/woocommerce-businesspay-gateway.php:828
     688msgid "BusinessPay Status: "
     689msgstr "Status BusinessPay: "
     690
     691#: includes/woocommerce-businesspay-gateway.php:1022
     692msgid "Transaction started but not confirmed."
     693msgstr "Transação iniciada mas não confirmada."
     694
     695#: includes/woocommerce-businesspay-gateway.php:1025
     696msgid "Awating payment."
     697msgstr "Aguardando pagamento."
     698
     699#: includes/woocommerce-businesspay-gateway.php:1028
     700msgid "Transaction effectivated."
     701msgstr "Transação efetivada."
     702
     703#: includes/woocommerce-businesspay-gateway.php:1031
     704msgid "Transaction under analysis."
     705msgstr "Transação em análise."
     706
     707#: includes/woocommerce-businesspay-gateway.php:1034
     708msgid "Transaction expired."
     709msgstr "Transação expirada."
     710
     711#: includes/woocommerce-businesspay-gateway.php:1037
     712msgid "Transaction authorized."
     713msgstr "Transação autorizada."
     714
     715#: includes/woocommerce-businesspay-gateway.php:1040
     716msgid "Transaction confirmed."
     717msgstr "Transação confirmada."
     718
     719#: includes/woocommerce-businesspay-gateway.php:1043
     720msgid "Transaction denied."
     721msgstr "Transação negada."
     722
     723#: includes/woocommerce-businesspay-gateway.php:1046
     724msgid "Cancellation in progress."
     725msgstr "Cancelamento em andamento."
     726
     727#: includes/woocommerce-businesspay-gateway.php:1049
     728msgid "Transaction Canceled."
     729msgstr "Transação cancelada."
     730
     731#: includes/woocommerce-businesspay-gateway.php:1052
     732msgid "Transaction pending of confirmation."
     733msgstr "Transação pendente de confirmação."
     734
     735#: includes/woocommerce-businesspay-gateway.php:1055
     736msgid "Failure to communicate with the provider."
     737msgstr "Falha na comunicação com o emissor."
     738
     739#: includes/woocommerce-businesspay-gateway.php:1058
     740msgid "No valid server response."
     741msgstr "Nenhuma resposta válida do servidor."
     742
     743#: includes/woocommerce-businesspay-gateway.php:1077
     744msgid "payment made less than the value of the order."
     745msgstr "Pagamento feito com valor menor que o vaor do pedido."
     746
     747#: includes/woocommerce-businesspay-gateway.php:1308
    693748msgid ""
    694749"The credentials for this virtual store are not valid on the BusinessPay "
     
    698753"novamente em alguns instantes."
    699754
    700 #: includes/woocommerce-businesspay-gateway.php:1120
    701 msgid "BusinessPay Status: "
    702 msgstr "Status BusinessPay: "
    703 
    704 #: includes/woocommerce-businesspay-gateway.php:1366
    705 msgid "Transaction started but not confirmed."
    706 msgstr "Transação iniciada mas não confirmada."
    707 
    708 #: includes/woocommerce-businesspay-gateway.php:1369
    709 msgid "Awating payment."
    710 msgstr "Aguardando pagamento."
    711 
    712 #: includes/woocommerce-businesspay-gateway.php:1372
    713 msgid "Transaction effectivated."
    714 msgstr "Transação efetivada."
    715 
    716 #: includes/woocommerce-businesspay-gateway.php:1375
    717 msgid "Transaction under analysis."
    718 msgstr "Transação em análise."
    719 
    720 #: includes/woocommerce-businesspay-gateway.php:1378
    721 msgid "Transaction expired."
    722 msgstr "Transação expirada."
    723 
    724 #: includes/woocommerce-businesspay-gateway.php:1381
    725 msgid "Transaction authorized."
    726 msgstr "Transação autorizada."
    727 
    728 #: includes/woocommerce-businesspay-gateway.php:1384
    729 msgid "Transaction confirmed."
    730 msgstr "Transação confirmada."
    731 
    732 #: includes/woocommerce-businesspay-gateway.php:1387
    733 msgid "Transaction denied."
    734 msgstr "Transação negada."
    735 
    736 #: includes/woocommerce-businesspay-gateway.php:1390
    737 msgid "Cancellation in progress."
    738 msgstr "Cancelamento em andamento."
    739 
    740 #: includes/woocommerce-businesspay-gateway.php:1393
    741 msgid "Transaction Canceled."
    742 msgstr "Transação cancelada."
    743 
    744 #: includes/woocommerce-businesspay-gateway.php:1396
    745 msgid "Transaction pending of confirmation."
    746 msgstr "Transação pendente de confirmação."
    747 
    748 #: includes/woocommerce-businesspay-gateway.php:1399
    749 msgid "Failure to communicate with the provider."
    750 msgstr "Falha na comunicação com o emissor."
    751 
    752 #: includes/woocommerce-businesspay-gateway.php:1402
    753 msgid "No valid server response."
    754 msgstr "Nenhuma resposta válida do servidor."
    755 
    756 #: includes/woocommerce-businesspay-gateway.php:1410
    757 msgid "The order will be analyzed by antifraud software"
    758 msgstr "O pedido será analisado pelo software antifraude"
    759 
    760 #: includes/woocommerce-businesspay-gateway.php:1417
    761 msgid "payment made less than the value of the order."
    762 msgstr "Pagamento feito com valor menor que o vaor do pedido."
    763 
    764 #: includes/woocommerce-businesspay-gateway.php:2631
    765 #: includes/woocommerce-businesspay-gateway.php:2638
     755#: includes/woocommerce-businesspay-gateway.php:1354
     756msgid "Antifraud Status: "
     757msgstr "Status Antifraude: "
     758
     759#: includes/woocommerce-businesspay-gateway.php:1486
     760msgid ""
     761"Order was automatically approved according to parameters defined in the "
     762"automatic approval rule."
     763msgstr ""
     764"Pedido aprovado automaticamente de acordo com parâmetros definidos na regra "
     765"de aprovação automática."
     766
     767#: includes/woocommerce-businesspay-gateway.php:1489
     768msgid "Order is queued for analysis."
     769msgstr "Pedido está na fila para análise."
     770
     771#: includes/woocommerce-businesspay-gateway.php:1492
     772msgid "Order manually approved by decision-making of an analyst."
     773msgstr "Pedido aprovado manualmente através da tomada de decisão do analista."
     774
     775#: includes/woocommerce-businesspay-gateway.php:1495
     776msgid ""
     777"Order approved automatically by client-established policy or antifraud "
     778"software rule."
     779msgstr ""
     780"Pedido aprovado manualmente por política estabelecida pelo cliente ou regra "
     781"do software antifraude."
     782
     783#: includes/woocommerce-businesspay-gateway.php:1498
     784msgid "Canceled by customer or duplicated order."
     785msgstr "Cancelado pelo cliente ou pedido duplicado."
     786
     787#: includes/woocommerce-businesspay-gateway.php:1501
     788msgid ""
     789"Order imputed as fraud confirmed by contact with the card administrator and "
     790"/ or contact with the card holder or CPF of the registry that is unaware of "
     791"the purchase."
     792msgstr ""
     793"Pedido imputado como fraude confirmada pelo contato com a administradora do "
     794"cartão e/ou contato com o portador do cartão ou CPF do registro que "
     795"desconhece a compra."
     796
     797#: includes/woocommerce-businesspay-gateway.php:1504
     798msgid "Order imported and not classified Score by the analyzer yet."
     799msgstr "Pedido importado e não classificado Score ainda pelo analista."
     800
     801#: includes/woocommerce-businesspay-gateway.php:1507
     802msgid ""
     803"Order Automatically Disapproved by some type of business rule that needs to "
     804"be applied."
     805msgstr ""
     806"Pedido reprovado automaticamente por algum tipo de regra de negócio que "
     807"precisa ser aplicada."
     808
     809#: includes/woocommerce-businesspay-gateway.php:1510
     810msgid ""
     811"Order disapproved without suspicion by lack of contact with the client "
     812"within the agreed period and / or social security number of restrictive "
     813"policies (Irregular, SUS or Canceled)."
     814msgstr ""
     815"Pedido cancelado sem suspeita por falta de contato com o cliente dentro do "
     816"período acordado e/ou número de CPF por políticas restritivas (Irregular, "
     817"SUS ou Cancelado)."
     818
     819#: includes/woocommerce-businesspay-gateway.php:1513
     820msgid ""
     821"Order disapproved automatically by policy established by customer or "
     822"antifraud software."
     823msgstr ""
     824"Pedido reprovado automaticamente por política estabelecida pelo cliente ou "
     825"software antifraude."
     826
     827#: includes/woocommerce-businesspay-gateway.php:1516
     828msgid ""
     829"Order automatically approved by policy established by the customer or "
     830"antifraud software."
     831msgstr ""
     832"Pedido aprovado automaticamente por política estabelecida pelo cliente ou "
     833"software antifraude."
     834
     835#: includes/woocommerce-businesspay-gateway.php:1639
     836msgid "Woocommerce Order"
     837msgstr "Pedido do WooCommerce"
     838
     839#: includes/woocommerce-businesspay-gateway.php:2974
     840#: includes/woocommerce-businesspay-gateway.php:2981
    766841msgid "BusinessPay Disabled"
    767842msgstr "BusinessPay desabilitado"
    768843
    769 #: includes/woocommerce-businesspay-gateway.php:2632
     844#: includes/woocommerce-businesspay-gateway.php:2975
    770845msgid "You must enable at least one form of payment."
    771846msgstr "Você precisa habilitar ao menos uma forma de pagamento."
    772847
    773 #: includes/woocommerce-businesspay-gateway.php:2633
     848#: includes/woocommerce-businesspay-gateway.php:2976
    774849msgid "Click here to configure!"
    775850msgstr "Clique aqui para configurar!"
    776851
    777 #: includes/woocommerce-businesspay-gateway.php:2639
     852#: includes/woocommerce-businesspay-gateway.php:2982
    778853#, php-format
    779854msgid ""
  • woo-businesspay/trunk/languages/woocommerce-businesspay.pot

    r1966657 r1977545  
    44"Project-Id-Version: WooCommerce BusinessPay\n"
    55"Report-Msgid-Bugs-To: \n"
    6 "POT-Creation-Date: 2018-10-31 17:48+0000\n"
     6"POT-Creation-Date: 2018-11-20 16:10+0000\n"
    77"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
    88"Last-Translator: Gustavo Piucco <gustavopiucco@gmail.com>\n"
     
    2727msgstr ""
    2828
    29 #: templates/businesspay-panel-gateway.php:19
    30 #: templates/businesspay-panel-antifraud.php:19
     29#: templates/businesspay-panel-gateway.php:18
     30#: templates/businesspay-panel-antifraud.php:20
    3131msgid "\\a\\t"
    3232msgstr ""
    3333
    34 #: templates/businesspay-panel-gateway.php:26
    35 #: includes/woocommerce-businesspay-gateway.php:317
     34#: templates/businesspay-panel-gateway.php:25
     35#: includes/woocommerce-businesspay-gateway.php:329
    3636msgid "Debit Card"
    3737msgstr ""
    3838
    39 #: templates/businesspay-panel-gateway.php:28
     39#: templates/businesspay-panel-gateway.php:27
    4040#: templates/frontend-template.php:87
    4141msgid "At sight via debit"
    4242msgstr ""
    4343
    44 #: templates/businesspay-panel-gateway.php:31
    45 #: includes/woocommerce-businesspay-gateway.php:228
     44#: templates/businesspay-panel-gateway.php:30
     45#: includes/woocommerce-businesspay-gateway.php:240
    4646msgid "Credit Card"
    4747msgstr ""
    4848
    49 #: templates/businesspay-panel-gateway.php:33
     49#: templates/businesspay-panel-gateway.php:32
    5050msgid "Unknown Brand"
    5151msgstr ""
    5252
    53 #: templates/businesspay-panel-gateway.php:39
     53#: templates/businesspay-panel-gateway.php:38
    5454#: templates/frontend-template.php:95
    5555msgid "In "
    5656msgstr ""
    5757
    58 #: templates/businesspay-panel-gateway.php:39
     58#: templates/businesspay-panel-gateway.php:38
    5959#: templates/frontend-template.php:95
    6060msgid "x of "
    6161msgstr ""
    6262
    63 #: templates/businesspay-panel-gateway.php:39
     63#: templates/businesspay-panel-gateway.php:38
    6464#: templates/frontend-template.php:95
    6565msgid " on credit card"
    6666msgstr ""
    6767
    68 #: templates/businesspay-panel-gateway.php:43
     68#: templates/businesspay-panel-gateway.php:42
    6969msgid "Bank Transference"
    7070msgstr ""
    7171
    72 #: templates/businesspay-panel-gateway.php:49
    73 #: templates/businesspay-panel-gateway.php:57
    74 #: templates/businesspay-panel-gateway.php:79
    75 #: templates/businesspay-panel-gateway.php:87
     72#: templates/businesspay-panel-gateway.php:48
     73#: templates/businesspay-panel-gateway.php:56
     74#: templates/businesspay-panel-gateway.php:78
     75#: templates/businesspay-panel-gateway.php:86
    7676msgid "Unavailable"
    7777msgstr ""
    7878
    79 #: templates/businesspay-panel-gateway.php:65
     79#: templates/businesspay-panel-gateway.php:64
    8080#: templates/frontend-template.php:26
    81 #: includes/woocommerce-businesspay-gateway.php:333
     81#: includes/woocommerce-businesspay-gateway.php:345
    8282msgid "Billet"
    8383msgstr ""
    8484
    85 #: templates/businesspay-panel-gateway.php:94
     85#: templates/businesspay-panel-gateway.php:93
    8686msgid "Unknown"
    8787msgstr ""
    8888
     89#: templates/businesspay-panel-gateway.php:102
     90msgid "Transaction Information"
     91msgstr ""
     92
    8993#: templates/businesspay-panel-gateway.php:103
    90 msgid "Transaction Information"
    91 msgstr ""
    92 
    93 #: templates/businesspay-panel-gateway.php:104
    94 #: templates/businesspay-panel-antifraud.php:33
    9594msgid "Token: "
    9695msgstr ""
    9796
    98 #: templates/businesspay-panel-gateway.php:106
    99 #: templates/businesspay-panel-antifraud.php:37
     97#: templates/businesspay-panel-gateway.php:105
     98#: templates/businesspay-panel-antifraud.php:36
    10099msgid "Date: "
    101100msgstr ""
    102101
    103 #: templates/businesspay-panel-gateway.php:108
    104 #: templates/businesspay-panel-antifraud.php:39
     102#: templates/businesspay-panel-gateway.php:107
     103#: templates/businesspay-panel-antifraud.php:38
    105104msgid "Status: "
    106105msgstr ""
    107106
     107#: templates/businesspay-panel-gateway.php:109
     108msgid "Payment Information"
     109msgstr ""
     110
    108111#: templates/businesspay-panel-gateway.php:110
    109 msgid "Payment Information"
    110 msgstr ""
    111 
    112 #: templates/businesspay-panel-gateway.php:111
    113112msgid "Type: "
    114113msgstr ""
    115114
    116 #: templates/businesspay-panel-gateway.php:114
     115#: templates/businesspay-panel-gateway.php:113
    117116msgid "Brand: "
    118117msgstr ""
    119118
    120 #: templates/businesspay-panel-gateway.php:116
     119#: templates/businesspay-panel-gateway.php:115
    121120msgid "Installments: "
    122121msgstr ""
    123122
    124 #: templates/businesspay-panel-gateway.php:119
     123#: templates/businesspay-panel-gateway.php:118
    125124msgid "Origin Bank: "
    126125msgstr ""
    127126
    128 #: templates/businesspay-panel-gateway.php:121
     127#: templates/businesspay-panel-gateway.php:120
    129128msgid "Reference Code: "
    130129msgstr ""
    131130
    132 #: templates/businesspay-panel-gateway.php:123
    133 #: templates/businesspay-panel-gateway.php:135
     131#: templates/businesspay-panel-gateway.php:122
     132#: templates/businesspay-panel-gateway.php:134
    134133msgid "Payment Date: "
    135134msgstr ""
    136135
    137 #: templates/businesspay-panel-gateway.php:125
    138 #: templates/businesspay-panel-gateway.php:137
     136#: templates/businesspay-panel-gateway.php:124
     137#: templates/businesspay-panel-gateway.php:136
    139138msgid "Payment Amount: "
    140139msgstr ""
    141140
    142 #: templates/businesspay-panel-gateway.php:127
     141#: templates/businesspay-panel-gateway.php:126
    143142msgid "Provider Bank: "
    144143msgstr ""
    145144
    146 #: templates/businesspay-panel-gateway.php:129
     145#: templates/businesspay-panel-gateway.php:128
    147146msgid "Provider Reference: "
    148147msgstr ""
    149148
    150 #: templates/businesspay-panel-gateway.php:131
     149#: templates/businesspay-panel-gateway.php:130
    151150msgid "Emission Date: "
    152151msgstr ""
    153152
    154 #: templates/businesspay-panel-gateway.php:133
     153#: templates/businesspay-panel-gateway.php:132
    155154msgid "Expiration Date: "
    156155msgstr ""
     
    201200msgstr ""
    202201
    203 #: templates/businesspay-panel-antifraud.php:32
     202#: templates/businesspay-panel-antifraud.php:33
    204203msgid "Analysis Information"
    205204msgstr ""
    206205
    207 #: templates/businesspay-panel-antifraud.php:35
     206#: templates/businesspay-panel-antifraud.php:34
    208207msgid "ID: "
    209208msgstr ""
    210209
    211 #: templates/businesspay-panel-antifraud.php:41
     210#: templates/businesspay-panel-antifraud.php:40
     211msgid "Score: "
     212msgstr ""
     213
     214#: templates/businesspay-panel-antifraud.php:42
    212215msgid "Message: "
    213216msgstr ""
     
    218221
    219222#: templates/frontend-template.php:21
    220 #: includes/woocommerce-businesspay-gateway.php:325
     223#: includes/woocommerce-businesspay-gateway.php:337
    221224msgid "Bank Transfer"
    222225msgstr ""
     
    304307msgstr ""
    305308
    306 #: includes/woocommerce-businesspay-gateway.php:25
     309#: includes/woocommerce-businesspay-gateway.php:26
    307310msgid "BusinessPay"
    308311msgstr ""
    309312
    310 #: includes/woocommerce-businesspay-gateway.php:26
     313#: includes/woocommerce-businesspay-gateway.php:27
    311314msgid "Accept payments using BusinessPay Gateway."
    312315msgstr ""
    313316
    314 #: includes/woocommerce-businesspay-gateway.php:156
     317#: includes/woocommerce-businesspay-gateway.php:162
    315318msgid "Account Enabled"
    316319msgstr ""
    317320
    318 #: includes/woocommerce-businesspay-gateway.php:156
     321#: includes/woocommerce-businesspay-gateway.php:162
    319322msgid "Account Disabled"
    320323msgstr ""
    321324
    322 #: includes/woocommerce-businesspay-gateway.php:157
     325#: includes/woocommerce-businesspay-gateway.php:163
    323326msgid "Installation Enabled"
    324327msgstr ""
    325328
    326 #: includes/woocommerce-businesspay-gateway.php:157
     329#: includes/woocommerce-businesspay-gateway.php:163
    327330msgid "Installation Disabled"
    328331msgstr ""
    329332
    330 #: includes/woocommerce-businesspay-gateway.php:158
     333#: includes/woocommerce-businesspay-gateway.php:164
    331334msgid "Antifraud Enabled"
    332335msgstr ""
    333336
    334 #: includes/woocommerce-businesspay-gateway.php:158
     337#: includes/woocommerce-businesspay-gateway.php:164
    335338msgid "Antifraud Disabled"
    336339msgstr ""
    337340
    338 #: includes/woocommerce-businesspay-gateway.php:160
     341#: includes/woocommerce-businesspay-gateway.php:165
     342msgid "Product not configured"
     343msgstr ""
     344
     345#: includes/woocommerce-businesspay-gateway.php:167
    339346msgid "Client Account:"
    340347msgstr ""
    341348
    342 #: includes/woocommerce-businesspay-gateway.php:161
     349#: includes/woocommerce-businesspay-gateway.php:168
    343350msgid "Client Installation:"
    344351msgstr ""
    345352
    346 #: includes/woocommerce-businesspay-gateway.php:162
     353#: includes/woocommerce-businesspay-gateway.php:169
    347354msgid "Client Antifraud:"
    348355msgstr ""
    349356
    350 #: includes/woocommerce-businesspay-gateway.php:171
     357#: includes/woocommerce-businesspay-gateway.php:170
     358msgid "Antifraud Product:"
     359msgstr ""
     360
     361#: includes/woocommerce-businesspay-gateway.php:183
    351362msgid "Antifraud by "
    352363msgstr ""
    353364
    354 #: includes/woocommerce-businesspay-gateway.php:180
     365#: includes/woocommerce-businesspay-gateway.php:192
    355366msgid "BusinessPay Payment Gateway"
    356367msgstr ""
    357368
    358 #: includes/woocommerce-businesspay-gateway.php:185
     369#: includes/woocommerce-businesspay-gateway.php:197
    359370msgid "Enable BusinessPay"
    360371msgstr ""
    361372
    362 #: includes/woocommerce-businesspay-gateway.php:186
     373#: includes/woocommerce-businesspay-gateway.php:198
    363374msgid "Enable BusinessPay Gateway Plugin"
    364375msgstr ""
    365376
    366 #: includes/woocommerce-businesspay-gateway.php:187
     377#: includes/woocommerce-businesspay-gateway.php:199
    367378msgid "Enable BusinessPay gateway plugin options."
    368379msgstr ""
    369380
    370 #: includes/woocommerce-businesspay-gateway.php:193
     381#: includes/woocommerce-businesspay-gateway.php:205
    371382msgid "Title"
    372383msgstr ""
    373384
    374 #: includes/woocommerce-businesspay-gateway.php:194
     385#: includes/woocommerce-businesspay-gateway.php:206
    375386msgid "Payment method title seen on the checkout page."
    376387msgstr ""
    377388
    378 #: includes/woocommerce-businesspay-gateway.php:195
     389#: includes/woocommerce-businesspay-gateway.php:207
    379390msgid "BusinessPay | Payments via credit card, debit and billet."
    380391msgstr ""
    381392
    382 #: includes/woocommerce-businesspay-gateway.php:200
     393#: includes/woocommerce-businesspay-gateway.php:212
    383394msgid "Description"
    384395msgstr ""
    385396
    386 #: includes/woocommerce-businesspay-gateway.php:201
     397#: includes/woocommerce-businesspay-gateway.php:213
    387398msgid "Payment method description seen on the checkout page."
    388399msgstr ""
    389400
    390 #: includes/woocommerce-businesspay-gateway.php:202
     401#: includes/woocommerce-businesspay-gateway.php:214
    391402msgid "Pay using BusinessPay, a secure experience of online buys."
    392403msgstr ""
    393404
    394 #: includes/woocommerce-businesspay-gateway.php:207
     405#: includes/woocommerce-businesspay-gateway.php:219
    395406msgid "Gateway Settings"
    396407msgstr ""
    397408
    398 #: includes/woocommerce-businesspay-gateway.php:212
     409#: includes/woocommerce-businesspay-gateway.php:224
    399410msgid "Authentication API"
    400411msgstr ""
    401412
    402 #: includes/woocommerce-businesspay-gateway.php:213
     413#: includes/woocommerce-businesspay-gateway.php:225
    403414msgid "Use your BusinessPay Authentication API"
    404415msgstr ""
    405416
    406 #: includes/woocommerce-businesspay-gateway.php:220
     417#: includes/woocommerce-businesspay-gateway.php:232
    407418msgid "Authentication Key"
    408419msgstr ""
    409420
    410 #: includes/woocommerce-businesspay-gateway.php:221
     421#: includes/woocommerce-businesspay-gateway.php:233
    411422msgid "Use your BusinessPay Authentication Key"
    412423msgstr ""
    413424
    414 #: includes/woocommerce-businesspay-gateway.php:229
     425#: includes/woocommerce-businesspay-gateway.php:241
    415426msgid "Enable credit card payments with BusinessPay"
    416427msgstr ""
    417428
    418 #: includes/woocommerce-businesspay-gateway.php:230
     429#: includes/woocommerce-businesspay-gateway.php:242
    419430msgid "Enable credit card payment with BusinessPay on checkout page"
    420431msgstr ""
    421432
    422 #: includes/woocommerce-businesspay-gateway.php:235
     433#: includes/woocommerce-businesspay-gateway.php:247
    423434msgid "Credit Card Settings"
    424435msgstr ""
    425436
    426 #: includes/woocommerce-businesspay-gateway.php:241
     437#: includes/woocommerce-businesspay-gateway.php:253
    427438msgid "Name in Invoice"
    428439msgstr ""
    429440
    430 #: includes/woocommerce-businesspay-gateway.php:242
     441#: includes/woocommerce-businesspay-gateway.php:254
    431442msgid ""
    432443"Name in Invoice to identify Shop. Its important to avoid gateway chargebacks."
    433444msgstr ""
    434445
    435 #: includes/woocommerce-businesspay-gateway.php:249
     446#: includes/woocommerce-businesspay-gateway.php:261
    436447msgid "Invoice Prefix"
    437448msgstr ""
    438449
    439 #: includes/woocommerce-businesspay-gateway.php:250
     450#: includes/woocommerce-businesspay-gateway.php:262
    440451msgid "Shop prefix to identify invoice shop origin"
    441452msgstr ""
    442453
    443 #: includes/woocommerce-businesspay-gateway.php:256
     454#: includes/woocommerce-businesspay-gateway.php:268
    444455msgid "Installments"
    445456msgstr ""
    446457
    447 #: includes/woocommerce-businesspay-gateway.php:258
     458#: includes/woocommerce-businesspay-gateway.php:270
    448459msgid "Enable Installments"
    449460msgstr ""
    450461
    451 #: includes/woocommerce-businesspay-gateway.php:262
     462#: includes/woocommerce-businesspay-gateway.php:274
    452463msgid "Installments Settings"
    453464msgstr ""
    454465
    455 #: includes/woocommerce-businesspay-gateway.php:267
     466#: includes/woocommerce-businesspay-gateway.php:279
    456467msgid "Minimum Installment"
    457468msgstr ""
    458469
    459 #: includes/woocommerce-businesspay-gateway.php:269
     470#: includes/woocommerce-businesspay-gateway.php:281
    460471msgid "Indicate the minimum installments."
    461472msgstr ""
    462473
    463 #: includes/woocommerce-businesspay-gateway.php:288
     474#: includes/woocommerce-businesspay-gateway.php:300
    464475msgid "Maximum Installment"
    465476msgstr ""
    466477
    467 #: includes/woocommerce-businesspay-gateway.php:290
     478#: includes/woocommerce-businesspay-gateway.php:302
    468479msgid "Indicate the Maximum installments."
    469480msgstr ""
    470481
    471 #: includes/woocommerce-businesspay-gateway.php:309
     482#: includes/woocommerce-businesspay-gateway.php:321
    472483msgid "Minimum Value"
    473484msgstr ""
    474485
    475 #: includes/woocommerce-businesspay-gateway.php:310
     486#: includes/woocommerce-businesspay-gateway.php:322
    476487msgid "Minimum value by installment"
    477488msgstr ""
    478489
    479 #: includes/woocommerce-businesspay-gateway.php:318
     490#: includes/woocommerce-businesspay-gateway.php:330
    480491msgid "Enable debit card payments with BusinessPay"
    481492msgstr ""
    482493
    483 #: includes/woocommerce-businesspay-gateway.php:319
     494#: includes/woocommerce-businesspay-gateway.php:331
    484495msgid "Enable debit card payment on checkout page"
    485496msgstr ""
    486497
    487 #: includes/woocommerce-businesspay-gateway.php:326
     498#: includes/woocommerce-businesspay-gateway.php:338
    488499msgid "Enable bank transfer payments with BusinessPay"
    489500msgstr ""
    490501
    491 #: includes/woocommerce-businesspay-gateway.php:327
     502#: includes/woocommerce-businesspay-gateway.php:339
    492503msgid "Enable bank transfer payment on checkout page"
    493504msgstr ""
    494505
    495 #: includes/woocommerce-businesspay-gateway.php:334
     506#: includes/woocommerce-businesspay-gateway.php:346
    496507msgid "Enable billet payments with BusinessPay"
    497508msgstr ""
    498509
    499 #: includes/woocommerce-businesspay-gateway.php:335
     510#: includes/woocommerce-businesspay-gateway.php:347
    500511msgid "Enable billet payment on checkout page"
    501512msgstr ""
    502513
    503 #: includes/woocommerce-businesspay-gateway.php:340
     514#: includes/woocommerce-businesspay-gateway.php:352
    504515msgid "Billet Settings"
    505516msgstr ""
    506517
    507 #: includes/woocommerce-businesspay-gateway.php:346
     518#: includes/woocommerce-businesspay-gateway.php:358
    508519msgid "Custom Logo URL"
    509520msgstr ""
    510521
    511 #: includes/woocommerce-businesspay-gateway.php:347
     522#: includes/woocommerce-businesspay-gateway.php:359
    512523msgid "URL logo image to be shown on the billet"
    513524msgstr ""
    514525
    515 #: includes/woocommerce-businesspay-gateway.php:352
     526#: includes/woocommerce-businesspay-gateway.php:364
    516527msgid "Number of Days"
    517528msgstr ""
    518529
    519 #: includes/woocommerce-businesspay-gateway.php:354
     530#: includes/woocommerce-businesspay-gateway.php:366
    520531msgid "Days of expiry of the billet after printed."
    521532msgstr ""
    522533
    523 #: includes/woocommerce-businesspay-gateway.php:361
     534#: includes/woocommerce-businesspay-gateway.php:373
    524535msgid "Instruction Line"
    525536msgstr ""
    526537
    527 #: includes/woocommerce-businesspay-gateway.php:362
     538#: includes/woocommerce-businesspay-gateway.php:374
    528539msgid "Billet instruction line"
    529540msgstr ""
    530541
    531 #: includes/woocommerce-businesspay-gateway.php:367
     542#: includes/woocommerce-businesspay-gateway.php:379
    532543msgid "Tools"
    533544msgstr ""
    534545
    535 #: includes/woocommerce-businesspay-gateway.php:373
     546#: includes/woocommerce-businesspay-gateway.php:385
    536547msgid "BusinessPay Sandbox"
    537548msgstr ""
    538549
    539 #: includes/woocommerce-businesspay-gateway.php:374
     550#: includes/woocommerce-businesspay-gateway.php:386
    540551msgid "Enable BusinessPay sandbox mode"
    541552msgstr ""
    542553
    543 #: includes/woocommerce-businesspay-gateway.php:375
     554#: includes/woocommerce-businesspay-gateway.php:387
    544555msgid "Enable BusinessPay Sandbox"
    545556msgstr ""
    546557
    547 #: includes/woocommerce-businesspay-gateway.php:382
     558#: includes/woocommerce-businesspay-gateway.php:394
    548559msgid "Debug"
    549560msgstr ""
    550561
    551 #: includes/woocommerce-businesspay-gateway.php:383
     562#: includes/woocommerce-businesspay-gateway.php:395
    552563msgid "Enable logging"
    553564msgstr ""
    554565
    555 #: includes/woocommerce-businesspay-gateway.php:389
     566#: includes/woocommerce-businesspay-gateway.php:401
    556567msgid "Status"
    557568msgstr ""
    558569
    559 #: includes/woocommerce-businesspay-gateway.php:411
     570#: includes/woocommerce-businesspay-gateway.php:423
    560571msgid "Card number must be at least 16 characters."
    561572msgstr ""
    562573
    563 #: includes/woocommerce-businesspay-gateway.php:414
     574#: includes/woocommerce-businesspay-gateway.php:426
    564575msgid "The Card Number field must be numeric."
    565576msgstr ""
    566577
    567 #: includes/woocommerce-businesspay-gateway.php:417
     578#: includes/woocommerce-businesspay-gateway.php:429
    568579msgid "Invalid card number."
    569580msgstr ""
    570581
    571 #: includes/woocommerce-businesspay-gateway.php:424
     582#: includes/woocommerce-businesspay-gateway.php:436
    572583msgid "The Name field can not be less than 6 characters."
    573584msgstr ""
    574585
    575 #: includes/woocommerce-businesspay-gateway.php:427
     586#: includes/woocommerce-businesspay-gateway.php:439
    576587msgid "The Name field can not be greater than 25 characters."
    577588msgstr ""
    578589
    579 #: includes/woocommerce-businesspay-gateway.php:430
     590#: includes/woocommerce-businesspay-gateway.php:442
    580591msgid "The Name field can not have numbers."
    581592msgstr ""
    582593
    583 #: includes/woocommerce-businesspay-gateway.php:440
     594#: includes/woocommerce-businesspay-gateway.php:452
    584595msgid "The Month of Expiration field must have 2 digits."
    585596msgstr ""
    586597
    587 #: includes/woocommerce-businesspay-gateway.php:443
     598#: includes/woocommerce-businesspay-gateway.php:455
    588599msgid "The Month of Expiration field must be numeric."
    589600msgstr ""
    590601
    591 #: includes/woocommerce-businesspay-gateway.php:446
     602#: includes/woocommerce-businesspay-gateway.php:458
    592603msgid "The Year of Expiration field must be numeric."
    593604msgstr ""
    594605
    595 #: includes/woocommerce-businesspay-gateway.php:449
     606#: includes/woocommerce-businesspay-gateway.php:461
    596607msgid "The Year of Expiration field must have 4 digits."
    597608msgstr ""
    598609
    599 #: includes/woocommerce-businesspay-gateway.php:456
    600 #: includes/woocommerce-businesspay-gateway.php:462
     610#: includes/woocommerce-businesspay-gateway.php:468
     611#: includes/woocommerce-businesspay-gateway.php:474
    601612msgid "The CVC field must have 3 or 4 digits."
    602613msgstr ""
    603614
    604 #: includes/woocommerce-businesspay-gateway.php:459
     615#: includes/woocommerce-businesspay-gateway.php:471
    605616msgid "The CVC field must be numeric."
    606617msgstr ""
    607618
    608 #: includes/woocommerce-businesspay-gateway.php:469
     619#: includes/woocommerce-businesspay-gateway.php:481
    609620msgid "Please select a installment option."
    610621msgstr ""
    611622
    612 #: includes/woocommerce-businesspay-gateway.php:476
     623#: includes/woocommerce-businesspay-gateway.php:492
    613624msgid "The Document field must have 11 digits for CPF or 14 digits for CNPJ."
    614625msgstr ""
    615626
    616 #: includes/woocommerce-businesspay-gateway.php:479
     627#: includes/woocommerce-businesspay-gateway.php:495
    617628msgid "The Document field must be numeric."
    618629msgstr ""
    619630
    620 #: includes/woocommerce-businesspay-gateway.php:482
     631#: includes/woocommerce-businesspay-gateway.php:498
    621632msgid "The Document field as CPF is invalid."
    622633msgstr ""
    623634
    624 #: includes/woocommerce-businesspay-gateway.php:485
     635#: includes/woocommerce-businesspay-gateway.php:501
    625636msgid "The Document field as CNPJ is invalid."
    626637msgstr ""
    627638
    628 #: includes/woocommerce-businesspay-gateway.php:493
     639#: includes/woocommerce-businesspay-gateway.php:509
    629640msgid "Please select a origin transfer bank option."
    630641msgstr ""
    631642
    632 #: includes/woocommerce-businesspay-gateway.php:499
    633 #: includes/woocommerce-businesspay-gateway.php:512
     643#: includes/woocommerce-businesspay-gateway.php:515
     644#: includes/woocommerce-businesspay-gateway.php:528
    634645msgid "The Neighborhood field need to be filled."
    635646msgstr ""
    636647
    637 #: includes/woocommerce-businesspay-gateway.php:506
     648#: includes/woocommerce-businesspay-gateway.php:522
    638649msgid "Please select a origin billet bank option."
    639650msgstr ""
    640651
    641 #: includes/woocommerce-businesspay-gateway.php:532
     652#: includes/woocommerce-businesspay-gateway.php:546
    642653msgid "BusinessPay | Debit Card"
    643654msgstr ""
    644655
    645 #: includes/woocommerce-businesspay-gateway.php:535
     656#: includes/woocommerce-businesspay-gateway.php:548
    646657msgid "BusinessPay | Credit Card"
    647658msgstr ""
    648659
    649 #: includes/woocommerce-businesspay-gateway.php:540
     660#: includes/woocommerce-businesspay-gateway.php:550
    650661msgid "BusinessPay | Bank Transfer"
    651662msgstr ""
    652663
    653 #: includes/woocommerce-businesspay-gateway.php:544
     664#: includes/woocommerce-businesspay-gateway.php:552
    654665msgid "BusinessPay | Billet"
    655666msgstr ""
    656667
    657 #: includes/woocommerce-businesspay-gateway.php:555
    658 #: includes/woocommerce-businesspay-gateway.php:1138
    659 msgid ""
    660 "BusinessPay: There was an error performing the transaction. Please contact "
    661 "us."
    662 msgstr ""
    663 
    664 #: includes/woocommerce-businesspay-gateway.php:556
    665 #: includes/woocommerce-businesspay-gateway.php:983
    666 #: includes/woocommerce-businesspay-gateway.php:1024
    667 msgid "Could not receive a valid server response. Please try again."
    668 msgstr ""
    669 
    670 #: includes/woocommerce-businesspay-gateway.php:579
    671 #: includes/woocommerce-businesspay-gateway.php:626
    672 #: includes/woocommerce-businesspay-gateway.php:675
    673 #: includes/woocommerce-businesspay-gateway.php:729
    674 msgid "Woocommerce Order"
    675 msgstr ""
    676 
    677 #: includes/woocommerce-businesspay-gateway.php:980
     668#: includes/woocommerce-businesspay-gateway.php:732
    678669msgid ""
    679670"The credentials for this virtual store are not valid on the BusinessPay "
     
    681672msgstr ""
    682673
    683 #: includes/woocommerce-businesspay-gateway.php:1021
     674#: includes/woocommerce-businesspay-gateway.php:735
     675#: includes/woocommerce-businesspay-gateway.php:1311
     676msgid "Could not receive a valid server response. Please try again."
     677msgstr ""
     678
     679#: includes/woocommerce-businesspay-gateway.php:828
     680msgid "BusinessPay Status: "
     681msgstr ""
     682
     683#: includes/woocommerce-businesspay-gateway.php:1022
     684msgid "Transaction started but not confirmed."
     685msgstr ""
     686
     687#: includes/woocommerce-businesspay-gateway.php:1025
     688msgid "Awating payment."
     689msgstr ""
     690
     691#: includes/woocommerce-businesspay-gateway.php:1028
     692msgid "Transaction effectivated."
     693msgstr ""
     694
     695#: includes/woocommerce-businesspay-gateway.php:1031
     696msgid "Transaction under analysis."
     697msgstr ""
     698
     699#: includes/woocommerce-businesspay-gateway.php:1034
     700msgid "Transaction expired."
     701msgstr ""
     702
     703#: includes/woocommerce-businesspay-gateway.php:1037
     704msgid "Transaction authorized."
     705msgstr ""
     706
     707#: includes/woocommerce-businesspay-gateway.php:1040
     708msgid "Transaction confirmed."
     709msgstr ""
     710
     711#: includes/woocommerce-businesspay-gateway.php:1043
     712msgid "Transaction denied."
     713msgstr ""
     714
     715#: includes/woocommerce-businesspay-gateway.php:1046
     716msgid "Cancellation in progress."
     717msgstr ""
     718
     719#: includes/woocommerce-businesspay-gateway.php:1049
     720msgid "Transaction Canceled."
     721msgstr ""
     722
     723#: includes/woocommerce-businesspay-gateway.php:1052
     724msgid "Transaction pending of confirmation."
     725msgstr ""
     726
     727#: includes/woocommerce-businesspay-gateway.php:1055
     728msgid "Failure to communicate with the provider."
     729msgstr ""
     730
     731#: includes/woocommerce-businesspay-gateway.php:1058
     732msgid "No valid server response."
     733msgstr ""
     734
     735#: includes/woocommerce-businesspay-gateway.php:1077
     736msgid "payment made less than the value of the order."
     737msgstr ""
     738
     739#: includes/woocommerce-businesspay-gateway.php:1308
    684740msgid ""
    685741"The credentials for this virtual store are not valid on the BusinessPay "
     
    687743msgstr ""
    688744
    689 #: includes/woocommerce-businesspay-gateway.php:1120
    690 msgid "BusinessPay Status: "
    691 msgstr ""
    692 
    693 #: includes/woocommerce-businesspay-gateway.php:1366
    694 msgid "Transaction started but not confirmed."
    695 msgstr ""
    696 
    697 #: includes/woocommerce-businesspay-gateway.php:1369
    698 msgid "Awating payment."
    699 msgstr ""
    700 
    701 #: includes/woocommerce-businesspay-gateway.php:1372
    702 msgid "Transaction effectivated."
    703 msgstr ""
    704 
    705 #: includes/woocommerce-businesspay-gateway.php:1375
    706 msgid "Transaction under analysis."
    707 msgstr ""
    708 
    709 #: includes/woocommerce-businesspay-gateway.php:1378
    710 msgid "Transaction expired."
    711 msgstr ""
    712 
    713 #: includes/woocommerce-businesspay-gateway.php:1381
    714 msgid "Transaction authorized."
    715 msgstr ""
    716 
    717 #: includes/woocommerce-businesspay-gateway.php:1384
    718 msgid "Transaction confirmed."
    719 msgstr ""
    720 
    721 #: includes/woocommerce-businesspay-gateway.php:1387
    722 msgid "Transaction denied."
    723 msgstr ""
    724 
    725 #: includes/woocommerce-businesspay-gateway.php:1390
    726 msgid "Cancellation in progress."
    727 msgstr ""
    728 
    729 #: includes/woocommerce-businesspay-gateway.php:1393
    730 msgid "Transaction Canceled."
    731 msgstr ""
    732 
    733 #: includes/woocommerce-businesspay-gateway.php:1396
    734 msgid "Transaction pending of confirmation."
    735 msgstr ""
    736 
    737 #: includes/woocommerce-businesspay-gateway.php:1399
    738 msgid "Failure to communicate with the provider."
    739 msgstr ""
    740 
    741 #: includes/woocommerce-businesspay-gateway.php:1402
    742 msgid "No valid server response."
    743 msgstr ""
    744 
    745 #: includes/woocommerce-businesspay-gateway.php:1410
    746 msgid "The order will be analyzed by antifraud software"
    747 msgstr ""
    748 
    749 #: includes/woocommerce-businesspay-gateway.php:1417
    750 msgid "payment made less than the value of the order."
    751 msgstr ""
    752 
    753 #: includes/woocommerce-businesspay-gateway.php:2631
    754 #: includes/woocommerce-businesspay-gateway.php:2638
     745#: includes/woocommerce-businesspay-gateway.php:1354
     746msgid "Antifraud Status: "
     747msgstr ""
     748
     749#: includes/woocommerce-businesspay-gateway.php:1486
     750msgid ""
     751"Order was automatically approved according to parameters defined in the "
     752"automatic approval rule."
     753msgstr ""
     754
     755#: includes/woocommerce-businesspay-gateway.php:1489
     756msgid "Order is queued for analysis."
     757msgstr ""
     758
     759#: includes/woocommerce-businesspay-gateway.php:1492
     760msgid "Order manually approved by decision-making of an analyst."
     761msgstr ""
     762
     763#: includes/woocommerce-businesspay-gateway.php:1495
     764msgid ""
     765"Order approved automatically by client-established policy or antifraud "
     766"software rule."
     767msgstr ""
     768
     769#: includes/woocommerce-businesspay-gateway.php:1498
     770msgid "Canceled by customer or duplicated order."
     771msgstr ""
     772
     773#: includes/woocommerce-businesspay-gateway.php:1501
     774msgid ""
     775"Order imputed as fraud confirmed by contact with the card administrator and "
     776"/ or contact with the card holder or CPF of the registry that is unaware of "
     777"the purchase."
     778msgstr ""
     779
     780#: includes/woocommerce-businesspay-gateway.php:1504
     781msgid "Order imported and not classified Score by the analyzer yet."
     782msgstr ""
     783
     784#: includes/woocommerce-businesspay-gateway.php:1507
     785msgid ""
     786"Order Automatically Disapproved by some type of business rule that needs to "
     787"be applied."
     788msgstr ""
     789
     790#: includes/woocommerce-businesspay-gateway.php:1510
     791msgid ""
     792"Order disapproved without suspicion by lack of contact with the client "
     793"within the agreed period and / or social security number of restrictive "
     794"policies (Irregular, SUS or Canceled)."
     795msgstr ""
     796
     797#: includes/woocommerce-businesspay-gateway.php:1513
     798msgid ""
     799"Order disapproved automatically by policy established by customer or "
     800"antifraud software."
     801msgstr ""
     802
     803#: includes/woocommerce-businesspay-gateway.php:1516
     804msgid ""
     805"Order automatically approved by policy established by the customer or "
     806"antifraud software."
     807msgstr ""
     808
     809#: includes/woocommerce-businesspay-gateway.php:1639
     810msgid "Woocommerce Order"
     811msgstr ""
     812
     813#: includes/woocommerce-businesspay-gateway.php:2974
     814#: includes/woocommerce-businesspay-gateway.php:2981
    755815msgid "BusinessPay Disabled"
    756816msgstr ""
    757817
    758 #: includes/woocommerce-businesspay-gateway.php:2632
     818#: includes/woocommerce-businesspay-gateway.php:2975
    759819msgid "You must enable at least one form of payment."
    760820msgstr ""
    761821
    762 #: includes/woocommerce-businesspay-gateway.php:2633
     822#: includes/woocommerce-businesspay-gateway.php:2976
    763823msgid "Click here to configure!"
    764824msgstr ""
    765825
    766 #: includes/woocommerce-businesspay-gateway.php:2639
     826#: includes/woocommerce-businesspay-gateway.php:2982
    767827#, php-format
    768828msgid ""
  • woo-businesspay/trunk/readme.txt

    r1969509 r1977545  
    2020Através do painel de administração dos pedidos do WooCommerce, você tem acesso a todas as informações disponíveis sobre a transação, os status informados pelo software antifraude e rede adquirente e a captura, para que você tenha total segurança em cada operação.
    2121Este plugin utiliza antifraude da ClearSale nativamente, isso significa que você não precisa se preocupar com configurações, nós cuidamos de tudo pra você.
    22 O software antifraude da ClearSale verifica a possibilidade de fraude em uma transação e impede que ela seja realizada. Caso não seja possível detectar a fraude, o valor da transação é ressarcido em sua intregralidade, fazendo com que sua taxa de chargeback sempre fique baixa.
     22
     23= Os seguintes produtos antifraude da ClearSale são compatíveis: =
     24* Realtime Decision;
     25* ClearSale Total;
     26* Total Garantido;
     27* Application;
     28
    2329Saiba mais em [ClearSale para E-Commerce](https://br.clear.sale/antifraude/ecommerce).
    2430
     
    2733= Para Compradores =
    2834Para o comprador, oferecemos a melhor experiência de compra, com facilidade de uso e segurança sempre.
    29 O comprador conta também com um cartão visual na página de finalização do pedido para facilitar a inserção das informações.
     35Oferecemos também um cartão visual na página de finalização do pedido para facilitar a inserção dos dados do cartão.
     36
     37= Os seguintes meios de pagamento são compatíveis: =
     38* Cartão de Crédito;
     39* Cartão de débito;
     40* Boleto Bancário via Bradesco ou Itaú;
     41* Transferência bancária via Bradesco ou Itaú;
     42
     43= As seguintes bandeiras de cartão de crédito são compatíveis: =
     44* American Express;
     45* Aura;
     46* Discover;
     47* Elo;
     48* Hiper;
     49* Hipercard;
     50* JCB;
     51* Mastercard;
     52* Visa;
    3053
    3154= Compatibilidade =
     
    5780* Não, sua conta da BusinessPay estará integrada automaticamente.
    5881
     82== Upgrade Notice ==
     83= 1.0.6 - 2018/11/20 =
     84* Add | Inserted Default Authentication Key and API to sandbox mode.
     85* Add | Admin panel antifraud product info.
     86* Add | Antifraud product Realtime Decision compatibility.
     87* Add | Async antifraud webhook consult status.
     88* Fix | Void index.php created in each plugin folder.
     89* Fix | Performance and code structure improvement.
     90
    5991== Changelog ==
    60 = 1.0.0 - 2018/10/25 =
    61 * Add | initial upload to plugin repository.
    62 
    63 = 1.0.1 - 2018/10/25 =
    64 * Add | Presentation and information contact updated.
    65 * Fix | initial upload to plugin repository.
    66 
    67 = 1.0.2 - 2018/10/25 =
    68 * Fix | Fixed an issue with .po and .mo files.
    69 * Fix | Fixed authentication issues.
    70 * Add | Woocommerce version compatibility declaration.
    71 
    72 = 1.0.3 - 2018/10/31 =
    73 * Add | Ajust WooCommerce order metadata to be hidden.
    74 * Add | Antifraud info panel on admin order edit page.
    75 * Fix | CamelCase translations fixed.
    76 
    77 = 1.0.4 - 2018/11/01 =
    78 * Fix | Fixed missing sanitize fields.
    79 * Fix | Antifraud address neighborhood missing.
    80 * Fix | Antifraud address complement missing.
     92= 1.0.6 - 2018/11/20 =
     93* Add | Inserted Default Authentication Key and API to sandbox mode.
     94* Add | Admin panel antifraud product info.
     95* Add | Antifraud product Realtime Decision compatibility.
     96* Add | Async antifraud webhook consult status.
     97* Fix | Void index.php created in each plugin folder.
     98* Fix | Performance and code structure improvement.
    8199
    82100= 1.0.5 - 2018/11/05 =
     
    92110* Fix | Fix date calculation error.
    93111
    94 == Upgrade Notice ==
    95 = 1.0.5 - 2018/11/05 =
    96 * Fix | Plugin readme updated.
    97 * Add | Added WooCommerce 3.5 compatibility.
    98 * Add | Added Storefront theme 2.3.5 compatibility.
    99 * Add | Added Screenshoots.
    100 * Add | Added Screenshoots descriptions.
    101 * Add | Added WooCommerce Visual Card dependency.
    102 * Fix | Wrong WooCommerce Visual Card slug.
    103 * Fix | Old WooCommerce version compatibility with get_option.
    104 * Fix | Better variables naming convention.
    105 * Fix | Fix date calculation error.
     112= 1.0.4 - 2018/11/01 =
     113* Fix | Fixed missing sanitize fields.
     114* Fix | Antifraud address neighborhood missing.
     115* Fix | Antifraud address complement missing.
     116
     117= 1.0.3 - 2018/10/31 =
     118* Add | Ajust WooCommerce order metadata to be hidden.
     119* Add | Antifraud info panel on admin order edit page.
     120* Fix | CamelCase translations fixed.
     121
     122= 1.0.2 - 2018/10/25 =
     123* Fix | Fixed an issue with .po and .mo files.
     124* Fix | Fixed authentication issues.
     125* Add | Woocommerce version compatibility declaration.
     126
     127= 1.0.1 - 2018/10/25 =
     128* Add | Presentation and information contact updated.
     129* Fix | initial upload to plugin repository.
     130
     131= 1.0.0 - 2018/10/25 =
     132* Add | initial upload to plugin repository.
  • woo-businesspay/trunk/templates/businesspay-panel-antifraud.php

    r1966657 r1977545  
    1414        $af_transaction_id = get_post_meta( $oid, '_businesspay-antifraud-transaction-id', true );
    1515        if ( strlen( $af_transaction_id ) > 0 ) {
    16             $af_woo_currency = get_woocommerce_currency_symbol();
     16            $af_id = get_post_meta( $oid, '_businesspay-antifraud-transaction-id', true );
     17
    1718            $af_transaction_date = str_replace( 'T', ' ', get_post_meta( $oid, '_businesspay-antifraud-transaction-date', true ) );
    1819            $af_transaction_date = date_create_from_format( $bpConfig->get_date_format(), $af_transaction_date );
    1920            $af_transaction_date = $af_transaction_date->format( 'd/m/Y ' . esc_html__( '\a\t', 'woocommerce-businesspay' ) . ' H:i:s' );
    2021
    21             $af_id = get_post_meta( $oid, '_businesspay-antifraud-id', true );
    22 
    2322            $af_transaction_status = get_post_meta( $oid, '_businesspay-antifraud-status-code', true ) . ' - ' . get_post_meta( $oid, '_businesspay-antifraud-status', true );
    24             $af_message = get_post_meta( $oid, '_businesspay-antifraud-message', true );
     23            $af_score              = get_post_meta( $oid, '_businesspay-antifraud-score', true );
     24            $af_message            = get_post_meta( $oid, '_businesspay-antifraud-message', true );
    2525
    2626            ?>
     
    2828            <h3><?php esc_html_e( 'Antifraud', 'woosommerce-businesspay' ); ?></h3>
    2929            <div class="businesspay-admin-order-payment">
    30                 <img src='<?php echo plugins_url( 'assets/img/businesspay-logotipo-clearsale.png', dirname( __FILE__ ) ); ?>' style='width: 108px;'>
     30                <img src='<?php echo plugins_url( 'assets/img/businesspay-logotipo-clearsale.png', dirname( __FILE__ ) ); ?>'
     31                     style='width: 108px;'>
    3132                <p>
    3233                    <strong><?php esc_html_e( 'Analysis Information', 'woocommerce-businesspay' ); ?></strong><br/>
    33                     <strong><?php esc_html_e( 'Token: ', 'woocommerce-businesspay' ); ?></strong><?php echo $af_transaction_id; ?>
    34                     <br/>
    35                     <strong><?php esc_html_e( 'ID: ', 'woocommerce-businesspay' ); ?></strong><?php echo $af_id; ?>
     34                    <strong><?php esc_html_e( 'ID: ', 'woocommerce-businesspay' ); ?></strong><?php echo $af_transaction_id; ?>
    3635                    <br/>
    3736                    <strong><?php esc_html_e( 'Date: ', 'woocommerce-businesspay' ); ?></strong><?php echo $af_transaction_date; ?>
     
    3938                    <strong><?php esc_html_e( 'Status: ', 'woocommerce-businesspay' ); ?></strong><?php echo $af_transaction_status; ?>
    4039                    <br/>
    41                     <strong><?php esc_html_e( 'Message: ', 'woocommerce-businesspay' ); ?></strong><?php echo $af_message; ?>
     40                    <strong><?php esc_html_e( 'Score: ', 'woocommerce-businesspay' ); ?></strong><?php echo $af_score; ?>
     41                    <br/>
     42                    <strong><?php esc_html_e( 'Message: ', 'woocommerce-businesspay' ); ?></strong><?php echo $af_score; ?>
    4243                    <br/>
    4344                </p>
  • woo-businesspay/trunk/templates/businesspay-panel-gateway.php

    r1966657 r1977545  
    88
    99if ( isset( $bpConfig ) ) {
    10 
    1110    $order = wc_get_order( $post->ID );
    1211    $oid   = $bpConfig->get_order_id( $order );
  • woo-businesspay/trunk/woocommerce-businesspay.php

    r1969506 r1977545  
    66 * Author:                  BusinessPay
    77 * Author URI:              https://www.businesspay.com.br/
    8  * Version:                 1.0.5
     8 * Version:                 1.0.6
    99 * Text Domain:             woocommerce-businesspay
    1010 * Domain Path:             /languages
     
    1919
    2020class WC_BusinessPay {
    21     const VERSION = '1.0.5';
     21    const VERSION = '1.0.6';
    2222    const VERSION_MIN_PHP = '5.4';
    2323    const VERSION_MIN_WP = '4.7';
     
    2929
    3030    public function __construct() {
    31 
    3231        add_action( 'init', array( $this, 'load_plugin_textdomain' ) );
    3332        if ( $this->check_dependency() ) {
     
    8685        return $methods;
    8786    }
     87
    8888
    8989
Note: See TracChangeset for help on using the changeset viewer.