<?php
/**
* Created by PhpStorm.
* User: apple
* Date: 29/03/19
* Time: 3:08 PM
*/
namespace App\AppBundle\MainBundle\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
use JsonSerializable;
/**
* AddOns
*
* @ORM\Entity
* @ORM\Table(name="orders_extended")
* @ORM\HasLifecycleCallbacks()
*/
class Orders_Extended implements JsonSerializable
{
/**
* @ORM\Column(type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var Orders_Pricing
* @ORM\OneToOne(targetEntity="Orders_Pricing")
* @ORM\JoinColumn(name="orders_pricing_id", referencedColumnName="id")
*/
private $orders_pricing;
/**
* @ORM\Column(type="boolean", nullable=true, options={"default" : 0})
* @Assert\NotBlank()
*/
private $is_completed;
/**
* @var \DateTime
* @ORM\Column(type="datetime", nullable=false)
* @Assert\NotBlank()
*/
private $start_time;
/**
* @var \DateTime
* @ORM\Column(type="datetime", nullable=false)
* @Assert\NotBlank()
*/
private $end_time;
/**
* @ORM\Column(type="boolean", nullable=true, options={"default" : 0})
* @Assert\NotBlank()
*/
private $is_order_paid;
/**
* @ORM\Column(type="boolean", nullable=true, options={"default" : 0})
* @Assert\NotBlank()
*/
private $is_email_sent;
/**
* @ORM\Column(type="boolean", nullable=true, options={"default" : 0})
* @Assert\NotBlank()
*/
private $is_sms_sent;
/**
* @ORM\Column(type="boolean", nullable=true, options={"default" : 0})
* @Assert\NotBlank()
*/
private $is_notification_sent;
/**
* @ORM\Column(type="boolean", nullable=true, options={"default" : 1})
* @Assert\NotBlank()
*/
private $is_active;
/**
* @ORM\ManyToOne(targetEntity="WP_Payment")
* @ORM\JoinColumn(name="wp_payment_id", referencedColumnName="id", nullable=true)
*/
private $wp_payment;
/**
* @ORM\Column(type="string", nullable=true)
*/
private $payment_method_type;
/**
* @ORM\Column(type="string", nullable=true)
*/
private $pay_stripe_customer_id;
/**
* @ORM\Column(type="string", nullable=true)
*/
private $pay_stripe_card_id;
/**
* @ORM\Column(type="string", nullable=true)
*/
private $pay_stripe_payment_intent_id;
/**
* @ORM\Column(type="string", nullable=true)
*/
private $pay_stripe_payment_method_id;
/**
* @ORM\Column(type="string", nullable=true)
* @Assert\NotBlank()
*/
private $pay_name;
/**
* @ORM\Column(type="string", nullable=true)
* @Assert\NotBlank()
*/
private $pay_card_type;
/**
* @ORM\Column(type="string", nullable=true)
* @Assert\NotBlank()
*/
private $pay_last_four;
/**
* @ORM\Column(type="string", nullable=true)
* @Assert\NotBlank()
*/
private $pay_brand;
/**
* @ORM\Column(type="string", nullable=true)
* @Assert\NotBlank()
*/
private $pay_expiry_month;
/**
* @ORM\Column(type="string", nullable=true)
* @Assert\NotBlank()
*/
private $pay_expiry_year;
/**
* Many features have one product. This is the owning side.
* @ORM\ManyToOne(targetEntity="Orders", inversedBy="orders_extended")
* @ORM\JoinColumn(name="order_id", referencedColumnName="id")
*/
private $orders;
/**
* @var \DateTime
* @ORM\Column(type="datetime", nullable=true)
* @Assert\NotBlank()
*/
private $booking_cancelled_on;
/**
* @ORM\Column(type="integer", nullable=false, options={"default" : 0})
* @Assert\NotBlank()
*/
private $booking_status;//2 - Completed, 3 - Cancelled by Spot Provider, 4 - Cancelled by Spot User, 5 - Cancelled From System, 6 Refunded, 7 - Non-Refunded
/**
* @ORM\Column(type="string", nullable=true)
* @Assert\NotBlank()
*/
private $booking_cancelled_reason;
/**
* @ORM\Column(type="decimal", precision=10, scale=2, nullable=true)
* @Assert\NotBlank()
*/
private $refund_amount;
/**
* @return mixed
*/
public function getId()
{
return $this->id;
}
/**
* @return mixed
*/
public function getIsCompleted()
{
return $this->is_completed;
}
/**
* @param mixed $is_completed
*/
public function setIsCompleted($is_completed)
{
$this->is_completed = $is_completed;
}
/**
* @return mixed
*/
public function getStartTime()
{
return $this->start_time;
}
/**
* @param mixed $start_time
*/
public function setStartTime($start_time)
{
$this->start_time = $start_time;
}
/**
* @return mixed
*/
public function getEndTime()
{
return $this->end_time;
}
/**
* @param mixed $end_time
*/
public function setEndTime($end_time)
{
$this->end_time = $end_time;
}
/**
* @return mixed
*/
public function getIsOrderPaid()
{
return $this->is_order_paid;
}
/**
* @param mixed $is_order_paid
*/
public function setIsOrderPaid($is_order_paid)
{
$this->is_order_paid = $is_order_paid;
}
/**
* @return Orders_Pricing
*/
public function getOrdersPricing()
{
return $this->orders_pricing;
}
/**
* @param mixed $orders_pricing
*/
public function setOrdersPricing($orders_pricing)
{
$this->orders_pricing = $orders_pricing;
}
/**
* @return mixed
*/
public function getIsEmailSent()
{
return $this->is_email_sent;
}
/**
* @param mixed $is_email_sent
*/
public function setIsEmailSent($is_email_sent)
{
$this->is_email_sent = $is_email_sent;
}
/**
* @return mixed
*/
public function getIsSmsSent()
{
return $this->is_sms_sent;
}
/**
* @param mixed $is_sms_sent
*/
public function setIsSmsSent($is_sms_sent)
{
$this->is_sms_sent = $is_sms_sent;
}
/**
* @return mixed
*/
public function getIsNotificationSent()
{
return $this->is_notification_sent;
}
/**
* @param mixed $is_notification_sent
*/
public function setIsNotificationSent($is_notification_sent)
{
$this->is_notification_sent = $is_notification_sent;
}
/**
* @return mixed
*/
public function getIsActive()
{
return $this->is_active;
}
/**
* @param mixed $is_active
*/
public function setIsActive($is_active)
{
$this->is_active = $is_active;
}
/**
* @return mixed
*/
public function getWpPayment()
{
return $this->wp_payment;
}
/**
* @param mixed $wp_payment
*/
public function setWpPayment($wp_payment)
{
$this->wp_payment = $wp_payment;
}
/**
* @return mixed
*/
public function getPayName()
{
return $this->pay_name;
}
/**
* @param mixed $pay_name
*/
public function setPayName($pay_name)
{
$this->pay_name = $pay_name;
}
/**
* @return mixed
*/
public function getPayCardType()
{
return $this->pay_card_type;
}
/**
* @param mixed $pay_card_type
*/
public function setPayCardType($pay_card_type)
{
$this->pay_card_type = $pay_card_type;
}
/**
* @return mixed
*/
public function getPayLastFour()
{
return $this->pay_last_four;
}
/**
* @param mixed $pay_last_four
*/
public function setPayLastFour($pay_last_four)
{
$this->pay_last_four = $pay_last_four;
}
/**
* @return mixed
*/
public function getPayBrand()
{
return $this->pay_brand;
}
/**
* @param mixed $pay_brand
*/
public function setPayBrand($pay_brand)
{
$this->pay_brand = $pay_brand;
}
/**
* @return mixed
*/
public function getPayExpiryMonth()
{
return $this->pay_expiry_month;
}
/**
* @param mixed $pay_expiry_month
*/
public function setPayExpiryMonth($pay_expiry_month)
{
$this->pay_expiry_month = $pay_expiry_month;
}
/**
* @return mixed
*/
public function getPayExpiryYear()
{
return $this->pay_expiry_year;
}
/**
* @param mixed $pay_expiry_year
*/
public function setPayExpiryYear($pay_expiry_year)
{
$this->pay_expiry_year = $pay_expiry_year;
}
/**
* @return Orders
*/
public function getOrders()
{
return $this->orders;
}
/**
* @param mixed $orders
*/
public function setOrders($orders)
{
$this->orders = $orders;
}
/**
* @return mixed
*/
public function getBookingCancelledOn()
{
return $this->booking_cancelled_on;
}
/**
* @param mixed $booking_cancelled_on
*/
public function setBookingCancelledOn($booking_cancelled_on)
{
$this->booking_cancelled_on = $booking_cancelled_on;
}
/**
* @return mixed
*/
public function getBookingStatus()
{
return $this->booking_status;
}
/**
* @param mixed $booking_status
*/
public function setBookingStatus($booking_status)
{
$this->booking_status = $booking_status;
}
/**
* @return mixed
*/
public function getBookingCancelledReason()
{
return $this->booking_cancelled_reason;
}
/**
* @param mixed $booking_cancelled_reason
*/
public function setBookingCancelledReason($booking_cancelled_reason)
{
$this->booking_cancelled_reason = $booking_cancelled_reason;
}
/**
* @return mixed
*/
public function getRefundAmount()
{
return $this->refund_amount;
}
/**
* @param mixed $refund_amount
*/
public function setRefundAmount($refund_amount)
{
$this->refund_amount = $refund_amount;
}
/**
* @return mixed
*/
public function getPayStripeCustomerId()
{
return $this->pay_stripe_customer_id;
}
/**
* @param mixed $pay_stripe_customer_id
*/
public function setPayStripeCustomerId($pay_stripe_customer_id)
{
$this->pay_stripe_customer_id = $pay_stripe_customer_id;
}
/**
* @return mixed
*/
public function getPayStripeCardId()
{
return $this->pay_stripe_card_id;
}
/**
* @param mixed $pay_stripe_card_id
*/
public function setPayStripeCardId($pay_stripe_card_id)
{
$this->pay_stripe_card_id = $pay_stripe_card_id;
}
/**
* @return mixed
*/
public function getPaymentMethodType()
{
return $this->payment_method_type;
}
/**
* @param mixed $payment_method_type
*/
public function setPaymentMethodType($payment_method_type)
{
$this->payment_method_type = $payment_method_type;
}
/**
* @return mixed
*/
public function getPayStripePaymentIntentId()
{
return $this->pay_stripe_payment_intent_id;
}
/**
* @param mixed $pay_stripe_payment_intent_id
*/
public function setPayStripePaymentIntentId($pay_stripe_payment_intent_id)
{
$this->pay_stripe_payment_intent_id = $pay_stripe_payment_intent_id;
}
/**
* @return mixed
*/
public function getPayStripePaymentMethodId()
{
return $this->pay_stripe_payment_method_id;
}
/**
* @param mixed $pay_stripe_payment_method_id
*/
public function setPayStripePaymentMethodId($pay_stripe_payment_method_id)
{
$this->pay_stripe_payment_method_id = $pay_stripe_payment_method_id;
}
public function jsonSerialize()
{
return array(
'id' => $this->id,
'is_completed' => $this->is_completed,
'start_time' => $this->start_time->format('Y-m-d H:i:s'),
'end_time' => $this->end_time->format('Y-m-d H:i:s'),
'is_order_paid' => $this->is_order_paid,
'is_email_sent' => $this->is_email_sent,
'is_sms_sent' => $this->is_sms_sent,
'is_notification_sent' => $this->is_notification_sent,
'hourly_rate' => $this->orders_pricing->getHourlyRate(),
'daily_max' => $this->orders_pricing->getDailyMax(),
'sub_total_price' => $this->orders_pricing->getSubTotalPrice(),
'tax_price' => $this->orders_pricing->getTaxPrice(),
'service_fee_price' => $this->orders_pricing->getServiceFeePrice(),
'total_price' => $this->orders_pricing->getTotalPrice(),
'wp_payment_id' => $this->getWpPayment() != NULL ? $this->getWpPayment()->getId() : '',
'pay_name' => $this->pay_name,
'pay_brand' => $this->pay_brand,
'pay_card_type' => $this->pay_card_type,
'pay_expiry_month' => $this->pay_expiry_month,
'pay_expiry_year' => $this->pay_expiry_year,
'pay_last_four' => $this->pay_last_four,
'booking_cancelled_on' => $this->booking_cancelled_on == NULL ? '' : $this->booking_cancelled_on->format('Y-m-d H:i:s'),
'booking_cancelled_reason' => $this->booking_cancelled_reason,
'booking_status' => $this->booking_status,
'refund_amount' => $this->refund_amount,
'without_discount_sub_total_price' => $this->orders_pricing->getWithoutDiscountSubTotalPrice(),
'without_discount_tax_price' => $this->orders_pricing->getWithoutDiscountTaxPrice(),
'without_discount_service_fee_price' => $this->orders_pricing->getWithoutDiscountServiceFeePrice(),
'without_discount_total_price' => $this->orders_pricing->getWithoutDiscountTotalPrice(),
'discount_total' => $this->orders_pricing->getDiscountTotal(),
'promo_code' => $this->getOrdersPricing()->getPromoCode() != NULL ? $this->getOrdersPricing()->getPromoCode()->jsonSerialize() : NULL,
'is_discount_applicable' => $this->orders_pricing->getIsDiscountApplicable(),
);
}
/**
* @var string $created
*
* @ORM\Column(name="created_at", type="string", nullable=false)
*/
protected $createdAt;
/**
* @var string $updated
*
* @ORM\Column(name="updated_at", type="string", nullable=false)
*/
protected $updatedAt;
public function getCreatedAt()
{
return $this->createdAt;
}
public function setCreatedAt($createdAt)
{
$this->createdAt = $createdAt;
return $this;
}
public function getUpdatedAt()
{
return $this->updatedAt;
}
public function setUpdatedAt($updatedAt)
{
$this->updatedAt = $updatedAt;
return $this;
}
/**
* @ORM\PrePersist
* @ORM\PreUpdate
*/
public function updatedTimestamps()
{
$this->setUpdatedAt(round(microtime(true) * 1000));
if ($this->getCreatedAt() === null) {
$this->setCreatedAt(round(microtime(true) * 1000));
}
}
public function __construct() {
$this->setCreatedAt(round(microtime(true) * 1000));
}
}