Plugin Directory

Changeset 1479700

Timestamp:
08/20/2016 10:12:27 PM (8 years ago)
Author:
akeda
Message:

Preparing for 1.1.2 release

Location:
woocommerce-gateway-paypal-express-checkout/trunk
Files:
4 added
10 edited

Legend:

Unmodified
Added
Removed
  • woocommerce-gateway-paypal-express-checkout/trunk/includes/abstracts/abstract-wc-gateway-ppec.php

    r1470867 r1479700  
    235235
    236236            if ( empty( $password ) ) {
    237                 WC_Admin_Settings::add_error( sprintf( __( 'Error: You must enter a %s API password.' ), __( $settings->get_environment(), 'woocommerce-gateway-paypal-express-checkout' ) ) );
     237                WC_Admin_Settings::add_error( ) );
    238238                return false;
    239239            }
     
    456456     */
    457457    public function is_available() {
    458         if ( 'yes' !== $this->enabled ) {
    459             return false;
    460         }
    461         return true;
     458        return 'yes' === $this->enabled;
    462459    }
    463460}
  • woocommerce-gateway-paypal-express-checkout/trunk/includes/class-wc-gateway-ppec-checkout-handler.php

    r1470458 r1479700  
    407407    }
    408408
     409
     410
     411
     412
     413
     414
     415
    409416    protected function is_success( $response ) {
    410         if ( 'Success' == $response['ACK'] || 'SuccessWithWarning' == $response['ACK'] ) {
    411             return true;
    412         } else {
    413             return false;
    414         }
     417       
     418           
     419       
     420           
     421       
    415422    }
    416423
     
    550557        $response = wc_gateway_ppec()->client->get_express_checkout_details( $token );
    551558
    552         if ( 'Success' == $response['ACK'] || 'SuccessWithWarning' == $response['ACK'] ) {
     559        if ( ) {
    553560            $checkout_details = new PayPal_Checkout_Details();
    554561            $checkout_details->loadFromGetECResponse( $response );
     
    575582        // Generate params to send to paypal, then do request
    576583        $response = wc_gateway_ppec()->client->do_express_checkout_payment( array_merge(
    577             $settings->get_do_express_checkout_params(),
    578584            $this->getDoExpressCheckoutParameters( $token, $payerID ),
    579             array(
    580                 'PAYMENTREQUEST_0_INVNUM' => $settings->invoice_prefix . $order->get_order_number(),
    581             )
     585            $settings->get_do_express_checkout_params( $order )
    582586        ) );
    583587
  • woocommerce-gateway-paypal-express-checkout/trunk/includes/class-wc-gateway-ppec-client-credential-certificate.php

    r1409404 r1479700  
    6464
    6565        if ( false === curl_setopt( $handle, CURLOPT_SSLCERT, $certificate_file ) ) {
    66             throw new Exception( __( 'Unable to accept certificate during cURL configuration', 'woocommerce-gateway-ppec' ), WC_Gateway_PPEC_Client::INVALID_ENVIRONMENT_ERROR );
     66            throw new Exception( __( 'Unable to accept certificate during cURL configuration', 'woocommerce-gateway-p' ), WC_Gateway_PPEC_Client::INVALID_ENVIRONMENT_ERROR );
    6767        }
    6868
    6969        if ( $this->_use_secure_transport() && false === curl_setopt( $handle, CURLOPT_SSLCERTPASSWD, $password ) ) {
    70             throw new Exception( __( 'Unable to accept certificate password during cURL configuration', 'woocommerce-gateway-ppec' ), WC_Gateway_PPEC_Client::INVALID_ENVIRONMENT_ERROR );
     70            throw new Exception( __( 'Unable to accept certificate password during cURL configuration', 'woocommerce-gateway-p' ), WC_Gateway_PPEC_Client::INVALID_ENVIRONMENT_ERROR );
    7171        }
    7272    }
     
    8585        $temp_file = tempnam( sys_get_temp_dir(), 'pptmp_' );
    8686        if ( ! $temp_file ) {
    87             throw new Exception( sprintf( __( 'Unable to write certificate file %s during cURL configuration', 'woocommerce-gateway-ppec' ), $temp_file ), WC_Gateway_PPEC_Client::INVALID_ENVIRONMENT_ERROR );
     87            throw new Exception( sprintf( __( 'Unable to write certificate file %s during cURL configuration', 'woocommerce-gateway-p' ), $temp_file ), WC_Gateway_PPEC_Client::INVALID_ENVIRONMENT_ERROR );
    8888        }
    8989
     
    111111
    112112        if ( false === $private_key ) {
    113             throw new Exception( __( 'Failed to retrieve private key during cURL configuration', 'woocommerce-gateway-ppec' ), WC_Gateway_PPEC_Client::INVALID_ENVIRONMENT_ERROR );
     113            throw new Exception( __( 'Failed to retrieve private key during cURL configuration', 'woocommerce-gateway-p' ), WC_Gateway_PPEC_Client::INVALID_ENVIRONMENT_ERROR );
    114114        }
    115115
    116116        if ( ! openssl_pkcs12_export_to_file( $this->_certificate, $temp_file, $private_key, $password ) ) {
    117             throw new Exception( __( 'Failed to export PKCS12 file during cURL configuration', 'woocommerce-gateway-ppec' ), WC_Gateway_PPEC_Client::INVALID_ENVIRONMENT_ERROR );
     117            throw new Exception( __( 'Failed to export PKCS12 file during cURL configuration', 'woocommerce-gateway-p' ), WC_Gateway_PPEC_Client::INVALID_ENVIRONMENT_ERROR );
    118118        }
    119119    }
     
    131131    protected function _maybe_create_non_secure_certificate_file( $temp_file ) {
    132132        if ( false === file_put_contents( $temp_file, $this->_certificate ) ) {
    133             throw new Exception( sprintf( __( 'Unable to write certificate file %s during cURL configuration', 'woocommerce-gateway-ppec' ), $temp_file ), WC_Gateway_PPEC_Client::INVALID_ENVIRONMENT_ERROR );
     133            throw new Exception( sprintf( __( 'Unable to write certificate file %s during cURL configuration', 'woocommerce-gateway-p' ), $temp_file ), WC_Gateway_PPEC_Client::INVALID_ENVIRONMENT_ERROR );
    134134        }
    135135    }
  • woocommerce-gateway-paypal-express-checkout/trunk/includes/class-wc-gateway-ppec-client.php

    r1470458 r1479700  
    119119            // Make sure $_credential and $_environment have been configured.
    120120            if ( ! $this->_credential ) {
    121                 throw new Exception( __( 'Missing credential', 'woocommerce-gateway-ppec' ), self::INVALID_CREDENTIAL_ERROR );
     121                throw new Exception( __( 'Missing credential', 'woocommerce-gateway-p' ), self::INVALID_CREDENTIAL_ERROR );
    122122            }
    123123
    124124            if ( ! is_a( $this->_credential, 'WC_Gateway_PPEC_Client_Credential' ) ) {
    125                 throw new Exception( __( 'Invalid credential object', 'woocommerce-gateway-ppec' ), self::INVALID_CREDENTIAL_ERROR );
     125                throw new Exception( __( 'Invalid credential object', 'woocommerce-gateway-p' ), self::INVALID_CREDENTIAL_ERROR );
    126126            }
    127127
    128128            if ( ! in_array( $this->_environment, array( 'live', 'sandbox' ) ) ) {
    129                 throw new Exception( __( 'Invalid environment', 'woocommerce-gateway-ppec' ), self::INVALID_ENVIRONMENT_ERROR );
     129                throw new Exception( __( 'Invalid environment', 'woocommerce-gateway-p' ), self::INVALID_ENVIRONMENT_ERROR );
    130130            }
    131131
     
    150150
    151151            if ( is_wp_error( $resp ) ) {
    152                 throw new Exception( sprintf( __( 'An error occurred while trying to connect to PayPal: %s', 'woocommerce-gateway-ppec' ), $resp->get_error_message() ), self::REQUEST_ERROR );
     152                throw new Exception( sprintf( __( 'An error occurred while trying to connect to PayPal: %s', 'woocommerce-gateway-p' ), $resp->get_error_message() ), self::REQUEST_ERROR );
    153153            }
    154154
     
    156156
    157157            if ( ! array_key_exists( 'ACK', $result ) ) {
    158                 throw new Exception( __( 'Malformed response received from PayPal', 'woocommerce-gateway-ppec' ), self::REQUEST_ERROR );
     158                throw new Exception( __( 'Malformed response received from PayPal', 'woocommerce-gateway-p' ), self::REQUEST_ERROR );
    159159            }
    160160
  • woocommerce-gateway-paypal-express-checkout/trunk/includes/class-wc-gateway-ppec-plugin.php

    r1470458 r1479700  
    145145        add_action( 'plugins_loaded', array( $this, 'bootstrap' ) );
    146146        add_filter( 'allowed_redirect_hosts' , array( $this, 'whitelist_paypal_domains_for_redirect' ) );
     147
    147148    }
    148149
     
    287288        require_once( $this->includes_path . 'class-wc-gateway-ppec-cart-handler.php' );
    288289        require_once( $this->includes_path . 'class-wc-gateway-ppec-ips-handler.php' );
     290
     291
    289292
    290293        $this->settings       = new WC_Gateway_PPEC_Settings();
     
    337340        return $domains;
    338341    }
     342
     343
     344
     345
     346
     347
     348
     349
     350
    339351}
  • woocommerce-gateway-paypal-express-checkout/trunk/includes/class-wc-gateway-ppec-settings.php

    r1470458 r1479700  
    115115        }
    116116
    117         if ( false === apply_filters( 'woocommerce_paypal_express_checkout_allow_guests', true ) ) {
     117        if ( apply_filters( 'woocommerce_paypal_express_checkout_allow_guests', true ) ) {
    118118            $params['SOLUTIONTYPE'] = 'Sole';
    119119        }
     
    175175        return $params;
    176176    }
    177     public function get_do_express_checkout_params( $buckets = 1 ) {
     177
     178    /**
     179     * Get base parameters, based on settings instance, for DoExpressCheckoutCheckout NVP call.
     180     *
     181     * @see https://developer.paypal.com/docs/classic/api/merchant/DoExpressCheckoutPayment_API_Operation_NVP/
     182     *
     183     * @param WC_Order  $order   Order object
     184     * @param int|array $buckets Number of buckets or list of bucket
     185     *
     186     * @return array DoExpressCheckoutPayment parameters
     187     */
     188    public function get_do_express_checkout_params( WC_Order $order, $buckets = 1 ) {
    178189        $params = array();
    179190        if ( ! is_array( $buckets ) ) {
     
    186197
    187198        foreach ( $buckets as $bucketNum ) {
     199
    188200            $params[ 'PAYMENTREQUEST_' . $bucketNum . '_PAYMENTACTION' ] = $this->get_paymentaction();
     201
     202
    189203        }
    190204
  • woocommerce-gateway-paypal-express-checkout/trunk/includes/class-wc-gateway-ppec-with-paypal.php

    r1470458 r1479700  
    99        $this->id = 'ppec_paypal';
    1010        parent::__construct();
     11
     12
     13
     14
     15
    1116    }
    1217}
  • woocommerce-gateway-paypal-express-checkout/trunk/includes/functions.php

    r1470458 r1479700  
    6464
    6565    $wc_ppec_logger->add( 'wc_gateway_ppec', $message );
     66
     67
     68
     69
    6670}
  • woocommerce-gateway-paypal-express-checkout/trunk/readme.txt

    r1470867 r1479700  
    44Requires at least: 4.4
    55Tested up to: 4.4
    6 Stable tag: 1.1.1
     6Stable tag: 1.1.
    77License: GPLv3
    88License URI: http://www.gnu.org/licenses/gpl-3.0.html
     
    8686== Changelog ==
    8787
     88
     89
     90
     91
     92
    8893= 1.1.1 =
    8994* Fixed fatal error prior to PHP 5.5 caused by passing empty() a non-variables.
  • woocommerce-gateway-paypal-express-checkout/trunk/woocommerce-gateway-paypal-express-checkout.php

    r1470867 r1479700  
    44 * Plugin URI: https://www.woothemes.com/products/woocommerce-gateway-paypal-express-checkout/
    55 * Description: A payment gateway for PayPal Express Checkout (https://www.paypal.com/us/webapps/mpp/express-checkout).
    6  * Version: 1.1.1
     6 * Version: 1.1.
    77 * Author: Automattic
    88 * Author URI: https://woocommerce.com
     
    3737        require_once( 'includes/class-wc-gateway-ppec-plugin.php' );
    3838
    39         $plugin = new WC_Gateway_PPEC_Plugin( __FILE__, '1.1.1' );
     39        $plugin = new WC_Gateway_PPEC_Plugin( __FILE__, '1.1.' );
    4040    }
    4141
Note: See TracChangeset for help on using the changeset viewer.