GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Pull Request — master (#25)
by Scott van
22:25 queued 11:41
created

EbayEnterprise_Multishipping_Model_Observer   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0
Metric Value
wmc 4
lcom 0
cbo 0
dl 0
loc 45
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A handleSalesOrderSaveBefore() 0 5 1
A handleSalesConvertQuoteToOrder() 0 22 3
1
<?php
2
/**
3
 * Copyright (c) 2013-2014 eBay Enterprise, Inc.
4
 *
5
 * NOTICE OF LICENSE
6
 *
7
 * This source file is subject to the Open Software License (OSL 3.0)
8
 * that is bundled with this package in the file LICENSE.md.
9
 * It is also available through the world-wide-web at this URL:
10
 * http://opensource.org/licenses/osl-3.0.php
11
 *
12
 * @copyright   Copyright (c) 2013-2014 eBay Enterprise, Inc. (http://www.ebayenterprise.com/)
13
 * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
14
 */
15
16
class EbayEnterprise_Multishipping_Model_Observer
17
{
18
    /**
19
     * Ensure shipment amounts have been collected for the order before it
20
     * is saved.
21
     *
22
     * @param Varien_Event_Observer
23
     * @return self
24
     */
25
    public function handleSalesOrderSaveBefore(Varien_Event_Observer $observer)
26
    {
27
        $observer->getEvent()->getOrder()->collectShipmentAmounts();
28
        return $this;
29
    }
30
31
    /**
32
     * Collect discount amounts from quote addresses and apply them to the
33
     * newly created order.
34
     *
35
     * @param Varien_Event_Observer
36
     * @return self
37
     */
38
    public function handleSalesConvertQuoteToOrder(Varien_Event_Observer $observer)
39
    {
40
        $event = $observer->getEvent();
41
        $order = $event->getOrder();
42
        $quote = $event->getQuote();
43
44
        $discountAmount = 0.00;
45
        $baseDiscountAmount = 0.00;
46
        foreach ($quote->getAllAddresses() as $address) {
47
            $discountAmount += $address->getDiscountAmount();
48
            $baseDiscountAmount += $address->getBaseDiscountAmount();
49
50
            if ($address->getDiscountDescription()) {
51
                $order->setDiscountDescription($address->getDiscountDescription());
52
            }
53
        }
54
55
        $order->setDiscountAmount($discountAmount)
56
            ->setBaseDiscountAmount($baseDiscountAmount);
57
58
        return $this;
59
    }
60
}
61