Use the user's default card to pay for subcriptions

This commit is contained in:
Rob Harrington
2018-05-04 11:39:26 +10:00
committed by Maikel Linke
parent fc2844a3d5
commit 45895e9924
2 changed files with 3 additions and 3 deletions

View File

@@ -47,7 +47,7 @@ module OpenFoodNetwork
end
def saved_credit_card
order.subscription.credit_card
order.user.default_card
end
def errors_present?

View File

@@ -151,7 +151,7 @@ module OpenFoodNetwork
let!(:payment) { create(:payment, source: nil) }
before { allow(updater).to receive(:payment) { payment } }
context "when no credit card is specified by the subscription" do
context "when no saved credit card is found" do
before { allow(updater).to receive(:saved_credit_card) { nil } }
it "returns false and down not update the payment source" do
@@ -161,7 +161,7 @@ module OpenFoodNetwork
end
end
context "when a credit card is specified by the subscription" do
context "when a saved credit card is found" do
let(:credit_card) { create(:credit_card) }
before { allow(updater).to receive(:saved_credit_card) { credit_card } }