mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
10
Gemfile.lock
10
Gemfile.lock
@@ -432,6 +432,7 @@ GEM
|
||||
rspec (>= 2.99.0, < 4.0)
|
||||
haml (4.0.4)
|
||||
tilt
|
||||
hashdiff (0.3.7)
|
||||
highline (1.6.15)
|
||||
hike (1.2.3)
|
||||
http_parser.rb (0.6.0)
|
||||
@@ -533,7 +534,7 @@ GEM
|
||||
pry-byebug (3.4.3)
|
||||
byebug (>= 9.0, < 9.1)
|
||||
pry (~> 0.10)
|
||||
public_suffix (3.0.0)
|
||||
public_suffix (3.0.3)
|
||||
rabl (0.7.2)
|
||||
activesupport (>= 2.3.14)
|
||||
multi_json (~> 1.0)
|
||||
@@ -691,9 +692,10 @@ GEM
|
||||
railties (>= 3.0)
|
||||
warden (1.2.7)
|
||||
rack (>= 1.0)
|
||||
webmock (1.8.11)
|
||||
addressable (>= 2.2.7)
|
||||
crack (>= 0.1.7)
|
||||
webmock (3.4.2)
|
||||
addressable (>= 2.3.6)
|
||||
crack (>= 0.3.2)
|
||||
hashdiff
|
||||
websocket-driver (0.7.0)
|
||||
websocket-extensions (>= 0.1.0)
|
||||
websocket-extensions (0.1.2)
|
||||
|
||||
@@ -30,7 +30,8 @@ describe Spree::Admin::PaymentsController, type: :controller do
|
||||
|
||||
context "where the request succeeds" do
|
||||
before do
|
||||
stub_request(:post, "https://sk_test_12345:@api.stripe.com/v1/charges/ch_1a2b3c/refunds").
|
||||
stub_request(:post, "https://api.stripe.com/v1/charges/ch_1a2b3c/refunds").
|
||||
with(basic_auth: ["sk_test_12345", ""]).
|
||||
to_return(:status => 200, :body => JSON.generate(id: 're_123', object: 'refund', status: 'succeeded') )
|
||||
end
|
||||
|
||||
@@ -48,7 +49,8 @@ describe Spree::Admin::PaymentsController, type: :controller do
|
||||
|
||||
context "where the request fails" do
|
||||
before do
|
||||
stub_request(:post, "https://sk_test_12345:@api.stripe.com/v1/charges/ch_1a2b3c/refunds").
|
||||
stub_request(:post, "https://api.stripe.com/v1/charges/ch_1a2b3c/refunds").
|
||||
with(basic_auth: ["sk_test_12345", ""]).
|
||||
to_return(:status => 200, :body => JSON.generate(error: { message: "Bup-bow!"}) )
|
||||
end
|
||||
|
||||
@@ -84,7 +86,8 @@ describe Spree::Admin::PaymentsController, type: :controller do
|
||||
|
||||
context "where the request succeeds" do
|
||||
before do
|
||||
stub_request(:post, "https://sk_test_12345:@api.stripe.com/v1/charges/ch_1a2b3c/refunds").
|
||||
stub_request(:post, "https://api.stripe.com/v1/charges/ch_1a2b3c/refunds").
|
||||
with(basic_auth: ["sk_test_12345", ""]).
|
||||
to_return(:status => 200, :body => JSON.generate(id: 're_123', object: 'refund', status: 'succeeded') )
|
||||
end
|
||||
|
||||
@@ -102,7 +105,8 @@ describe Spree::Admin::PaymentsController, type: :controller do
|
||||
|
||||
context "where the request fails" do
|
||||
before do
|
||||
stub_request(:post, "https://sk_test_12345:@api.stripe.com/v1/charges/ch_1a2b3c/refunds").
|
||||
stub_request(:post, "https://api.stripe.com/v1/charges/ch_1a2b3c/refunds").
|
||||
with(basic_auth: ["sk_test_12345", ""]).
|
||||
to_return(:status => 200, :body => JSON.generate(error: { message: "Bup-bow!"}) )
|
||||
end
|
||||
|
||||
|
||||
@@ -186,7 +186,8 @@ feature "As a consumer I want to check out my cart", js: true, retry: 3 do
|
||||
allow(Stripe).to receive(:api_key) { "sk_test_12345" }
|
||||
allow(Stripe).to receive(:publishable_key) { "some_key" }
|
||||
Spree::Config.set(stripe_connect_enabled: true)
|
||||
stub_request(:post, "https://sk_test_12345:@api.stripe.com/v1/charges")
|
||||
stub_request(:post, "https://api.stripe.com/v1/charges")
|
||||
.with(basic_auth: ["sk_test_12345", ""])
|
||||
.to_return(status: 200, body: JSON.generate(response_mock))
|
||||
|
||||
visit checkout_path
|
||||
|
||||
@@ -41,8 +41,9 @@ describe "checking out an order with a Stripe Connect payment method", type: :re
|
||||
context "and the user doesn't request that the card is saved for later" do
|
||||
before do
|
||||
# Charges the card
|
||||
stub_request(:post, "https://sk_test_12345:@api.stripe.com/v1/charges")
|
||||
.with(body: /#{token}.*#{order.number}/).to_return(charge_response_mock)
|
||||
stub_request(:post, "https://api.stripe.com/v1/charges")
|
||||
.with(basic_auth: ["sk_test_12345", ""], body: /#{token}.*#{order.number}/)
|
||||
.to_return(charge_response_mock)
|
||||
end
|
||||
|
||||
context "and the charge request is successful" do
|
||||
@@ -79,8 +80,8 @@ describe "checking out an order with a Stripe Connect payment method", type: :re
|
||||
params[:order][:payments_attributes][0][:source_attributes][:save_requested_by_customer] = '1'
|
||||
|
||||
# Saves the card against the user
|
||||
stub_request(:post, "https://sk_test_12345:@api.stripe.com/v1/customers")
|
||||
.with(:body => { card: token, email: order.email})
|
||||
stub_request(:post, "https://api.stripe.com/v1/customers")
|
||||
.with(basic_auth: ["sk_test_12345", ""], body: { card: token, email: order.email})
|
||||
.to_return(store_response_mock)
|
||||
|
||||
# Requests a token from the newly saved card
|
||||
@@ -89,8 +90,8 @@ describe "checking out an order with a Stripe Connect payment method", type: :re
|
||||
.to_return(token_response_mock)
|
||||
|
||||
# Charges the card
|
||||
stub_request(:post, "https://sk_test_12345:@api.stripe.com/v1/charges")
|
||||
.with(body: /#{token}.*#{order.number}/).to_return(charge_response_mock)
|
||||
stub_request(:post, "https://api.stripe.com/v1/charges")
|
||||
.with(basic_auth: ["sk_test_12345", ""], body: /#{token}.*#{order.number}/).to_return(charge_response_mock)
|
||||
end
|
||||
|
||||
context "and the store, token and charge requests are successful" do
|
||||
@@ -176,8 +177,9 @@ describe "checking out an order with a Stripe Connect payment method", type: :re
|
||||
.to_return(token_response_mock)
|
||||
|
||||
# Charges the card
|
||||
stub_request(:post, "https://sk_test_12345:@api.stripe.com/v1/charges")
|
||||
.with(body: /#{token}.*#{order.number}/).to_return(charge_response_mock)
|
||||
stub_request(:post, "https://api.stripe.com/v1/charges")
|
||||
.with(basic_auth: ["sk_test_12345", ""], body: /#{token}.*#{order.number}/)
|
||||
.to_return(charge_response_mock)
|
||||
end
|
||||
|
||||
context "and the charge and token requests are accepted" do
|
||||
|
||||
Reference in New Issue
Block a user