Forum: Ruby on Rails Error Checking and Processing

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
54a6fc785e9fcf73ead8e387432b32f5?d=identicon&s=25 Dan Harper (Guest)
on 2006-03-25 00:41
(Received via mailing list)
Does anyone have any ideas on the best way to perform error checking and
processing for a particular problem:

- A customer fills in an order form with their credit card details and
hits submit.

The controller has to do the following work:

 - Try to find an existing customer matched by email
    - if the customer exists, update their details in the database
    - if the customer is new save a new record
    - validation errors could occur here
 - Copy the data from the cart session variable to an Order object
 - Save the order to the orders table
 - Send the credit card details to PayPal for processing
    - parse success/fail and save any errors to forward to the user
 - If anything failed, redirect back to the form filling in the form
details and showing all error messages.

Now some things I'm not too clear on in Rails land:
 - How to I parse the response from PayPal for error messages (using
SOAP and the PayPayl Rails plugin)?
 - How do I redirect back to the form and send the data to fill in?  (I
can redirect to the form, but there are no values filled in)
 - What is the best way to structure these steps in code (order, etc)
and the best way to handle the success/fail, rollback, errors, etc?

It may be obvious, but my brain is a bit mushed from staring at this
problem too long, any help appreciated.

Cheers,
Dan
54a6fc785e9fcf73ead8e387432b32f5?d=identicon&s=25 Dan Harper (Guest)
on 2006-03-25 05:44
(Received via mailing list)
Dan Harper wrote:
> Now some things I'm not too clear on in Rails land:
> - How to I parse the response from PayPal for error messages (using
> SOAP and the PayPayl Rails plugin)?
> - How do I redirect back to the form and send the data to fill in?  (I
> can redirect to the form, but there are no values filled in)

I figured out the blank values problem (sorta), but the others are still
a mystery.

Any ideas?
4005a47a8f2ceee49670b920593c1d52?d=identicon&s=25 Ben Munat (Guest)
on 2006-03-25 08:56
(Received via mailing list)
Dan Harper wrote:
> Dan Harper wrote:
>
>> Now some things I'm not too clear on in Rails land:
>> - How to I parse the response from PayPal for error messages (using
>> SOAP and the PayPayl Rails plugin)?
>> - How do I redirect back to the form and send the data to fill in?  (I
>> can redirect to the form, but there are no values filled in)
>
I don't know anything about SOAP, but the latter problem sounds like
it's simply the
result of redirects being a new request... save the form data in the
flash and pull it
back out after the redirect.

b
This topic is locked and can not be replied to.