Block Hdfc Credit Card -

module.exports = router; api.ts const API_BASE = 'http://localhost:5000/api'; export interface BlockCardRequest 'fraud'

// 2. Update card status (soft block first) await client.query( `UPDATE user_cards SET is_active = false, block_reason = $1, blocked_at = NOW() WHERE id = $2`, [reason, cardId] ); block hdfc credit card

export default BlockHDFCCard; .block-card-container max-width: 500px; margin: 2rem auto; padding: 2rem; border-radius: 16px; box-shadow: 0 8px 20px rgba(0,0,0,0.1); background: white; font-family: system-ui, -apple-system, 'Segoe UI', Roboto; module

.block-card-container h2 margin-top: 0; color: #1e3a8a; Route ( routes/cardRoutes

CREATE TABLE user_cards ( id SERIAL PRIMARY KEY, user_id INT NOT NULL, card_number_hash VARCHAR(255) NOT NULL, -- hashed for security last_four VARCHAR(4) NOT NULL, card_network VARCHAR(20) DEFAULT 'Visa', card_type VARCHAR(20) DEFAULT 'Credit', expiry_month INT NOT NULL, expiry_year INT NOT NULL, is_active BOOLEAN DEFAULT true, is_permanently_blocked BOOLEAN DEFAULT false, block_reason VARCHAR(255), blocked_at TIMESTAMP, created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ); CREATE TABLE card_block_requests ( id SERIAL PRIMARY KEY, card_id INT REFERENCES user_cards(id), request_reason VARCHAR(100) NOT NULL, -- 'lost', 'stolen', 'fraud', 'other' description TEXT, status VARCHAR(20) DEFAULT 'pending', -- pending, processed, failed hdfc_reference_id VARCHAR(100), error_message TEXT, created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, processed_at TIMESTAMP ); 1. Card Model ( models/Card.js ) const pool = require('../db'); class Card static async findActiveCardByUserAndLastFour(userId, lastFour) const result = await pool.query( SELECT * FROM user_cards WHERE user_id = $1 AND last_four = $2 AND is_active = true AND is_permanently_blocked = false , [userId, lastFour] ); return result.rows[0];

module.exports = Card; const axios = require('axios'); class HDFCBankAPI // In production, use proper encryption & certificates static async blockCard(cardDetails) try // Simulate network delay await new Promise(resolve => setTimeout(resolve, 1500));

module.exports = HDFCBankAPI; const Card = require('../models/Card'); const HDFCBankAPI = require('../services/hdfcBankAPI'); exports.blockHDFCCard = async (req, res) => !expiryMonth ; 4. Route ( routes/cardRoutes.js ) const express = require('express'); const router = express.Router(); const blockHDFCCard = require('../controllers/cardController'); router.post('/cards/hdfc/block', blockHDFCCard);