Add checking for longitude and latitude when calling getEstimate. #782

This commit is contained in:
Korina Cordero 2024-01-26 04:50:54 -05:00
parent 213171f4b7
commit 20f5bb08e0

View file

@ -41,7 +41,16 @@ class InvoiceController extends ApiController
}
// get customer location from customer_metadata using customer id
$coordinates = $this->getCustomerMetadata($cust);
$lng = $req->request->get('longitude');
$lat = $req->request->get('latitude');
if ((empty($lng)) || (empty($lat)))
{
// use customer metadata location as basis
$coordinates = $this->getCustomerMetadata($cust);
}
else
$coordinates = new Point($lng, $lat);
// make invoice criteria
$icrit = new InvoiceCriteria();