veza/veza-backend-api/tests/integration/webhook_test_helpers.go
senke 7cb4ef56e1
Some checks failed
Backend API CI / test-unit (push) Failing after 0s
Backend API CI / test-integration (push) Failing after 0s
feat(v0.912): Cashflow - payment E2E integration tests
- Add MarketplaceServiceOverride and AuthMiddlewareOverride to config for tests
- Wire overrides in routes_webhooks and routes_marketplace (authForMarketplaceInterface)
- payment_flow_test: cart -> checkout -> webhook -> order completed, license, transfer
- webhook_idempotency_test: 3 identical webhooks -> 1 order, 1 license
- webhook_security_test: empty secret 500, invalid sig 401, valid sig 200
- refund_flow_test: completed order -> refund -> order refunded, license revoked
- Shared computeWebhookSignature helper in webhook_test_helpers.go
- SetMaxOpenConns(1) for sqlite :memory: in idempotency test to avoid flakiness

Ref: docs/ROADMAP_V09XX_TO_V1.md v0.912 Cashflow
2026-02-27 20:00:51 +01:00

17 lines
395 B
Go

//go:build integration
// +build integration
package integration
import (
"crypto/hmac"
"crypto/sha512"
"encoding/hex"
)
// computeWebhookSignature computes HMAC-SHA512 signature for Hyperswitch webhook payload.
func computeWebhookSignature(payload []byte, secret string) string {
mac := hmac.New(sha512.New, []byte(secret))
mac.Write(payload)
return hex.EncodeToString(mac.Sum(nil))
}