mirror of
https://github.com/Dvorinka/Bookra.git
synced 2026-10-28 23:51:17 +00:00
refactor(db): replace sqlc with handwritten pgx repos
- Finish Paddle-to-Stripe billing migration; drop paddle/stripe libs - Renumber migrations; add 00012 memberships+manage_token, 00013 location_type_capacity - Add tests: admin, auth, bookings customer service - Remove graphify-out artifacts and stale env files Authored By: TDvorak <[email protected]> Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
1 parent
2039669e2c
commit
f2f7439050
93 files changed
+6987
-69060
No files matched your search
@@ -2,31 +2,37 @@ package config
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestPaddleCheckoutConfigured(t *testing.T) {
|
||||
func TestStripeCheckoutConfigured(t *testing.T) {
|
||||
cfg := Config{
|
||||
PaddleAPIKey: "pdl_sdbx_apikey_123",
|
||||
PaddleWebhookKey: "pdl_ntf_123",
|
||||
PaddlePriceMatrix: map[string]map[string]string{
|
||||
"starter": {"czk": "pri_starter_czk", "usd": "pri_starter_usd"},
|
||||
"pro": {"czk": "pri_pro_czk", "usd": "pri_pro_usd"},
|
||||
"business": {"czk": "pri_business_czk", "usd": "pri_business_usd"},
|
||||
StripeAPIKey: "sk_test_123",
|
||||
StripeWebhookKey: "whsec_test_123",
|
||||
StripePriceMatrix: map[string]map[string]string{
|
||||
"starter": {"czk": "price_starter_czk", "usd": "price_starter_usd"},
|
||||
"pro": {"czk": "price_pro_czk", "usd": "price_pro_usd"},
|
||||
"business": {"czk": "price_business_czk", "usd": "price_business_usd"},
|
||||
},
|
||||
}
|
||||
|
||||
if !cfg.PaddleCheckoutConfigured("pro") {
|
||||
if !cfg.StripeCheckoutConfigured("pro") {
|
||||
t.Fatal("expected pro checkout configured")
|
||||
}
|
||||
}
|
||||
|
||||
func TestPaddleCheckoutConfiguredRequiresWebhook(t *testing.T) {
|
||||
func TestStripeCheckoutConfiguredRequiresWebhook(t *testing.T) {
|
||||
cfg := Config{
|
||||
PaddleAPIKey: "pdl_sdbx_apikey_123",
|
||||
PaddlePriceMatrix: map[string]map[string]string{
|
||||
"pro": {"czk": "pri_pro_czk", "usd": "pri_pro_usd"},
|
||||
StripeAPIKey: "sk_test_123",
|
||||
StripePriceMatrix: map[string]map[string]string{
|
||||
"pro": {"czk": "price_pro_czk", "usd": "price_pro_usd"},
|
||||
},
|
||||
}
|
||||
|
||||
if cfg.PaddleCheckoutConfigured("pro") {
|
||||
if cfg.StripeCheckoutConfigured("pro") {
|
||||
t.Fatal("expected checkout disabled without webhook key")
|
||||
}
|
||||
}
|
||||
|
||||
func TestBillingProviderIsStripe(t *testing.T) {
|
||||
if (Config{}).BillingProvider() != "stripe" {
|
||||
t.Fatal("expected stripe billing provider")
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user