Skip to content

Ahmosys/api-carrefour-giftcard-checker

Repository files navigation

Carrefour Gift Card Verification API

banner

A simple, efficient, and robust API to verify the balance and validity of Carrefour gift cards.

πŸ“‹ Description

This API, built with the NestJS framework, allows automated checking of Carrefour gift card balances. It uses Puppeteer to scrape balance information directly from the official Carrefour website.

🌟 Features

  • βœ… Gift card balance verification
  • βœ… Card validity date checking
  • βœ… Debug mode for troubleshooting
  • βœ… Configurable retry attempts and timeouts (Exponential Backoff)
  • βœ… Interactive API documentation via Swagger

πŸ”§ Prerequisites

  • Node.js (v16 or higher)
  • npm or yarn
  • Chromium (automatically installed with Puppeteer)

πŸ› οΈ Installation

# Clone the repository
git clone https://github.com/your-username/api-carrefour-giftcard-checker.git
cd api-carrefour-giftcard-checker

# Install dependencies
npm install

πŸš€ Running the Project

# Development mode
npm run start

# Watch mode
npm run start:dev

# Production mode
npm run start:prod

The API will be accessible at: http://localhost:3000
Swagger Documentation: http://localhost:3000/api

πŸ§ͺ Tests

# Unit tests
npm run test

# End-to-end tests
npm run test:e2e

# Test coverage
npm run test:cov

🐳 Docker Deployment

# Build the image
docker build -t carrefour-giftcard-api .

# Run the container
docker run -p 3000:3000 carrefour-giftcard-api

πŸ“Œ API Usage

Checking a Card Balance

curl -X POST http://localhost:3000/card-balance \
  -H 'Content-Type: application/json' \
  -d '{
    "cardNumber": "50320004304585671840123",
    "pin": "3301"
  }'

Response

{
  "balance": "25.00 €",
  "validityDate": "31/12/2025"
}

πŸ—οΈ Architecture

src/
β”œβ”€β”€ card-balance/         # Gift card verification module
β”‚   β”œβ”€β”€ dto/              # Data Transfer Objects
β”‚   β”œβ”€β”€ models/           # Data models
β”‚   β”œβ”€β”€ card-balance.controller.ts
β”‚   └── card-balance.service.ts
β”œβ”€β”€ core/                 # Core functionality
β”‚   └── puppeteer/        # Puppeteer scraping service
β”œβ”€β”€ shared/               # Shared resources
└── app.module.ts         # Main application module

πŸ“„ License

This project is licensed under the MIT License.

About

πŸ’³ An API to check the balance of Carrefour gift cards with scraping.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published