kilbot / WooCommerce-POS

:bangbang: All development now at https://github.com/wcpos.
http://wcpos.com
GNU General Public License v3.0
353 stars 125 forks source link

Incorrect tax calculation on negative fees (discounts) #85

Closed kilbot closed 9 years ago

kilbot commented 9 years ago

screen shot 2015-06-18 at 1 48 17 pm

screen shot 2015-06-18 at 1 48 40 pm

{
    "order": {
        "id": 11035,
        "order_number": 11035,
        "created_at": "2015-06-18T05:44:30Z",
        "updated_at": "2015-06-18T05:44:30Z",
        "completed_at": "2015-06-18T05:44:30Z",
        "status": "completed",
        "currency": "GBP",
        "total": "4.72",
        "subtotal": "9.00",
        "total_line_items_quantity": 1,
        "total_tax": "1.62",
        "total_shipping": "0.00",
        "cart_tax": "1.62",
        "shipping_tax": "0.00",
        "total_discount": "0.90",
        "shipping_methods": "",
        "payment_details": {
            "method_id": "pos_cash",
            "method_title": "Cash",
            "paid": true,
            "result": "success",
            "message": "",
            "redirect": ""
        },
        "billing_address": {
            "first_name": "",
            "last_name": "",
            "company": "",
            "address_1": "",
            "address_2": "",
            "city": "",
            "state": "",
            "postcode": "",
            "country": "",
            "email": "shopmanager@woopos.com.au",
            "phone": ""
        },
        "shipping_address": {
            "first_name": "",
            "last_name": "",
            "company": "",
            "address_1": "",
            "address_2": "",
            "city": "",
            "state": "",
            "postcode": "",
            "country": ""
        },
        "note": "",
        "customer_ip": "180.181.253.150",
        "customer_user_agent": "Mozilla\/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/43.0.2357.124 Safari\/537.36",
        "customer_id": 41,
        "view_order_url": "http:\/\/demo.woopos.com.au\/my-account\/view-order\/11035",
        "line_items": [{
            "id": 31938,
            "subtotal": "9.00",
            "subtotal_tax": "1.80",
            "total": "8.10",
            "total_tax": "1.62",
            "price": "8.10",
            "quantity": 1,
            "tax_class": null,
            "name": "Woo Single #2",
            "product_id": 99,
            "sku": "",
            "meta": []
        }],
        "shipping_lines": [],
        "tax_lines": [{
            "id": 31940,
            "rate_id": "2",
            "code": "GB-VAT-1",
            "title": "VAT",
            "total": "0.62",
            "compound": true
        }],
        "fee_lines": [{
            "id": 31939,
            "title": "Order Discount (After Tax)",
            "tax_class": null,
            "total": "-5.00",
            "total_tax": "-1.00"
        }],
        "coupon_lines": [],
        "customer": {
            "id": 41,
            "created_at": "2014-09-03T02:41:33Z",
            "email": "shopmanager@woopos.com.au",
            "first_name": "Shop",
            "last_name": "Manager",
            "username": "shopmanager",
            "role": "shop_manager",
            "last_order_id": "11035",
            "last_order_date": "2015-06-18T05:44:30Z",
            "orders_count": 460,
            "total_spent": "223665.72",
            "avatar_url": "http:\/\/0.gravatar.com\/avatar\/?s=96",
            "billing_address": {
                "first_name": "Shop",
                "last_name": "Manager",
                "company": "WooCommerce POS",
                "address_1": "23 Woo St",
                "address_2": "",
                "city": "Perth",
                "state": "WA",
                "postcode": "6000",
                "country": "AU",
                "email": "shopmanager@woopos.com.au",
                "phone": ""
            },
            "shipping_address": {
                "first_name": "",
                "last_name": "",
                "company": "",
                "address_1": "",
                "address_2": "",
                "city": "",
                "state": "",
                "postcode": "",
                "country": ""
            }
        },
        "subtotal_tax": "1.8",
        "cart_discount_tax": "0.18"
    }
}
kilbot commented 9 years ago

fixed with 1b6c5b7