From 8accc2ba6fe9b6e4f6756f851133746b6bfe6c4f Mon Sep 17 00:00:00 2001 From: Stephen Adamson Date: Thu, 20 Aug 2026 16:37:39 +0100 Subject: [PATCH] =?UTF-8?q?fix:=20dev=20mock=20parity=20=E2=80=94=20GetChe?= =?UTF-8?q?ckout/GetPayment=20return=20structured=20NOT=5FFOUND=20errors?= =?UTF-8?q?=20matching=20prod?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus --- backend/internal/square/square_dev.go | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) 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 }