Created
January 14, 2012 10:00
-
-
Save runlevel5/1610873 to your computer and use it in GitHub Desktop.
Credit adjustment for spree
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
order_number = 'R4678748' | |
o = Order.find_by_number(order_number) | |
adjustment_amount = o.total | |
rma_adjustment = o.adjustments.find_by_adjustment_source_type('ReturnAuthorization') | |
rma_adjustment.amount = rma_adjustment.amount - adjustment_amount | |
rma_adjustment.save | |
rma = rma_adjustment.adjustment_source | |
rma.amount = -1 * rma_adjustment.amount | |
rma.save | |
o.update_totals! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment