worldpay xml gateway

123 views
Skip to first unread message

JamieD

unread,
May 9, 2011, 8:28:58 AM5/9/11
to Active Merchant
Hi,

I've implemented a gateway module for worldpay but have run into an
issue and am wondering what the best way to solve this would be.
Looking at the documentation there is a briefly mentioned, but very
important, detail here http://www.worldpay.com/support/bg/xml/kb/3dsecure/dxml4002.html#SecondOrder
(see the info box). The gateway returns a cookie header when the app
needs to store and send off in the header for the next request. As
active merchant wraps up Net::HTTP and only returns the body of the
response it's not possible to easily access the headers of the
response from the gateway.

What I've come up with so far is to override the handle_response
method on the Connection class, if I was to return a full response
object this would obviously change the behavior and all other gateways
would need to be modified. So what I am thinking of going is returning
a String object which is the body and adding a get_headers method to
it to enable access. This would ensure compatibility with the other
gateways and include the additional information needed for worldpay.

Would there be a better way to do this or is this probably the best
solution for dealing what's got the be the most awkward payment
gateway around?

Thanks
Jamie

Nathaniel Talbott

unread,
May 9, 2011, 10:47:46 AM5/9/11
to activem...@googlegroups.com
On Mon, May 9, 2011 at 08:28, JamieD <jam...@gmail.com> wrote:

> Would there be a better way to do this or is this probably the best
> solution for dealing what's got the be the most awkward payment
> gateway around?

Have you seen the recently committed WorldPay gateway?

https://github.com/Shopify/active_merchant/blob/master/lib/active_merchant/billing/gateways/worldpay.rb

It looks like the issue you're running in to is related to 3D-Secure,
which the merged gateway doesn't support yet. Am I on target?

If gateways need access to the headers, then we should probably make
that generally available rather than hacking it in.


--
Nathaniel Talbott
<:((><

JamieD

unread,
May 9, 2011, 11:55:23 AM5/9/11
to Active Merchant


On May 9, 3:47 pm, Nathaniel Talbott <nathan...@spreedly.com> wrote:
> On Mon, May 9, 2011 at 08:28, JamieD <jam5...@gmail.com> wrote:
> > Would there be a better way to do this or is this probably the best
> > solution for dealing what's got the be the most awkward payment
> > gateway around?
>
> Have you seen the recently committed WorldPay gateway?
>
>  https://github.com/Shopify/active_merchant/blob/master/lib/active_mer...

No, I'd not seen that, would have been a good starting point for
though.

>
> It looks like the issue you're running in to is related to 3D-Secure,
> which the merged gateway doesn't support yet. Am I on target?

Yes it is related to 3D-Secure

>
> If gateways need access to the headers, then we should probably make
> that generally available rather than hacking it in.

I think it would be a good thing to make the entire response object
available so it can be accessed if required.

What is the status of 3D-Secure and active merchant? I know there has
been a lot of talk about it but I'd not seen any agreed implementation
of it yet, has this been resolved?

FYI, this is my hacked implementation to work around the issue until
changes are made to active merchant

https://gist.github.com/962764

Jamie

Douglas Shearer

unread,
Feb 15, 2013, 7:30:51 AM2/15/13
to activem...@googlegroups.com
Hi Jamie.

I wonder if your Worldpay 3D secure implementation is available anywhere?

Currently in the process of implementing this myself, would be nice to see how someone else did it.

Cheers.

Ed W

unread,
Feb 25, 2013, 12:23:55 PM2/25/13
to activem...@googlegroups.com
On 09/05/2011 16:55, JamieD wrote:

> What is the status of 3D-Secure and active merchant? I know there has
> been a lot of talk about it but I'd not seen any agreed implementation
> of it yet, has this been resolved?
>

I offered my opinion previously:

My thought is that the purchase method should continue to return
success/fail, but also it can return "more_auth_needed" + some location
to redirect to. This gives you an API to handle Paypal (whatever it's
called) where you can redirect to paypal to capture the actual card
details, Sagepay server (where you redirect to sage to collect the card
details) and also all other gateways that need 3D secure.

In all cases the flow is the same, it's not a fail on the auth/payment
call, it's a "needs more info". Model it as such and nearly everything
else drops out

However, I haven't seen any bites on accepting this, so I have given up
on pushing changes until the developers show some interest in accepting
the changes...

Ed W

Jan Hecking

unread,
Feb 27, 2013, 5:29:47 AM2/27/13
to activem...@googlegroups.com
Hi Douglas,

I also need a Worldpay gateway plugin that supports 3D Secure. Except for the cookie issue that was the original topic of Jamie's mail, extending the existing Worldpay gateway is fairly trivial and I've got an implementation that I'm willing to share. But it seems a total waste that everyone needs to re-invent the wheel.

What's the state of your implementation? Maybe we can at least combine our two implementations and push for inclusion into AM?

I've seen discussions on this Group since at least 2011 about adding official support for 3D Secure to AM and it's very disappointing that nothing has been merged back into the official repository yet except for one or two custom gateway plugins. E.g. in Jan 2011 Cody Fauser from Shopify commented on a different topic that "We at Shopify are in the process of implementing several 3D Secure
gateways [...]. We're currently incorporating 3D Secure into our checkout and we're trying to distill a nice API between the various implementations." [1] I can definitely feel your pain Ed W as I can see that you've been pushing for such a "nice API" for a very long time without much response.

Jan

[1] https://groups.google.com/d/msg/activemerchant/cEdpQ8CvJbU/J8m569jqPTgJ

Jan Hecking

unread,
Feb 28, 2013, 5:34:10 AM2/28/13
to activem...@googlegroups.com
Here is my initial commit to add 3D Secure support to the WorldPay gateway:


I still need to add some new tests for this functionality before I'm going to submit this back to the main repository as a pull request.

I've restricted my changes to only the worldpay gateway implementation as there doesn't seem to be an agreed upon approach across gateway implementations. I do like Ed W's suggestions for a more generic design that supports other alternative implementations. But there doesn't seem to be much support for that from the maintainers.

The most iffy part of the Worldpay specific 3D Secure implementation is the requirement to support session cookies to keep state between the gateway requests. I think I've found a fairly clean solution based on a tip from Nathaniel here (unrelated to 3D Secure support): https://groups.google.com/d/msg/activemerchant/SZgiVs6bUmI/rKvvFIzlNAAJ. However I'm still thinking of how to best abstract this for the client using the worldpay gateway. Currently I feel like a bit to much of the implementation details are exposed to the client (session cookie, echo data, etc.). Comments on this and other parts of the implementation are welcome!

I've also added a bit of documentation for the parameters supported by the gateway in the options hash since I had to add quite a few new options specifically for 3D Secure support.

Cheers,
Jan


--
You received this message because you are subscribed to a topic in the Google Groups "Active Merchant" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/activemerchant/XS5CYS210GU/unsubscribe?hl=en.
To unsubscribe from this group and all its topics, send an email to activemerchan...@googlegroups.com.
To post to this group, send email to activem...@googlegroups.com.
Visit this group at http://groups.google.com/group/activemerchant?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Jan Hecking

unread,
Mar 3, 2013, 10:54:59 PM3/3/13
to activem...@googlegroups.com
And here is the pull request: https://github.com/Shopify/active_merchant/pull/609

If you have an interest in 3D Secure authentication support for WorldPay please take a look and let me know what you think in the comments.

Cheers,
Jan
Reply all
Reply to author
Forward
0 new messages