/**
  * @param CommandInterface $command
  * @return bool
  */
 public function execute(CommandInterface $command)
 {
     if (!$command instanceof CreateMemberCommand) {
         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->setAccountId($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->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 CreateWithdrawalCommand) {
         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()]);
     $withdrawal = new Withdrawal();
     $withdrawal->setClient($member);
     $withdrawal->setAmount($command->getAmount());
     $withdrawal->setStatus(Withdrawal::STATUS_OPEN);
     $this->withdrawal_repo->save($withdrawal);
     $data = ["email" => $member->getEmail(), "account_id" => $member->getAccountId(), "full_name" => $member->getFullName(), "ticket" => $withdrawal->getWithdrawalId(), "amount" => $withdrawal->getAmount(), "bank_name" => $member->getBankName(), "account_number" => $member->getAccountNumber(), "account_holder" => $member->getAccountHolder(), "date" => date("Y-m-d H:i:s")];
     $this->event_emitter->emit("withdrawal.created", [$data]);
     return (int) $withdrawal->getWithdrawalId();
 }
 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;
 }
Exemple #5
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;
 }
 /**
  * @param CommandInterface $command
  * @return int
  */
 public function execute(CommandInterface $command)
 {
     if (!$command instanceof CreateDepositCommand) {
         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()]);
     $deposit = new Deposit();
     $deposit->setClient($member);
     $deposit->setAmountIdr($command->getAmountIdr());
     $deposit->setToBank($command->getToBank());
     $deposit->setAmountUsd($command->getAmountUsd());
     $deposit->setStatus(Deposit::STATUS_OPEN);
     $this->deposit_repo->save($deposit);
     $data = ["email" => $member->getEmail(), "ticket" => $deposit->getDepositId(), "full_name" => $member->getFullName(), "account_id" => $member->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("deposit.created", [$data]);
     return (int) $deposit->getDepositId();
 }