Add customer_credit scope

This commit is contained in:
Gaetan Craig-Riou
2026-02-13 16:55:13 +11:00
parent 152fd15bd0
commit 5a376c9106
4 changed files with 7 additions and 7 deletions

View File

@@ -52,6 +52,10 @@ module Spree
.where(environment: [Rails.env, "", nil])
}
def self.customer_credit
find_by(name: Rails.application.config.credit_payment_method[:name])
end
def configured?
!stripe? || stripe_configured?
end

View File

@@ -54,9 +54,7 @@ module Spree
private
def payment_method
Spree::PaymentMethod.find_by(
name: Rails.application.config.credit_payment_method[:name]
)
Spree::PaymentMethod.customer_credit
end
def error_response(translation_key)

View File

@@ -44,7 +44,7 @@ module CreditPaymentMethod
end
def credit_payment_method
Spree::PaymentMethod.find_by(name: Rails.application.config.credit_payment_method[:name])
Spree::PaymentMethod.customer_credit
end
def create_credit_payment_method

View File

@@ -42,9 +42,7 @@ RSpec.describe CreditPaymentMethod::LinkerService do
)
expect(api_payment_method.display_on).to eq("back_end")
credit_payment_method = Spree::PaymentMethod.find_by(
name: Rails.application.config.credit_payment_method[:name]
)
credit_payment_method = Spree::PaymentMethod.customer_credit
expect(credit_payment_method).not_to be_nil
expect(credit_payment_method.description).to eq(
Rails.application.config.credit_payment_method[:description]