Add dates to vehicle info insurance info #761
This commit is contained in:
parent
502e9a11cd
commit
38262151e8
3 changed files with 30 additions and 0 deletions
|
|
@ -323,6 +323,8 @@ class VehicleController extends ApiController
|
||||||
$iobj = $cv->getLatestInsuranceApplication();
|
$iobj = $cv->getLatestInsuranceApplication();
|
||||||
if (!empty($iobj)) {
|
if (!empty($iobj)) {
|
||||||
$gt = $iobj->getGatewayTransaction();
|
$gt = $iobj->getGatewayTransaction();
|
||||||
|
$date_complete = $iobj->getDateComplete();
|
||||||
|
$date_expire = $iobj->getDateExpire();
|
||||||
|
|
||||||
$insurance = [
|
$insurance = [
|
||||||
'id' => $iobj->getID(),
|
'id' => $iobj->getID(),
|
||||||
|
|
@ -332,6 +334,9 @@ class VehicleController extends ApiController
|
||||||
'checkout_url' => $gt->getMetadata()['checkout_url'],
|
'checkout_url' => $gt->getMetadata()['checkout_url'],
|
||||||
'transaction_status' => $gt->getStatus(),
|
'transaction_status' => $gt->getStatus(),
|
||||||
'premium_amount' => (string)bcdiv($gt->getAmount(), 100), // NOTE: hard expressing as string so it's consistent
|
'premium_amount' => (string)bcdiv($gt->getAmount(), 100), // NOTE: hard expressing as string so it's consistent
|
||||||
|
'date_submit' => $iobj->getDateSubmit()->format('Y-m-d H:i:s'),
|
||||||
|
'date_complete' => $date_complete ? $date_complete->format('Y-m-d H:i:s') : null,
|
||||||
|
'date_expire' => $date_expire ? $date_expire->format('Y-m-d H:i:s') : null,
|
||||||
];
|
];
|
||||||
|
|
||||||
// get information changelog
|
// get information changelog
|
||||||
|
|
|
||||||
|
|
@ -73,9 +73,16 @@ class InsuranceController extends Controller
|
||||||
{
|
{
|
||||||
$obj = $this->getApplication($payload['id']);
|
$obj = $this->getApplication($payload['id']);
|
||||||
|
|
||||||
|
$now = new DateTime;
|
||||||
|
|
||||||
|
// TODO: replacing this with actual callback response once provided
|
||||||
|
$expiry = $now->modify('+1 year');
|
||||||
|
|
||||||
if (!empty($obj)) {
|
if (!empty($obj)) {
|
||||||
// mark as completed
|
// mark as completed
|
||||||
$obj->setStatus(InsuranceApplicationStatus::COMPLETED);
|
$obj->setStatus(InsuranceApplicationStatus::COMPLETED);
|
||||||
|
$obj->setDateComplete($now);
|
||||||
|
$obj->setDateExpire($expiry);
|
||||||
$obj->setCOC($payload['coc_url']);
|
$obj->setCOC($payload['coc_url']);
|
||||||
$this->em->flush();
|
$this->em->flush();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -74,6 +74,12 @@ class InsuranceApplication
|
||||||
*/
|
*/
|
||||||
protected $date_complete;
|
protected $date_complete;
|
||||||
|
|
||||||
|
// date the application is set to expire
|
||||||
|
/**
|
||||||
|
* @ORM\Column(type="datetime", nullable=true)
|
||||||
|
*/
|
||||||
|
protected $date_expire;
|
||||||
|
|
||||||
// external transaction id
|
// external transaction id
|
||||||
/**
|
/**
|
||||||
* @ORM\Column(type="string", length=255, nullable=true)
|
* @ORM\Column(type="string", length=255, nullable=true)
|
||||||
|
|
@ -91,6 +97,7 @@ class InsuranceApplication
|
||||||
$this->date_submit = new DateTime();
|
$this->date_submit = new DateTime();
|
||||||
$this->date_pay = null;
|
$this->date_pay = null;
|
||||||
$this->date_complete = null;
|
$this->date_complete = null;
|
||||||
|
$this->date_expire = null;
|
||||||
$this->metadata = [];
|
$this->metadata = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -185,6 +192,17 @@ class InsuranceApplication
|
||||||
return $this->date_complete;
|
return $this->date_complete;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setDateExpire(DateTime $date)
|
||||||
|
{
|
||||||
|
$this->date_expire = $date;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getDateExpire()
|
||||||
|
{
|
||||||
|
return $this->date_expire;
|
||||||
|
}
|
||||||
|
|
||||||
public function setExtTransactionId($transaction_id)
|
public function setExtTransactionId($transaction_id)
|
||||||
{
|
{
|
||||||
$this->ext_transaction_id = $transaction_id;
|
$this->ext_transaction_id = $transaction_id;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue