Add generateInvoice API call. #421
This commit is contained in:
parent
ce0240d001
commit
22c1fab15c
1 changed files with 50 additions and 37 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue