Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions validation_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,11 @@ def test_payment_failure(self) -> None:
Given a checkout session ready for completion,
When a payment instrument with a known failing token ('fail_token') is
submitted,
Then the server should return a 402 Payment Required error.
Then the server either rejects with a 4xx describing the payment
problem, or answers in-band per the spec's error model with a typed
'payment_failed' error message (checkout.md standard error codes /
error_code.json; checkout-rest.md "Error Responses": business
outcomes return HTTP 200 with the UCP envelope and messages[]).
"""
response_json = self.create_checkout_session(handlers=[])
checkout_id = checkout.Checkout(**response_json).id
Expand All @@ -358,10 +362,10 @@ def test_payment_failure(self) -> None:
headers=integration_test_utils.get_headers(),
)

self.assert_4xx_error(
self.assert_business_error(
response,
expected_status=402,
substring="Payment Failed",
accepted_codes={"payment_failed"},
error_4xx_substring="payment",
)

def test_complete_without_fulfillment(self) -> None:
Expand Down
Loading