Set member status to sustainer upon payment
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing

Introduces a state machine for the payment status as well.

refs #213
This commit is contained in:
2025-05-27 16:39:03 +04:00
parent 463bf34cdf
commit e48132cf5f
10 changed files with 73 additions and 24 deletions

View File

@@ -177,7 +177,7 @@ RSpec.describe "Donations", type: :request do
.to_return(status: 200, headers: {}, body: invoice)
stub_request(:get, "http://btcpay.example.com/api/v1/stores/123456/invoices/MCkDbf2cUgBuuisUCgnRnb/payment-methods")
.to_return(status: 200, headers: {}, body: payments)
allow(user).to receive(:add_member_status).with(:sustainer).and_return(["sustainer"])
get confirm_btcpay_contributions_donation_path(subject)
end
@@ -185,11 +185,16 @@ RSpec.describe "Donations", type: :request do
subject.reload
expect(subject.paid_at).not_to be_nil
expect(subject.amount_sats).to eq(2061)
expect(subject.payment_status).to eq("settled")
end
it "redirects to the donations index" do
expect(response).to redirect_to(contributions_donations_url)
end
it "updates the user's member status" do
expect(user).to have_received(:add_member_status).with(:sustainer)
end
end
describe "amount in sats" do