<?php
namespace App\AppBundle\MainBundle\Entity;
use DateTime;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
use JsonSerializable;
use PetstoreIO\Order;
use Symfony\Component\Validator\Constraints as Assert;
/**
* AddOns
*
* @ORM\Entity(repositoryClass="App\AppBundle\MainBundle\Repository\Orders_Suppliers_Transfers_PayoutRepository")
* @ORM\Table(name="orders_suppliers_transfers_payout")
* @ORM\HasLifecycleCallbacks()
*/
class Orders_Suppliers_Transfers_Payout implements JsonSerializable
{
/**
* @ORM\Column(type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @ORM\Column(type="string", nullable=true)
*/
private $reference_id;
/**
* @var ArrayCollection
* @ORM\OneToMany(targetEntity="Orders_Suppliers_Transfer", mappedBy="orders_suppliers_transfers_payout")
*/
private $order_supplier_transfers;
/**
* @var ArrayCollection
* @ORM\OneToMany(targetEntity="Orders_Suppliers_Transfer_Charge", mappedBy="orders_suppliers_transfers_payout")
*/
private $order_supplier_transfers_charges;
/**
* @var ArrayCollection
* @ORM\OneToMany(targetEntity="Orders_Suppliers_Transfers_Payout_Status", mappedBy="order_supplier_transfer_payout")
*/
private $order_supplier_transfers_payout_status;
/**
* @var User
* @ORM\ManyToOne(targetEntity="User")
* @ORM\JoinColumn(name="supplier_id", referencedColumnName="id")
*/
private $supplier;
/**
* @var ArrayCollection
* @ORM\ManyToMany(targetEntity="PS_Add_Spot")
* @ORM\JoinTable(name="orders_suppliers_transfers_payout_spots",
* joinColumns={@ORM\JoinColumn(name="orders_suppliers_transfers_payout_id", referencedColumnName="id")},
* inverseJoinColumns={@ORM\JoinColumn(name="add_spot_id", referencedColumnName="id")}
* )
*/
private $add_spots;
/**
* @ORM\Column(type="decimal", precision=10, scale=2)
*/
private $amount;//This is net earnings
/**
* @ORM\Column(type="decimal", precision=10, scale=2, nullable=true)
*/
private $total_amount = 0;
/**
* @ORM\Column(type="decimal", precision=10, scale=2, nullable=true)
*/
private $commission_fees = 0;
/**
* @ORM\Column(type="decimal", precision=10, scale=2, nullable=true)
*/
private $vat = 0;
/**
* @ORM\Column(type="decimal", precision=10, scale=2, nullable=true)
*/
private $charges_amount = 0;
/**
* @ORM\Column(type="decimal", precision=10, scale=2, nullable=true)
*/
private $service_fee = 0;
/**
* @ORM\Column(type="string", nullable=false)
*/
private $currency_symbol;
/**
* @ORM\Column(type="string", nullable=false)
*/
private $currency_code;
/**
* @ORM\Column(type="string", nullable=true)
*/
private $comment;
/**
* @ORM\Column(type="string", nullable=true)
* @Assert\NotBlank()
*/
private $status;//BookingStatus Constants for Refund Status
/**
* @ORM\Column(type="string", nullable=true)
* @Assert\NotBlank()
*/
private $stripe_id;
/**
* @var DateTime
* @ORM\Column(type="datetime", nullable=true)
* @Assert\NotBlank()
*/
private $processed_date;
/**
* @var DateTime
* @ORM\Column(type="datetime", nullable=true)
* @Assert\NotBlank()
*/
private $start_date;
/**
* @ORM\Column(type="boolean", nullable=false, options={"default" : 0})
* @Assert\NotBlank()
*/
private $hold_transfer = false;
/**
* @var DateTime
* @ORM\Column(type="datetime", nullable=true)
*/
private $arrival_date;
/**
* @ORM\Column(type="string", nullable=false)
*/
private $stripe_currency = 'chf';
/**
* @ORM\Column(type="string", length = 1000, nullable=true)
*/
private $invoice;
/**
* @ORM\Column(type="boolean", nullable=false, options={"default" : 0})
*/
private $is_auto_payout = false;
/**
* @return mixed
*/
public function getId()
{
return $this->id;
}
/**
* @return ArrayCollection
*/
public function getOrderSupplierTransfers()
{
return $this->order_supplier_transfers;
}
/**
* @param ArrayCollection $order_supplier_transfers
*/
public function setOrderSupplierTransfers($order_supplier_transfers)
{
$this->order_supplier_transfers = $order_supplier_transfers;
}
/**
* @return ArrayCollection
*/
public function getOrderSupplierTransfersPayoutStatus()
{
return $this->order_supplier_transfers_payout_status;
}
/**
* @param ArrayCollection $order_supplier_transfers_payout_status
*/
public function setOrderSupplierTransfersPayoutStatus($order_supplier_transfers_payout_status)
{
$this->order_supplier_transfers_payout_status = $order_supplier_transfers_payout_status;
}
/**
* @return mixed
*/
public function getAmount()
{
return $this->amount;
}
/**
* @param mixed $amount
*/
public function setAmount($amount)
{
$this->amount = $amount;
}
/**
* @return mixed
*/
public function getComment()
{
return $this->comment;
}
/**
* @param mixed $comment
*/
public function setComment($comment)
{
$this->comment = $comment;
}
/**
* @return mixed
*/
public function getStatus()
{
return $this->status;
}
/**
* @param mixed $status
*/
public function setStatus($status)
{
$this->status = $status;
}
/**
* @return mixed
*/
public function getStripeId()
{
return $this->stripe_id;
}
/**
* @param mixed $stripe_id
*/
public function setStripeId($stripe_id)
{
$this->stripe_id = $stripe_id;
}
/**
* @return DateTime
*/
public function getProcessedDate()
{
return $this->processed_date;
}
/**
* @param DateTime $processed_date
*/
public function setProcessedDate(DateTime $processed_date)
{
$this->processed_date = $processed_date;
}
/**
* @return DateTime
*/
public function getStartDate()
{
return $this->start_date;
}
/**
* @param DateTime $start_date
*/
public function setStartDate(DateTime $start_date)
{
$this->start_date = $start_date;
}
/**
* @return mixed
*/
public function getHoldTransfer()
{
return $this->hold_transfer;
}
/**
* @param mixed $hold_transfer
*/
public function setHoldTransfer($hold_transfer)
{
$this->hold_transfer = $hold_transfer;
}
/**
* @return mixed
*/
public function getCurrencySymbol()
{
return $this->currency_symbol;
}
/**
* @param mixed $currency_symbol
*/
public function setCurrencySymbol($currency_symbol)
{
$this->currency_symbol = $currency_symbol;
}
/**
* @return mixed
*/
public function getCurrencyCode()
{
return $this->currency_code;
}
/**
* @param mixed $currency_code
*/
public function setCurrencyCode($currency_code)
{
$this->currency_code = $currency_code;
}
/**
* @return DateTime
*/
public function getArrivalDate()
{
return $this->arrival_date;
}
/**
* @param DateTime $arrival_date
*/
public function setArrivalDate(DateTime $arrival_date)
{
$this->arrival_date = $arrival_date;
}
/**
* @return User
*/
public function getSupplier()
{
return $this->supplier;
}
/**
* @param User $supplier
*/
public function setSupplier(User $supplier)
{
$this->supplier = $supplier;
}
/**
* @return ArrayCollection
*/
public function getAddSpots()
{
return $this->add_spots;
}
/**
* @param mixed $add_spots
*/
public function setAddSpots($add_spots)
{
$this->add_spots = $add_spots;
}
/**
* @param PS_Add_Spot $add_Spot
*
* @return Orders_Suppliers_Transfers_Payout
*/
public function addSpot(PS_Add_Spot $add_Spot)
{
if (!$this->add_spots->contains($add_Spot)) {
$this->add_spots->add($add_Spot);
}
return $this;
}
/**
* @param PS_Add_Spot $add_Spot
*/
public function removeAddSpot(PS_Add_Spot $add_Spot)
{
$this->add_spots->removeElement($add_Spot);
}
/**
* @return mixed
*/
public function getReferenceId()
{
return $this->reference_id;
}
/**
* @param mixed $reference_id
*/
public function setReferenceId($reference_id)
{
$this->reference_id = $reference_id;
}
/**
* @return ArrayCollection
*/
public function getOrderSupplierTransfersCharges()
{
return $this->order_supplier_transfers_charges;
}
/**
* @param ArrayCollection $order_supplier_transfers_charges
*/
public function setOrderSupplierTransfersCharges($order_supplier_transfers_charges)
{
$this->order_supplier_transfers_charges = $order_supplier_transfers_charges;
}
/**
* @return mixed
*/
public function getStripeCurrency()
{
return $this->stripe_currency;
}
/**
* @param mixed $stripe_currency
*/
public function setStripeCurrency($stripe_currency)
{
$this->stripe_currency = $stripe_currency;
}
/**
* @return mixed
*/
public function getInvoice()
{
return $this->invoice;
}
/**
* @param mixed $invoice
*/
public function setInvoice($invoice)
{
$this->invoice = $invoice;
}
/**
* @return mixed
*/
public function getIsAutoPayout()
{
return $this->is_auto_payout;
}
/**
* @param mixed $is_auto_payout
*/
public function setIsAutoPayout($is_auto_payout)
{
$this->is_auto_payout = $is_auto_payout;
}
/**
* @return mixed
*/
public function getTotalAmount()
{
return $this->total_amount;
}
/**
* @param mixed $total_amount
*/
public function setTotalAmount($total_amount)
{
$this->total_amount = $total_amount;
}
/**
* @return mixed
*/
public function getCommissionFees()
{
return $this->commission_fees;
}
/**
* @param mixed $commission_fees
*/
public function setCommissionFees($commission_fees)
{
$this->commission_fees = $commission_fees;
}
/**
* @return mixed
*/
public function getChargesAmount()
{
return $this->charges_amount;
}
/**
* @param mixed $charges_amount
*/
public function setChargesAmount($charges_amount)
{
$this->charges_amount = $charges_amount;
}
/**
* @return mixed
*/
public function getVat()
{
return $this->vat;
}
/**
* @param mixed $vat
*/
public function setVat($vat)
{
$this->vat = $vat;
}
/**
* @return mixed
*/
public function getServiceFee()
{
return $this->service_fee;
}
/**
* @param mixed $service_fee
*/
public function setServiceFee($service_fee)
{
$this->service_fee = $service_fee;
}
public function jsonSerialize()
{
return array(
'id' => $this->id,
'reference_id' => $this->reference_id,
'supplier_id' => $this->getSupplier()->getId(),
'order_supplier_transfers' => $this->getOrderSupplierTransfers(),
'order_supplier_transfers_charges' => $this->getOrderSupplierTransfersCharges(),
'total_bookings' => count($this->getOrderSupplierTransfers()),
'amount' => $this->amount,
'total_amount' => $this->total_amount,
'commission_fees' => $this->commission_fees,
'charges_amount' => $this->charges_amount,
'service_fee' => $this->service_fee,
'vat' => $this->vat,
'currency_symbol' => $this->currency_symbol,
'currency_code' => $this->currency_code,
'comment' => $this->comment,
'status' => $this->status,
'is_auto_payout' => $this->is_auto_payout,
'stripe_id' => $this->stripe_id,
'hold_transfer' => $this->hold_transfer,
'processed_date' => $this->processed_date != NULL ? $this->processed_date->format('Y-m-d H:i:s') : NULL,
'start_date' => $this->start_date != NULL ? $this->start_date->format('Y-m-d H:i:s') : NULL,
'arrival_date' => $this->arrival_date != NULL ? $this->arrival_date->format('Y-m-d H:i:s') : NULL,
'created' => $this->createdAt->format('Y-m-d H:i:s'),
'updated' => $this->updatedAt->format('Y-m-d H:i:s'),
'order_supplier_transfers_payout_status' => $this->getOrderSupplierTransfersPayoutStatus(),
'stripe_currency' => $this->stripe_currency,
'invoice' => $this->invoice,
);
}
/**
* @var DateTime $created
*
* @ORM\Column(type="datetime", nullable=false)
*/
protected $createdAt;
/**
* @var DateTime $updated
*
* @ORM\Column(type="datetime", nullable=false)
*/
protected $updatedAt;
/**
* @return DateTime
*/
public function getCreatedAt()
{
return $this->createdAt;
}
/**
* @return DateTime
*/
public function getUpdatedAt()
{
return $this->updatedAt;
}
public function setUpdatedAt($updatedAt)
{
$this->updatedAt = $updatedAt;
return $this;
}
/**
* @ORM\PrePersist
*/
public function setCreatedAt()
{
$this->createdAt = new DateTime();
$this->updatedAt = new DateTime();
return $this;
}
/**
* @ORM\PreUpdate
*/
public function setUpdatedAtValue()
{
$this->updatedAt = new DateTime();
}
public function __construct()
{
$this->add_spots = new ArrayCollection();
$this->order_supplier_transfers = new ArrayCollection();
$this->order_supplier_transfers_charges = new ArrayCollection();
}
}