const {processBbpsEnquirePayment} = require("../services/bbpsEnquirePayment");

exports.enquirePayment = async (req, res) => {
  try {
    console.log("BBPS EnquirePayment controller hit");
    console.log("req.body:", req.body);

    const data = await processBbpsEnquirePayment(req.body);

    return res.status(200).json({
      success: data.success,
      status: data.status,
      data
    });

  } catch (err) {
    console.error("BBPS EnquirePayment error:", err.message);

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