start_datetime; } /** * @param int $amount */ public function refund(int $amount){ $this->status = self::RefundedStatus; $this->refunded_amount = $amount; Event::dispatch(new BookableRoomReservationRefundAccepted($this->getId())); } /** * @return \DateTime */ public function getLocalStartDatetime(): \DateTime { return $this->room->getSummit()->convertDateFromUTC2TimeZone($this->start_datetime); } /** * @param \DateTime $start_datetime */ public function setStartDatetime(\DateTime $start_datetime): void { $this->start_datetime = $start_datetime; } /** * @return \DateTime */ public function getEndDatetime(): \DateTime { return $this->end_datetime; } /** * @return \DateTime */ public function getLocalEndDatetime(): \DateTime { return $this->room->getSummit()->convertDateFromUTC2TimeZone($this->end_datetime); } /** * @param \DateTime $end_datetime */ public function setEndDatetime(\DateTime $end_datetime): void { $this->end_datetime = $end_datetime; } /** * @return string */ public function getStatus(): string { return $this->status; } /** * @param string $status */ public function setStatus(string $status): void { $this->status = $status; } /** * @return Member */ public function getOwner(): Member { return $this->owner; } /** * @param Member $owner */ public function setOwner(Member $owner): void { $this->owner = $owner; } /** * @return SummitBookableVenueRoom */ public function getRoom(): SummitBookableVenueRoom { return $this->room; } /** * @param SummitBookableVenueRoom $room */ public function setRoom(SummitBookableVenueRoom $room): void { $this->room = $room; } /** * @return string */ public function getPaymentGatewayCartId(): string { return $this->payment_gateway_cart_id; } /** * @param string $payment_gateway_cart_id */ public function setPaymentGatewayCartId(string $payment_gateway_cart_id): void { $this->payment_gateway_cart_id = $payment_gateway_cart_id; } /** * @return \DateTime|null */ public function getApprovedPaymentDate(): ?\DateTime { return $this->approved_payment_date; } /** * @param \DateTime $approved_payment_date */ public function setApprovedPaymentDate(\DateTime $approved_payment_date): void { $this->approved_payment_date = $approved_payment_date; } /** * @return string */ public function getCurrency(): string { return $this->currency; } /** * @param string $currency */ public function setCurrency(string $currency): void { $this->currency = $currency; } /** * @return int */ public function getAmount(): int { return $this->amount; } /** * @param int $amount */ public function setAmount(int $amount): void { $this->amount = $amount; } public function __construct() { parent::__construct(); $this->amount = 0; $this->refunded_amount = 0; $this->status = self::ReservedStatus; } /** * @return string|null */ public function getPaymentGatewayClientToken(): ?string { return $this->payment_gateway_client_token; } /** * @param string $payment_gateway_client_token */ public function setPaymentGatewayClientToken(string $payment_gateway_client_token): void { $this->payment_gateway_client_token = $payment_gateway_client_token; } /** * @return bool */ public function isPaid():bool { return $this->status == self::PaidStatus; } public function setPaid():void{ if($this->isPaid()){ Log::warning(sprintf("SummitRoomReservation %s is already Paid", $this->getId())); return; } if($this->status != self::ReservedStatus){ Log::warning(sprintf("setting payed status to SummitRoomReservation %s with status %s", $this->getId(), $this->status)); } $this->status = self::PaidStatus; $now = new \DateTime('now', new \DateTimeZone('UTC')); $this->approved_payment_date = $now; Event::dispatch(new PaymentBookableRoomReservationConfirmed($this->getId())); } public function cancel():void{ $this->status = self::Canceled; Event::dispatch(new BookableRoomReservationCanceled($this->id)); } public function requestRefund():void{ $this->status = self::RequestedRefundStatus; Event::dispatch(new RequestedBookableRoomReservationRefund($this->getId())); } /** * @param null|string $error */ public function setPaymentError(?string $error):void{ if(empty($error)) return; $this->status = self::ErrorStatus; $this->last_error = $error; } /** * @return null|string */ public function getLastError():?string{ return $this->last_error; } /** * @return int */ public function getOwnerId(){ try { return is_null($this->owner) ? 0 : $this->owner->getId(); } catch(\Exception $ex){ return 0; } } /** * @return int */ public function getRoomId(){ try { return is_null($this->room) ? 0 : $this->room->getId(); } catch(\Exception $ex){ return 0; } } /** * @return int */ public function getRefundedAmount(): int { return $this->refunded_amount; } }