import { nanoid } from "nanoid";
import { initializePayment, verifyPayment } from "../services/payment.service.js";

export async function startPayment(request, response) {
  const reference = `OMS-PAY-${nanoid(10).toUpperCase()}`;
  const payment = await initializePayment({ ...request.body, reference });
  response.status(201).json(payment);
}

export async function confirmPayment(request, response) {
  const result = await verifyPayment(request.body);
  response.json(result);
}
