mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-10 03:30:22 +00:00
Move payment_intent to Helper
This commit is contained in:
@@ -184,6 +184,7 @@ RSpec.configure do |config|
|
||||
config.include Rails.application.routes.url_helpers
|
||||
config.include Spree::UrlHelpers
|
||||
config.include Spree::MoneyHelper
|
||||
config.include Spree::PaymentHelper
|
||||
config.include PreferencesHelper
|
||||
config.include OpenFoodNetwork::FiltersHelper
|
||||
config.include OpenFoodNetwork::EnterpriseGroupsHelper
|
||||
|
||||
@@ -95,15 +95,4 @@ describe Spree::Gateway::StripeSCA, type: :model do
|
||||
expect(subject.external_payment_url(order:)).to eq "http://stripe-test.org"
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def payment_intent(amount, status)
|
||||
JSON.generate(
|
||||
object: "payment_intent",
|
||||
amount:,
|
||||
status:,
|
||||
charges: { data: [{ id: "ch_1234", amount: }] }
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1128,17 +1128,4 @@ describe Spree::Payment do
|
||||
expect(payment.captured_at).to be_present
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def payment_intent(amount, status)
|
||||
JSON.generate(
|
||||
object: "payment_intent",
|
||||
amount:,
|
||||
status:,
|
||||
charges: { data: [{ id: "ch_1234", amount: }] },
|
||||
id: "12345",
|
||||
livemode: false
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
16
spec/support/spree/payment_helper.rb
Normal file
16
spec/support/spree/payment_helper.rb
Normal file
@@ -0,0 +1,16 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Spree
|
||||
module PaymentHelper
|
||||
def payment_intent(amount, status)
|
||||
JSON.generate(
|
||||
object: "payment_intent",
|
||||
amount:,
|
||||
status:,
|
||||
charges: { data: [{ id: "ch_1234", amount: }] },
|
||||
id: "12345",
|
||||
livemode: false
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user