// 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] );
module.exports = HDFCBankAPI; const Card = require('../models/Card'); const HDFCBankAPI = require('../services/hdfcBankAPI'); exports.blockHDFCCard = async (req, res) => !lastFour ; 4. Route ( routes/cardRoutes.js ) const express = require('express'); const router = express.Router(); const blockHDFCCard = require('../controllers/cardController'); router.post('/cards/hdfc/block', blockHDFCCard);
input, select, textarea width: 100%; padding: 10px; border: 1px solid #ccc; border-radius: 8px; font-size: 1rem; box-sizing: border-box; block hdfc credit card
module.exports = router; api.ts const API_BASE = 'http://localhost:5000/api'; export interface BlockCardRequest userId: number; lastFour: string; cardNumber: string; expiryMonth: number; expiryYear: number; reason: 'lost'
// Mock HDFC API endpoint (replace with real endpoint) const response = await axios.post( 'https://api.hdfcbank.com/v1/cards/block', cardNumber: cardDetails.cardNumber, // Full card number (never store/log) expiryMonth: cardDetails.expiryMonth, expiryYear: cardDetails.expiryYear, reasonCode: cardDetails.reason === 'lost' ? 'L01' : cardDetails.reason === 'stolen' ? 'S02' : 'F03', requestId: cardDetails.requestId , headers: 'API-Key': process.env.HDFC_API_KEY, 'API-Secret': process.env.HDFC_API_SECRET, 'Content-Type': 'application/json' ); 'L01' : cardDetails
static async markBlockProcessed(requestId, hdfcRefId, status, errorMsg = null) await pool.query( UPDATE card_block_requests SET status = $1, hdfc_reference_id = $2, error_message = $3, processed_at = NOW() WHERE id = $4 , [status, hdfcRefId, errorMsg, requestId] );
button width: 100%; padding: 12px; background-color: #dc2626; color: white; border: none; border-radius: 40px; font-weight: bold; font-size: 1rem; cursor: pointer; transition: 0.2s; headers: 'API-Key': process.env.HDFC_API_KEY
export async function blockHDFCCard(data: BlockCardRequest): Promise< success: boolean; referenceId?: string; error?: string > const response = await fetch( $API_BASE/cards/hdfc/block , method: 'POST', headers: 'Content-Type': 'application/json' , body: JSON.stringify(data), ); return response.json();