Skip to content

Instantly share code, notes, and snippets.

@spiritbear
Created September 10, 2015 22:11
Show Gist options
  • Select an option

  • Save spiritbear/8981b6ee796a85a77e77 to your computer and use it in GitHub Desktop.

Select an option

Save spiritbear/8981b6ee796a85a77e77 to your computer and use it in GitHub Desktop.
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