Add generateInvoice API call. #421

This commit is contained in:
Korina Cordero 2020-06-02 07:41:47 +00:00
parent ce0240d001
commit 22c1fab15c

View file

@ -1180,10 +1180,22 @@ class CMBRiderAPIHandler implements RiderAPIHandlerInterface
public function generateInvoice(Request $req)
{
$required_params = ['jo_id'];
$data = $this->checkJO($req, $required_params, $jo);
$data = $this->checkParamsAndKey($req, $required_params);
if (isset($data['error']))
return $data;
// get jo
$jo_id = $req->query->get('jo_id');
$jo = $this->em->getRepository(JobOrder::class)->find($jo_id);
if ($jo == null)
{
$data = [
'invoice' => null
];
}
else
{
$inv = $jo->getInvoice();
$promo = $inv->getPromo();
@ -1238,6 +1250,7 @@ class CMBRiderAPIHandler implements RiderAPIHandlerInterface
'promo' => $promo_data,
]
];
}
return $data;
}