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:
@@ -1165,7 +1165,13 @@ func (m *MockClient) GetCheckout(ctx context.Context, checkoutID string) (*Payme
|
|||||||
|
|
||||||
checkout, ok := m.checkouts[checkoutID]
|
checkout, ok := m.checkouts[checkoutID]
|
||||||
if !ok {
|
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
|
// Mirror the real client's GetCheckout state machine
|
||||||
@@ -1181,7 +1187,13 @@ func (m *MockClient) GetCheckout(ctx context.Context, checkoutID string) (*Payme
|
|||||||
case "COMPLETED":
|
case "COMPLETED":
|
||||||
result, ok := m.completed[checkoutID]
|
result, ok := m.completed[checkoutID]
|
||||||
if !ok {
|
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
|
return result, nil
|
||||||
default:
|
default:
|
||||||
@@ -1197,7 +1209,13 @@ func (m *MockClient) GetPayment(ctx context.Context, paymentID string) (*Payment
|
|||||||
|
|
||||||
payment, ok := m.payments[paymentID]
|
payment, ok := m.payments[paymentID]
|
||||||
if !ok {
|
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
|
return payment, nil
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user