Are you using JavaScript to redirect the user to the sorry page?  If so
then WWW::Mechanise won't redirect.  It doesn't understand JavaScript.
Happily, there are drop in replacements for it that do:

http://search.cpan.org/~oalders/WWW-Mechanize-1.84/lib/WWW/Mechanize/FAQ.pod#Which_modules_work_like_Mechanize_and_have_JavaScript_support
?

On Tue, Apr 25, 2017 at 12:06 PM SSC_perl <p...@surfshopcart.com> wrote:

>         Here’s more information on this situation.  SurfShop uses two main
> HTML templates, main.htm and secure.htm.  Then there are sub-templates that
> get loaded as the content of those two main templates.
>
>         During checkout, secure.htm is used.  If the order is successful,
> receipt.htm is used as the sub-template, if not, then sorry.htm is shown
> with the error message.  This, of course, works as expected when placing an
> order by hand.
>
>         When placing a successful order with WWW::Mechanize, receipt.htm
> is shown correctly in $mech->content().  However, if the order was
> declined, that’s when Mech returns the same page it was on when the
> ‘processTransaction’ button was clicked, which is confirm.htm.
>
>         Up until this point, Mech performs just like when I manually place
> an order, so what could be causing it to get mixed up at the end?  I don’t
> think I'm doing anything special, but you never know.  Here’s a snippet of
> the code where the process fails:
>
>
> $mech->submit_form(
> form_name => 'ccForm',
> fields    => {
>   Ecom_Payment_Card_Type          => 'VISA',
>   Ecom_Payment_Card_Number        => ‘4444333322221111',
>   Ecom_Payment_Card_Verification  => '123',
>   Ecom_Payment_Card_ExpDate_Month => '05',
>   Ecom_Payment_Card_ExpDate_Year  => '2024',
>      },
> button    => 'processTransaction',
> );
>
>         As you can see, it’s pretty standard stuff.
>
>         Is there another method I can use besides $mech->content() to see
> what’s being returned?  The more tests I can do on this, the more it will
> help me find where I went wrong.
>
> Frank
> --
> To unsubscribe, e-mail: beginners-unsubscr...@perl.org
> For additional commands, e-mail: beginners-h...@perl.org
> http://learn.perl.org/
>
>
>

Reply via email to