Esempio n. 1
0
 /**
  * @param CommandInterface $command
  * @return bool
  */
 public function execute(CommandInterface $command)
 {
     if (!$command instanceof EditMemberCommand) {
         throw new \DomainException("Internal error, silahkan hubungi CS kami");
     }
     $command->setRepository($this->member_repo);
     $violation = $this->validator->validate($command);
     if ($violation->count() > 0) {
         $message = $violation->get(0)->getMessage();
         throw new \DomainException($message);
     }
     //        $member = new Member();
     $member = $this->app->em->getRepository("Mabes\\Entity\\Member")->find($command->getAccountId());
     $member->setEmail($command->getEmail());
     $member->setAccountNumber($command->getAccountNumber());
     $member->setAccountHolder($command->getAccountHolder());
     $member->setBankName($command->getBankName());
     $member->setFullName($command->getFullname());
     $member->setAddress($command->getAddress());
     $member->setPhone($command->getPhone());
     $this->app->em->flush();
     //        $this->member_repo->save($member);
     $data = ["account_id" => $member->getAccountId(), "email" => $member->getEmail(), "phone" => $member->getPhone(), "fullname" => $member->getFullName(), "bank_name" => $member->getBankName(), "account_number" => $member->getAccountNumber(), "account_holder" => $member->getAccountHolder(), "address" => $member->getAddress(), "date" => date("Y-m-d H:i:s")];
     $this->event_emitter->emit("validation.created", [$data]);
     return true;
 }
 public function execute(CommandInterface $command)
 {
     if (!$command instanceof CreateIslamicAccountCommand) {
         throw new \DomainException("Internal error, silahkan hubungi CS kami");
     }
     $command->setRepository($this->member_repo);
     $violation = $this->validator->validate($command);
     if ($violation->count() > 0) {
         $message = $violation->get(0)->getMessage();
         throw new \DomainException($message);
     }
     $member = $this->member_repo->findOneBy(["account_id" => $command->getAccountId()]);
     $data = ["account_id" => $command->getAccountId(), "mt4_account" => $command->getMt4Account(), "fullname" => $member->getFullname(), "phone" => $member->getPhone(), "email" => $member->getEmail(), "date" => date("Y-m-d H:i:s")];
     $this->event_emitter->emit("akun.islami.created", [$data]);
     return true;
 }
 public function execute(CommandInterface $command)
 {
     if (!$command instanceof DepositMarkAsFailedCommand) {
         throw new \DomainException("Internal error, silahkan hubungi CS kami");
     }
     $command->setRepository($this->deposit_repository);
     $violation = $this->validator->validate($command);
     if ($violation->count() > 0) {
         $message = $violation->get(0)->getMessage();
         throw new \DomainException($message);
     }
     $deposit = $this->deposit_repository->findOneBy(["deposit_id" => $command->getDepositId()]);
     $deposit->setStatus(Deposit::STATUS_FAILED);
     $this->deposit_repository->save($deposit);
     $data = ["email" => $deposit->getClient()->getEmail(), "ticket" => $deposit->getDepositId(), "full_name" => $deposit->getClient()->getFullName(), "account_id" => $deposit->getClient()->getAccountId(), "amount_idr" => $deposit->getAmountIdr(), "amount_usd" => $deposit->getAmountUsd(), "bank_name" => $deposit->getToBank(), "date" => date("Y-m-d H:i:s")];
     $this->event_emitter->emit("admin.deposit.failed", [$data]);
     return true;
 }
 public function execute(CommandInterface $command)
 {
     if (!$command instanceof WithdrawalMarkAsDoneCommand) {
         throw new \DomainException("Internal error, silahkan hubungi CS kami");
     }
     $command->setRepository($this->withdrawal_repository);
     $violation = $this->validator->validate($command);
     if ($violation->count() > 0) {
         $message = $violation->get(0)->getMessage();
         throw new \DomainException($message);
     }
     $withdrawal = $this->withdrawal_repository->findOneBy(["withdrawal_id" => $command->getWithdrawalId()]);
     $withdrawal->setStatus(Withdrawal::STATUS_PROCESSED);
     $this->withdrawal_repository->save($withdrawal);
     $data = ["email" => $withdrawal->getClient()->getEmail(), "account_id" => $withdrawal->getClient()->getAccountId(), "full_name" => $withdrawal->getClient()->getFullName(), "ticket" => $withdrawal->getWithdrawalId(), "amount" => $withdrawal->getAmount(), "bank_name" => $withdrawal->getClient()->getBankName(), "account_number" => $withdrawal->getClient()->getAccountNumber(), "account_holder" => $withdrawal->getClient()->getAccountHolder(), "date" => date("Y-m-d H:i:s")];
     $this->event_emitter->emit("admin.withdrawal.processed", [$data]);
     return true;
 }
Esempio n. 5
0
 public function execute(CommandInterface $command)
 {
     if (!$command instanceof CreateStaffCommand) {
         throw new \DomainException("Internal error, silahkan hubungi CS kami");
     }
     $command->setRepository($this->staff_repository);
     $violation = $this->validator->validate($command);
     if ($violation->count() > 0) {
         $message = $violation->get(0)->getMessage();
         throw new \DomainException($message);
     }
     $staff = new Staff();
     $this->hash_service->setRawPassword($command->getPassword());
     $staff->setUsername($command->getUsername());
     $staff->setPassword($this->hash_service->hash());
     $this->staff_repository->save($staff);
     return true;
 }
Esempio n. 6
0
 public function execute(CommandInterface $command)
 {
     if (!$command instanceof AuthCommand) {
         throw new \DomainException("Internal error, silahkan hubungi CS kami");
     }
     $command->setRepository($this->staff_repository);
     $violation = $this->validator->validate($command);
     if ($violation->count() > 0) {
         $message = $violation->get(0)->getMessage();
         throw new \DomainException($message);
     }
     $staff = $this->staff_repository->findOneBy(["username" => $command->getUsername()]);
     $this->auth_password_service->setRawPassword($command->getPassword());
     $this->auth_password_service->setPassword($staff->getPassword());
     if (!$this->auth_password_service->auth()) {
         throw new \DomainException("Password yang anda masukkan salah");
     }
     return true;
 }
 public function execute(CommandInterface $command)
 {
     if (!$command instanceof AddInvestorPasswordCommand) {
         throw new \DomainException("Internal error, silahkan hubungi CS kami");
     }
     $command->setRepository($this->member_repo);
     $violation = $this->validator->validate($command);
     if ($violation->count() > 0) {
         $message = $violation->get(0)->getMessage();
         throw new \DomainException($message);
     }
     $member = $this->member_repo->findOneBy(["account_id" => $command->getAccountId()]);
     $investor_password = new InvestorPassword();
     $investor_password->setInvestorPassword($command->getInvestorPassword());
     $investor_password->setMtAccount($command->getMt4Account());
     $investor_password->setAccountId($member);
     $this->investor_password_repo->save($investor_password);
     $data = ["email" => $member->getEmail(), "account_id" => $member->getAccountId(), "fullname" => $member->getFullName(), "mt4_account" => $investor_password->getMtAccount(), "investor_password" => $investor_password->getInvestorPassword(), "date" => date("Y-m-d H:i:s")];
     $this->event_emitter->emit("investor.password.created", [$data]);
     return true;
 }
Esempio n. 8
0
 public function execute(CommandInterface $command)
 {
     if (!$command instanceof ClaimRebateCommand) {
         throw new \DomainException("Internal error, silahkan hubungi CS kami");
     }
     $command->setRepository($this->member_repo);
     $violation = $this->validator->validate($command);
     if ($violation->count() > 0) {
         $message = $violation->get(0)->getMessage();
         throw new \DomainException($message);
     }
     $member = $this->member_repo->findOneBy(["account_id" => $command->getAccountId()]);
     $claim_rebate = new ClaimRebate();
     $claim_rebate->setMember($member);
     $claim_rebate->setMt4Account($command->getMt4Account());
     $claim_rebate->setType($command->getType());
     $this->claim_rebate_repo->save($claim_rebate);
     $data = ["email" => $member->getEmail(), "account_id" => $member->getAccountId(), "fullname" => $member->getFullName(), "type" => $claim_rebate->getType(), "mt4_account" => $claim_rebate->getMt4Account(), "bank_name" => $member->getBankName(), "account_number" => $member->getAccountNumber(), "account_holder" => $member->getAccountHolder(), "date" => date("Y-m-d H:i:s")];
     $this->event_emitter->emit("claim.rebate.created", [$data]);
     return true;
 }