Created
September 10, 2015 22:11
-
-
Save spiritbear/8981b6ee796a85a77e77 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| def refund_mail_balance | |
| transaction_params = {:transaction_type => 'refund', :amount => @company.current_balance } | |
| transaction_response = CompanyTransactionService.create(@company, 'refund', transaction_params) | |
| if transaction_response.status != 'accept' | |
| raise CustomerlobbyErrors::UnprocessableEntityError.new "Error refunding mail balance: #{transaction_response.status} (#{transaction_response.status_description})" | |
| end | |
| company.update_attributes(:current_balance => 0) | |
| end | |
| def cancel_subscription | |
| : | |
| : | |
| : | |
| end | |
| def process | |
| ActiveRecord::Base.transaction do | |
| refund_mail_balance | |
| cancel_subscription | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment