mirror of
https://github.com/we-promise/sure.git
synced 2026-04-19 12:04:08 +00:00
Handle missing Stripe payment link gracefully
Agent-Logs-Url: https://github.com/we-promise/sure/sessions/efba0c75-5f82-41a1-b618-532d38e222da Co-authored-by: jjmata <187772+jjmata@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
e0d2150e2d
commit
f1f1bc91cc
@@ -60,4 +60,20 @@ class Provider::StripeTest < ActiveSupport::TestCase
|
||||
stripe.payment_link_url(payment_link_id: "plink_test123")
|
||||
)
|
||||
end
|
||||
|
||||
test "returns nil when payment link retrieval fails" do
|
||||
payment_links = mock
|
||||
payment_links.expects(:retrieve)
|
||||
.with("plink_test123")
|
||||
.raises(StandardError, "not found")
|
||||
|
||||
client = mock
|
||||
client.stubs(:v1).returns(OpenStruct.new(payment_links: payment_links))
|
||||
|
||||
Stripe::StripeClient.stubs(:new).returns(client)
|
||||
Sentry.expects(:capture_exception).with(instance_of(StandardError))
|
||||
stripe = Provider::Stripe.new(secret_key: "foo", webhook_secret: "bar")
|
||||
|
||||
assert_nil stripe.payment_link_url(payment_link_id: "plink_test123")
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user