diff --git a/app/Classes/Modules/Accounts/ControllersLogic/AuthenticateUserLogic.php b/app/Classes/Modules/Accounts/ControllersLogic/AuthenticateUserLogic.php
index 432a9eeb..62114ed7 100644
--- a/app/Classes/Modules/Accounts/ControllersLogic/AuthenticateUserLogic.php
+++ b/app/Classes/Modules/Accounts/ControllersLogic/AuthenticateUserLogic.php
@@ -63,6 +63,7 @@ class AuthenticateUserLogic extends AbstractControllerLogic
return $this->response(['access_token' => $token, 'redirect_url' => $this->authenticationRedirect->url()]);
} catch (\Exception $exception){
+ dd($exception);
throw new ErrorException($exception->getMessage(), $exception->getCode());
}
diff --git a/app/Classes/Modules/Accounts/ControllersLogic/CheckEmailLogic.php b/app/Classes/Modules/Accounts/ControllersLogic/CheckEmailLogic.php
new file mode 100644
index 00000000..6c0a7444
--- /dev/null
+++ b/app/Classes/Modules/Accounts/ControllersLogic/CheckEmailLogic.php
@@ -0,0 +1,59 @@
+ 'User found',
+ 'message' => 'Account Already Exists'
+ ];
+ }
+
+ /** @var FetchesUser */
+ private $fetchesUser;
+
+
+ /**
+ * CheckEmailLogic constructor.
+ * @param FetchesUser $fetchesUser
+ */
+ public function __construct(FetchesUser $fetchesUser)
+ {
+ $this->fetchesUser = $fetchesUser;
+ }
+
+
+ /**
+ * @param Request $request
+ * @return JsonResponse
+ * @throws ErrorException
+ */
+ protected function logic(Request $request): JsonResponse {
+
+ try {
+
+ $this->fetchesUser->execute(['email' => $request->input('email')]);
+
+ return $this->response();
+
+ } catch (\Exception $exception){
+ throw new ErrorException($exception->getMessage(), $exception->getCode());
+ }
+
+ }
+
+}
\ No newline at end of file
diff --git a/app/Classes/Modules/Accounts/ControllersLogic/ListUsersLogic.php b/app/Classes/Modules/Accounts/ControllersLogic/ListUsersLogic.php
new file mode 100644
index 00000000..2899073d
--- /dev/null
+++ b/app/Classes/Modules/Accounts/ControllersLogic/ListUsersLogic.php
@@ -0,0 +1,65 @@
+ 'List Users',
+ 'message' => 'You have successfully retrieved a list of users'
+ ];
+ }
+
+ /** @var CanListUsers */
+ private $canListUser;
+
+ /** @var ListsUsers */
+ private $listsUsers;
+
+ /**
+ * ListUsersControllerLogic constructor.
+ * @param CanListUsers $canListUser
+ * @param ListsUsers $listsUsers
+ */
+ public function __construct(CanListUsers $canListUser, ListsUsers $listsUsers)
+ {
+ $this->canListUser = $canListUser;
+ $this->listsUsers = $listsUsers;
+ }
+
+
+ /**
+ * @param Request $request
+ * @return JsonResponse
+ * @throws ErrorException
+ */
+ public function logic(Request $request) : JsonResponse
+ {
+ try {
+
+ $this->canListUser->passes();
+
+ $query = $this->listsUsers->execute($this->listsUsers->deserializeFilters($request->input('filters')));
+
+ return $this->collectionResponse(UserResource::collection($query));
+
+
+ } catch (\Exception $exception){
+ throw new ErrorException($exception->getMessage(), $exception->getCode());
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/app/Classes/Modules/Accounts/Services/AuthenticationRedirect.php b/app/Classes/Modules/Accounts/Services/AuthenticationRedirect.php
index 397a31d9..5b7e964f 100644
--- a/app/Classes/Modules/Accounts/Services/AuthenticationRedirect.php
+++ b/app/Classes/Modules/Accounts/Services/AuthenticationRedirect.php
@@ -2,11 +2,18 @@
namespace App\Classes\Modules\Accounts\Services;
+use App\Classes\ValueObjects\Constants\Roles;
+
class AuthenticationRedirect
{
public function url(){
- return route('dashboard');
+
+ if(\Auth::user()->hasRole('Shadow Admin') || \Auth::user()->hasRole('Ultimate Admin')){
+ return route('dashboard.forwarder');
+ }
+
+ // return route('dashboard.importer', ['id' => Auth()->user()->employers->first()->company->id]);
}
}
\ No newline at end of file
diff --git a/app/Classes/Modules/Accounts/Services/ListsUsers.php b/app/Classes/Modules/Accounts/Services/ListsUsers.php
new file mode 100644
index 00000000..95d4bfbf
--- /dev/null
+++ b/app/Classes/Modules/Accounts/Services/ListsUsers.php
@@ -0,0 +1,33 @@
+repository = $repository;
+ }
+
+
+ /**
+ * @return Builder
+ */
+ function getRepository(): Builder
+ {
+ return $this->repository->newQuery();
+ }
+}
\ No newline at end of file
diff --git a/app/Classes/Modules/Accounts/Standards/Rules/CanListUsers.php b/app/Classes/Modules/Accounts/Standards/Rules/CanListUsers.php
new file mode 100644
index 00000000..0039de25
--- /dev/null
+++ b/app/Classes/Modules/Accounts/Standards/Rules/CanListUsers.php
@@ -0,0 +1,46 @@
+ 'Created Company',
+ 'message' => 'You have successfully created a new Company'
+ ];
+ }
+
+ /** @var CreateCompanyProcessor */
+ private $createCompanyProcessor;
+
+ /**
+ * CreateCompanyLogic constructor.
+ * @param CreateCompanyProcessor $createCompanyProcessor
+ */
+ public function __construct(CreateCompanyProcessor $createCompanyProcessor)
+ {
+ $this->createCompanyProcessor = $createCompanyProcessor;
+ }
+
+ /**
+ * @param Request $request
+ * @return JsonResponse
+ * @throws ErrorException
+ */
+ public function logic(Request $request) : JsonResponse
+ {
+ try {
+
+ return $this->resourceResponse(new CompanyResource($this->createCompanyProcessor->execute($request)));
+
+ } catch (\Exception $exception){
+ throw new ErrorException($exception->getMessage(), $exception->getCode());
+ }
+
+ }
+
+}
\ No newline at end of file
diff --git a/app/Classes/Modules/Companies/ControllerLogic/DeleteCompanyLogic.php b/app/Classes/Modules/Companies/ControllerLogic/DeleteCompanyLogic.php
new file mode 100644
index 00000000..83d3548b
--- /dev/null
+++ b/app/Classes/Modules/Companies/ControllerLogic/DeleteCompanyLogic.php
@@ -0,0 +1,73 @@
+ 'Deleted Company',
+ 'message' => 'You have successfully deleted a Company'
+ ];
+ }
+
+
+ /** @var CanDeleteCompany */
+ private $canDeleteCompany;
+
+ /** @var DeletesCompany */
+ private $deletesCompany;
+
+ /** @var FetchesCompany */
+ private $fetchesCompany;
+
+ /**
+ * DeleteCompanyLogic constructor.
+ * @param CanDeleteCompany $canDeleteCompany
+ * @param DeletesCompany $deletesCompany
+ * @param FetchesCompany $fetchesCompany
+ */
+ public function __construct(CanDeleteCompany $canDeleteCompany, DeletesCompany $deletesCompany, FetchesCompany $fetchesCompany)
+ {
+ $this->canDeleteCompany = $canDeleteCompany;
+ $this->deletesCompany = $deletesCompany;
+ $this->fetchesCompany = $fetchesCompany;
+ }
+
+
+ /**
+ * @param Request $request
+ * @return JsonResponse
+ * @throws ErrorException
+ */
+ public function logic(Request $request) : JsonResponse
+ {
+ try {
+
+ $this->canDeleteCompany->passes();
+
+ $query = $this->fetchesCompany->execute(['id' => $request->route('id')]);
+
+ $this->deletesCompany->execute($query);
+
+ return $this->response([]);
+
+ } catch (\Exception $exception){
+ throw new ErrorException($exception->getMessage(), $exception->getCode());
+ }
+
+ }
+
+}
\ No newline at end of file
diff --git a/app/Classes/Modules/Companies/ControllerLogic/FetchCompanyLogic.php b/app/Classes/Modules/Companies/ControllerLogic/FetchCompanyLogic.php
new file mode 100644
index 00000000..bf1db91a
--- /dev/null
+++ b/app/Classes/Modules/Companies/ControllerLogic/FetchCompanyLogic.php
@@ -0,0 +1,67 @@
+ 'Retrieved Company',
+ 'message' => 'You have successfully retrieved a Company'
+ ];
+ }
+
+ /** @var CanFetchCompany */
+ private $canFetchCompany;
+
+ /** @var FetchesCompany */
+ private $fetchesCompany;
+
+ /**
+ * FetchCompanyControllerLogic constructor.
+ * @param CanFetchCompany $canFetchCompany
+ * @param FetchesCompany $fetchesCompany
+ */
+ public function __construct(CanFetchCompany $canFetchCompany, FetchesCompany $fetchesCompany)
+ {
+ $this->canFetchCompany = $canFetchCompany;
+ $this->fetchesCompany = $fetchesCompany;
+ }
+
+
+ /**
+ * @param Request $request
+ * @return JsonResponse
+ * @throws ErrorException
+ */
+ public function logic(Request $request) : JsonResponse
+ {
+ try {
+
+ $this->canFetchCompany->passes();
+
+ $query = $this->fetchesCompany->execute(['id' => $request->route('id')]);
+
+ return $this->resourceResponse(new CompanyResource($query));
+
+ } catch (\Exception $exception){
+ throw new ErrorException($exception->getMessage(), $exception->getCode());
+ }
+
+ }
+
+}
\ No newline at end of file
diff --git a/app/Classes/Modules/Companies/ControllerLogic/ListCompaniesLogic.php b/app/Classes/Modules/Companies/ControllerLogic/ListCompaniesLogic.php
new file mode 100644
index 00000000..96c54464
--- /dev/null
+++ b/app/Classes/Modules/Companies/ControllerLogic/ListCompaniesLogic.php
@@ -0,0 +1,64 @@
+ 'Retrieved Companies',
+ 'message' => 'You have successfully retrieved a list of Companies'
+ ];
+ }
+
+ /** @var CanListCompanies */
+ private $canListCompanies;
+
+ /** @var ListsCompanies */
+ private $listsCompanies;
+
+ /**
+ * ListCompaniesControllerLogic constructor.
+ * @param CanListCompanies $canListCompanies
+ * @param ListsCompanies $listsCompanies
+ */
+ public function __construct(CanListCompanies $canListCompanies, ListsCompanies $listsCompanies)
+ {
+ $this->canListCompanies = $canListCompanies;
+ $this->listsCompanies = $listsCompanies;
+ }
+
+
+ /**
+ * @param Request $request
+ * @return JsonResponse
+ * @throws ErrorException
+ */
+ public function logic(Request $request) : JsonResponse
+ {
+ try {
+ $this->canListCompanies->passes();
+
+ $query = $this->listsCompanies->execute($this->listsCompanies->deserializeFilters($request->input('filters')));
+ return $this->collectionResponse(CompanyResource::collection($query));
+
+ } catch (\Exception $exception){
+ throw new ErrorException($exception->getMessage(), $exception->getCode());
+ }
+
+ }
+
+}
\ No newline at end of file
diff --git a/app/Classes/Modules/Companies/ControllerLogic/UpdateCompanyLogic.php b/app/Classes/Modules/Companies/ControllerLogic/UpdateCompanyLogic.php
new file mode 100644
index 00000000..edd078bc
--- /dev/null
+++ b/app/Classes/Modules/Companies/ControllerLogic/UpdateCompanyLogic.php
@@ -0,0 +1,78 @@
+ 'Updated Company',
+ 'message' => 'You have successfully updated the Company'
+ ];
+ }
+
+ /** @var CanUpdateCompany */
+ private $canUpdateCompany;
+
+ /** @var UpdatesCompany */
+ private $updatesCompany;
+
+ /** @var FetchesCompany */
+ private $fetchesCompany;
+
+ /**
+ * UpdateCompanyControllerLogic constructor.
+ * @param CanUpdateCompany $canUpdateCompany
+ * @param UpdatesCompany $updatesCompany
+ * @param FetchesCompany $fetchesCompany
+ */
+ public function __construct(CanUpdateCompany $canUpdateCompany, UpdatesCompany $updatesCompany, FetchesCompany $fetchesCompany)
+ {
+ $this->canUpdateCompany = $canUpdateCompany;
+ $this->updatesCompany = $updatesCompany;
+ $this->fetchesCompany = $fetchesCompany;
+ }
+
+
+ /**
+ * @param Request $request
+ * @return JsonResponse
+ * @throws ErrorException
+ */
+ public function logic(Request $request) : JsonResponse
+ {
+ try {
+
+ $object = new CompanyObject($request->input('reference_no'), $request->input('name'), $request->input('type'));
+
+ $this->canUpdateCompany->passes($object);
+
+ $query = $this->fetchesCompany->execute(['id' => $request->route('id')]);
+
+ $query = $this->updatesCompany->execute($query, $object);
+
+ return $this->resourceResponse(new CompanyResource($query));
+
+
+ } catch (\Exception $exception){
+ throw new ErrorException($exception->getMessage(), $exception->getCode());
+ }
+
+ }
+
+}
\ No newline at end of file
diff --git a/app/Classes/Modules/Companies/DataTransferObjects/ConnectionObject.php b/app/Classes/Modules/Companies/DataTransferObjects/ConnectionObject.php
new file mode 100644
index 00000000..078378b4
--- /dev/null
+++ b/app/Classes/Modules/Companies/DataTransferObjects/ConnectionObject.php
@@ -0,0 +1,45 @@
+inviter = $inviter;
+ $this->invitee = $invitee;
+ }
+
+ /**
+ * @return CompanyModule
+ */
+ public function getInviter(): CompanyModule
+ {
+ return $this->inviter;
+ }
+
+ /**
+ * @return CompanyModule
+ */
+ public function getInvitee(): CompanyModule
+ {
+ return $this->invitee;
+ }
+
+
+}
\ No newline at end of file
diff --git a/app/Classes/Modules/Companies/DataTransferObjects/EmployeeObject.php b/app/Classes/Modules/Companies/DataTransferObjects/EmployeeObject.php
new file mode 100644
index 00000000..816a2de5
--- /dev/null
+++ b/app/Classes/Modules/Companies/DataTransferObjects/EmployeeObject.php
@@ -0,0 +1,58 @@
+companyModule = $companyModule;
+ $this->user = $user;
+ $this->role = $role;
+ }
+
+ /**
+ * @return CompanyModule
+ */
+ public function getCompanyModule(): CompanyModule
+ {
+ return $this->companyModule;
+ }
+
+ /**
+ * @return User
+ */
+ public function getUser(): User
+ {
+ return $this->user;
+ }
+
+ /**
+ * @return int
+ */
+ public function getRole(): int
+ {
+ return $this->role;
+ }
+
+
+}
\ No newline at end of file
diff --git a/app/Classes/Modules/Companies/DataTransferObjects/ModuleObject.php b/app/Classes/Modules/Companies/DataTransferObjects/ModuleObject.php
new file mode 100644
index 00000000..732799a3
--- /dev/null
+++ b/app/Classes/Modules/Companies/DataTransferObjects/ModuleObject.php
@@ -0,0 +1,44 @@
+company = $company;
+ $this->type = $type;
+ }
+
+ /**
+ * @return Company
+ */
+ public function getCompany(): Company
+ {
+ return $this->company;
+ }
+
+ /**
+ * @return int
+ */
+ public function getType(): int
+ {
+ return $this->type;
+ }
+
+}
\ No newline at end of file
diff --git a/app/Classes/Modules/Companies/Services/ListsCompanies.php b/app/Classes/Modules/Companies/Services/ListsCompanies.php
new file mode 100644
index 00000000..179704e7
--- /dev/null
+++ b/app/Classes/Modules/Companies/Services/ListsCompanies.php
@@ -0,0 +1,33 @@
+repository = $repository;
+ }
+
+
+ /**
+ * @return Builder
+ */
+ function getRepository(): Builder
+ {
+ return $this->repository->newQuery();
+ }
+}
\ No newline at end of file
diff --git a/app/Classes/Modules/Companies/Standards/Rules/CanDeleteCompany.php b/app/Classes/Modules/Companies/Standards/Rules/CanDeleteCompany.php
new file mode 100644
index 00000000..b2621b4f
--- /dev/null
+++ b/app/Classes/Modules/Companies/Standards/Rules/CanDeleteCompany.php
@@ -0,0 +1,43 @@
+ 'Created Receipt',
+ 'message' => 'You have successfully created a receipt'
+ ];
+ }
+
+
+ /** @var GeneratesReceiptBillNo */
+ private $generatesReceiptBillNo;
+
+ /** @var CanCreateReceipt */
+ private $canCreateReceipt;
+
+ private $fetchesCurrency;
+
+ private $rateCalculatesCurrency;
+
+ private $fetchesCompany;
+
+ private $createsReceipt;
+
+ private $canCreateReceiptDetail;
+
+ private $createsReceiptDetail;
+
+ private $fetchesTransaction;
+ /**
+ * CreateWalletLogic constructor.
+ * @param CreatesWallet $createsWallet
+ * @param GeneratesWalletCode $generatesWalletCode
+ * @param CanCreateCompanyWallet $canCreateCompanyWallet
+ */
+ public function __construct(
+ GeneratesReceiptBillNo $generatesReceiptBillNo, CanCreateReceipt $canCreateReceipt,
+ FetchesCurrency $fetchesCurrency,RateCalculatesCurrency $rateCalculatesCurrency, FetchesCompany $fetchesCompany,
+ CreatesReceipt $createsReceipt,
+ CanCreateReceiptDetail $canCreateReceiptDetail, CreatesReceiptDetail $createsReceiptDetail,
+ FetchesTransaction $fetchesTransaction
+ ){
+ $this->generatesReceiptBillNo = $generatesReceiptBillNo;
+ $this->canCreateReceipt = $canCreateReceipt;
+ $this->fetchesCurrency = $fetchesCurrency;
+ $this->rateCalculatesCurrency = $rateCalculatesCurrency;
+ $this->fetchesCompany = $fetchesCompany;
+ $this->createsReceipt =$createsReceipt;
+ $this->canCreateReceiptDetail =$canCreateReceiptDetail;
+ $this->createsReceiptDetail = $createsReceiptDetail;
+ $this->fetchesTransaction = $fetchesTransaction;
+ }
+
+ /**
+ * @param Request $request
+ * @return JsonResponse
+ * @throws ErrorException
+ */
+ public function logic(Request $request) : JsonResponse
+ {
+ try {
+
+ DB::beginTransaction();
+ $json_array = json_decode($request->getContent(), true);
+ $company = $this->fetchesCompany->execute(['id' => $json_array['company_id']]);
+
+ $conversion_currency = $this->fetchesCurrency->execute(['id' => $json_array['currency_id']]);
+ $convertable_currency = $this->fetchesCurrency->execute(['id' => 1]);//MYR
+ $convert_amount = $this->rateCalculatesCurrency->execute($conversion_currency, $convertable_currency, $json_array['amount']);
+ $convert_rate = $this->rateCalculatesCurrency->execute_rate($conversion_currency, $convertable_currency);
+
+ $object = new ReceiptObject(
+ $this->generatesReceiptBillNo->execute(),$json_array['trans_type1'],$json_array['trans_type2'],
+ number_format( (float) $convert_amount, 5, '.', ''), 1 , number_format( (float) $json_array['amount'], 5, '.', ''),
+ $json_array['currency_id'],number_format( (float) $convert_rate, 5, '.', ''),
+ $json_array['dt_transaction'],1,$request->route('id'),
+ $company->id
+ );
+
+
+ $this->canCreateReceipt->passes($object);
+
+ $receipt = $this->createsReceipt->execute($object);
+
+ $receipt_array = new ReceiptResource($receipt);
+ $receipt_detail_array = array();
+
+ foreach ($json_array['receipt_detail'] as $key => $value) {
+
+ $transaction_inv = $this->fetchesTransaction->execute(['id' => $value['transaction_id']]);
+
+ $object_detail = new ReceiptDetailObject(
+ $json_array['trans_type1'],$json_array['trans_type2'],
+ $transaction_inv->id,$receipt->id,
+ number_format( (float) $convert_amount, 5, '.', ''), number_format( (float) $json_array['amount'], 5, '.', '')
+ );
+ $this->canCreateReceiptDetail->passes($object_detail);
+ $transaction_detail = $this->createsReceiptDetail->execute($object_detail);
+ //array_push($stack, "apple", "raspberry");
+ $receipt_detail_resource= new ReceiptDetailResource($transaction_detail);
+ $receipt_detail_array[]= $receipt_detail_resource->toArray($request);
+
+ }
+
+ //$transaction_array['transaction_detail']= $transaction_detail_array;
+ //print_r($transaction_detail_array);
+ //dd($transaction_detail_array);
+ DB::commit();
+
+ return $this->resourceResponse($receipt_array);
+ //return $this->resourceResponse($json_array);
+
+ } catch (\Exception $exception) {
+ throw new ErrorException($exception->getMessage(), $exception->getCode());
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/app/Classes/Modules/Receipts/DataTransferObjects/ReceiptDetailObject.php b/app/Classes/Modules/Receipts/DataTransferObjects/ReceiptDetailObject.php
new file mode 100644
index 00000000..6cf2b16e
--- /dev/null
+++ b/app/Classes/Modules/Receipts/DataTransferObjects/ReceiptDetailObject.php
@@ -0,0 +1,81 @@
+trans_type1= $trans_type1;
+ $this->trans_type2 = $trans_type2;
+ $this->transaction_id = $transaction_id;
+ $this->receipt_id = $receipt_id;
+ $this->price = $price;
+ $this->amount = $amount;
+
+ }
+
+
+ /**
+ * @return string
+ */
+ public function getTransType1(): string
+ {
+ return $this->trans_type1;
+ }
+
+ /**
+ * @return string
+ */
+ public function getTransType2(): string
+ {
+ return $this->trans_type2;
+ }
+
+ /**
+ * @return int
+ */
+ public function getTransactionId(): int
+ {
+ return $this->transaction_id;
+ }
+
+ /**
+ * @return int
+ */
+ public function getReceiptId(): int
+ {
+ return $this->receipt_id;
+ }
+
+ public function getPrice(): float
+ {
+ return $this->price;
+ }
+
+ public function getAmount(): float
+ {
+ return $this->amount;
+ }
+
+}
\ No newline at end of file
diff --git a/app/Classes/Modules/Receipts/DataTransferObjects/ReceiptObject.php b/app/Classes/Modules/Receipts/DataTransferObjects/ReceiptObject.php
new file mode 100644
index 00000000..d8e66907
--- /dev/null
+++ b/app/Classes/Modules/Receipts/DataTransferObjects/ReceiptObject.php
@@ -0,0 +1,150 @@
+ $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;
+
+ private $currency_rate;
+
+ private $dt_transaction;
+
+ 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;
+ $this->status = $status;
+ $this->booking_id = $booking_id;
+ $this->company_id = $company_id;
+ }
+
+
+ /**
+ * @return int
+ */
+ public function getBillNo(): int
+ {
+ return $this->bill_no;
+ }
+
+ /**
+ * @return string
+ */
+ public function getTransType1(): string
+ {
+ return $this->trans_type1;
+ }
+
+ /**
+ * @return string
+ */
+ public function getTransType2(): string
+ {
+ return $this->trans_type2;
+ }
+
+
+ public function getAmount(): float
+ {
+ return $this->amount;
+ }
+
+ /**
+ * @return int
+ */
+ public function getCurrency(): int
+ {
+ return $this->currency_id;
+ }
+
+
+ public function getOriginalAmount(): float
+ {
+ return $this->original_amount;
+ }
+
+ public function getOriginalCurrency(): int
+ {
+ return $this->original_currency_id;
+ }
+
+ public function getCurrencyRate(): float
+ {
+ return $this->currency_rate;
+ }
+
+ /**
+ * @return string
+ */
+ public function getDtTransaction(): string
+ {
+ return $this->dt_transaction;
+ }
+
+ public function getStatus(): int
+ {
+ return $this->original_currency_id;
+ }
+
+ public function getBookingId(): int
+ {
+ return $this->booking_id;
+ }
+
+ public function getCompanyId(): int
+ {
+ return $this->company_id;
+ }
+}
\ No newline at end of file
diff --git a/app/Classes/Modules/Receipts/Services/ChecksIfReceiptBillNoExists.php b/app/Classes/Modules/Receipts/Services/ChecksIfReceiptBillNoExists.php
new file mode 100644
index 00000000..f175a1fd
--- /dev/null
+++ b/app/Classes/Modules/Receipts/Services/ChecksIfReceiptBillNoExists.php
@@ -0,0 +1,22 @@
+repository = $repository;
+ }
+
+ public function execute(int $bill_no): bool {
+ return $this->repository->where('bill_no', $bill_no)->exists();
+ }
+
+}
\ No newline at end of file
diff --git a/app/Classes/Modules/Receipts/Services/CreatesReceipt.php b/app/Classes/Modules/Receipts/Services/CreatesReceipt.php
new file mode 100644
index 00000000..2892ae62
--- /dev/null
+++ b/app/Classes/Modules/Receipts/Services/CreatesReceipt.php
@@ -0,0 +1,35 @@
+bill_no = $object->getBillNo();
+ $model->trans_type1 = $object->getTransType1();
+ $model->trans_type2 = $object->getTransType2();
+ $model->amount = $object->getAmount();
+ $model->currency_id = $object->getCurrency();
+ $model->original_amount = $object->getOriginalAmount();
+ $model->original_currency_id = $object->getOriginalCurrency();
+ $model->currency_rate = $object->getCurrencyRate();
+ $model->dt_transaction = $object->getDtTransaction();
+ $model->status = $object->getStatus();
+ $model->booking_id = $object->getBookingId();
+ $model->company_id = $object->getCompanyId();
+
+
+ return $this->handler($model);
+
+ }
+}
\ No newline at end of file
diff --git a/app/Classes/Modules/Receipts/Services/CreatesReceiptDetail.php b/app/Classes/Modules/Receipts/Services/CreatesReceiptDetail.php
new file mode 100644
index 00000000..4a3f1c62
--- /dev/null
+++ b/app/Classes/Modules/Receipts/Services/CreatesReceiptDetail.php
@@ -0,0 +1,29 @@
+trans_type1 = $object->getTransType1();
+ $model->trans_type2 = $object->getTransType2();
+ $model->transaction_id = $object->getTransactionId();
+ $model->receipt_id = $object->getReceiptId();
+ $model->price = $object->getPrice();
+ $model->amount = $object->getAmount();
+
+
+ return $this->handler($model);
+
+ }
+}
\ No newline at end of file
diff --git a/app/Classes/Modules/Receipts/Services/GeneratesReceiptBillNo.php b/app/Classes/Modules/Receipts/Services/GeneratesReceiptBillNo.php
new file mode 100644
index 00000000..34e196a8
--- /dev/null
+++ b/app/Classes/Modules/Receipts/Services/GeneratesReceiptBillNo.php
@@ -0,0 +1,27 @@
+receiptBillNoExists = $receiptBillNoExists;
+ }
+
+
+
+ public function execute(): int {
+
+ $code = mt_rand(100000001, 999999999);
+ return !$this->receiptBillNoExists->execute($code) ? $code : self::execute();
+
+ }
+
+}
\ No newline at end of file
diff --git a/app/Classes/Modules/Receipts/Standards/Rules/CanCreateReceipt.php b/app/Classes/Modules/Receipts/Standards/Rules/CanCreateReceipt.php
new file mode 100644
index 00000000..58321a3f
--- /dev/null
+++ b/app/Classes/Modules/Receipts/Standards/Rules/CanCreateReceipt.php
@@ -0,0 +1,50 @@
+receiptValidation = $receiptValidation;
+ }
+
+
+ /**
+ * @return bool
+ */
+ protected function authorized(): bool
+ {
+ // TODO Set Authorization rules
+ return true;
+ }
+
+ /**
+ * @param CompanyWalletValidation $object
+ * @return bool
+ * @throws \App\Classes\Exceptions\RequestValidationException
+ */
+ protected function validators($object): bool
+ {
+ return $this->receiptValidation->validate($object);
+ }
+
+ /**
+ * @param SegmentCompanyValidation $object
+ * @return bool
+ */
+ protected function criteria($object): bool
+ {
+ return true;
+ }
+
+}
\ No newline at end of file
diff --git a/app/Classes/Modules/Receipts/Standards/Rules/CanCreateReceiptDetail.php b/app/Classes/Modules/Receipts/Standards/Rules/CanCreateReceiptDetail.php
new file mode 100644
index 00000000..edc788e4
--- /dev/null
+++ b/app/Classes/Modules/Receipts/Standards/Rules/CanCreateReceiptDetail.php
@@ -0,0 +1,50 @@
+receiptDetailValidation = $receiptDetailValidation;
+ }
+
+
+ /**
+ * @return bool
+ */
+ protected function authorized(): bool
+ {
+ // TODO Set Authorization rules
+ return true;
+ }
+
+ /**
+ * @param CompanyWalletValidation $object
+ * @return bool
+ * @throws \App\Classes\Exceptions\RequestValidationException
+ */
+ protected function validators($object): bool
+ {
+ return $this->receiptDetailValidation->validate($object);
+ }
+
+ /**
+ * @param SegmentCompanyValidation $object
+ * @return bool
+ */
+ protected function criteria($object): bool
+ {
+ return true;
+ }
+
+}
\ No newline at end of file
diff --git a/app/Classes/Modules/Receipts/Standards/Validators/ReceiptDetailValidation.php b/app/Classes/Modules/Receipts/Standards/Validators/ReceiptDetailValidation.php
new file mode 100644
index 00000000..b970549f
--- /dev/null
+++ b/app/Classes/Modules/Receipts/Standards/Validators/ReceiptDetailValidation.php
@@ -0,0 +1,59 @@
+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;
+ $this->status = $status;
+ $this->booking_id = $booking_id;
+ $this->company_id = $company_id;
+ */
+ protected function data($object): array
+ {
+ return [
+ 'trans_type1' => $object->getTransType1(),
+ 'trans_type2' => $object->getTransType2(),
+ 'transaction_id' => $object->getTransactionId(),
+ 'receipt_id' => $object->getReceiptId(),
+ 'price'=>$object->getPrice(),
+ 'amount' => $object->getAmount()
+ ];
+ }
+
+ /**
+ * @return array
+ */
+ protected function rules(): array
+ {
+ return [
+ 'trans_type1' => 'required',
+ 'trans_type2' => 'required',
+ 'transaction_id' => 'required',
+ 'receipt_id' => 'required',
+ 'price'=>'required',
+ 'amount' => 'required'
+ ];
+ }
+
+ /**
+ * @return array
+ */
+ protected function messages(): array
+ {
+ return [];
+ }
+}
\ No newline at end of file
diff --git a/app/Classes/Modules/Receipts/Standards/Validators/ReceiptValidation.php b/app/Classes/Modules/Receipts/Standards/Validators/ReceiptValidation.php
new file mode 100644
index 00000000..a1c98a3f
--- /dev/null
+++ b/app/Classes/Modules/Receipts/Standards/Validators/ReceiptValidation.php
@@ -0,0 +1,55 @@
+ $object->getBillNo(),
+ 'trans_type1' => $object->getBillNo(),
+ 'trans_type2' => $object->getTransType2(),
+ 'amount' => $object->getAmount(),
+ 'currency_id' => $object->getCurrency(),
+ 'original_amount' => $object->getOriginalAmount(),
+ 'original_currency_id'=>$object->getOriginalCurrency(),
+ 'dt_transaction'=>$object->getDtTransaction(),
+ 'status'=>$object->getStatus(),
+ 'booking_id'=>$object->getBookingId(),
+ 'company_id'=>$object->getCompanyId()
+ ];
+ }
+
+ /**
+ * @return array
+ */
+ protected function rules(): array
+ {
+ return [
+ 'bill_no' => 'required',
+ 'trans_type1' => 'required',
+ 'trans_type2' => 'required',
+ 'amount' => 'required',
+ 'currency_id' => 'required',
+ 'original_amount' => 'required',
+ 'original_currency_id'=>'required',
+ 'dt_transaction'=>'required',
+ 'status'=>'required',
+ 'booking_id'=>'required',
+ 'company_id'=>'required'
+ ];
+ }
+
+ /**
+ * @return array
+ */
+ protected function messages(): array
+ {
+ return [];
+ }
+}
\ No newline at end of file
diff --git a/app/Classes/Modules/Transactions/Services/FetchesTransaction.php b/app/Classes/Modules/Transactions/Services/FetchesTransaction.php
new file mode 100644
index 00000000..6777da5b
--- /dev/null
+++ b/app/Classes/Modules/Transactions/Services/FetchesTransaction.php
@@ -0,0 +1,34 @@
+repository = $repository;
+ }
+
+
+ /**
+ * @return Builder
+ */
+ public function getRepository(): Builder
+ {
+ return $this->repository->newQuery();
+ }
+}
\ No newline at end of file
diff --git a/app/Http/Controllers/Accounts/CheckEmailController.php b/app/Http/Controllers/Accounts/CheckEmailController.php
new file mode 100644
index 00000000..e9dcacb9
--- /dev/null
+++ b/app/Http/Controllers/Accounts/CheckEmailController.php
@@ -0,0 +1,21 @@
+execute($request);
+ }
+
+}
diff --git a/app/Http/Controllers/Accounts/ListUsersController.php b/app/Http/Controllers/Accounts/ListUsersController.php
new file mode 100644
index 00000000..c63d898a
--- /dev/null
+++ b/app/Http/Controllers/Accounts/ListUsersController.php
@@ -0,0 +1,30 @@
+listsUsers = $listsUsers;
+ }
+
+
+ public function list(Request $request, ListUsersLogic $logic): JsonResponse {
+ return $logic->execute($request);
+ }
+
+}
\ No newline at end of file
diff --git a/app/Http/Controllers/Companies/CreateCompanyController.php b/app/Http/Controllers/Companies/CreateCompanyController.php
new file mode 100644
index 00000000..2ed56acc
--- /dev/null
+++ b/app/Http/Controllers/Companies/CreateCompanyController.php
@@ -0,0 +1,20 @@
+execute($request);
+ }
+
+}
\ No newline at end of file
diff --git a/app/Http/Controllers/Companies/DeleteCompanyController.php b/app/Http/Controllers/Companies/DeleteCompanyController.php
new file mode 100644
index 00000000..f59a8eaa
--- /dev/null
+++ b/app/Http/Controllers/Companies/DeleteCompanyController.php
@@ -0,0 +1,20 @@
+execute($request);
+ }
+
+}
\ No newline at end of file
diff --git a/app/Http/Controllers/Companies/FetchCompanyController.php b/app/Http/Controllers/Companies/FetchCompanyController.php
new file mode 100644
index 00000000..cc4a9a02
--- /dev/null
+++ b/app/Http/Controllers/Companies/FetchCompanyController.php
@@ -0,0 +1,20 @@
+execute($request);
+ }
+
+}
\ No newline at end of file
diff --git a/app/Http/Controllers/Companies/ListCompaniesController.php b/app/Http/Controllers/Companies/ListCompaniesController.php
new file mode 100644
index 00000000..17cc6caf
--- /dev/null
+++ b/app/Http/Controllers/Companies/ListCompaniesController.php
@@ -0,0 +1,20 @@
+execute($request);
+ }
+
+}
\ No newline at end of file
diff --git a/app/Http/Controllers/Companies/UpdateCompanyController.php b/app/Http/Controllers/Companies/UpdateCompanyController.php
new file mode 100644
index 00000000..3ff239fb
--- /dev/null
+++ b/app/Http/Controllers/Companies/UpdateCompanyController.php
@@ -0,0 +1,20 @@
+execute($request);
+ }
+
+}
\ No newline at end of file
diff --git a/app/Http/Controllers/Receipts/CreateReceiptController.php b/app/Http/Controllers/Receipts/CreateReceiptController.php
new file mode 100644
index 00000000..dadf87b3
--- /dev/null
+++ b/app/Http/Controllers/Receipts/CreateReceiptController.php
@@ -0,0 +1,15 @@
+execute($request);
+ }
+}
\ No newline at end of file
diff --git a/app/Http/Resources/ReceiptDetailResource.php b/app/Http/Resources/ReceiptDetailResource.php
new file mode 100644
index 00000000..4c8850f8
--- /dev/null
+++ b/app/Http/Resources/ReceiptDetailResource.php
@@ -0,0 +1,29 @@
+ $this->id,
+ 'trans_type1' => $this->trans_type1,
+ 'trans_type2' => $this->trans_type2,
+ 'transaction_id' => (int) $this->transaction_id,
+ 'receipt_id' => (int)$this->receipt_id,
+ 'price' => (double) $this->price,
+ 'amount' => (double) $this->amount
+
+ ];
+ }
+}
diff --git a/app/Http/Resources/ReceiptResource.php b/app/Http/Resources/ReceiptResource.php
new file mode 100644
index 00000000..95573ef3
--- /dev/null
+++ b/app/Http/Resources/ReceiptResource.php
@@ -0,0 +1,34 @@
+ $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
+ ];
+ }
+}
diff --git a/app/Models/Receipt.php b/app/Models/Receipt.php
new file mode 100644
index 00000000..d534e7fd
--- /dev/null
+++ b/app/Models/Receipt.php
@@ -0,0 +1,27 @@
+hasOne(Companies::class, 'company_id', 'id');
+ }
+
+ public function currency(): HasOne
+ {
+ return $this->hasOne(Currency::class, 'currency_id', 'id');
+ }
+
+ public function original_currency(): HasOne
+ {
+ return $this->hasOne(Currency::class, 'original_currency_id', 'id');
+ }
+
+}
diff --git a/app/Models/ReceiptDetail.php b/app/Models/ReceiptDetail.php
new file mode 100644
index 00000000..a6e53f24
--- /dev/null
+++ b/app/Models/ReceiptDetail.php
@@ -0,0 +1,22 @@
+hasOne(Transaction::class, 'transaction_id', 'id');
+ }
+
+ public function receipt(): HasOne
+ {
+ return $this->hasOne(Receipt::class, 'receipt_id', 'id');
+ }
+
+}
diff --git a/database/migrations/2020_12_02_131122_create_receipt_table.php b/database/migrations/2020_12_02_131122_create_receipt_table.php
new file mode 100644
index 00000000..a0569b25
--- /dev/null
+++ b/database/migrations/2020_12_02_131122_create_receipt_table.php
@@ -0,0 +1,62 @@
+id();
+ $table->string('trans_type1');
+ $table->string('trans_type2');
+ $table->bigInteger('bill_no')->unsigned();
+ $table->decimal('amount', 14, 5)->default(0.00);
+ $table->decimal('original_amount', 14, 5)->default(0.00);
+ $table->bigInteger('currency_id')->unsigned();
+ $table->bigInteger('original_currency_id')->unsigned();
+ $table->decimal('currency_rate', 14, 5)->default(0.00);
+ $table->date('dt_transaction');
+ $table->integer('status');
+ $table->bigInteger('booking_id')->unsigned();
+ $table->bigInteger('company_id')->unsigned();
+ $table->timestamps();
+ $table->foreign('company_id')->references('id')->on('companies')->onDelete('cascade');
+ $table->foreign('currency_id')->references('id')->on('currencies')->onDelete('cascade');
+ $table->foreign('original_currency_id')->references('id')->on('currencies')->onDelete('cascade');
+
+ });
+
+ Schema::create('receipt_detail', function (Blueprint $table) {
+ $table->id();
+ $table->string('trans_type1');
+ $table->string('trans_type2');
+ $table->bigInteger('receipt_id')->unsigned();
+ $table->bigInteger('transaction_id')->unsigned();
+ $table->decimal('price', 14, 5)->default(0.00);
+ $table->decimal('amount', 14, 5)->default(0.00);
+ $table->timestamps();
+ $table->foreign('receipt_id')->references('id')->on('receipt')->onDelete('cascade');
+ $table->foreign('transaction_id')->references('id')->on('transaction')->onDelete('cascade');
+
+ });
+ }
+
+ /**
+ * Reverse the migrations.
+ *
+ * @return void
+ */
+ public function down()
+ {
+ Schema::dropIfExists('receipt');
+ Schema::dropIfExists('receipt_detail');
+ }
+}
diff --git a/resources/assets/vue/components/accounts/forms/ForgetPasswordFormComponent.vue b/resources/assets/vue/components/accounts/forms/ForgetPasswordFormComponent.vue
new file mode 100644
index 00000000..88f4f169
--- /dev/null
+++ b/resources/assets/vue/components/accounts/forms/ForgetPasswordFormComponent.vue
@@ -0,0 +1,71 @@
+
+
Enter your email address to register/login.
+Looks like you already have an account with us.
+Looks like you are a new user.
Let's create a fresh new izyim profile for you.
Enter your email address you're using for your account below
and we will send you a password reset link
+ Users
+Forwarders
+Importers
+Warehouses
+Active Users
+Blocked Users
+User Invites
+Reports
+List of the system currently active users
+List of the system currently inactive users
+Orders
+Customers
+Warehouses
+Employees
+Active Users
+Blocked Users
+User Invites
+Reports
+List of the system currently active users
+