views:

84

answers:

1

ActiveMerchant seems to be baked with AR in mind.

I've come to this conclusion based on the fact that the purchase() method returns an ActiveRecord::Billing::Response object:

Is this correct and, if so, does this mean it might be difficult to use ActiveMerchant in a project that uses a different Ruby ORM (Sequel/Datamapper)?

A: 

If you check the implementation of ActiveMerchant::Billing::Response, there is no mention of ActiveRecord anywhere in the file. Not sure where you got the idea that AM returns AR objects.

Looking at the implementation of #purchase for the Braintree gateway, it calls #commit, which simply returns an ActiveMerchant::Billing::Response object

François Beausoleil
Your answer makes sense. I can't find in the code where it says that the return value is an ActiveMerchant::Billing::Response object but I see the Response class defined. Perhaps there was a typo here - the comment for purchase() reads: "Returns: ActiveRecord::Billing::Response object": http://github.com/Shopify/active_merchant/blob/master/lib/active_merchant/billing/gateways/psl_card.rb#L107
zzz