• erio's avatar
    test(payment): cover ErrOrderNotFound sentinel contract · d5dac84e
    erio authored
    Service layer (payment_fulfillment_order_not_found_test.go):
    - TestHandlePaymentNotification_UnknownOrder_ReturnsSentinel: in-memory
      sqlite ent client, query for a non-existent out_trade_no → errors.Is
      must recognise ErrOrderNotFound (handler relies on this to ack 200).
    - TestHandlePaymentNotification_NonSuccessStatus_Skips: non-success
      notification short-circuits before DB lookup → nil error.
    - TestErrOrderNotFound_DistinctFromOtherErrors: generic errors must not
      match the sentinel (prevents silently swallowing DB failures).
    
    Handler layer (payment_webhook_handler_test.go):
    - TestUnknownOrderWebhookAcksWithSuccess: locks the two ingredients the
      handleNotify ack path depends on — fmt.Errorf %w wrapping preserves
      errors.Is recognition, and writeSuccessResponse(stripe) returns an
      empty 200 body that Stripe treats as acknowledged.
    d5dac84e
payment_webhook_handler_test.go 7.51 KB