Showing
2 changed files
with
3 additions
and
5 deletions
| ... | @@ -13,10 +13,8 @@ module Var | ... | @@ -13,10 +13,8 @@ module Var |
| 13 | 13 | ||
| 14 | def self.create_charge(service, object, options = {}) | 14 | def self.create_charge(service, object, options = {}) |
| 15 | binding.pry | 15 | binding.pry |
| 16 | - return { error_message: 'Service is not supported' } | 16 | + return { error_message: 'Service is not supported' } unless VALID_SERVICES.include? service |
| 17 | - unless VALID_SERVICES.include? service | 17 | + return { error_message: "#{object.class.to_s} doesn't support charges"} unless object.respond_to?(:charge_with) |
| 18 | - return { error_message: "#{object.class.to_s} doesn't support charges"} | ||
| 19 | - unless object.respond_to?(:charge_with) | ||
| 20 | object.charge_with(service, options) | 18 | object.charge_with(service, options) |
| 21 | end | 19 | end |
| 22 | end | 20 | end | ... | ... |
-
Please register or login to post a comment