TL;DR:
For recurring profile - orders are generated by Magento after a notification from Paypal, taxes are stored as line-items are are charged in accordance with your store's tax rules, based on the original order. Invoices happen automatically and no action is required from the customer.
There are two ways of performing 'recurring' payments via Magento:
Billing Agreements
A billing agreement in Paypal is a means of storing a token, or a billing agreement, in order to generate orders from it. The customer has authorized that you may store the information and you may create orders on-demand. This does not happen automatically, however, but either an admin or the customer themselves may generate sales orders without having to re-enter payment information.
If you wish to be in control of how and when items are billed every month, Billing Agreements are an easy way of maintaining this.
- You may capture/invoice manually from Admin > Sales > Billing Agreements
- You can view billing agreements on a per-customer basis from the customer admin
- The customer is able to edit/cancel their own agreement
Any of the above could be considered positives or negatives, depending on how hands-on you are with your store.
For more information -
http://www.magentocommerce.com/knowledge-base/entry/setting-up-billing-agreements-through-paypal
Recurring Profiles
http://www.magentocommerce.com/knowledge-base/entry/working-with-recurring-profiles
First, a few drawbacks -
- Magento's recurring profiles is configured to work with Paypal only (at least as of 1.6CE / 1.11 EE)
- You cannot purchase non-recurring items along with recurring items (at least as of 1.6CE/1.11EE)
- The customer has no control over the frequency, only start date, though they can 'hold' and 'unhold' their shipments. Any substantive changes, such as product substitution, require cancellation or manual modification of the profile from within Paypal's own interface.
- Only Simple/Virtual product types.
Paypal tokenizes the credit card and, when used with your store's API key, allows you to charge the customer without the card being present. This token is called a 'reference transaction' and expires after a maximum of 365 days. I'm not sure how this works in a standard Paypal Express store, but a Website Payments Pro account needs the feature enabled by their customer service team before you can use it.
The order is entered by Magento, in response to a Paypal IPN that the funds were charged. New orders and invoices are generated.
More information
Some information was sourced here:
http://lewisbrian.hubpages.com/hub/Effectively-Working-with-Recurring-Profiles-in-Magento
Tokenization / billing agreements:
http://en.wikipedia.org/wiki/Tokenization_(data_security)
https://www.paypal.com/helpcenter/main.jsp;jsessionid=4Tc2KhVVj1Q0gfK1RR8GNGSGptqQPH2zqMgyKzbpTvpTwVkprGnh!9559953?t=solutionTab&ft=homeTab&ps=&solutionId=163218&locale=en_GB&_dyncharset=UTF-8&countrycode=GB&cmd=_help&serverInstance=9002
Recurring payment profiles in Paypal Express:
https://www.paypal.com/cgi-bin/webscr?cmd=xpt/Marketing/general/RecurringPaymentFAQs-outside#Q9
Magento Recurring Profiles:
http://www.magentocommerce.com/knowledge-base/entry/working-with-recurring-profiles
As Fabian said, Magento does not save much information about what discounts have been applied how. In particular take a look at Mage_SalesRule_Model_Validator
The only information that is set is:
$item->setDiscountAmount($discountAmount);
$item->setBaseDiscountAmount($baseDiscountAmount);
$item->setOriginalDiscountAmount($originalDiscountAmount);
$item->setBaseOriginalDiscountAmount($baseOriginalDiscountAmount);
...
$item->setAppliedRuleIds(join(',',$appliedRuleIds));
One avenue worth exploring is this event:
Mage::dispatchEvent('salesrule_validator_process', array(
'rule' => $rule,
'item' => $item,
'address' => $address,
'quote' => $quote,
'qty' => $qty,
'result' => $result,
));
since it has qty available which in your case should be the desired quantity. With the additional $item also being available you can add a custom column to the quote_item (and subsequently the order_item) to save this information. The big gotcha here is that one item can take part in multiple rules, so you would have to save the qty split by $rule->getId().
Best Answer
Magento is calculating:
Tax: 554.26 × 0.0825 = 45.72645.
Subtotal + Tax: 554.26 + 45.72645 = 599.98645.
Total - Discount: 599.98645 - 54.42 = 544.56645
I think if you tweak some settings in
Admin -> System -> Configuration -> Sales -> Tax -> Calculation Settings
andAdmin -> System -> Configuration -> Sales -> Sales -> Checkout Totals Sort Order
then you can get it to the computation that you're expecting but the way I have it broken out above is how it's computing based on your current settings.