killbill / killbill-plugin-framework-ruby

Framework to write Kill Bill plugins in Ruby
http://killbill.io
8 stars 11 forks source link

Don't assume store method exists #49

Closed lstephen closed 9 years ago

lstephen commented 9 years ago

The store method of a gateway is called here: https://github.com/killbill/killbill-plugin-framework-ruby/blob/master/lib/killbill/helpers/active_merchant/payment_plugin.rb#L171

Some gateways do not implement this method as they do not support it. As mentioned in the Active Merchant documentation it is optional: http://www.rubydoc.info/github/activemerchant/active_merchant/ActiveMerchant/Billing/Gateway

A workaround is to have a gateway implement a dummy store method, but perhaps there can be a check added to see if a gateway supports it or not.

pierre commented 9 years ago

None of the ActiveMerchant gateways will work out-of-the box after the code (and test code) has been generated, there will always be some modifications needed (even for the simplest gateways, such as Stripe).

If store isn't provided by the provider, just pass options[:skip_gw] = true by default in the add_payment_method implementation. The killbill gem will make sure the relevant state is persisted in the plugin tables, but no remote call will be attempted.

pierre commented 9 years ago

Take a look at the Litle plugin for an example.

lstephen commented 9 years ago

If store isn't provided by the provider, just pass options[:skip_gw] = true by default in the add_payment_method implementation.

Thanks, this is what I needed. :thumbsup: