Ejemplo n.º 1
0
 public function merchant_application($data)
 {
     $errors = array();
     $results = array();
     $i = 0;
     // Instantiate State Model
     $States = new State();
     // Newest modification for Merchant Application submission
     foreach ($data['Property'] as $property) {
         // Create client
         $o_bcpc = new BaseCommerceClient(RENTSQUARE_PARTNER_USER, RENTSQUARE_PARTNER_PASS, RENTSQUARE_PARTNER_KEY);
         $o_bcpc->setSandbox(BC_SANDBOXVALUE);
         $o_merch_app = new MerchantApplication();
         $o_account = new Account();
         // Account & Address infno
         //$o_account->setAccountName( $property['legal_name'] );
         $o_account->setAccountName("RentSquare LLC");
         $o_account->setAcceptACH(true);
         $o_account->setAcceptBC(true);
         // Legal Address
         $legal_state = $States->findById($property['legal_state_id']);
         $legal_state = $legal_state['State']['abbr'];
         $state_inc = $States->findById($property['state_inc']);
         $state_inc = $state_inc['State']['abbr'];
         $home_state = $States->findById($data['User']['state_id']);
         $home_state = $home_state['State']['abbr'];
         switch ($property['ownership_type']) {
             case 0:
                 $ownership_type = 'Corporation';
                 break;
             case 1:
                 $ownership_type = 'LLC';
                 break;
             case 2:
                 $ownership_type = 'Partnership';
                 $state_inc = 'N/A';
                 break;
             case 3:
                 $ownership_type = 'Sole Proprietor';
                 $property['legal_ein'] = $data['User']['ssn'];
                 $state_inc = 'N/A';
                 break;
         }
         $o_legal_address = new Address(Address::$XS_ADDRESS_NAME_LEGAL);
         //$o_legal_address->setLine1( $property['legal_street'] );
         //$o_legal_address->setCity( $property['legal_city'] );
         //$o_legal_address->setState( $legal_state );
         //$o_legal_address->setZipcode( $property['legal_zip'] );
         $o_legal_address->setLine1("218 S. Formosa Ave");
         $o_legal_address->setCity("Los Angeles");
         $o_legal_address->setState("CA");
         $o_legal_address->setZipcode("90036");
         $o_legal_address->setCountry("USA");
         $o_account->setLegalAddress($o_legal_address);
         //$o_account->setAccountPhoneNumber( $property['legal_phone'] );
         //$o_account->setCustomerServicePhoneNumber( $data['User']['phone'] );
         //$o_account->setEIN( $property['legal_ein'] );
         $o_account->setAccountPhoneNumber("303-809-6116");
         $o_account->setReferralPartnerID("a0Fi0000005jNJ3");
         //*** Hardcoded at BC
         $o_account->setCongaTemplateId("a0d310000006iKoi");
         //*** Hardcoded at BC
         $o_account->setCustomerServicePhoneNumber("303-809-6116");
         $o_account->setDBA($property['legal_dba']);
         $o_account->setEntityType(Account::$XS_ENTITY_TYPE_CORP);
         $o_account->setAssociationNumber("268000");
         $o_account->setEIN("452501975");
         $o_account->setIpAddressOfAppSubmission("192.168.0.1");
         //*** Hardcoded at BC
         $o_account->setWebsite('http://rentsquare.com');
         // Settlement Account Bank Info
         $o_account->setSettlementAccountBankName($property['bank_name']);
         $o_account->setSettlementAccountBankPhone('');
         //** TODO  Required I think - need to add to form?
         $o_account->setSettlementAccountName($property['legal_name']);
         $o_account->setSettlementAccountNumber($property['bank_account_num']);
         $o_account->setSettlementAccountRoutingNumber($property['routing_number']);
         $o_account->setSettlementSameAsFeeAccount(true);
         $o_merch_app->setAccount($o_account);
         $o_dba_address = new Address(Address::$XS_ADDRESS_NAME_DBA);
         $o_dba_address->setLine1($property['legal_street']);
         $o_dba_address->setCity($property['legal_city']);
         $o_dba_address->setState($state_inc);
         //** Should this be legal state??
         $o_dba_address->setZipcode($property['legal_zip']);
         $o_dba_address->setCountry("USA");
         $o_location = new Location();
         $o_location->setContactSameAsOwner(true);
         $o_location->setDescriptionOfProductsAndServices("Property Management Services");
         $o_location->setDBAAddress($o_dba_address);
         //$o_location->setDescription( Location::$XS_DESCRIPTION_CONSULTING );	// Dont see in Angela's document
         //$o_cal = Calendar->getInstance();						//*** Hardcoded at BC
         //$o_cal->add( Calendar->YEAR, -2 );						//*** Hardcoded at BC
         //$o_year = $o_cal->getTime();						//*** Hardcoded at BC
         //$o_location->setEntityStartDate( $o_year );					//*** Hardcoded at BC
         $o_location->setEntityState($legal_state);
         //** Should this be legal state??
         $o_location->setSalesAgentName('Sean Perlmutter');
         $o_location->setProgramPricing('RentSquare');
         $o_location->setProgramDetails('Fees Billed to Partner');
         $o_contact = new PrincipalContact();
         $o_contact->setLastName($data['User']['last_name']);
         $o_contact->setFirstName($data['User']['first_name']);
         $o_mailing = new Address(Address::$XS_ADDRESS_NAME_MAILING);
         $o_mailing->setLine1($data['User']['street']);
         $o_mailing->setCity($data['User']['city']);
         $o_mailing->setState($home_state);
         $o_mailing->setZipcode($data['User']['zip']);
         $o_mailing->setCountry("USA");
         $o_contact->setMailingAddress($o_mailing);
         $o_contact->setPhoneNumber($data['User']['phone']);
         $o_contact->setMobilePhoneNumber($data['User']['phone']);
         $o_contact->setEmail($data['User']['email']);
         $o_contact->setTitle("Property Manager");
         //  This 'new' call is not valid - causing fatal error - passing in DOB from applicaiton instead
         //$o_cal = new Calendar();
         //$o_cal->getInstance();
         //$o_cal->add( Calendar.YEAR, -60 );
         //$o_bday = $o_cal->getTime();
         $o_bday = $data['User']['dob'] . " 00:00:00";
         $o_contact->setBirthdate($o_bday);
         $o_contact->setAuthorizedUser(true);
         $o_contact->setAccountSigner(true);
         $o_contact->setOwnershipPercentage(100);
         $o_contact->setSSN($data['User']['ssn']);
         $o_contact->setIsPrimary(true);
         $o_location->addPrincipalContact($o_contact);
         $o_ach_details = new ACHDetails();
         $o_ach_details->setTransactionFee('3.95');
         $o_ach_details->setAverageTicketAmount($property['average_rent']);
         $o_ach_details->setMaxSingleTransactionAmount($property['average_rent'] * 3);
         $o_ach_details->setAverageMonthlyAmount($property['num_units'] * floatval($property['average_rent']));
         $o_ach_details->setMaxDailyAmount($property['num_units'] * floatval($property['average_rent']) * 3);
         $o_ach_details->setAuthMethodOnlinePercentage('100');
         $o_ach_details->setCompanyNameDescriptor('Same_As_legal');
         $o_ach_details->setDescriptor('RentSquare');
         $o_ach_details->addSubmissionMethod('Online');
         $o_ach_details->addPaymentToFrom('');
         $o_ach_details->setMerchantReports('true');
         $o_ach_details->setPaymentUrl('http://rentsquare.com');
         $o_ach_details->setIssueCredits('true');
         $o_ach_details->setIssueDebits('true');
         $o_location->setACHDetails($o_ach_details);
         $o_bc_details = new BankCardDetails();
         $o_bc_details->setAcceptAmex(false);
         $o_bc_details->addDebitBrandsRequested("Visa,MasterCard,Discover Network,Credit,Debit");
         $o_bc_details->setFeeOther("ie Annual Fee collected in month 3");
         //** Not Sure If this is RIGHT
         $o_bc_details->setAverageMonthlyVolume(urlencode(floatval($property['num_units']) * floatval($property['average_rent'])));
         $o_bc_details->setMaxTicket(150);
         $o_bc_details->setMaxMonthlyVolume(4000);
         $o_bc_details->setPaymentUrl("https://www.url.com/payment");
         $o_bc_details->setRecurring(true);
         $o_bc_details->setRetrievalFee(7.5);
         $o_bc_details->setWirelessFee(5);
         $o_bc_details->setCardholderCharged(BankCardDetails::$XS_CARDHOLDER_CHARGED_PURCHASE);
         $o_bc_details->setCardholderDataStoredLocally(false);
         $o_bc_details->setPreviouslyTerminatedAsVisaMastercardMerchant(false);
         $o_bc_details->setVisaMastercardSignage(true);
         $o_bc_details->set3rdPartyAccessToCardholderData(false);
         $o_bc_details->setMailOrderPercentage(0);
         $o_bc_details->setTelephoneOrderPercentage(0);
         $o_bc_details->setDuplicates(false);
         $o_bc_details->setUnpaidItemFee(30);
         $o_bc_details->setAuthorizationFee(0.25);
         $o_location->setBankCardDetails($o_bc_details);
         $o_merch_app->addLocation($o_location);
         $o_bc = $o_bcpc->submitApplication($o_merch_app);
         try {
             foreach ($o_bc as $merchAppObj) {
                 $status = $merchAppObj->getResponseCode();
                 $messages = $merchAppObj->getResponseMessages();
                 if ($status != "200") {
                     return array($status, $messages);
                 }
             }
         } catch (Exeption $e) {
             $status = 0;
             $messages = $e->getMessage();
             return array($status, $messages);
         }
     }
     // end foreach
     return array(1, '');
 }
Ejemplo n.º 2
0
 static function buildFromJSON($vo_json)
 {
     $o_ach_details = new ACHDetails();
     if (array_key_exists("ach_details_auth_method_conversion_percentage", $vo_json)) {
         $o_ach_details->setAuthMethodConversionPercentage($vo_json["ach_details_auth_method_conversion_percentage"]);
     }
     if (array_key_exists("ach_details_auth_method_online_percentage", $vo_json)) {
         $o_ach_details->setAuthMethodOnlinePercentage($vo_json["ach_details_auth_method_online_percentage"]);
     }
     if (array_key_exists("ach_details_auth_method_verbal_percentage", $vo_json)) {
         $o_ach_details->setAuthMethodVerbalPercentage($vo_json["ach_details_auth_method_verbal_percentage"]);
     }
     if (array_key_exists("ach_details_average_monthly_amount", $vo_json)) {
         $o_ach_details->setAverageMonthlyAmount($vo_json["ach_details_average_monthly_amount"]);
     }
     if (array_key_exists("ach_details_average_ticket_amount", $vo_json)) {
         $o_ach_details->setAverageTicketAmount($vo_json["ach_details_average_ticket_amount"]);
     }
     if (array_key_exists("ach_details_chargeback_fee", $vo_json)) {
         $o_ach_details->setChargebackFee($vo_json["ach_details_chargeback_fee"]);
     }
     if (array_key_exists("ach_details_collections_service_fee", $vo_json)) {
         $o_ach_details->setCollectionsServiceFee($vo_json["ach_details_collections_service_fee"]);
     }
     if (array_key_exists("ach_details_company_name_descriptor", $vo_json)) {
         $o_ach_details->setCompanyNameDescriptor($vo_json["ach_details_company_name_descriptor"]);
     }
     if (array_key_exists("ach_details_descriptor", $vo_json)) {
         $o_ach_details->setDescriptor($vo_json["ach_details_descriptor"]);
     }
     if (array_key_exists("ach_details_discount_rate", $vo_json)) {
         $o_ach_details->setDiscountRate($vo_json["ach_details_discount_rate"]);
     }
     if (array_key_exists("ach_details_issue_credits", $vo_json)) {
         $o_ach_details->setIssueCredits($vo_json["ach_details_issue_credits"]);
     }
     if (array_key_exists("ach_details_issue_debits", $vo_json)) {
         $o_ach_details->setIssueDebits($vo_json["ach_details_issue_debits"]);
     }
     if (array_key_exists("ach_details_max_daily_amount", $vo_json)) {
         $o_ach_details->setMaxDailyAmount($vo_json["ach_details_max_daily_amount"]);
     }
     if (array_key_exists("ach_details_max_daily_transactions", $vo_json)) {
         $o_ach_details->setMaxDailyTransactions($vo_json["ach_details_max_daily_transactions"]);
     }
     if (array_key_exists("ach_details_max_monthly_amount", $vo_json)) {
         $o_ach_details->setMaxMonthlyAmount($vo_json["ach_details_max_monthly_amount"]);
     }
     if (array_key_exists("ach_details_max_monthly_transactions", $vo_json)) {
         $o_ach_details->setMaxMonthlyTransactions($vo_json["ach_details_max_monthly_transactions"]);
     }
     if (array_key_exists("ach_details_max_single_transaction_amount", $vo_json)) {
         $o_ach_details->setMaxSingleTransactionAmount($vo_json["ach_details_max_single_transaction_amount"]);
     }
     if (array_key_exists("ach_details_monthly_fee", $vo_json)) {
         $o_ach_details->setMonthlyFee($vo_json["ach_details_monthly_fee"]);
     }
     if (array_key_exists("ach_details_monthly_minimum_fee", $vo_json)) {
         $o_ach_details->setMonthlyMinimumFee($vo_json["ach_details_monthly_minimum_fee"]);
     }
     if (array_key_exists("ach_details_payer_auth", $vo_json)) {
         $o_ach_details->setPayerAuth($vo_json["ach_details_payer_auth"]);
     }
     if (array_key_exists("ach_details_proof_of_auth_fee", $vo_json)) {
         $o_ach_details->setProofOfAuthFee($vo_json["ach_details_proof_of_auth_fee"]);
     }
     if (array_key_exists("ach_details_payment_to_from", $vo_json)) {
         $o_payment_to_from = $vo_json["ach_details_payment_to_from"];
         for ($n_index = 0, $n_size = count($o_payment_to_from); $n_index < $n_size; $n_index++) {
             $o_ach_details->addPaymentToFrom($o_payment_to_from[$n_index]);
         }
     }
     if (array_key_exists("ach_details_payment_url", $vo_json)) {
         $o_ach_details->setPaymentUrl($vo_json["ach_details_payment_url"]);
     }
     if (array_key_exists("ach_details_recurring", $vo_json)) {
         $o_ach_details->setRecurring($vo_json["ach_details_recurring"]);
     }
     if (array_key_exists("ach_details_return_fee", $vo_json)) {
         $o_ach_details->setReturnFee($vo_json["ach_details_return_fee"]);
     }
     if (array_key_exists("ach_details_submission_methods", $vo_json)) {
         $o_submission_methods = $vo_json["ach_details_submission_methods"];
         for ($n_index = 0, $n_size = count($o_submission_methods); $n_index < $n_size; $n_index++) {
             $o_ach_details->addSubmissionMethod($o_submission_methods[$n_index]);
         }
     }
     if (array_key_exists("ach_details_termination_fee", $vo_json)) {
         $o_ach_details->setTerminationFee($vo_json["ach_details_termination_fee"]);
     }
     if (array_key_exists("ach_details_transaction_fee", $vo_json)) {
         $o_ach_details->setTransactionFee($vo_json["ach_details_transaction_fee"]);
     }
     if (array_key_exists("ach_details_unauth_return", $vo_json)) {
         $o_ach_details->setUnauthReturn($vo_json["ach_details_unauth_return"]);
     }
     if (array_key_exists("ach_details_submission_methods", $vo_json)) {
         $o_fees_client_requests = $vo_json["ach_details_fees_client_requests"];
         for ($n_index = 0, $n_size = count($o_fees_client_requests); $n_index < $n_size; $n_index++) {
             $o_ach_details->addFeesClientRequests($o_fees_client_requests[$n_index]);
         }
     }
     if (array_key_exists("ach_details_merchant_reports", $vo_json)) {
         $o_ach_details->setMerchantReports($vo_json["ach_details_merchant_reports"]);
     }
     if (array_key_exists("ach_details_payment_url_2", $vo_json)) {
         $o_ach_details->setPaymentUrl2($vo_json["ach_details_payment_url_2"]);
     }
     if (array_key_exists("ach_details_url_passwords", $vo_json)) {
         $o_ach_details->setUrlPasswords($vo_json["ach_details_url_passwords"]);
     }
     if (array_key_exists("ach_details_has_current_processor", $vo_json)) {
         $o_ach_details->setHasCurrentProcessor($vo_json["ach_details_has_current_processor"]);
     }
     if (array_key_exists("ach_details_username", $vo_json)) {
         $o_ach_details->setUsername($vo_json["ach_details_username"]);
     }
     if (array_key_exists("ach_details_password", $vo_json)) {
         $o_ach_details->setPassword($vo_json["ach_details_password"]);
     }
     if (array_key_exists("ach_details_in_person_signature", $vo_json)) {
         $o_ach_details->setInPersonSignaturePercentage($vo_json["ach_details_in_person_signature"]);
     }
     if (array_key_exists("ach_details_duplicates", $vo_json)) {
         $o_ach_details->setDuplicates($vo_json["ach_details_duplicates"]);
     }
     if (array_key_exists("ach_details_current_processor", $vo_json)) {
         $o_ach_details->setCurrentProcessor($vo_json["ach_details_current_processor"]);
     }
     if (array_key_exists("ach_details_represent_fee", $vo_json)) {
         $o_ach_details->setRepresentFee($vo_json["ach_details_represent_fee"]);
     }
     if (array_key_exists("ach_details_auth_method_written_in_person_percentage", $vo_json)) {
         $o_ach_details->setAuthMethodWrittenInPersonPercentage($vo_json["ach_details_auth_method_written_in_person_percentage"]);
     }
     if (array_key_exists("ach_details_auth_method_written_in_faxed_percentage", $vo_json)) {
         $o_ach_details->setAuthMethodWrittenFaxedPercentage($vo_json["ach_details_auth_method_written_in_faxed_percentage"]);
     }
     if (array_key_exists("ach_details_fee_other", $vo_json)) {
         $o_ach_details->setFeeOther($vo_json["ach_details_fee_other"]);
     }
     if (array_key_exists("ach_details_payment_url_3", $vo_json)) {
         $o_ach_details->setPaymentUrl3($vo_json["ach_details_payment_url_3"]);
     }
     if (array_key_exists("ach_details_url_passwords_2", $vo_json)) {
         $o_ach_details->setUrlPasswords2($vo_json["ach_details_url_passwords_2"]);
     }
     if (array_key_exists("ach_details_url_passwords_3", $vo_json)) {
         $o_ach_details->setUrlPasswords3($vo_json["ach_details_url_passwords_3"]);
     }
     if (array_key_exists("ach_details_merchant_rep_email", $vo_json)) {
         $o_ach_details->setMerchantRepEmail($vo_json["ach_details_merchant_rep_email"]);
     }
     return $o_ach_details;
 }