{"push_id":633664939,"size":1,"distinct_size":1,"ref":"refs/heads/refactor-tax-keeping-gross-prices","head":"4855076c9f42444eb09fb1a04cb5729d051ac151","before":"b05134ed9299d1f84a9e2a80f576d158259d00fa","commits":[{"sha":"4855076c9f42444eb09fb1a04cb5729d051ac151","author":{"email":"df252263d3dbdf4a931869a3055dbbb26cb6b81a@googlemail.com","name":"Martin Meyerhoff"},"message":"Refactor Spree to make MOSS taxation possible\n\n1. Add current_tax_zone helper\n\nThe `current_tax_zone` is needed for displaying the correct price\nincluding VAT.\n\nIn order to cache product prices that depend on the current tax zone,\nwe need to add the current tax zone to the cache key for a single or\nmultiple products.\n\n2. Display correct VAT prices\n\n2. 1. Add Spree::Price#price_including_tax_for(zone)\n\nThis methods returns the correctly calculated gross price\nfor any zone that might have VAT. This way we can make sure to\nalways include the correct VAT in prices (even if they differ).\n\nThe method is delegated to Spree::Product and Spree::Variant.\n\n2. 2. Amend display_price helper to use current tax zone\n\n3. Copy price including VAT from Variant\n\nThis enables us to always have the same price as displayed\nin the order. It also frees us from having to load default VAT\nrates in `tax_rate.rb`.\n\nThe line item price will only ever be updated after the address\nstep in the state machine.\n\nOne expectation is changed in the back-end, because here the\nprice of the line items is updated from the variant, and those are\ndifferent.\n\n4. Refactor Spree::Zone and Spree::TaxRate\n\nWhen adjusting line items, do not include the default rates\nin the Array of applicable rates. This was only necessary because\nwe could not be sure about the price being correct in the first place,\nwhich is now fixed through ´Spree::Price#price_inlcuding_vat_for(zone)´.\n\nAs a consequence, I could refactor the stock estimator and fix\nhttps://github.com/spree/spree/issues/6234.\n\n5. Add rounding spec to tax_rate_spec.rb\n\nThis is mainly for posterity: I got stuck in rounding hell once, and\nthis test should ensure no-one else will have to.\n\n6. Fix reimbursement expectations\n\nThe reimbursement spec expected negative adjustments for included tax,\nwhich aren't necessary anymore - if your local tax zone does not include\nthe default VAT zone's VAT, the price is adjusted accordingly\nbeforehand.\n\n7. Add test for MOSS taxes\n\nThis is an elaborate almost-integration-test for a particular setup\nproving that it actually *is* possible now to configure Spree for MOSS.","distinct":true,"url":"https://api.github.com/repos/magiclabs/spree/commits/4855076c9f42444eb09fb1a04cb5729d051ac151"}]}