diff --git a/backend/handlers/payments/vat_test.go b/backend/handlers/payments/vat_test.go index 4b1d060..b09e53e 100644 --- a/backend/handlers/payments/vat_test.go +++ b/backend/handlers/payments/vat_test.go @@ -22,7 +22,6 @@ import ( ) func TestSPV_VATAppliedAtTillSale(t *testing.T) { - t.Parallel() ctx, tx := testutils.SetupTestTx(t) _, err := tx.Exec(ctx, `UPDATE business_settings SET is_vat_registered = TRUE, default_vat_rate = 20.00, voucher_type = 'SPV'`) @@ -91,7 +90,6 @@ func TestSPV_VATAppliedAtTillSale(t *testing.T) { } func TestMPV_NoVATAtTillSale(t *testing.T) { - t.Parallel() ctx, tx := testutils.SetupTestTx(t) _, err := tx.Exec(ctx, `UPDATE business_settings SET is_vat_registered = TRUE, default_vat_rate = 20.00, voucher_type = 'MPV'`) @@ -154,7 +152,6 @@ func TestMPV_NoVATAtTillSale(t *testing.T) { } func TestMPV_VATAppliedAtRedemption(t *testing.T) { - t.Parallel() ctx, tx := testutils.SetupTestTx(t) _, err := tx.Exec(ctx, `UPDATE business_settings SET is_vat_registered = TRUE, default_vat_rate = 20.00, voucher_type = 'MPV'`) @@ -239,7 +236,6 @@ func TestMPV_VATAppliedAtRedemption(t *testing.T) { } func TestSPV_NoVATAtRedemption(t *testing.T) { - t.Parallel() ctx, tx := testutils.SetupTestTx(t) _, err := tx.Exec(ctx, `UPDATE business_settings SET is_vat_registered = TRUE, default_vat_rate = 20.00, voucher_type = 'SPV'`) @@ -315,7 +311,6 @@ func TestSPV_NoVATAtRedemption(t *testing.T) { } } func TestVAT_SkippedWhenNotRegistered(t *testing.T) { - t.Parallel() ctx, tx := testutils.SetupTestTx(t) _, err := tx.Exec(ctx, `UPDATE business_settings SET is_vat_registered = FALSE, voucher_type = 'SPV'`) @@ -378,7 +373,6 @@ func TestVAT_SkippedWhenNotRegistered(t *testing.T) { } func TestEnableVATRegistration(t *testing.T) { - t.Parallel() ctx, tx := testutils.SetupTestTx(t) _, err := tx.Exec(ctx, `UPDATE business_settings SET is_vat_registered = FALSE, default_vat_rate = 20.00, voucher_type = 'SPV'`) @@ -469,7 +463,6 @@ func TestEnableVATRegistration(t *testing.T) { } func TestCashBookingPayment_VATApplied(t *testing.T) { - t.Parallel() ctx, tx := testutils.SetupTestTx(t) _, err := tx.Exec(ctx, `UPDATE business_settings SET is_vat_registered = TRUE, default_vat_rate = 20.00`) @@ -542,7 +535,6 @@ func TestCashBookingPayment_VATApplied(t *testing.T) { } func TestCashBookingPayment_NoVATWhenNotRegistered(t *testing.T) { - t.Parallel() ctx, tx := testutils.SetupTestTx(t) // Explicitly not registered (default) @@ -600,7 +592,6 @@ func TestCashBookingPayment_NoVATWhenNotRegistered(t *testing.T) { } func TestOnTheHouseTillSale_NoVATEvenIfRegistered(t *testing.T) { - t.Parallel() ctx, tx := testutils.SetupTestTx(t) _, err := tx.Exec(ctx, `UPDATE business_settings SET is_vat_registered = TRUE, default_vat_rate = 20.00, voucher_type = 'SPV'`) @@ -658,7 +649,6 @@ func TestOnTheHouseTillSale_NoVATEvenIfRegistered(t *testing.T) { } func TestGetVATConfig(t *testing.T) { - t.Parallel() ctx, tx := testutils.SetupTestTx(t) _, err := tx.Exec(ctx, `UPDATE business_settings SET is_vat_registered = TRUE, default_vat_rate = 5.00, voucher_type = 'MPV'`) @@ -693,7 +683,6 @@ func TestGetVATConfig(t *testing.T) { } func TestApplyVATToBookingPayment_Direct(t *testing.T) { - t.Parallel() ctx, tx := testutils.SetupTestTx(t) _, err := tx.Exec(ctx, `UPDATE business_settings SET is_vat_registered = TRUE, default_vat_rate = 20.00`) @@ -754,7 +743,6 @@ func TestApplyVATToBookingPayment_Direct(t *testing.T) { } func TestApplyVATToTillSale_Direct(t *testing.T) { - t.Parallel() ctx, tx := testutils.SetupTestTx(t) _, err := tx.Exec(ctx, `UPDATE business_settings SET is_vat_registered = TRUE, default_vat_rate = 20.00, voucher_type = 'SPV'`) @@ -806,7 +794,6 @@ func TestApplyVATToTillSale_Direct(t *testing.T) { } func TestVAT_Idempotency_ApplyTwice(t *testing.T) { - t.Parallel() ctx, tx := testutils.SetupTestTx(t) _, err := tx.Exec(ctx, `UPDATE business_settings SET is_vat_registered = TRUE, default_vat_rate = 20.00, voucher_type = 'SPV'`) @@ -875,7 +862,6 @@ func TestVAT_Idempotency_ApplyTwice(t *testing.T) { } func TestVAT_DifferentRates(t *testing.T) { - t.Parallel() ctx, tx := testutils.SetupTestTx(t) // Test with 5% reduced VAT rate @@ -938,7 +924,6 @@ func TestVAT_DifferentRates(t *testing.T) { } func TestPaymentSummary_VATAggregates(t *testing.T) { - t.Parallel() ctx, tx := testutils.SetupTestTx(t) _, err := tx.Exec(ctx, `UPDATE business_settings SET is_vat_registered = TRUE, default_vat_rate = 20.00`) @@ -1033,7 +1018,6 @@ func TestPaymentSummary_VATAggregates(t *testing.T) { } func TestBuyGiftCard_SPV_VATApplied(t *testing.T) { - t.Parallel() ctx, tx := testutils.SetupTestTx(t) _, err := tx.Exec(ctx, `UPDATE business_settings SET is_vat_registered = TRUE, default_vat_rate = 20.00, voucher_type = 'SPV'`) @@ -1112,7 +1096,6 @@ func TestBuyGiftCard_SPV_VATApplied(t *testing.T) { } func TestVAT_ToggleLifecycle(t *testing.T) { - t.Parallel() ctx, tx := testutils.SetupTestTx(t) _, err := tx.Exec(ctx, `UPDATE business_settings SET is_vat_registered = FALSE, default_vat_rate = 20.00, voucher_type = 'SPV'`) @@ -1252,7 +1235,6 @@ func TestVAT_ToggleLifecycle(t *testing.T) { } func TestVAT_Refund_VATInclusiveCashPayment(t *testing.T) { - t.Parallel() ctx, tx := testutils.SetupTestTx(t) _, err := tx.Exec(ctx, `UPDATE business_settings SET is_vat_registered = TRUE, default_vat_rate = 20.00`) @@ -1339,7 +1321,6 @@ func TestVAT_Refund_VATInclusiveCashPayment(t *testing.T) { } func TestSPV_FullLifecycle_BuyAndRedeem(t *testing.T) { - t.Parallel() ctx, tx := testutils.SetupTestTx(t) _, err := tx.Exec(ctx, `UPDATE business_settings SET is_vat_registered = TRUE, default_vat_rate = 20.00, voucher_type = 'SPV'`) @@ -1451,7 +1432,6 @@ func TestSPV_FullLifecycle_BuyAndRedeem(t *testing.T) { } func TestMPV_FullLifecycle_BuyAndRedeem(t *testing.T) { - t.Parallel() ctx, tx := testutils.SetupTestTx(t) _, err := tx.Exec(ctx, `UPDATE business_settings SET is_vat_registered = TRUE, default_vat_rate = 20.00, voucher_type = 'MPV'`) @@ -1564,7 +1544,6 @@ func TestMPV_FullLifecycle_BuyAndRedeem(t *testing.T) { } func TestVAT_TopupGiftCard_NoVATOnTopup(t *testing.T) { - t.Parallel() ctx, tx := testutils.SetupTestTx(t) _, err := tx.Exec(ctx, `UPDATE business_settings SET is_vat_registered = TRUE, default_vat_rate = 20.00, voucher_type = 'SPV'`) @@ -1638,7 +1617,6 @@ func TestVAT_TopupGiftCard_NoVATOnTopup(t *testing.T) { } func TestVAT_RemainingBalanceWithVAT(t *testing.T) { - t.Parallel() ctx, tx := testutils.SetupTestTx(t) _, err := tx.Exec(ctx, `UPDATE business_settings SET is_vat_registered = TRUE, default_vat_rate = 20.00`) @@ -1756,7 +1734,6 @@ func TestVAT_RemainingBalanceWithVAT(t *testing.T) { } func TestVAT_GiftCardCRUD_DoesNotInterfere(t *testing.T) { - t.Parallel() ctx, tx := testutils.SetupTestTx(t) _, err := tx.Exec(ctx, `UPDATE business_settings SET is_vat_registered = TRUE, default_vat_rate = 20.00, voucher_type = 'SPV'`) @@ -1845,7 +1822,6 @@ func TestVAT_GiftCardCRUD_DoesNotInterfere(t *testing.T) { // TestMPV_Topup_NoVAT verifies a gift card topup with voucher_type=MPV does not // apply VAT at sale. func TestMPV_Topup_NoVAT(t *testing.T) { - t.Parallel() ctx, tx := testutils.SetupTestTx(t) _, err := tx.Exec(ctx, `UPDATE business_settings SET is_vat_registered = TRUE, default_vat_rate = 20.00, voucher_type = 'MPV'`) @@ -1919,7 +1895,6 @@ func TestMPV_Topup_NoVAT(t *testing.T) { // Uses a booking that has already started so buildSplitRecords returns a // single payment record, making VAT assertion straightforward. func TestCreateBookingPayment_VATApplied(t *testing.T) { - t.Parallel() ctx, tx := testutils.SetupTestTx(t) _, err := tx.Exec(ctx, `UPDATE business_settings SET is_vat_registered = TRUE, default_vat_rate = 20.00`) @@ -1989,7 +1964,6 @@ func TestCreateBookingPayment_VATApplied(t *testing.T) { // TestTillSale_SavedCard_SPV_VATApplied verifies that a till sale with // saved_card payment method applies VAT for SPV. func TestTillSale_SavedCard_SPV_VATApplied(t *testing.T) { - t.Parallel() ctx, tx := testutils.SetupTestTx(t) _, err := tx.Exec(ctx, `UPDATE business_settings SET is_vat_registered = TRUE, default_vat_rate = 20.00, voucher_type = 'SPV'`) @@ -2068,7 +2042,6 @@ func TestTillSale_SavedCard_SPV_VATApplied(t *testing.T) { // get double-taxed. The voucher_type_at_purchase stored on the card at // creation time is used at redemption, not the current business_settings. func TestVoucherToggle_SPVPurchase_MPVRedeem(t *testing.T) { - t.Parallel() ctx, tx := testutils.SetupTestTx(t) _, err := tx.Exec(ctx, `UPDATE business_settings SET is_vat_registered = TRUE, default_vat_rate = 20.00, voucher_type = 'SPV'`) @@ -2182,7 +2155,6 @@ func TestVoucherToggle_SPVPurchase_MPVRedeem(t *testing.T) { // TestApplyVATToTillSale_MPV verifies ApplyVATToTillSale has no effect when // voucher_type is MPV. func TestApplyVATToTillSale_MPV(t *testing.T) { - t.Parallel() ctx, tx := testutils.SetupTestTx(t) _, err := tx.Exec(ctx, `UPDATE business_settings SET is_vat_registered = TRUE, default_vat_rate = 20.00, voucher_type = 'MPV'`) @@ -2229,7 +2201,6 @@ func TestApplyVATToTillSale_MPV(t *testing.T) { // switching to SPV still gets VAT at redemption — because the stored // voucher_type_at_purchase is MPV, overriding the current business_settings. func TestVoucherToggle_MPVPurchase_SPVRedeem(t *testing.T) { - t.Parallel() ctx, tx := testutils.SetupTestTx(t) _, err := tx.Exec(ctx, `UPDATE business_settings SET is_vat_registered = TRUE, default_vat_rate = 20.00, voucher_type = 'MPV'`) @@ -2342,7 +2313,6 @@ func TestVoucherToggle_MPVPurchase_SPVRedeem(t *testing.T) { // TestLegacyGiftCard_NullVoucherType defaults NULL voucher_type_at_purchase // to SPV behavior — no VAT at redemption. func TestLegacyGiftCard_NullVoucherType(t *testing.T) { - t.Parallel() ctx, tx := testutils.SetupTestTx(t) _, err := tx.Exec(ctx, `UPDATE business_settings SET is_vat_registered = TRUE, default_vat_rate = 20.00, voucher_type = 'MPV'`) @@ -2415,7 +2385,6 @@ func TestLegacyGiftCard_NullVoucherType(t *testing.T) { // user's account balance (usedBalance=true), no VAT is ever applied — // it was already paid when the card was originally purchased. func TestUsedBalance_NoVATRegardless(t *testing.T) { - t.Parallel() ctx, tx := testutils.SetupTestTx(t) // Set MPV — even with MPV, usedBalance should NOT have VAT @@ -2495,7 +2464,6 @@ func TestUsedBalance_NoVATRegardless(t *testing.T) { // TestVAT_DiscountPayment_NoVAT verifies that discount payments never get VAT // applied, even when the business is VAT-registered. func TestVAT_DiscountPayment_NoVAT(t *testing.T) { - t.Parallel() ctx, tx := testutils.SetupTestTx(t) _, err := tx.Exec(ctx, `UPDATE business_settings SET is_vat_registered = TRUE, default_vat_rate = 20.00`) @@ -2603,7 +2571,6 @@ func TestVAT_DiscountPayment_NoVAT(t *testing.T) { // TestVAT_SplitPayments verifies VAT is correctly partitioned across split // records when a single Square payment is split into deposit + balance. func TestVAT_SplitPayments(t *testing.T) { - t.Parallel() ctx, tx := testutils.SetupTestTx(t) _, err := tx.Exec(ctx, `UPDATE business_settings SET is_vat_registered = TRUE, default_vat_rate = 20.00`) @@ -2712,7 +2679,6 @@ func TestVAT_SplitPayments(t *testing.T) { // TestEnableVATRegistration_TillSales verifies that enable_vat_registration // also retroactively applies VAT to completed till_sales records. func TestEnableVATRegistration_TillSales(t *testing.T) { - t.Parallel() ctx, tx := testutils.SetupTestTx(t) adminID, err := fixtures.CreateTestAdminUser(tx) @@ -2775,7 +2741,6 @@ func TestEnableVATRegistration_TillSales(t *testing.T) { } func TestGetVATConfig_WithTxQuerier(t *testing.T) { - t.Parallel() ctx, tx := testutils.SetupTestTx(t) _, err := tx.Exec(ctx, `UPDATE business_settings SET is_vat_registered = TRUE, default_vat_rate = 5.00, voucher_type = 'MPV'`) @@ -2800,7 +2765,6 @@ func TestGetVATConfig_WithTxQuerier(t *testing.T) { } func TestGetVATConfig_DbConnQuerier(t *testing.T) { - t.Parallel() ctx, tx := testutils.SetupTestTx(t) _, err := tx.Exec(ctx, `UPDATE business_settings SET is_vat_registered = TRUE, default_vat_rate = 8.00, voucher_type = 'SPV'`) @@ -2826,7 +2790,6 @@ func TestGetVATConfig_DbConnQuerier(t *testing.T) { } func TestApplyVATToBookingPayment_DefensiveCheck(t *testing.T) { - t.Parallel() ctx, tx := testutils.SetupTestTx(t) _, err := tx.Exec(ctx, `UPDATE business_settings SET is_vat_registered = TRUE, default_vat_rate = 20.00`) @@ -2878,7 +2841,6 @@ func TestApplyVATToBookingPayment_DefensiveCheck(t *testing.T) { } func TestApplyVATToBookingPayment_OnTheHouse_Skip(t *testing.T) { - t.Parallel() ctx, tx := testutils.SetupTestTx(t) _, err := tx.Exec(ctx, `UPDATE business_settings SET is_vat_registered = TRUE, default_vat_rate = 20.00`) @@ -3302,8 +3264,7 @@ func TestVAT_RoundingConsistency(t *testing.T) { for _, tt := range edgeCases { t.Run(tt.name, func(t *testing.T) { - t.Parallel() - ctx, tx := testutils.SetupTestTx(t) + ctx, tx := testutils.SetupTestTx(t) _, err := tx.Exec(ctx, `UPDATE business_settings SET is_vat_registered = TRUE, default_vat_rate = 20.00`) if err != nil { @@ -3406,7 +3367,6 @@ func TestVAT_RoundingConsistency(t *testing.T) { // including purchase, redemption, and toggle scenarios. func TestVAT_DiscountAndCashPayment_RemainingBalance(t *testing.T) { - t.Parallel() ctx, tx := testutils.SetupTestTx(t) _, err := tx.Exec(ctx, `UPDATE business_settings SET is_vat_registered = TRUE, default_vat_rate = 20.00`) diff --git a/frontend/src/lib/components/admin/BookingCreateModal.svelte b/frontend/src/lib/components/admin/BookingCreateModal.svelte index 53c2fd3..b1f0037 100644 --- a/frontend/src/lib/components/admin/BookingCreateModal.svelte +++ b/frontend/src/lib/components/admin/BookingCreateModal.svelte @@ -570,7 +570,7 @@ workingHours = { ...workingHours, ...whMap }; availableHours = { ...availableHours, ...ahMap }; } - } catch { + } catch { toast.error('Failed to load availability'); } finally { loadingAvailableHours = false; @@ -1144,7 +1144,7 @@ {#if loadingUsers}