- Where Developers Learn, Share, & Build Careers


I am using ActiveMerchant to process a credit card transaction that can be successful or unsuccessful, which Part of some transactions, if any part of the internal accounting using activivercard processing fails, then I am not clear about how to roll back the whole transaction.

I have a payment model, and a point model - the user's digits are converted into dollars to reduce their payments.

  • Save points transactions: Debit user accounts, credit internal accounts
  • Save credit card transactions results ( Whether it succeeds or fails)
  • Again, if everything works, send an email to the user

    I see how it works And believe that I callback to handle the contents like emailing the user after after_commit (and after_rollback ).

    But how can I make an unsuccessful credit card transaction as a similar rollback, which is a failed AR save reason? Is it as easy as coding like increase active activation: rollback if my non-AR transaction fails? The above document contains a section that bothers me about it (related to transactions that do not work in many database connections).

    Rail 3.2.5, MySQL 5.1 (Indobi), Ruby 1.9.3

    < P> Your ActiveMerchant call is on an external server so it will not affect your ActiveRecord transaction. ActiveRecord :: Rollback . Feel free to increase

  • Comments

    Popular posts from this blog

    Python SQLAlchemy:AttributeError: Neither 'Column' object nor 'Comparator' object has an attribute 'schema' -

    java - How not to audit a join table and related entities using Hibernate Envers? -

    mongodb - CakePHP paginator ignoring order, but only for certain values -