Plugin Directory

Changeset 2692952


Ignore:
Timestamp:
03/12/2022 01:56:01 PM (4 years ago)
Author:
louiscollarsmith
Message:

Updated to v1.0.1

Location:
quiver-delivery/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • quiver-delivery/trunk/includes/class-quiver-delivery-shipping-method.php

    r2624465 r2692952  
    1616        'QUI-WN' => 'WINDOW'
    1717    ];
    18     private $BATCH_CREATE_QUOTE_URL = 'https://api.quiver.london/delivery/quotes:batchCreate';
    19     private $CREATE_DELIVERY_URL = 'https://api.quiver.london/delivery/deliveries';
     18    // private $BATCH_CREATE_QUOTE_URL = 'https://api.quiver.london/delivery/quotes:batchCreate';
     19    // private $CREATE_DELIVERY_URL = 'https://api.quiver.london/delivery/deliveries';
     20    private $BATCH_CREATE_QUOTE_URL = 'http://localhost:2002/delivery/quotes:batchCreate';
     21    private $CREATE_DELIVERY_URL = 'http://localhost:2002/delivery/deliveries';
    2022
    2123    /**
     
    9092                'postcode' => array_key_exists('postcode', $destination) ? $destination['postcode'] : '',
    9193            ];
     94
     95            if (empty($address['postcode'])) {
     96                return;
     97            }
    9298           
    9399            $lineItems = [];
     
    97103            }
    98104
     105            $order = [
     106                'subtotalPrice' => (float) WC()->cart->get_subtotal()
     107            ];
     108
    99109            $request = [
    100110                'address' => $address,
    101111                'lineItems' => $lineItems,
     112                'order' => $order
    102113            ];
    103114
     
    148159                $quiver_line_items = $this->order_to_line_items($order);
    149160                $quiver_customer = $this->order_to_quiver_customer($order);
     161                $quiver_purchaser = $this->order_to_quiver_purchaser($order);
    150162                $quiver_address = $this->order_to_quiver_address($order);
    151163
     
    157169                    'address' => $quiver_address,
    158170                ];
     171
     172                if ($quiver_purchaser['firstName'] != $quiver_customer['firstName']
     173                    || $quiver_purchaser['lastName'] != $quiver_customer['lastName']
     174                    || $quiver_purchaser['company'] != $quiver_customer['company']) {
     175                    $request['purchaser'] = $quiver_purchaser;
     176                }
     177
    159178                $response = $this->post_request($this->CREATE_DELIVERY_URL, $request);
    160179                if (!$response) {
     
    214233            'firstName' => $order->get_shipping_first_name(),
    215234            'lastName' => $order->get_shipping_last_name(),
     235            'company' => $order->get_shipping_company(),
     236            'emailAddress' => $order->get_billing_email(),
     237            'phoneNumber' => $order->get_billing_phone()
     238        ];
     239    }
     240
     241        /**
     242     * @param WC_Order $order
     243     * @return array
     244    */
     245    private function order_to_quiver_purchaser( $order ) {
     246        return [
     247            'firstName' => $order->get_billing_first_name(),
     248            'lastName' => $order->get_billing_last_name(),
     249            'company' => $order->get_billing_company(),
    216250            'emailAddress' => $order->get_billing_email(),
    217251            'phoneNumber' => $order->get_billing_phone()
  • quiver-delivery/trunk/quiver-delivery.php

    r2624465 r2692952  
    44 * Plugin URI: https://wordpress.org/plugins/quiver-delivery/
    55 * Description: Quiver provides fast and emissionless urban delivery. Magic.
    6  * Version: 1.0.0
     6 * Version: 1.0.1
    77 * Author: Quiver
    88 * Author URI: https://getquiver.co.uk/
     
    2222class Quiver_Delivery {
    2323
    24     private $version = "1.0.0";
     24    private $version = "1.0.1";
    2525
    2626    /**
  • quiver-delivery/trunk/readme.md

    r2625649 r2692952  
    66Requires PHP: 5.6
    77Tested up to: 5.8.1
    8 Stable tag: 1.0.0
     8Stable tag: 1.0.1
    99WC requires at least: 3.0.0
    1010WC tested up to: 5.8.0
  • quiver-delivery/trunk/readme.txt

    r2625649 r2692952  
    66Requires PHP: 5.6
    77Tested up to: 5.8.1
    8 Stable tag: 1.0.0
     8Stable tag: 1.0.1
    99WC requires at least: 3.0.0
    1010WC tested up to: 5.8.0
Note: See TracChangeset for help on using the changeset viewer.