Plugin Directory

Changeset 1966480


Ignore:
Timestamp:
10/31/2018 01:32:43 PM (7 years ago)
Author:
pauldechov
Message:

Update trunk to 1.6.5

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

Legend:

Unmodified
Added
Removed
  • woocommerce-gateway-paypal-express-checkout/trunk/changelog.txt

    r1948167 r1966480  
    11*** Changelog ***
     2
     3= 1.6.5 - 2018-10-31 =
     4* Fix - Truncate the line item descriptions to avoid exceeding PayPal character limits.
     5* Update - WC 3.5 compatibility.
     6* Fix - checkout.js script loading when not needed.
     7* Fix - Missing shipping total and address when starting from checkout page.
    28
    39= 1.6.4 - 2018-09-27 =
  • woocommerce-gateway-paypal-express-checkout/trunk/includes/abstracts/abstract-wc-gateway-ppec.php

    r1904138 r1966480  
    124124                return array(
    125125                    'result'   => 'success',
    126                     'redirect' => $checkout->start_checkout_from_checkout( $order_id, $this->use_ppc ),
     126                    'redirect' => $checkout->start_checkout_from_order( $order_id, $this->use_ppc ),
    127127                );
    128128            } catch ( PayPal_API_Exception $e ) {
     
    135135
    136136                $checkout_context = array(
    137                     'start_from' => 'checkout',
    138137                    'order_id'   => $order_id,
    139138                );
  • woocommerce-gateway-paypal-express-checkout/trunk/includes/class-wc-gateway-ppec-cart-handler.php

    r1948167 r1966480  
    137137
    138138        if ( isset( $_POST['from_checkout'] ) && 'yes' === $_POST['from_checkout'] ) {
    139             add_filter( 'woocommerce_cart_needs_shipping', '__return_false' );
    140 
    141139            // Intercept process_checkout call to exit after validation.
    142140            add_action( 'woocommerce_after_checkout_validation', array( $this, 'maybe_start_checkout' ), 10, 2 );
    143141            WC()->checkout->process_checkout();
    144142        } else {
    145             $this->start_checkout();
     143            $this->start_checkout( true );
    146144        }
    147145    }
     
    163161        if ( empty( $error_messages ) ) {
    164162            $this->set_customer_data( $_POST );
    165             $this->start_checkout();
     163            $this->start_checkout( false );
    166164        } else {
    167165            wp_send_json_error( array( 'messages' => $error_messages ) );
     
    173171     * Set Express Checkout and return token in response.
    174172     *
     173     * @param bool $skip_checkout  Whether checkout screen is being bypassed.
     174     *
    175175     * @since 1.6.4
    176176     */
    177     protected function start_checkout() {
     177    protected function start_checkout( $skip_checkout ) {
    178178        try {
    179             wc_gateway_ppec()->checkout->start_checkout_from_cart();
     179            wc_gateway_ppec()->checkout->start_checkout_from_cart( $skip_checkout );
    180180            wp_send_json_success( array( 'token' => WC()->session->paypal->token ) );
    181181        } catch( PayPal_API_Exception $e ) {
     
    268268        ?>
    269269        <div class="wcppec-checkout-buttons woo_pp_cart_buttons_div">
    270             <?php if ( 'yes' === $settings->use_spb ) : ?>
     270            <?php if ( 'yes' === $settings->use_spb ) :
     271                wp_enqueue_script( 'wc-gateway-ppec-smart-payment-buttons' ); ?>
    271272            <div id="woo_pp_ec_button_product"></div>
    272273            <?php else : ?>
     
    304305            <?php endif; ?>
    305306
    306             <?php if ( 'yes' === $settings->use_spb ) : ?>
     307            <?php if ( 'yes' === $settings->use_spb ) :
     308                wp_enqueue_script( 'wc-gateway-ppec-smart-payment-buttons' ); ?>
    307309            <div id="woo_pp_ec_button_cart"></div>
    308310            <?php else : ?>
     
    337339        ?>
    338340
    339         <?php if ( 'yes' === $settings->use_spb ) : ?>
     341        <?php if ( 'yes' === $settings->use_spb ) :
     342            wp_enqueue_script( 'wc-gateway-ppec-smart-payment-buttons' ); ?>
    340343        <p class="woocommerce-mini-cart__buttons buttons wcppec-cart-widget-spb">
    341344            <span id="woo_pp_ec_button_mini_cart"></span>
     
    428431
    429432        } elseif ( 'yes' === $settings->use_spb ) {
    430             wp_enqueue_script( 'paypal-checkout-js', 'https://www.paypalobjects.com/api/checkout.js', array(), null, true );
    431             wp_enqueue_script( 'wc-gateway-ppec-smart-payment-buttons', wc_gateway_ppec()->plugin_url . 'assets/js/wc-gateway-ppec-smart-payment-buttons.js', array( 'jquery', 'paypal-checkout-js' ), wc_gateway_ppec()->version, true );
     433            wp_register_script( 'paypal-checkout-js', 'https://www.paypalobjects.com/api/checkout.js', array(), null, true );
     434            wp_register_script( 'wc-gateway-ppec-smart-payment-buttons', wc_gateway_ppec()->plugin_url . 'assets/js/wc-gateway-ppec-smart-payment-buttons.js', array( 'jquery', 'paypal-checkout-js' ), wc_gateway_ppec()->version, true );
    432435
    433436            $data = array(
  • woocommerce-gateway-paypal-express-checkout/trunk/includes/class-wc-gateway-ppec-checkout-handler.php

    r1925163 r1966480  
    706706
    707707    /**
    708      * Handler when buyer is checking out from cart page.
     708     * Handler when buyer is checking out prior to order creation.
    709709     *
    710710     * @return string Redirect URL.
    711711     */
    712     public function start_checkout_from_cart() {
     712    public function start_checkout_from_cart( $skip_checkout = true ) {
    713713        $settings     = wc_gateway_ppec()->settings;
    714714
    715715        $context_args = array(
    716             'start_from' => 'cart',
     716            'skip_checkout' => $skip_checkout,
    717717        );
    718718
     
    727727
    728728    /**
    729      * Handler when buyer is checking out from checkout page.
     729     * Handler when buyer is checking out after order is created (i.e. from checkout page with Smart Payment Buttons disabled).
    730730     *
    731731     * @param int  $order_id Order ID.
     
    734734     * @return string Redirect URL.
    735735     */
    736     public function start_checkout_from_checkout( $order_id, $use_ppc ) {
     736    public function start_checkout_from_order( $order_id, $use_ppc ) {
    737737        $settings     = wc_gateway_ppec()->settings;
    738738
    739739        $context_args = array(
    740             'start_from' => 'checkout',
    741             'order_id'   => $order_id,
     740            'skip_checkout' => false,
     741            'order_id'      => $order_id,
    742742        );
    743743
     
    997997     *     Context args to retrieve SetExpressCheckout parameters.
    998998     *
    999      *     @type string $start_from Start from 'cart' or 'checkout'.
    1000      *     @type int    $order_id   Order ID if $start_from is 'checkout'.
     999     *     @type int    $order_id   Order ID if order has been created.
    10011000     * }
    10021001     *
     
    10051004    public function needs_billing_agreement_creation( $args ) {
    10061005        $needs_billing_agreement = false;
    1007         switch ( $args['start_from'] ) {
    1008             case 'cart':
    1009                 if ( class_exists( 'WC_Subscriptions_Cart' ) ) {
    1010                     $needs_billing_agreement = WC_Subscriptions_Cart::cart_contains_subscription();
    1011                 }
    1012                 break;
    1013             case 'checkout':
    1014                 if ( function_exists( 'wcs_order_contains_subscription' ) ) {
    1015                     $needs_billing_agreement = wcs_order_contains_subscription( $args['order_id'] );
    1016                 }
    1017                 if ( function_exists( 'wcs_order_contains_renewal' ) ) {
    1018                     $needs_billing_agreement = ( $needs_billing_agreement || wcs_order_contains_renewal( $args['order_id'] ) );
    1019                 }
    1020                 break;
     1006
     1007        if ( empty( $args['order_id'] ) ) {
     1008            if ( class_exists( 'WC_Subscriptions_Cart' ) ) {
     1009                $needs_billing_agreement = WC_Subscriptions_Cart::cart_contains_subscription();
     1010            }
     1011        } else {
     1012            if ( function_exists( 'wcs_order_contains_subscription' ) ) {
     1013                $needs_billing_agreement = wcs_order_contains_subscription( $args['order_id'] );
     1014            }
     1015            if ( function_exists( 'wcs_order_contains_renewal' ) ) {
     1016                $needs_billing_agreement = ( $needs_billing_agreement || wcs_order_contains_renewal( $args['order_id'] ) );
     1017            }
    10211018        }
    10221019
  • woocommerce-gateway-paypal-express-checkout/trunk/includes/class-wc-gateway-ppec-client.php

    r1948167 r1966480  
    228228     *     Context args to retrieve SetExpressCheckout parameters.
    229229     *
    230      *     @type string $start_from               Start from 'cart' or 'checkout'.
    231      *     @type int    $order_id                 Order ID if $start_from is 'checkout'.
     230     *     @type string $skip_checkout            Whether checking out ahead of store checkout screen.
     231     *     @type int    $order_id                 Order ID if checking out after order is created.
    232232     *     @type bool   $create_billing_agreement Whether billing agreement creation
    233233     *                                            is needed after returned from PayPal.
     
    240240            $args,
    241241            array(
    242                 'start_from'               => 'cart',
     242                'skip_checkout'            => true,
    243243                'order_id'                 => '',
    244244                'create_billing_agreement' => false,
     
    262262        }
    263263
    264         if ( 'checkout' === $args['start_from'] ) {
     264        if ( ! $args['skip_checkout'] ) {
     265            // Display shipping address sent from checkout page, rather than selecting from addresses on file with PayPal.
    265266            $params['ADDROVERRIDE'] = '1';
    266267        }
     
    289290        $params['PAYMENTREQUEST_0_CURRENCYCODE'] = get_woocommerce_currency();
    290291
    291         switch ( $args['start_from'] ) {
    292             case 'checkout':
    293                 $details = $this->_get_details_from_order( $args['order_id'] );
    294                 break;
    295             case 'cart':
    296                 $details = $this->_get_details_from_cart();
    297                 break;
     292        if ( ! empty( $args['order_id'] ) ) {
     293            $details = $this->_get_details_from_order( $args['order_id'] );
     294        } else {
     295            $details = $this->_get_details_from_cart();
    298296        }
    299297
     
    328326                $line_item_params = array(
    329327                    'L_PAYMENTREQUEST_0_NAME' . $count => $values['name'],
    330                     'L_PAYMENTREQUEST_0_DESC' . $count => ! empty( $values['description'] ) ? strip_tags( $values['description'] ) : '',
     328                    'L_PAYMENTREQUEST_0_DESC' . $count => ! empty( $values['description'] ) ? substr( strip_tags( $values['description'] ), 0, 127 ) : '',
    331329                    'L_PAYMENTREQUEST_0_QTY' . $count  => $values['quantity'],
    332330                    'L_PAYMENTREQUEST_0_AMT' . $count  => $values['amount'],
     
    351349     *     Context args to retrieve SetExpressCheckout parameters.
    352350     *
    353      *     @type string $start_from               Start from 'cart' or 'checkout'.
    354      *     @type int    $order_id                 Order ID if $start_from is 'checkout'.
    355351     *     @type bool   $create_billing_agreement Whether billing agreement creation
    356352     *                                            is needed after returned from PayPal.
  • woocommerce-gateway-paypal-express-checkout/trunk/includes/class-wc-gateway-ppec-settings.php

    r1904138 r1966480  
    184184        _deprecated_function( __METHOD__, '1.2.0', 'WC_Gateway_PPEC_Client::get_set_express_checkout_params' );
    185185
    186         return wc_gateway_ppec()->client->get_set_express_checkout_params( array( 'start_from' => 'cart' ) );
     186        return wc_gateway_ppec()->client->get_set_express_checkout_params( array( 'skip_checkout' => true ) );
    187187    }
    188188
     
    192192        // Still missing order_id in args.
    193193        return wc_gateway_ppec()->client->get_set_express_checkout_params( array(
    194             'start_from' => 'checkout',
     194            'skip_checkout' => false,
    195195        ) );
    196196    }
  • woocommerce-gateway-paypal-express-checkout/trunk/includes/class-wc-gateway-ppec-with-spb-addons.php

    r1904138 r1966480  
    2020     */
    2121    public function display_paypal_button() {
     22        wp_enqueue_script( 'wc-gateway-ppec-smart-payment-buttons' );
    2223        ?>
    2324        <div id="woo_pp_ec_button_checkout"></div>
  • woocommerce-gateway-paypal-express-checkout/trunk/includes/class-wc-gateway-ppec-with-spb.php

    r1904138 r1966480  
    2020     */
    2121    public function display_paypal_button() {
     22        wp_enqueue_script( 'wc-gateway-ppec-smart-payment-buttons' );
    2223        ?>
    2324        <div id="woo_pp_ec_button_checkout"></div>
  • woocommerce-gateway-paypal-express-checkout/trunk/readme.txt

    r1948167 r1966480  
    33Tags: ecommerce, e-commerce, commerce, woothemes, wordpress ecommerce, store, sales, sell, shop, shopping, cart, checkout, configurable, paypal
    44Requires at least: 4.4
    5 Tested up to: 4.9.6
    6 Stable tag: 1.6.4
     5Tested up to: 4.9.8
     6Stable tag: 1.6.5
    77License: GPLv3
    88License URI: http://www.gnu.org/licenses/gpl-3.0.html
     
    102102== Changelog ==
    103103
     104= 1.6.5 - 2018-10-31 =
     105* Fix - Truncate the line item descriptions to avoid exceeding PayPal character limits.
     106* Update - WC 3.5 compatibility.
     107* Fix - checkout.js script loading when not needed.
     108* Fix - Missing shipping total and address when starting from checkout page.
     109
    104110= 1.6.4 - 2018-09-27 =
    105111* Fix - Billing address from Checkout form not being passed to PayPal via Smart Payment Button.
  • woocommerce-gateway-paypal-express-checkout/trunk/woocommerce-gateway-paypal-express-checkout.php

    r1948167 r1966480  
    44 * Plugin URI: https://woocommerce.com/products/woocommerce-gateway-paypal-express-checkout/
    55 * Description: A payment gateway for PayPal Checkout (https://www.paypal.com/us/webapps/mpp/paypal-checkout).
    6  * Version: 1.6.4
     6 * Version: 1.6.5
    77 * Author: WooCommerce
    88 * Author URI: https://woocommerce.com
     
    1212 * Text Domain: woocommerce-gateway-paypal-express-checkout
    1313 * Domain Path: /languages
    14  * WC tested up to: 3.4
     14 * WC tested up to: 3.5
    1515 * WC requires at least: 2.6
    1616 */
     
    2828}
    2929
    30 define( 'WC_GATEWAY_PPEC_VERSION', '1.6.4' );
     30define( 'WC_GATEWAY_PPEC_VERSION', '1.6.5' );
    3131
    3232/**
Note: See TracChangeset for help on using the changeset viewer.