Add email and customer signature to complete call in rider api #424
This commit is contained in:
parent
2b13adffa0
commit
eb2d173ea7
2 changed files with 53 additions and 0 deletions
|
|
@ -59,6 +59,12 @@ class JOExtra
|
||||||
*/
|
*/
|
||||||
protected $after_other_images;
|
protected $after_other_images;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(type="string", nullable=true)
|
||||||
|
*/
|
||||||
|
protected $cust_signature;
|
||||||
|
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->before_other_images = new ArrayCollection();
|
$this->before_other_images = new ArrayCollection();
|
||||||
|
|
@ -181,4 +187,14 @@ class JOExtra
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setCustomerSignature($sig_file)
|
||||||
|
{
|
||||||
|
$this->cust_signature($sig_file);
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getCustomerSignature()
|
||||||
|
{
|
||||||
|
return $this->cust_signature;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1394,6 +1394,17 @@ class CMBRiderAPIHandler implements RiderAPIHandlerInterface
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// set customer signature
|
||||||
|
$jo_extra = $jo->getJOExtra();
|
||||||
|
$sig_file = $this->handleFileUpload($req, 'signature');
|
||||||
|
if ($sig_file)
|
||||||
|
$jo_extra->setCustomerSignature($sig_file);
|
||||||
|
|
||||||
|
// set email
|
||||||
|
$cust_email = $req->request->get('customer_email', '');
|
||||||
|
$jo->addMeta('customer_email', $cust_email);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
// set jo status to fulfilled
|
// set jo status to fulfilled
|
||||||
$jo->setStatus(JOStatus::FULFILLED);
|
$jo->setStatus(JOStatus::FULFILLED);
|
||||||
|
|
@ -1517,6 +1528,32 @@ class CMBRiderAPIHandler implements RiderAPIHandlerInterface
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function handleFileUpload($req, $name)
|
||||||
|
{
|
||||||
|
$file = $req->files->get($name);
|
||||||
|
if (empty($file))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
$orig_filename = pathinfo($file->getClientOriginalName(), PATHINFO_FILENAME);
|
||||||
|
|
||||||
|
// generate prefix to assure uniqueness
|
||||||
|
$prefix = uniqid() . '_';
|
||||||
|
$new_filename = $prefix . $orig_filename . '.' . $file->guessClientExtension();
|
||||||
|
|
||||||
|
// move to our upload dir
|
||||||
|
$dest = $this->upload_dir;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
$file->move($dest, $new_filename);
|
||||||
|
}
|
||||||
|
catch (FileException $e)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $new_filename;
|
||||||
|
}
|
||||||
|
|
||||||
public function uploadArrivePhotos(Request $req)
|
public function uploadArrivePhotos(Request $req)
|
||||||
{
|
{
|
||||||
$required_params = [
|
$required_params = [
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue