Title / Description
Code class GatewayPicker "bla-test #{test}" def self.run(context) if transaction.cc_type == AMERICAN_EXPRESS AmericanExpressGatewayPicker.execute(context) elseif transaction.cc_type == DISCOVER DiscoverGatewayPicker.execute(context) ... end end end class AmericanExpressGatewayPicker def self.run(context) context.gateway = GATEWAYS_FOR_AMEX.random { |gw| gw.can_process_amount(context.amount) } end end class DiscoverGatewayPicker def self.run(context) if context.gateway == DEPRECATED_GW_1 DeprecatedGateway1Picker.execute(context) else context.gateway = GATEWAYS_FOR_DISCOVER.random { |gw| gw.can_process_amount(context.amount) } end end end (a lot more service classes) outcome = GatewayPicker.execute(transaction) gateway = outcome.gateway gateway.process(transaction)
Author
Highlight as C C++ CSS Clojure Delphi ERb Groovy (beta) HAML HTML JSON Java JavaScript PHP Plain text Python Ruby SQL XML YAML diff code