Bogus gateway to test PayPal #424

Closed
wants to merge 3 commits into
from

Conversation

Projects
None yet

PayPal has some methods untestable via the normal Bogus Gateway
like setup_authorization, and handles authorization differently, the
PaypalBogusGateway behaves more like the actual PayPal Gateway to enable
simple tests without remote interaction for setup_authorization as well as authorize.

@sideshowcoder sideshowcoder Bogus gateway to test PayPal
Since PayPal has some methods untestable via the normal Bogus Gateway
like setup_authorization, and handles authorization differently, the
PaypalBogusGateway behaves more like the actual PayPal Gateway to enable
simple tests without remote interaction
192f497

This pull request fails (merged 192f497 into 7cad106).

This pull request fails (merged 17747b9 into 7cad106).

This pull request passes (merged 4478947 into 7cad106).

Contributor

ntalbott commented Aug 23, 2012

It seems like the general usefulness of the BogusGateway is that it is a generic stand-in for any gateway; how would you see the PaypalBogusGateway being used?

Actually the BogusGateway does not allow testing the Paypal specific methods like setup_authorization, since the Application I am working on only works with Paypal only I wanted to be able to test my code with these methods in place as well. That was the reason to extend the Bogus Gateway to also include these methods and give the correct responses.

So in my code the PaypalBogusGateway stands in for a PaypalExpressGateway and responds to the setup_* methods in the form a Paypal Gateway would.

Contributor

jduff commented Aug 24, 2012

I don't feel like this is a common enough use case to pull this in. I would keep the customized mock in your application since it is fairly specific to the way you are using active merchant in your application.

John Duff
Software Developer @ Shopify

Sent from my iPhone

On 2012-08-24, at 5:19 AM, Philipp Fehre notifications@github.com wrote:

Actually the BogusGateway does not allow testing the Paypal specific methods like setup_authorization, since the Application I am working on only works with Paypal only I wanted to be able to test my code with these methods in place as well. That was the reason to extend the Bogus Gateway to also include these methods and give the correct responses.

So in my code the PaypalBogusGateway stands in for a PaypalExpressGateway and responds to the setup_* methods in the form a Paypal Gateway would.


Reply to this email directly or view it on GitHub.

Contributor

ntalbott commented Aug 24, 2012

I'm with @jduff; the PayPal Express gateway is actually kind of an oddity in the ActiveMerchant codebase. Until/unless other gateways start using a common API with it, it's probably best to just mock out yourself locally.

ntalbott closed this Aug 24, 2012

Even though this commit didn't get merged, I wanted to thank you for posting it. I was able to use it to test paypal express in my own rails app. Just what I needed.

Owner

sideshowcoder replied Nov 19, 2012

Thanks :) happy to be helpful.

I'd like to thank you for this too. This guy too: http://infotrope.net/2013/05/31/testing-paypal-express-with-activemerchants-bogusgateway-and-how-to-make-it-work/

Shows people have a need for it, no?

Well if more people find it useful I am happy to bring this up to speed with the changes to active_merchant since the pr was closed.

I just ran into this issue as while writing rspec tests for purchasing by PayPal Express

nleo commented Sep 3, 2013

+1

+1

ch000 commented May 5, 2014

+1

+1

+1
Though this was not merged, it helped me.

Any chance you'd package this as a separate gem @sideshowcoder ?

@CloCkWeRX Good idea, haven't touched that in a while so wonder if it still works.

Friom unit tests, it seems to.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment