summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md10
-rw-r--r--app/services/solidus_subscriptions/checkout.rb2
-rw-r--r--lib/solidus_subscriptions/config.rb5
-rw-r--r--spec/lib/solidus_subscriptions/config_spec.rb17
-rw-r--r--spec/services/solidus_subscriptions/checkout_spec.rb1
-rw-r--r--spec/support/helpers/checkout_infrastructure.rb4
6 files changed, 1 insertions, 38 deletions
diff --git a/README.md b/README.md
index eaec397..cb4912b 100644
--- a/README.md
+++ b/README.md
@@ -19,16 +19,6 @@ bundle
bundle exec rails g solidus_subscriptions:install
```
-## Configuration
-
-This gem requires a gateway which supports credit cards in order to process subscription orders.
-
-Add this to specify the gateway used by the gem: an initializer.
-
-```ruby
-SolidusSubscriptions::Config.default_gateway { my_gateway }
-```
-
### Guest checkout
Subscriptions require a user to be present to allow them to be managed after they are purchased.
diff --git a/app/services/solidus_subscriptions/checkout.rb b/app/services/solidus_subscriptions/checkout.rb
index d82a0dc..cd66406 100644
--- a/app/services/solidus_subscriptions/checkout.rb
+++ b/app/services/solidus_subscriptions/checkout.rb
@@ -131,7 +131,7 @@ module SolidusSubscriptions
order.payments.create(
source: active_card,
amount: order.total,
- payment_method: Config.default_gateway
+ payment_method: active_card.payment_method,
)
end
diff --git a/lib/solidus_subscriptions/config.rb b/lib/solidus_subscriptions/config.rb
index 6ab41c6..d6dbbf6 100644
--- a/lib/solidus_subscriptions/config.rb
+++ b/lib/solidus_subscriptions/config.rb
@@ -31,11 +31,6 @@ module SolidusSubscriptions
def out_of_stock_dispatcher_class
@out_of_stock_dispatcher_class ||= ::SolidusSubscriptions::OutOfStockDispatcher
end
-
- def default_gateway(&block)
- return @gateway.call unless block_given?
- @gateway = block
- end
end
# Maximum number of times a user can skip their subscription before it
diff --git a/spec/lib/solidus_subscriptions/config_spec.rb b/spec/lib/solidus_subscriptions/config_spec.rb
deleted file mode 100644
index b5b8519..0000000
--- a/spec/lib/solidus_subscriptions/config_spec.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-require 'spec_helper'
-
-RSpec.describe SolidusSubscriptions::Config do
- before { described_class.instance_variable_set('@gateway', nil) }
- after { described_class.instance_variable_set('@gateway', nil) }
-
- describe '.default_gateway' do
- let(:bogus) { build_stubbed(:credit_card_payment_method) }
- subject(:gateway) { described_class.default_gateway }
-
- before do
- described_class.default_gateway { bogus }
- end
-
- it { is_expected.to eq bogus }
- end
-end
diff --git a/spec/services/solidus_subscriptions/checkout_spec.rb b/spec/services/solidus_subscriptions/checkout_spec.rb
index 5a9a386..84780db 100644
--- a/spec/services/solidus_subscriptions/checkout_spec.rb
+++ b/spec/services/solidus_subscriptions/checkout_spec.rb
@@ -25,7 +25,6 @@ RSpec.describe SolidusSubscriptions::Checkout do
end
before do
- SolidusSubscriptions::Config.default_gateway { payment_method }
Spree::Variant.all.each { |v| v.update(subscribable: true) }
end
diff --git a/spec/support/helpers/checkout_infrastructure.rb b/spec/support/helpers/checkout_infrastructure.rb
index 6a18083..8196a87 100644
--- a/spec/support/helpers/checkout_infrastructure.rb
+++ b/spec/support/helpers/checkout_infrastructure.rb
@@ -3,16 +3,12 @@
module CheckoutInfrastructure
def self.extended(base)
base.before(:all) do
- payment_method = create :credit_card_payment_method
create :country
create :shipping_method
-
- SolidusSubscriptions::Config.default_gateway { payment_method }
end
base.after(:all) do
DatabaseCleaner.clean_with(:truncation)
- SolidusSubscriptions::Config.default_gateway { nil }
end
end
end