Plugin Directory

Changeset 2666098


Ignore:
Timestamp:
01/26/2022 04:18:40 PM (4 years ago)
Author:
iwdagency
Message:

add braintree

Location:
iwd-checkout-connector/trunk
Files:
2 added
7 edited

Legend:

Unmodified
Added
Removed
  • iwd-checkout-connector/trunk/includes/api/class-iwd-con-paypal-checkout.php

    r2540679 r2666098  
    4343        }
    4444
    45         $new_session_obj = new WC_Session_Handler();
    46         $session_data    = $new_session_obj->get_session( $api->quote_id );
     45        $this->init();
    4746
    48         $data['delivery_methods']       = IWD_CONNECTOR()->shipping->getShippingMethods( $session_data );
    49         $data['chosen_delivery_method'] = IWD_CONNECTOR()->shipping->getSelectedShipping( $session_data );
    50         $data['addresses']              = IWD_CONNECTOR()->customer->getAddresses( $session_data );
    51         $data['cart_items']             = IWD_CONNECTOR()->cart->getCartItems( $session_data );
    52         $data['cart']                   = IWD_CONNECTOR()->cart->getCart( $session_data );
     47        if ( ! empty( (array) $api->data ) ) {
     48            $this->setSessionData( $api->quote_id );
     49            $session_data = $this->getSessionData( $api->quote_id );
     50            $customer     = unserialize( $session_data['customer'] );
     51            IWD_CONNECTOR()->customer->saveAddresses( $api->data, $customer['id'] );
     52            $updated_session = $this->updateSessionData( $api->quote_id );
     53        } else {
     54            $updated_session = $this->getSessionData( $api->quote_id );
     55        }
     56
     57        $data['delivery_methods']       = IWD_CONNECTOR()->shipping->getShippingMethods( $updated_session );
     58        $data['chosen_delivery_method'] = IWD_CONNECTOR()->shipping->getSelectedShipping( $updated_session );
     59        $data['addresses']              = IWD_CONNECTOR()->customer->getAddresses( $updated_session );
     60        $data['cart_items']             = IWD_CONNECTOR()->cart->getCartItems( $updated_session );
     61        $data['cart']                   = IWD_CONNECTOR()->cart->getCart( $updated_session );
    5362
    5463        return $data;
  • iwd-checkout-connector/trunk/includes/api/class-iwd-order-update.php

    r2629644 r2666098  
    6868                $order->add_order_note( sprintf( __( 'Transaction %1$s has been voided in PayPal.' ), $transaction->id ) );
    6969                $order->update_status( 'cancelled' );
    70             }
     70            } elseif ( 'hold' == $paymentAction ) {
     71                if ( (property_exists($transaction, 'dispute')) ) {
     72                    $order->add_order_note('The Order was put on Hold because the Dispute with ID: '.$transaction->dispute->id
     73                        .' has been opened. Please access your Braintree account for more information.');
     74                } else {
     75                    $order->add_order_note('Order was put on Hold.');
     76                }
     77                $order->update_status( 'on-hold' );
     78            }
    7179            $order->save();
    7280
  • iwd-checkout-connector/trunk/includes/checkout/class-iwd-con-buttons.php

    r2629644 r2666098  
    5858        wp_enqueue_style('iwd-buttons-css-apple-pay', IWD_CONNECTOR_URL . 'public/css/iwd_apple_pay_buttons.css', array(), IWD_CONNECTOR_VERSION);
    5959        wp_enqueue_script('iwd-buttons-subscr', IWD_CONNECTOR_URL . 'public/js/payment/iwd_paypal_subscription.js', array('jquery', 'jquery-blockui',), IWD_CONNECTOR_VERSION);
    60     }
    61 
     60        $this->add_braintree_scripts();
     61    }
     62
     63    public function add_braintree_scripts()
     64    {
     65        wp_enqueue_script('braintree', 'https://js.braintreegateway.com/web/3.85.1/js/client.min.js', false);
     66        wp_enqueue_script('applepay', 'https://js.braintreegateway.com/web/3.85.1/js/apple-pay.min.js', false);
     67        wp_enqueue_script('iwdApplePayDataCol', 'https://js.braintreegateway.com/web/3.85.1/js/data-collector.min.js', false);
     68        wp_enqueue_script('iwd-braintree-apple-pay', IWD_CONNECTOR_URL . 'public/js/payment/braintree/iwd_braintree_apple_pay.js', array('jquery'), IWD_CONNECTOR_VERSION);
     69    }
    6270    /**
    6371     * Buttons for cart and mini cart
     
    100108                IWD.PayPal.params = {
    101109                    'containerId': '<?php echo esc_html($containerId); ?>',
    102                     'checkoutPagePath': '<?php echo esc_html(self::CHECKOUT_PAGE_PATH); ?>',
     110                    'checkoutPagePath': '<?php echo home_url(self::CHECKOUT_PAGE_PATH); ?>',
    103111                    'grandTotalAmount': "<?php echo esc_html(WC()->cart->get_total('edit')); ?>",
    104112                    'btnShape': '<?php echo esc_html(get_option('btn_shape')); ?>',
  • iwd-checkout-connector/trunk/includes/checkout/class-iwd-con-iframe.php

    r2540679 r2666098  
    2424            }
    2525
     26            if ( isset( $_GET['paypal_funding_source'] ) && ! empty( $_GET['paypal_funding_source'] ) ) {
     27                $params['paypal_funding_source'] = sanitize_text_field( $_GET['paypal_funding_source'] );
     28            }
     29
    2630            return IWD_CONNECTOR()->helper->getFrameUrl() . '?' . http_build_query( $params );
    2731        }
  • iwd-checkout-connector/trunk/iwd-checkout-connector.php

    r2646929 r2666098  
    55 * Description: Checkout Suite Connector
    66 * Author: Dominate
    7  * Version: 1.0.4
     7 * Version: 1.0.5
    88 * Author URI: https://www.dominate.co/
    99 * WC requires at least: 2.6.0
     
    3030             * Define plugin minimums and constants.
    3131             */
    32             define( 'IWD_CONNECTOR_VERSION', '1.0.4' );
     32            define( 'IWD_CONNECTOR_VERSION', '1.0.5' );
    3333            define( 'IWD_CONNECTOR_FILE', __FILE__ );
    3434            define( 'IWD_CONNECTOR_PATH', plugin_dir_path( __FILE__ ) );
  • iwd-checkout-connector/trunk/public/js/payment/iwd_paypal_button.js

    r2586060 r2666098  
    1616            init: function() {
    1717                if (window.paypal) {
    18                     let paypal = window.paypal;
     18                    let paypal = window.paypal,
     19                        clickedFundingSource = 'paypal';
    1920
    2021                    paypal.Buttons(
     
    2930                                fundingicons: false,
    3031                                tagline: false,
     32                            },
     33
     34                            onClick: function(data)  {
     35                                clickedFundingSource = data.fundingSource;
    3136                            },
    3237
     
    4449
    4550                            onApprove: function(data) {
    46                                 window.location.href = '/' + IWD.PayPal.params.checkoutPagePath + '?paypal_order_id=' + data.orderID;
     51                                window.location.href = IWD.PayPal.params.checkoutPagePath
     52                                    + '?paypal_order_id=' + data.orderID + '&paypal_funding_source=' + clickedFundingSource;
    4753                            }
    4854                        }
  • iwd-checkout-connector/trunk/public/templates/iwd-checkout-saas.php

    r2629644 r2666098  
    88        // Remove paypal_order_id param from url
    99        history.replaceState && history.replaceState(
    10             null, '', location.pathname + location.search.replace(/[\?&]paypal_order_id=[^&]+/, '').replace(/^&/, '?')
     10            null, '', location.pathname
     11                + location.search
     12                    .replace(/[\?&]paypal_order_id=[^&]+/, '')
     13                    .replace(/[\?&]paypal_funding_source=[^&]+/, '')
     14                    .replace(/^&/, '?')
    1115        );
    1216
Note: See TracChangeset for help on using the changeset viewer.