Checkout being completed even if credit card isn't valid

21 views
Skip to first unread message

BryanMTL

unread,
Jul 8, 2009, 8:57:55 AM7/8/09
to Spree
With the new auto_capture code, I've noticed that if a fake card is
provided, the checkout completes but the state stays as "in progress".
The gateway doesn't return an error.

We're using WPP in sandbox mode though.

Anyone else have this behavior?

Paul Callaghan

unread,
Jul 8, 2009, 9:10:32 AM7/8/09
to spree...@googlegroups.com
I think this is a symptom of http://railsdog.lighthouseapp.com/projects/31096/tickets/557-need-to-avoid-silent-failures-in-the-checkout-process

You can confirm this by removing the cc.valid? check (which will get the gateway do do any validity checks)

NB you also need the fix from http://railsdog.lighthouseapp.com/projects/31096/tickets/555

Paul

BryanMTL

unread,
Jul 8, 2009, 9:43:03 AM7/8/09
to Spree
Thanks Paul. I'll check that out right now.

On Jul 8, 9:10 am, Paul Callaghan <paulcc....@googlemail.com> wrote:
> I think this is a symptom ofhttp://railsdog.lighthouseapp.com/projects/31096/tickets/557-need-to-...
>
> You can confirm this by removing the cc.valid? check (which will get the
> gateway do do any validity checks)
>
> NB you also need the fix fromhttp://railsdog.lighthouseapp.com/projects/31096/tickets/555

BryanMTL

unread,
Jul 8, 2009, 10:12:54 AM7/8/09
to Spree
With WPP in sandbox mode (spree running in production or development
mode), the checkout still completes even if the cc.valid? returns
false.

Paul Callaghan

unread,
Jul 8, 2009, 10:28:27 AM7/8/09
to spree...@googlegroups.com
Do you have my fix for #555 included?

There might be an issue with the cc_type - AM might return nil or bogus for the dummy card, which will cause a few silent failures.

See what Creditcard.type?(num) gives in the console, where num is the digit string (eg "411111111111111...")

Also check that you've not left the :use_bogus setting on...

Paul

BryanMTL

unread,
Jul 8, 2009, 10:36:21 AM7/8/09
to Spree
Hey Paul,

I do have the fix applied and use_bogus is set to false.

When I run the server with the debugger turned on, unless cc.valid?
and cc.purchase(order.total) will kill the thread and cc.purchase
(order.total) will return the proper gateway error from paypal - that
error message just doesn't seem to be returned to the checkout
controller and it's defaulting to success.

BryanMTL

unread,
Jul 8, 2009, 10:39:52 AM7/8/09
to Spree
Sorry Paul, if I remove the cc.valid? method, the error is properly
returned.

Paul Callaghan

unread,
Jul 8, 2009, 11:00:49 AM7/8/09
to spree...@googlegroups.com
Sounds like we got to the bottom of it

So: there's two issues

(a) silent failures, as identified in #557 (part of the fix is to remove the cc.valid? check but there may be other things to change too)

(b) cc.valid? shouldn't really be failing for you - and chances are it's the cc_type which is doing it, so maybe we need to extend spree_cc_type to return something sensible when it detects the gateway is in test mode...


OTOH - finding the cc_type is a bit of a black art (plus AM's regexps are out of date...), so it might be best to remove it from the validation checks anyway! Note that we don't save a CC now until it's been through authorization, so we can rely on the gateway to validate it.


Paul

BryanMTL

unread,
Jul 8, 2009, 11:24:21 AM7/8/09
to Spree
The cc.valid? doesn't really fail, it returns false for invalid cards.
It's simply the fact that it seems to be failing silently.

It's working fine for me now with it removed.

Paul Callaghan

unread,
Jul 8, 2009, 12:36:36 PM7/8/09
to spree...@googlegroups.com

The cc.valid? doesn't really fail, it returns false for invalid cards.
It's simply the fact that it seems to be failing silently.

in test mode, your test card should be valid(!) - so if the cc_type is causing the validation fail, then it needs to be fixed...
 

It's working fine for me now with it removed.

good!
 

Paul

Reply all
Reply to author
Forward
0 new messages