/**
  * Generate collection of tabs
  *
  * @return TabCollection
  * @throws \RuntimeException
  * @throws \InvalidArgumentException
  */
 public function generate()
 {
     if (!$this->signableObject instanceof Distribution || !$this->signableObject->isOneTime()) {
         throw new \InvalidArgumentException('Signable object must be one-time distribution.');
     }
     if ($this->signableObject->getTransferMethod() !== Distribution::TRANSFER_METHOD_WIRE_TRANSFER) {
         throw new \RuntimeException('Invalid transfer method for one-time distribution.');
     }
     $bankInformation = $this->signableObject->getBankInformation();
     $clientAccount = $this->signableObject->getClientAccount();
     $client = $clientAccount ? $clientAccount->getClient() : null;
     $companyInformation = $client ? $client->getRiaCompanyInformation() : null;
     $tabs = array();
     $advisorCode = new TextTab();
     $advisorCode->setTabLabel('advisor#')->setValue($this->getAdvisorCode($companyInformation));
     $tabs[] = $advisorCode;
     $accountNumber = new TextTab();
     $accountNumber->setTabLabel('account#')->setValue($clientAccount ? $clientAccount->getAccountNumber() : '');
     $tabs[] = $accountNumber;
     $bankNameTab = new TextTab();
     $bankNameTab->setTabLabel('bank_name')->setValue($bankInformation->getName());
     $tabs[] = $bankNameTab;
     $bankPhoneTab = new TextTab();
     $bankPhoneTab->setTabLabel('bank_phone_number')->setValue($bankInformation->getPhoneNumber());
     $tabs[] = $bankPhoneTab;
     return new TabCollection($tabs);
 }
Exemple #2
0
 /**
  * Generate account information section tabs
  *
  * @return array
  */
 public function accountInformationSection()
 {
     $bankInformation = $this->signableObject->getBankInformation();
     $tabs = array();
     $accountTitleTab = new TextTab();
     $accountTitleTab->setTabLabel('account_title')->setValue($bankInformation->getAccountTitle());
     $tabs[] = $accountTitleTab;
     return $tabs;
 }
 /**
  * Generate payment method section tabs
  *
  * @return array
  */
 protected function paymentMethodSection()
 {
     $clientAccount = $this->signableObject->getClientAccount();
     $owner = $clientAccount->getPrimaryApplicant();
     $paymentMethod = '';
     $transferMethod = $this->signableObject->getTransferMethod();
     if ($transferMethod === Distribution::TRANSFER_METHOD_RECEIVE_CHECK) {
         $paymentMethod = 'send_check';
         $sendCheckMethodTab = new RadioGroupTab();
         $sendCheckMethodTab->setGroupName('send_check_method')->setValue('us_first_class_mail')->setSelected(true);
         $tabs[] = $sendCheckMethodTab;
         $sendCheckTypeTab = new RadioGroupTab();
         $sendCheckTypeTab->setGroupName('send_check_type')->setValue('address_of_record')->setSelected(true);
         $tabs[] = $sendCheckTypeTab;
         $nameTab = new TextTab();
         $nameTab->setTabLabel('send_check_payee_name')->setValue($owner->getFullName());
         $tabs[] = $nameTab;
         $addressTab = new TextTab();
         $addressTab->setTabLabel('send_check_address')->setValue($owner->getStreet());
         $tabs[] = $addressTab;
         $cityTab = new TextTab();
         $cityTab->setTabLabel('send_check_city')->setValue($owner->getCity());
         $tabs[] = $cityTab;
         $stateTab = new TextTab();
         $stateTab->setTabLabel('send_check_state')->setValue($owner->getState()->getName());
         $tabs[] = $stateTab;
         $zipTab = new TextTab();
         $zipTab->setTabLabel('send_check_zip')->setValue($owner->getZip());
         $tabs[] = $zipTab;
     } elseif ($transferMethod !== Distribution::TRANSFER_METHOD_NOT_FUNDING) {
         $paymentMethod = 'electronic';
         $electronicType = $transferMethod === Distribution::TRANSFER_METHOD_WIRE_TRANSFER ? 'wire_transfer' : 'bank_transfer';
         $electronicTypeTab = new RadioGroupTab();
         $electronicTypeTab->setGroupName('electronic_type')->setValue($electronicType)->setSelected(true);
         $tabs[] = $electronicTypeTab;
         /** @var BankInformation $bankInformation */
         $bankInformation = $this->signableObject->getBankInformation();
         if ($bankInformation) {
             $isCheckingAccountType = $bankInformation->getAccountType() == BankInformation::ACCOUNT_TYPE_CHECK;
             $bankAccountTypeTab = new RadioGroupTab();
             $bankAccountTypeTab->setGroupName('electronic_account_type')->setValue($isCheckingAccountType ? 'check' : 'saving')->setSelected(true);
             $tabs[] = $bankAccountTypeTab;
             $bankAccountTitleTab = new TextTab();
             $bankAccountTitleTab->setTabLabel('electronic_bank_account_title')->setValue($bankInformation->getAccountTitle());
             $tabs[] = $bankAccountTitleTab;
             $bankAccountNumberTab = new TextTab();
             $bankAccountNumberTab->setTabLabel('electronic_bank_account_number')->setValue($bankInformation->getAccountNumber());
             $tabs[] = $bankAccountNumberTab;
             $bankRoutingNumberTab = new TextTab();
             $bankRoutingNumberTab->setTabLabel('electronic_bank_routing_number')->setValue($bankInformation->getRoutingNumber());
             $tabs[] = $bankRoutingNumberTab;
             $bankNameTab = new TextTab();
             $bankNameTab->setTabLabel('electronic_bank_name')->setValue($bankInformation->getName());
             $tabs[] = $bankNameTab;
         }
     }
     $paymentMethodTab = new RadioGroupTab();
     $paymentMethodTab->setGroupName('payment_method')->setValue($paymentMethod)->setSelected(true);
     $tabs[] = $paymentMethodTab;
     return $tabs;
 }