large commit

This commit is contained in:
omair saleh
2021-03-11 13:06:02 +08:00
parent 13ddf458db
commit 05401f6bbc
729 changed files with 23312 additions and 7218 deletions
@@ -2,149 +2,231 @@
namespace App\Classes\Modules\Transactions\DataTransferObjects;
use App\Classes\Interfaces\DataTransferObject;
use App\Classes\General\Interfaces\DataTransferObject;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
use Carbon\Carbon;
class TransactionObject implements DataTransferObject
{
/*
*
* return [
'id' => $this->id,
'trans_type1' => $this->trans_type1,
'trans_type2' => $this->trans_type2,
'bill_no' => (int) $this->bill_no,
'amount' => (double) $this->amount,
'currency_id' => (int) $this->currency_id,
'original_amount' => (double) $this->original_amount,
'original_currency_id' => (int) $this->original_currency_id,
'currency_rate' => (double) $this->currency_rate,
'dt_transaction' => $this->dt_transaction,
'status' => (int) $this->status,
'booking_id' => (int) $this->booking_id,
'company_id' => (int) $this->company_id
];
*/
private $trans_type1;
private $trans_type2;
private $bill_no;
private $amount;
private $currency_id;
private $original_amount;
private $original_currency_id;
/** @var string */
private $billNo;
private $currency_rate;
private $dt_transaction;
/** @var string */
private $transactionType;
/** @var int */
private $issuer;
/** @var int */
private $receiver;
/** @var int */
private $recipientBankAccountId;
/** @var int */
private $paymentMethod;
/** @var float */
private $amount;
/** @var float */
private $originalAmount;
/** @var int */
private $currencyId;
/** @var int */
private $originalCurrencyId;
/** @var float */
private $currencyRate;
/** @var float */
private $tax;
/** @var float */
private $serviceCharge;
/** @var Carbon|null */
private $expiresOn;
/** @var int|null */
private $status;
private $booking_id;
private $company_id;
public function __construct(
int $bill_no,string $trans_type1,string $trans_type2,
float $amount, int $currency_id, int $original_amount,
int $original_currency_id, float $currency_rate,
string $dt_transaction,int $status,int $booking_id,
int $company_id
){
$this->bill_no = $bill_no;
$this->trans_type1= $trans_type1;
$this->trans_type2 = $trans_type2;
$this->amount= $amount;
$this->currency_id = $currency_id;
$this->original_amount = $original_amount;
$this->original_currency_id = $original_currency_id;
$this->currency_rate = $currency_rate;
$this->dt_transaction = $dt_transaction;
/** @var array|null */
private $details;
/**
* TransactionObject constructor.
* @param string $billNo
* @param string $transactionType
* @param int $issuer
* @param int $receiver
* @param int $recipientBankAccountId
* @param int $paymentMethod
* @param float $amount
* @param float $originalAmount
* @param int $currencyId
* @param int $originalCurrencyId
* @param float $currencyRate
* @param float $tax
* @param float $serviceCharge
* @param Carbon|null $expiresOn
* @param int|null $status
* @param array|null $details
*/
public function __construct(string $billNo, string $transactionType, int $issuer, int $receiver, int $recipientBankAccountId, int $paymentMethod, float $amount, float $originalAmount, int $currencyId, int $originalCurrencyId, float $currencyRate, float $tax, float $serviceCharge, ?Carbon $expiresOn, ?int $status = ApprovalStatus::PENDING_SUBMISSION, ?array $details = [])
{
$this->billNo = $billNo;
$this->transactionType = $transactionType;
$this->issuer = $issuer;
$this->receiver = $receiver;
$this->recipientBankAccountId = $recipientBankAccountId;
$this->paymentMethod = $paymentMethod;
$this->amount = $amount;
$this->originalAmount = $originalAmount;
$this->currencyId = $currencyId;
$this->originalCurrencyId = $originalCurrencyId;
$this->currencyRate = $currencyRate;
$this->tax = $tax;
$this->serviceCharge = $serviceCharge;
$this->expiresOn = $expiresOn;
$this->status = $status;
$this->booking_id = $booking_id;
$this->company_id = $company_id;
$this->details = $details;
}
/**
* @return string
*/
public function getBillNo(): string
{
return $this->billNo;
}
/**
* @return string
*/
public function getTransactionType(): string
{
return $this->transactionType;
}
/**
* @return int
*/
public function getBillNo(): int
public function getIssuer(): int
{
return $this->bill_no;
return $this->issuer;
}
/**
* @return string
* @return int
*/
public function getTransType1(): string
public function getReceiver(): int
{
return $this->trans_type1;
return $this->receiver;
}
/**
* @return string
* @return int
*/
public function getTransType2(): string
public function getRecipientBankAccountId(): int
{
return $this->trans_type2;
return $this->recipientBankAccountId;
}
/**
* @return int
*/
public function getPaymentMethod(): int
{
return $this->paymentMethod;
}
/**
* @return float
*/
public function getAmount(): float
{
return $this->amount;
}
/**
* @return int
* @return float
*/
public function getCurrency(): int
{
return $this->currency_id;
}
public function getOriginalAmount(): float
{
return $this->original_amount;
return $this->originalAmount;
}
public function getOriginalCurrency(): int
/**
* @return int
*/
public function getCurrencyId(): int
{
return $this->original_currency_id;
return $this->currencyId;
}
/**
* @return int
*/
public function getOriginalCurrencyId(): int
{
return $this->originalCurrencyId;
}
/**
* @return float
*/
public function getCurrencyRate(): float
{
return $this->currency_rate;
return $this->currencyRate;
}
/**
* @return string
* @return float
*/
public function getDtTransaction(): string
public function getTax(): float
{
return $this->dt_transaction;
return $this->tax;
}
/**
* @return float
*/
public function getServiceCharge(): float
{
return $this->serviceCharge;
}
/**
* @return Carbon|null
*/
public function getExpiresOn(): ?Carbon
{
return $this->expiresOn;
}
/**
* @return int
*/
public function getStatus(): int
{
return $this->original_currency_id;
return $this->status;
}
public function getBookingId(): int
/**
* @return array
*/
public function getDetails(): array
{
return $this->booking_id;
}
public function getCompanyId(): int
{
return $this->company_id;
return array_map(function($product){
return new TransactionDetailObject($product['stockCode'], $product['description'], $product['quantity'], floatval(str_replace(',', '', $product['unit_price'])));
}, $this->details);
}
}