Class: Spree::Gateway::BogusSimple
- Inherits:
-
Bogus
- Object
- ApplicationRecord
- Base
- PaymentMethod
- Spree::Gateway
- Bogus
- Spree::Gateway::BogusSimple
- Defined in:
- app/models/spree/gateway/bogus_simple.rb
Constant Summary
Constants inherited from Bogus
Spree::Gateway::Bogus::TEST_AMEX, Spree::Gateway::Bogus::TEST_DISC, Spree::Gateway::Bogus::TEST_MC, Spree::Gateway::Bogus::TEST_VISA, Spree::Gateway::Bogus::VALID_CCS
Constants inherited from Spree::Gateway
Constants inherited from PaymentMethod
Instance Attribute Summary
Attributes inherited from Bogus
Instance Method Summary collapse
- #authorize(_money, credit_card, _options = {}) ⇒ Object
- #payment_profiles_supported? ⇒ Boolean
- #purchase(_money, credit_card, _options = {}) ⇒ Object
Methods inherited from Bogus
#actions, #cancel, #capture, #create_profile, #credit, #payment_source_class, #provider_class, #test?, #void
Methods inherited from Spree::Gateway
#disable_customer_profile, #exchange_multiplier, #method_missing, #method_type, #options, #payment_source_class, #provider, #reusable_sources, #sources_by_order, #supports?
Methods inherited from PaymentMethod
#auto_capture?, #available_for_order?, #available_for_store?, #cancel, find_with_destroyed, #method_type, #payment_source_class, #provider_class, providers, #public_preferences, #reusable_sources, #source_required?, #store_credit?, #supports?
Methods inherited from Base
belongs_to_required_by_default, for_store, has_many_inversing, json_api_columns, json_api_permitted_attributes, json_api_type, page, spree_base_scopes, spree_base_uniqueness_scope
Methods included from Preferences::Preferable
#clear_preferences, #default_preferences, #defined_preferences, #deprecated_preferences, #get_preference, #has_preference!, #has_preference?, #preference_default, #preference_deprecated, #preference_type, #set_preference
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Spree::Gateway
Instance Method Details
#authorize(_money, credit_card, _options = {}) ⇒ Object
8 9 10 11 12 13 14 |
# File 'app/models/spree/gateway/bogus_simple.rb', line 8 def (_money, credit_card, = {}) if VALID_CCS.include? credit_card.number ActiveMerchant::Billing::Response.new(true, 'Bogus Gateway: Forced success', {}, test: true, authorization: '12345', avs_result: { code: 'A' }) else ActiveMerchant::Billing::Response.new(false, 'Bogus Gateway: Forced failure', { message: 'Bogus Gateway: Forced failure' }, test: true) end end |
#payment_profiles_supported? ⇒ Boolean
4 5 6 |
# File 'app/models/spree/gateway/bogus_simple.rb', line 4 def payment_profiles_supported? false end |
#purchase(_money, credit_card, _options = {}) ⇒ Object
16 17 18 19 20 21 22 |
# File 'app/models/spree/gateway/bogus_simple.rb', line 16 def purchase(_money, credit_card, = {}) if VALID_CCS.include? credit_card.number ActiveMerchant::Billing::Response.new(true, 'Bogus Gateway: Forced success', {}, test: true, authorization: '12345', avs_result: { code: 'A' }) else ActiveMerchant::Billing::Response.new(false, 'Bogus Gateway: Forced failure', message: 'Bogus Gateway: Forced failure', test: true) end end |