コード例 #1
0
 /**
  * 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);
 }
コード例 #2
0
ファイル: CheckRequest.php プロジェクト: junjinZ/wealthbot
 /**
  * Generate delivery details section tabs
  *
  * @return array
  */
 public function deliveryDetailsSection()
 {
     $clientAccount = $this->signableObject->getClientAccount();
     $owner = $clientAccount->getPrimaryApplicant();
     $tabs = array();
     $deliveryDetailsTab = new RadioGroupTab();
     $deliveryDetailsTab->setGroupName('delivery_details')->setValue('account_owner')->setSelected(true);
     $tabs[] = $deliveryDetailsTab;
     $payeeNameTab = new TextTab();
     $payeeNameTab->setTabLabel('delivery_payee_name')->setValue($owner->getFullName());
     $tabs[] = $payeeNameTab;
     $addressTab = new TextTab();
     $addressTab->setTabLabel('delivery_address')->setValue($owner->getStreet());
     $tabs[] = $addressTab;
     $cityTab = new TextTab();
     $cityTab->setTabLabel('delivery_city')->setValue($owner->getCity());
     $tabs[] = $cityTab;
     $stateTab = new TextTab();
     $stateTab->setTabLabel('delivery_state')->setValue($owner->getState()->getName());
     $tabs[] = $stateTab;
     $zipTab = new TextTab();
     $zipTab->setTabLabel('delivery_zip_code')->setValue($owner->getZip());
     $tabs[] = $zipTab;
     return $tabs;
 }
コード例 #3
0
 /**
  * Create tab configuration object
  *
  * @return TabsConfigurationInterface
  * @throws \InvalidArgumentException
  */
 public function create()
 {
     $type = $this->signableObject->getDocumentSignatureType();
     $account = $this->signableObject->getClientAccount();
     $accountType = $account->getSystemType();
     switch ($type) {
         case DocumentSignature::TYPE_OPEN_OR_TRANSFER_ACCOUNT:
             if ($accountType === SystemAccount::TYPE_ROTH_IRA || $accountType === SystemAccount::TYPE_TRADITIONAL_IRA) {
                 $configuration = new IraAccountApplication($account);
             } else {
                 $configuration = new PersonalAccountApplication($account);
             }
             break;
         case DocumentSignature::TYPE_TRANSFER_INFORMATION:
             $configuration = new AccountTransferForm($account);
             break;
         case DocumentSignature::TYPE_AUTO_INVEST_CONTRIBUTION:
         case DocumentSignature::TYPE_ONE_TIME_CONTRIBUTION:
             $configuration = new ElectronicFundsTransferForm($this->signableObject);
             break;
         case DocumentSignature::TYPE_AUTO_DISTRIBUTION:
             if ($accountType === SystemAccount::TYPE_ROTH_IRA || $accountType === SystemAccount::TYPE_TRADITIONAL_IRA) {
                 $configuration = new IraDistributionForm($this->signableObject);
             } else {
                 $configuration = new ElectronicFundsTransferForm($this->signableObject);
             }
             break;
         case DocumentSignature::TYPE_CHANGE_BENEFICIARY:
             if (!$this->signableObject instanceof Beneficiary) {
                 throw new \InvalidArgumentException(sprintf('Object must be instance of Beneficiary.'));
             }
             $configuration = new BeneficiaryDesignationForm($this->signableObject);
             break;
         case DocumentSignature::TYPE_ONE_TIME_DISTRIBUTION:
             if ($accountType === SystemAccount::TYPE_ROTH_IRA || $accountType === SystemAccount::TYPE_TRADITIONAL_IRA) {
                 $configuration = new IraDistributionForm($this->signableObject);
             } else {
                 if (!$this->signableObject instanceof Distribution || !$this->signableObject->isOneTime()) {
                     throw new \InvalidArgumentException(sprintf('Object must be one-time distribution.'));
                 }
                 if (Distribution::TRANSFER_METHOD_RECEIVE_CHECK === $this->signableObject->getTransferMethod()) {
                     $configuration = new CheckRequest($this->signableObject);
                 } elseif (Distribution::TRANSFER_METHOD_WIRE_TRANSFER == $this->signableObject->getTransferMethod()) {
                     $configuration = new WireInstructions($this->signableObject);
                 } else {
                     $configuration = new ElectronicFundsTransferForm($this->signableObject);
                 }
             }
             break;
         default:
             throw new \InvalidArgumentException(sprintf('Invalid type: %s for signable document.', $type));
             break;
     }
     return $configuration;
 }
コード例 #4
0
 /**
  * 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;
 }
コード例 #5
0
 public function isDocumentSignatureForObjectExist(SignableInterface $object)
 {
     $signature = $this->findOneDocumentSignatureBySourceIdAndType($object->getSourceObjectId(), $object->getDocumentSignatureType());
     return $signature ? true : false;
 }
コード例 #6
0
 /**
  * Get docusign template for signable object
  *
  * @param SignableInterface $object
  * @return string
  * @throws \InvalidArgumentException
  * @throws \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException
  */
 private function getTemplateForSignableObject(SignableInterface $object)
 {
     $type = $object->getDocumentSignatureType();
     $accountType = $object->getClientAccount()->getSystemType();
     switch ($type) {
         case DocumentSignature::TYPE_OPEN_OR_TRANSFER_ACCOUNT:
             if ($accountType === SystemAccount::TYPE_PERSONAL_INVESTMENT || $accountType === SystemAccount::TYPE_JOINT_INVESTMENT) {
                 $key = 'personal_account';
             } elseif ($accountType === SystemAccount::TYPE_ROTH_IRA || $accountType === SystemAccount::TYPE_TRADITIONAL_IRA) {
                 $key = 'ira_account';
             } else {
                 throw new \InvalidArgumentException(sprintf('Invalid account type: %s', $accountType));
             }
             break;
         case DocumentSignature::TYPE_TRANSFER_INFORMATION:
             $key = 'account_transfer_form';
             break;
         case DocumentSignature::TYPE_AUTO_INVEST_CONTRIBUTION:
         case DocumentSignature::TYPE_ONE_TIME_CONTRIBUTION:
             $key = 'electronic_funds_transfer_form';
             break;
         case DocumentSignature::TYPE_CHANGE_BENEFICIARY:
             $key = 'beneficiary_designation_form';
             break;
         case DocumentSignature::TYPE_AUTO_DISTRIBUTION:
             if ($accountType === SystemAccount::TYPE_PERSONAL_INVESTMENT || $accountType === SystemAccount::TYPE_JOINT_INVESTMENT) {
                 $key = 'electronic_funds_transfer_form';
             } elseif ($accountType === SystemAccount::TYPE_ROTH_IRA || $accountType === SystemAccount::TYPE_TRADITIONAL_IRA) {
                 $key = 'ira_distribution_form';
             } else {
                 throw new \InvalidArgumentException(sprintf('Invalid account type: %s', $accountType));
             }
             break;
         case DocumentSignature::TYPE_ONE_TIME_DISTRIBUTION:
             if ($accountType === SystemAccount::TYPE_PERSONAL_INVESTMENT || $accountType === SystemAccount::TYPE_JOINT_INVESTMENT) {
                 if (!$object instanceof Distribution || !$object->isOneTime()) {
                     throw new \InvalidArgumentException(sprintf('Object must be one-time distribution.'));
                 }
                 if (Distribution::TRANSFER_METHOD_RECEIVE_CHECK === $object->getTransferMethod()) {
                     $key = 'check_request';
                 } elseif (Distribution::TRANSFER_METHOD_WIRE_TRANSFER == $object->getTransferMethod()) {
                     $key = 'wire_instructions';
                 } else {
                     $key = 'electronic_funds_transfer_form';
                 }
             } elseif ($accountType === SystemAccount::TYPE_ROTH_IRA || $accountType === SystemAccount::TYPE_TRADITIONAL_IRA) {
                 $key = 'ira_distribution_form';
             } else {
                 throw new \InvalidArgumentException(sprintf('Invalid account type: %s', $accountType));
             }
             break;
         default:
             throw new \InvalidArgumentException(sprintf('Invalid document signature type: %s', $type));
             break;
     }
     if (!$this->hasTemplate($key)) {
         throw new InvalidConfigurationException('Template with key: %s does not exist. Check configuration.', $key);
     }
     return $this->getTemplate($key);
 }
コード例 #7
0
 /**
  * Generate collection of tabs
  *
  * @return TabCollection
  * @throws \InvalidArgumentException
  */
 public function generate()
 {
     $account = $this->signableObject->getClientAccount();
     $transferInformation = $this->signableObject;
     if ($transferInformation instanceof Distribution) {
         $transferDirection = 'distribution';
     } elseif ($transferInformation instanceof BaseContribution) {
         $transferDirection = 'contribution';
     } else {
         throw new \InvalidArgumentException('Signable object must be instance of Distribution or BaseContribution');
     }
     $client = $account->getClient();
     $companyInformation = $client->getRiaCompanyInformation();
     $tabs = array();
     $advisorCode = new TextTab();
     $advisorCode->setTabLabel('advisor#')->setValue($this->getAdvisorCode($companyInformation));
     $tabs[] = $advisorCode;
     $accountNumber = new TextTab();
     $accountNumber->setTabLabel('account#')->setValue($account->getAccountNumber());
     $tabs[] = $accountNumber;
     if ($account->hasSystemAccount()) {
         $transferInstructionsValue = 'update';
     } else {
         $transferInstructionsValue = 'new';
     }
     $transferInstructionsTab = new RadioGroupTab();
     $transferInstructionsTab->setGroupName('transfer_instructions')->setValue($transferInstructionsValue)->setSelected(true);
     $tabs[] = $transferInstructionsTab;
     $direction = new RadioGroupTab();
     $direction->setGroupName('transfer_direction')->setValue($transferDirection)->setSelected(true);
     $tabs[] = $direction;
     $bankInformation = $transferInformation->getBankInformation();
     if ($bankInformation) {
         $accountOwnerName = new TextTab();
         $accountOwnerName->setTabLabel('account_owner_full_name')->setValue($bankInformation->getAccountOwnerFullName());
         $tabs[] = $accountOwnerName;
         if (trim($bankInformation->getJointAccountOwnerFullName()) != '') {
             $jointAccountOwner = new TextTab();
             $jointAccountOwner->setTabLabel('joint_account_owner_full_name')->setValue($bankInformation->getJointAccountOwnerFullName());
             $tabs[] = $jointAccountOwner;
         }
         $bankAccountType = new RadioGroupTab();
         $bankAccountTypeValue = $bankInformation->getAccountType() == BankInformation::ACCOUNT_TYPE_CHECK ? 'checking' : 'savings';
         $bankAccountType->setGroupName('bank_account_type')->setValue($bankAccountTypeValue)->setSelected(true);
         $tabs[] = $bankAccountType;
         $bankAccountNumber = new TextTab();
         $bankAccountNumber->setTabLabel('bank_account_number')->setValue($bankInformation->getAccountNumber());
         $tabs[] = $bankAccountNumber;
         $bankRoutingNumber = new TextTab();
         $bankRoutingNumber->setTabLabel('bank_routing_number')->setValue($bankInformation->getRoutingNumber());
         $tabs[] = $bankRoutingNumber;
         $bankName = new TextTab();
         $bankName->setTabLabel('bank_name')->setValue($bankInformation->getName());
         $tabs[] = $bankName;
         $bankAccountTitle = new TextTab();
         $bankAccountTitle->setTabLabel('bank_account_title')->setValue($bankInformation->getAccountTitle());
         $tabs[] = $bankAccountTitle;
         $bankPhoneNumber = new TextTab();
         $bankPhoneNumber->setTabLabel('bank_phone_number')->setValue($bankInformation->getPhoneNumber());
         $tabs[] = $bankPhoneNumber;
     }
     if ($transferInformation instanceof BaseContribution) {
         $startDateValue = $transferInformation->getStartTransferDate();
         $frequency = $transferInformation->getTransactionFrequency();
         switch ($frequency) {
             case BaseContribution::TRANSACTION_FREQUENCY_ONE_TIME:
                 $frequencyValue = 'one_time';
                 break;
             case BaseContribution::TRANSACTION_FREQUENCY_EVERY_OTHER_WEEK:
                 $frequencyValue = 'every_other_week';
                 break;
             case BaseContribution::TRANSACTION_FREQUENCY_MONTHLY:
                 $frequencyValue = 'monthly';
                 break;
             case BaseContribution::TRANSACTION_FREQUENCY_QUARTERLY:
                 $frequencyValue = 'quarterly';
                 break;
             default:
                 $frequencyValue = null;
                 break;
         }
     } elseif ($transferInformation instanceof Distribution) {
         $startDateValue = $transferInformation->getTransferDate();
         $frequency = $transferInformation->getFrequency();
         if ($transferInformation->isOneTime()) {
             $frequencyValue = 'one_time';
         } else {
             switch ($frequency) {
                 case Distribution::FREQUENCY_EVERY_OTHER_WEEK:
                     $frequencyValue = 'every_other_week';
                     break;
                 case Distribution::FREQUENCY_MONTHLY:
                     $frequencyValue = 'monthly';
                     break;
                 case Distribution::FREQUENCY_QUARTERLY:
                     $frequencyValue = 'quarterly';
                     break;
                 default:
                     $frequencyValue = null;
                     break;
             }
         }
     } else {
         $frequencyValue = null;
         $startDateValue = null;
     }
     if ($frequencyValue) {
         $frequencyTab = new RadioGroupTab();
         $frequencyTab->setGroupName('transaction_frequency')->setValue($frequencyValue)->setSelected(true);
         $tabs[] = $frequencyTab;
     }
     $amountTab = new TextTab();
     $amountTab->setTabLabel('transaction_amount')->setValue($transferInformation->getAmount());
     $tabs[] = $amountTab;
     if ($startDateValue) {
         $startDateTab = new TextTab();
         $startDateTab->setTabLabel('transfer_start_date')->setValue($startDateValue->format('m/d'));
         $tabs[] = $startDateTab;
     }
     return new TabCollection($tabs);
 }