const service = require('../services/retrieveTransaction');

exports.retrieveTransaction = async (req, res) => {
  try {
    console.log("Retrieve transaction request received");
    console.log("req.body", req.body);

    const data = await service.retrieveTransaction(req.body);

    return res.status(200).json({
      success: true,
      message: "Transaction retrieved successfully",
      data
    });
  } catch (err) {
    console.error("Retrieve transaction error", err && err.stack || err);

    return res.status(err.statusCode || 500).json({
      success: false,
      message: err.message || "Internal server error",
      detail: err.detail || null
    });
  }
};
