8000 simple-mdac/README.md at master · shroominic/simple-mdac · GitHub
[go: up one dir, main page]

Skip to content

Latest commit

 

History

History
138 lines (101 loc) · 3.37 KB

README.md

File metadata and controls

138 lines (101 loc) · 3.37 KB

🛂 Simple MDAC Registration

Simplified Malaysia Digital Arrival Card (MDAC) registration with a beautiful web interface.

Features

  • 🎨 Beautiful UI - Clean, modern interface with blue/teal travel theme
  • 💾 Local storage - Person and trip details saved in browser localStorage
  • 🔒 Type-safe - Full Pydantic validation with proper enums
  • 🎓 Network School - Pre-configured for Network School destination

Quick Start

1. Install Dependencies

uv sync

2. Set Environment Variable

export TWOC_API_KEY="your_2captcha_api_key"

3. Run the Web App

uv run uvicorn app:app --reload

Then open http://localhost:8000 in your browser.

Or Run Example Script

uv run python example.py

Web Interface

The web interface provides:

  • Smart defaults: Most fields pre-filled with sensible defaults
  • localStorage persistence: Your personal details are saved for next time
  • Advanced options: Hidden by default, expand when needed
  • Fixed destination: Network School (Johor) is pre-configured
  • Date validation: Ensures all dates are in DD/MM/YYYY format

Form Sections

  1. Personal Information - Always visible

    • Full name, passport number, nationality
    • Date of birth, gender, passport expiry
    • Email and phone number
  2. Trip Information - Always visible

    • Length of stay (default: 30 days)
  3. Advanced Options - Hidden by default

    • Arrival date (defaults to today)
    • Travel mode (Air/Land/Sea)
    • Embarkation point (default: Singapore)
    • Vessel/flight number

API Endpoints

  • GET / - Web interface
  • POST /api/submit - Submit MDAC registration

Example API Request

curl -X POST http://localhost:8000/api/submit \
  -H "Content-Type: application/json" \
  -d '{
    "person": {
      "name": "JOHN DOE",
      "passport_number": "A12345678",
      "date_of_birth": "01/01/1990",
      "nationality": "USA",
      "gender": "1",
      "passport_expiry": "31/12/2030",
      "email": "john@example.com",
      "phone_number": "1234567890"
    },
    "trip": {
      "length_of_stay_days": 30,
      "arrival_date": null,
      "travel_mode": "2",
      "embarkation_point": "SGP",
      "vessel_name": "BUS"
    }
  }'

Project Structure

.
├── app.py              # FastAPI web application
├── mdac.py             # Core MDAC logic with enums and models
├── pyproject.toml      # Dependencies
├── example.py          # Example usage of the MDAC registration function
└── README.md           # This file

Available Enums

  • Country: 50+ common countries (Singapore, Malaysia, USA, UK, etc.)
  • Gender: Male, Female
  • TravelMode: Air, Land, Sea
  • AccommodationType: Hotel, Friends/Relatives, Others
  • State: All 16 Malaysian states
  • AccommodationPreset: Network School (pre-configured)

Date Format

All dates must be in DD/MM/YYYY format:

  • ✅ 15/03/1990
  • ✅ 31/12/2030
  • ❌ 03/15/1990 (US format)
  • ❌ 1990-03-15 (ISO format)

Security

  • Uses 2captcha for automatic CAPTCHA solving
  • Requires valid 2captcha API key in TWOC_API_KEY environment variable
  • All requests use randomized headers to avoid fingerprinting

Disclaimer

Use at your own risk. Developer not responsible for any issues with submissions. Always verify information before submitting.

License

MIT

0