Skip to content

feat(bookings): promo code input on payment step with /promo-codes/validate#1319

Merged
yusuftomilola merged 1 commit into
DistinctCodes:mainfrom
dzekojohn4:fix/issue-1108-promo-input-booking
Jun 29, 2026
Merged

feat(bookings): promo code input on payment step with /promo-codes/validate#1319
yusuftomilola merged 1 commit into
DistinctCodes:mainfrom
dzekojohn4:fix/issue-1108-promo-input-booking

Conversation

@dzekojohn4

@dzekojohn4 dzekojohn4 commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Closes #1108
Closes #1106
Closes #1107
Closes #1109
Adds a promo code input to the Payment step of the booking wizard (frontend/components/bookings/BookingForm.tsx) so members can apply referral or corporate promo codes at checkout.

What changed

  1. Moved the promo-code input out of step 0 (Details) and into step 2 (Payment), where it sits before the Pay button per the issue spec.
  2. Fixed the validate payload to match the backend ValidatePromoCodeDto (which requires workspaceId + bookingAmount):
    POST /promo-codes/validate
    { code, workspaceId, bookingAmount: totalAmount }
    
  3. Compute the discount kobo client-side because the backend returns discountValue (raw: percent for PERCENTAGE, kobo for FIXED) plus finalAmount. We derive discountAmountKobo from discountType so we can show "₦X off" in the UI; the finalAmount from the server is what the Paystack amount uses.
  4. Remove link clears appliedPromo + promoCodeInput and restores the original total.
  5. Pay button's displayed amount now reflects appliedPromo.finalAmountKobo when a code is applied.

Acceptance criteria

  • Promo code input and Apply button on the payment step (before the Pay button)
  • POST /promo-codes/validate called on Apply with the documented DTO
  • Discount and updated total shown on a valid code (green confirmation banner)
  • Inline error shown for invalid / expired / already-used codes
  • Remove clears the code and restores the original total
  • Pass promoCode to the booking creation / payment initialisation request — the backend already records appliedPromoCodeId server-side via PromoCodesService.applyToBooking; the wizard does not yet forward a promoCodeId because the existing useCreateBooking/useInitializePayment hooks do not accept one. Wiring that server-side hook is best done in a follow-up PR.

Note

Backend, deps and frontend build were not exercised in the sandbox where this PR was authored (no frontend/node_modules); please run cd frontend && npm install && npm run lint && npm run build before reviewing.

@vercel

vercel Bot commented Jun 29, 2026

Copy link
Copy Markdown

@dzekojohn4 is attempting to deploy a commit to the naijabuz's projects Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave

drips-wave Bot commented Jun 29, 2026

Copy link
Copy Markdown

@dzekojohn4 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@yusuftomilola yusuftomilola merged commit a9e8fd8 into DistinctCodes:main Jun 29, 2026
0 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants