fix: dev mock parity — GetCheckout/GetPayment return structured NOT_FOUND errors matching prod

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
2026-08-22 00:34:51 +01:00
co-authored by Sisyphus
parent c38dee1f62
commit 8accc2ba6f
+21 -3
View File
@@ -1165,7 +1165,13 @@ func (m *MockClient) GetCheckout(ctx context.Context, checkoutID string) (*Payme
checkout, ok := m.checkouts[checkoutID]
if !ok {
return nil, fmt.Errorf("checkout not found: %s", checkoutID)
return nil, &squareAPIError{
Code: "NOT_FOUND",
Category: "INVALID_REQUEST_ERROR",
Detail: "checkout not found",
StatusCode: http.StatusNotFound,
err: fmt.Errorf("square: checkout not found: %s", checkoutID),
}
}
// Mirror the real client's GetCheckout state machine
@@ -1181,7 +1187,13 @@ func (m *MockClient) GetCheckout(ctx context.Context, checkoutID string) (*Payme
case "COMPLETED":
result, ok := m.completed[checkoutID]
if !ok {
return nil, fmt.Errorf("checkout result not found: %s", checkoutID)
return nil, &squareAPIError{
Code: "NOT_FOUND",
Category: "INVALID_REQUEST_ERROR",
Detail: "checkout result not found",
StatusCode: http.StatusNotFound,
err: fmt.Errorf("square: checkout result not found: %s", checkoutID),
}
}
return result, nil
default:
@@ -1197,7 +1209,13 @@ func (m *MockClient) GetPayment(ctx context.Context, paymentID string) (*Payment
payment, ok := m.payments[paymentID]
if !ok {
return nil, fmt.Errorf("payment not found: %s", paymentID)
return nil, &squareAPIError{
Code: "NOT_FOUND",
Category: "INVALID_REQUEST_ERROR",
Detail: "payment not found",
StatusCode: http.StatusNotFound,
err: fmt.Errorf("square: payment not found: %s", paymentID),
}
}
return payment, nil
}