<?php
/**
* This class handles all payment transaction resulting from Payment system (Axepta).
*/
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
/**
* @ORM\Entity(repositoryClass="App\Repository\TransactionRepository")
*
* @ORM\Table(name="payment_transaction")
*/
class Transaction
{
/**
* @Gedmo\Timestampable(on="create")
*
* @ORM\Column(type="datetime", name="created_at", nullable=true)
*/
protected $createdAt;
/**
* @var int
*
* @ORM\Id
*
* @ORM\Column(type="integer")
*
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var bool
*
* @ORM\Column(type="boolean", nullable=true)
*/
private $isValid;
/**
* @var string
*
* @ORM\Column(type="string", nullable=true)
*/
private $responseCode;
/**
* @var string
*
* @ORM\Column(type="text", nullable=true)
*/
private $message;
/**
* @var string
*
* @ORM\Column(type="string", nullable=true)
*/
private $merchant_id;
/**
* @var string
*
* @ORM\Column(type="string", nullable=true)
*/
private $amount;
/**
* @var string
*
* @ORM\Column(type="string", nullable=true)
*/
private $transaction_id;
/**
* @var User
*
* @ORM\ManyToOne(targetEntity="App\Entity\User", inversedBy="transactions", cascade={"persist"})
*
* @ORM\JoinColumn(nullable=false)
*/
private $user;
/**
* @var Sale
*
* @ORM\ManyToOne(targetEntity="App\Entity\Sale", inversedBy="transactions", cascade={"persist"})
*
* @ORM\JoinColumn(name="sale_saleid", referencedColumnName="id", nullable=false)
*/
private $sale;
/**
* @var string
*
* @ORM\Column(type="string", nullable=true)
*/
private $customer_email;
/**
* @var string|null
*
* @ORM\Column(type="string", nullable=true)
*/
private $country;
public function getId(): int
{
return $this->id;
}
public function setResponseCode(?string $responseCode): void
{
$this->responseCode = $responseCode;
}
public function getResponseCode(): ?string
{
return $this->responseCode;
}
public function setMessage(?string $message): void
{
$this->message = $message;
}
public function getMessage(): ?string
{
return $this->message;
}
public function setMerchantId(?string $merchantId): void
{
$this->merchant_id = $merchantId;
}
public function getMerchantId(): ?string
{
return $this->merchant_id;
}
public function setAmount(?string $amount): void
{
$this->amount = $amount;
}
public function getAmount(): ?string
{
return $this->amount;
}
public function setUser(User $user): void
{
$this->user = $user;
$this->customer_email = $user->getEmail();
}
public function getUser(): User
{
return $this->user;
}
public function setSale(Sale $sale): void
{
$this->sale = $sale;
}
public function getSale(): Sale
{
return $this->sale;
}
/**
* Get transaction successfulness.
*/
public function isValid(): bool
{
return (bool) $this->isValid;
}
public function setIsValid(bool $isValid): void
{
$this->isValid = $isValid;
}
public function getTransactionId(): ?string
{
return $this->transaction_id;
}
public function setTransactionId(string $transaction_id): void
{
$this->transaction_id = $transaction_id;
}
public function setCreatedAt($createdAt): void
{
$this->createdAt = $createdAt;
}
public function getCreatedAt()
{
return $this->createdAt;
}
public function setCountry(?string $country): void
{
$this->country = $country;
}
public function getCountry(): ?string
{
return $this->country;
}
}