summaryrefslogtreecommitdiff
path: root/internal/billing/service_test.go
diff options
context:
space:
mode:
authorChia <Chia@93.nz>2026-08-05 14:48:00 +1200
committerChia <Chia@93.nz>2026-08-05 14:48:00 +1200
commitcd0dd91ab93653631904f2ea0e574ccde6d60339 (patch)
treec65417b880a3f4a35c504c44edae821bc2122f70 /internal/billing/service_test.go
parent86b1f42e3c5601ff10621a9779cf0076590797a1 (diff)
add passkey, totp.
Diffstat (limited to 'internal/billing/service_test.go')
-rw-r--r--internal/billing/service_test.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/internal/billing/service_test.go b/internal/billing/service_test.go
index 17f8143..f675da7 100644
--- a/internal/billing/service_test.go
+++ b/internal/billing/service_test.go
@@ -85,6 +85,18 @@ func TestIntegrationIdentifierSuffixUsesLetters(t *testing.T) {
}
}
+func TestCheckoutReturnURLPreservesCallbackAndSessionPlaceholder(t *testing.T) {
+ success := checkoutReturnURL("https://console.example.test/admin/?topup=success", "order-123", true)
+ if !strings.Contains(success, "topup=success") || !strings.Contains(success, "order_id=order-123") ||
+ !strings.Contains(success, "session_id={CHECKOUT_SESSION_ID}") {
+ t.Fatalf("unexpected success URL %q", success)
+ }
+ cancel := checkoutReturnURL("https://console.example.test/admin/?topup=cancel&session_id=stale", "order-123", false)
+ if !strings.Contains(cancel, "topup=cancel") || !strings.Contains(cancel, "order_id=order-123") || strings.Contains(cancel, "session_id=") {
+ t.Fatalf("unexpected cancel URL %q", cancel)
+ }
+}
+
func TestWebhookRejectsInvalidSignatureBeforeProcessing(t *testing.T) {
service := &Service{stripeWebhookSecret: "whsec_test"}
request := httptest.NewRequest(http.MethodPost, "/billing/stripe/webhook", strings.NewReader(`{"id":"evt_fake"}`))