Re: [Rails] state_machine prevents ActiveRecord from being persisted
It sounds like you're in a tangle between FSM states and ActiveRecord states. You might need to add a payment_queued state that forces an AR save before transitioning to do_pay. You could then add some logic that fires a loop back to through do_pay (retry n times after increasing timeout) before failing.
On Thursday, January 28, 2010 3:06:47 PM UTC-5, FFighter wrote:
-- On Thursday, January 28, 2010 3:06:47 PM UTC-5, FFighter wrote:
Hi Joel, thanks for the reply.
The system is working well. My problem is with the state_machine gem. If the payment fails, I can't really get it saved without doing the hack I mentioned, becase the state_machine implementation rollback any db transaction when you return false from an event, however, I have to return false to tell the subscription object that the payment has failed, hence, the subscription upgrade fails, and state_machine rollback.
It has been solved (with that hack) but I just wanted to know if there was a more elegant non-hackish way to do that with state_machine.
Regards,
Marcelo.On Wed, Jan 27, 2010 at 9:09 AM, Joel Dezenzio <jdez...@gmail.com> wrote:
What type of payment system are you using? IPN?
If so, then once the payment reaches the payment gateway and the customer
finishes paying, you check the status of the payment received and if
successful, you change the subscription based off the amount(s) received.
You are supplying information but you aren't supplying any actual methods so
that we can review what you are doing. I use an IPN system for one of my
sites and do the above. I'd love to help you out but without seeing code
and how things are actually working with your controllers/models, I can't.
Sincerely,
Joel Dezenzio
Website Bio: http://jdezenzio.com/
Rails Production Sites: http://ncaastatpages.com
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonra...@googlegroups.com .
To unsubscribe from this group, send email to rubyonrails-ta...@googlegroups.com .
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en .
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/9aa88aa9-4b2a-4c11-b45c-45b9bcdd9478%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home