diff --git a/backend/internal/square/square_dev.go b/backend/internal/square/square_dev.go index b95cc2b..bfd2f9b 100644 --- a/backend/internal/square/square_dev.go +++ b/backend/internal/square/square_dev.go @@ -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 }