diff --git a/lib/tasks/sample_data/payment_method_factory.rb b/lib/tasks/sample_data/payment_method_factory.rb index 512e54437f..640faf2c9c 100644 --- a/lib/tasks/sample_data/payment_method_factory.rb +++ b/lib/tasks/sample_data/payment_method_factory.rb @@ -24,6 +24,7 @@ class PaymentMethodFactory def create_cash_method(enterprise) create_payment_method( + "Spree::PaymentMethod::Check", enterprise, "Cash on collection", "Pay on collection!", @@ -33,6 +34,7 @@ class PaymentMethodFactory def create_card_method(enterprise) create_payment_method( + "Spree::Gateway::Bogus", enterprise, "Credit card (fake)", "We charge 1%, but won't ask for your details. ;-)", @@ -40,14 +42,14 @@ class PaymentMethodFactory ) end - def create_payment_method(enterprise, name, description, calculator) - card = enterprise.payment_methods.new( + def create_payment_method(provider_class, enterprise, name, description, calculator) + payment_method = provider_class.constantize.new( name: name, description: description, environment: Rails.env, distributor_ids: [enterprise.id] ) - calculator.calculable = card + calculator.calculable = payment_method calculator.save! end end