/** * 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); }
/** * @return array */ private function getBeneficiariesInformationTabs() { $tabs = array(); $primary = 0; $alternative = 0; /** @var Beneficiary[] $accountBeneficiaries */ $accountBeneficiaries = $this->beneficiary->getAccount()->getBeneficiaries(); foreach ($accountBeneficiaries as $beneficiary) { if ($beneficiary->isPrimary()) { $primary++; $prefix = 'beneficiary_' . $primary . '_'; } else { $alternative++; $prefix = 'alternative_beneficiary_' . $alternative . '_'; } $nameTab = new TextTab(); $nameTab->setTabLabel($prefix . 'name')->setValue($beneficiary->getFullName()); $tabs[] = $nameTab; $relationshipTab = new TextTab(); $relationshipTab->setTabLabel($prefix . 'relationship')->setValue($beneficiary->getRelationship()); $tabs[] = $relationshipTab; $birthDateTab = new TextTab(); $birthDateTab->setTabLabel($prefix . 'birth_date')->setValue($beneficiary->getBirthDate()->format('m-d-Y')); $tabs[] = $birthDateTab; $ssnTab = new TextTab(); $ssnTab->setTabLabel($prefix . 'ssn')->setValue($beneficiary->getSsn()); $tabs[] = $ssnTab; $shareTab = new TextTab(); $shareTab->setTabLabel($prefix . 'share')->setValue($beneficiary->getShare()); $tabs[] = $shareTab; } return $tabs; }
private function getOwnerInformationTabs(AccountOwnerInterface $owner, $isJoint = false) { $prefix = ''; if ($isJoint) { $prefix = 'joint_'; } $tabs = array(); $fullName = new TextTab(); $fullName->setTabLabel($prefix . 'full_name')->setValue($owner->getFullName()); $tabs[] = $fullName; $ssn = new TextTab(); $ssn->setTabLabel($prefix . 'ssn')->setValue($owner->getSsnTin()); $tabs[] = $ssn; $dob = new TextTab(); $dob->setTabLabel($prefix . 'dob')->setValue($owner->getBirthDate()->format('m-d-Y')); $tabs[] = $dob; $homeStreet = new TextTab(); $homeStreet->setTabLabel($prefix . 'home_address_street')->setValue($owner->getStreet()); $tabs[] = $homeStreet; $homeCity = new TextTab(); $homeCity->setTabLabel($prefix . 'home_address_city')->setValue($owner->getCity()); $tabs[] = $homeCity; $homeState = new TextTab(); $homeState->setTabLabel($prefix . 'home_address_state')->setValue($owner->getState() ? $owner->getState()->getName() : ''); $tabs[] = $homeState; $homeZip = new TextTab(); $homeZip->setTabLabel($prefix . 'home_address_zip')->setValue($owner->getZip()); $tabs[] = $homeZip; $primaryPhone = new TextTab(); $primaryPhone->setTabLabel($prefix . 'primary_phone_number')->setValue($owner->getPhoneNumber()); $tabs[] = $primaryPhone; $emailAddress = new TextTab(); $emailAddress->setTabLabel($prefix . 'email_address')->setValue($owner->getEmail()); $tabs[] = $emailAddress; // If is different mailing address if ($owner->getIsDifferentAddress()) { $mailingStreet = new TextTab(); $mailingStreet->setTabLabel($prefix . 'mailing_address_street')->setValue($owner->getMailingStreet()); $tabs[] = $mailingStreet; $mailingCity = new TextTab(); $mailingCity->setTabLabel($prefix . 'mailing_address_city')->setValue($owner->getMailingCity()); $tabs[] = $mailingCity; $mailingState = new TextTab(); $mailingState->setTabLabel($prefix . 'mailing_address_state')->setValue($owner->getMailingState() ? $owner->getMailingState()->getName() : ''); $tabs[] = $mailingState; $mailingZip = new TextTab(); $mailingZip->setTabLabel($prefix . 'mailing_address_zip')->setValue($owner->getMailingZip()); $tabs[] = $mailingZip; } // Check employment type $employmentType = $owner->getEmploymentType(); if ($employmentType === Profile::CLIENT_EMPLOYMENT_TYPE_RETIRED || $employmentType === Profile::CLIENT_EMPLOYMENT_TYPE_UNEMPLOYED) { $employmentStatus = new RadioGroupTab(); $employmentStatus->setGroupName($prefix . 'employment_status')->setValue(strtolower($employmentType))->setSelected(true); $tabs[] = $employmentStatus; $incomeSource = new TextTab(); $incomeSource->setTabLabel($prefix . 'source_of_income')->setValue($owner->getIncomeSource()); $tabs[] = $incomeSource; } elseif ($employmentType === Profile::CLIENT_EMPLOYMENT_TYPE_EMPLOYED || $employmentType === Profile::CLIENT_EMPLOYMENT_TYPE_SELF_EMPLOYED) { $employerName = new TextTab(); $employerName->setTabLabel($prefix . 'employer_name')->setValue($owner->getEmployerName()); $tabs[] = $employerName; $occupation = new TextTab(); $occupation->setTabLabel($prefix . 'occupation')->setValue($owner->getOccupation()); $tabs[] = $occupation; $businessType = new TextTab(); $businessType->setTabLabel($prefix . 'type_of_business')->setValue($owner->getBusinessType()); $tabs[] = $businessType; $employerStreet = new TextTab(); $employerStreet->setTabLabel($prefix . 'employer_address_street')->setValue($owner->getEmployerAddress()); $tabs[] = $employerStreet; $employerCity = new TextTab(); $employerCity->setTabLabel($prefix . 'employer_address_city')->setValue($owner->getEmploymentCity()); $tabs[] = $employerCity; $employerState = new TextTab(); $employerState->setTabLabel($prefix . 'employer_address_state')->setValue($owner->getEmploymentState() ? $owner->getEmploymentState()->getName() : ''); $tabs[] = $employerState; $employerZip = new TextTab(); $employerZip->setTabLabel($prefix . 'employer_address_zip')->setValue($owner->getEmploymentZip()); $tabs[] = $employerZip; } $isUsCitizen = new RadioGroupTab(); $isUsCitizen->setGroupName($prefix . 'is_us_citizen')->setValue('yes')->setSelected(true); $tabs[] = $isUsCitizen; if ($owner->getIsSeniorPoliticalFigure()) { $isSeniorPoliticalFigure = new CheckboxTab(); $isSeniorPoliticalFigure->setTabLabel($prefix . 'is_senior_political_figure')->setSelected(true); $fields = $owner->getSeniorSpfName() . ', ' . $owner->getSeniorPoliticalTitle() . ', ' . $owner->getSeniorAccountOwnerRelationship() . ', ' . $owner->getSeniorCountryOffice(); $spfFields = new TextTab(); $spfFields->setTabLabel($prefix . 'spf_fields')->setValue($fields); $tabs[] = $isSeniorPoliticalFigure; $tabs[] = $spfFields; } return $tabs; }
/** * Generate collection of tabs * * @return TabCollection */ public function generate() { $client = $this->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($this->account->getAccountNumber()); $tabs[] = $accountNumber; $accountOwner = $this->account->getPrimaryApplicant(); $transferInformation = $this->account->getTransferInformation(); $accountTitleTab = new TextTab(); $accountTitleTab->setTabLabel('account_title')->setValue($this->account->getTypeString()); $tabs[] = $accountTitleTab; $ssnTab = new TextTab(); $ssnTab->setTabLabel('ssn')->setValue($accountOwner->getSsnTin()); $tabs[] = $ssnTab; $accountType = $this->getAccountTypeTabValue(); $accountTypeTab = new RadioGroupTab(); $accountTypeTab->setGroupName('account_type')->setValue($accountType)->setSelected(true); $tabs[] = $accountTypeTab; // Information on the account transferring from $accountTitle = $transferInformation->getAccountTitle() . ' ' . $this->account->getTypeName(); $transferFromAccountTitleTab = new TextTab(); $transferFromAccountTitleTab->setTabLabel('transfer_from_account_title')->setValue($accountTitle); $tabs[] = $transferFromAccountTitleTab; $transferFromAccountNumberTab = new TextTab(); $transferFromAccountNumberTab->setTabLabel('transfer_from_account_number')->setValue($transferInformation->getAccountNumber()); $tabs[] = $transferFromAccountNumberTab; $transferFromFirmTab = new TextTab(); $transferFromFirmTab->setTabLabel('transfer_from_delivering_firm_name')->setValue($transferInformation->getFinancialInstitution()); $tabs[] = $transferFromFirmTab; $transferFromFirmAddressTab = new TextTab(); $transferFromFirmAddressTab->setTabLabel('transfer_from_firm_address')->setValue($transferInformation->getFirmAddress()); $tabs[] = $transferFromFirmAddressTab; $transferFromFirmPhoneTab = new TextTab(); $transferFromFirmPhoneTab->setTabLabel('transfer_from_phone_number')->setValue($transferInformation->getPhoneNumber()); $tabs[] = $transferFromFirmPhoneTab; $transferFromAccountTypeTab = new RadioGroupTab(); $transferFromAccountTypeTab->setGroupName('transfer_from_account_type')->setValue($accountType)->setSelected(true); $tabs[] = $transferFromAccountTypeTab; // -------------------------------------------- $brokerageFirmTransferTypeTab = new RadioGroupTab(); $brokerageFirmTransferTypeTab->setGroupName('brokerage_firm_transfer_type')->setValue('full')->setSelected(true); $tabs[] = $brokerageFirmTransferTypeTab; $bankTransferTypeTab = new RadioGroupTab(); $bankTransferTypeTab->setGroupName('bank_transfer_type')->setValue('full')->setSelected(true); $tabs[] = $bankTransferTypeTab; $depositCertificatesTab = new RadioGroupTab(); $depositCertificatesTab->setGroupName('deposit_certificates')->setValue('redeem_cd_immediately')->setSelected(true); $tabs[] = $depositCertificatesTab; $deliveringAccountTitle = $transferInformation->getDeliveringAccountTitle(); $ameritradeAccountTitle = $transferInformation->getAmeritradeAccountTitle(); if (strlen($deliveringAccountTitle) > 0) { $deliveringAccountTitleTab = new TextTab(); $deliveringAccountTitleTab->setTabLabel('delivering_account_title')->setValue($deliveringAccountTitle); $tabs[] = $deliveringAccountTitleTab; } if (strlen($ameritradeAccountTitle) > 0) { $ameritradeAccountTitleTab = new TextTab(); $ameritradeAccountTitleTab->setTabLabel('td_ameritrade_account_title')->setValue($ameritradeAccountTitle); $tabs[] = $ameritradeAccountTitleTab; } return new TabCollection($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; }
/** * 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; }
/** * 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); }