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, ''); }
static function buildFromJSON($vo_json) { $o_bc_details = new BankCardDetails(); if (array_key_exists("bank_card_details_fee_other", $vo_json)) { $o_bc_details->setFeeOther($vo_json["bank_card_details_fee_other"]); } if (array_key_exists("bank_card_details_accept_amex", $vo_json)) { $o_bc_details->setAcceptAmex($vo_json["bank_card_details_accept_amex"]); } if (array_key_exists("bank_card_details_amex_average_monthly_volume", $vo_json)) { $o_bc_details->setAmexAverageMonthlyVolume($vo_json["bank_card_details_amex_average_monthly_volume"]); } if (array_key_exists("bank_card_details_amex_average_ticket_amount", $vo_json)) { $o_bc_details->setAmexAverageTicketAmount($vo_json["bank_card_details_amex_average_ticket_amount"]); } if (array_key_exists("bank_card_details_amex_cap_number", $vo_json)) { $o_bc_details->setAmexCapNumber($vo_json["bank_card_details_amex_cap_number"]); } if (array_key_exists("bank_card_details_amex_current_number", $vo_json)) { $o_bc_details->setAmexCurrentNumber($vo_json["bank_card_details_amex_current_number"]); } if (array_key_exists("bank_card_details_amex_max_high_ticket_amount", $vo_json)) { $o_bc_details->setAmexMaxHighTicketAmount($vo_json["bank_card_details_amex_max_high_ticket_amount"]); } if (array_key_exists("bank_card_details_amex_max_monthly_volume", $vo_json)) { $o_bc_details->setAmexMaxMonthlyVolume($vo_json["bank_card_details_amex_max_monthly_volume"]); } if (array_key_exists("bank_card_details_amex_transaction_fee", $vo_json)) { $o_bc_details->setAmexTransactionFee($vo_json["bank_card_details_amex_transaction_fee"]); } if (array_key_exists("bank_card_details_amex_auth_fee", $vo_json)) { $o_bc_details->setAmexAuthFee($vo_json["bank_card_details_amex_authorization_fee"]); } if (array_key_exists("bank_card_details_auth_fee", $vo_json)) { $o_bc_details->setAuthFee($vo_json["bank_card_details_authorization_fee"]); } if (array_key_exists("bank_card_details_avs", $vo_json)) { $o_bc_details->setAvs($vo_json["bank_card_details_avs"]); } if (array_key_exists("bank_card_details_average_monthly_voume", $vo_json)) { $o_bc_details->setAverageMonthlyVolume($vo_json["bank_card_details_average_monthly_voume"]); } if (array_key_exists("bank_card_details_average_ticket_amount", $vo_json)) { $o_bc_details->setAverageTicket($vo_json["bank_card_details_average_ticket_amount"]); } if (array_key_exists("bank_card_details_batch_settlement", $vo_json)) { $o_bc_details->setBatchSettlement($vo_json["bank_card_details_batch_settlement"]); } if (array_key_exists("bank_card_details_card_present_percentage", $vo_json)) { $o_bc_details->setCardPresentPercentage($vo_json["bank_card_details_card_present_percentage"]); } if (array_key_exists("bank_card_details_chargeback_fee", $vo_json)) { $o_bc_details->setChargebackFee($vo_json["bank_card_details_chargeback_fee"]); } if (array_key_exists("bank_card_details_flat_rate", $vo_json)) { $o_bc_details->setFlatRate($vo_json["bank_card_details_flat_rate"]); } if (array_key_exists("bank_card_details_gateway_access", $vo_json)) { $o_bc_details->setGatewayAccess($vo_json["bank_card_details_gateway_access"]); } if (array_key_exists("bank_card_details_gateway_transaction", $vo_json)) { $o_bc_details->setGatewayTransaction($vo_json["bank_card_details_gateway_transaction"]); } if (array_key_exists("bank_card_details_internet_percentage", $vo_json)) { $o_bc_details->setInternetPercentage($vo_json["bank_card_details_internet_percentage"]); } if (array_key_exists("bank_card_details_max_ticket", $vo_json)) { $o_bc_details->setMaxTicket($vo_json["bank_card_details_max_ticket"]); } if (array_key_exists("bank_card_details_max_monthly_volume", $vo_json)) { $o_bc_details->setMaxMonthlyVolume($vo_json["bank_card_details_max_monthly_volume"]); } if (array_key_exists("bank_card_details_mid_qual_rate", $vo_json)) { $o_bc_details->setMidQualRate($vo_json["bank_card_details_mid_qual_rate"]); } if (array_key_exists("bank_card_details_minimum_discount", $vo_json)) { $o_bc_details->setMinimumDiscount($vo_json["bank_card_details_minimum_discount"]); } if (array_key_exists("bank_card_details_monthly_fee", $vo_json)) { $o_bc_details->setMonthlyFee($vo_json["bank_card_details_monthly_fee"]); } if (array_key_exists("bank_card_details_non_qual_rate", $vo_json)) { $o_bc_details->setNonQualRate($vo_json["bank_card_details_non_qual_rate"]); } if (array_key_exists("bank_card_details_online_statement_fee", $vo_json)) { $o_bc_details->setOnlineStmtFee($vo_json["bank_card_details_online_statement_fee"]); } if (array_key_exists("bank_card_details_pci_compliance_monthly", $vo_json)) { $o_bc_details->setPciComplianceMonthly($vo_json["bank_card_details_pci_compliance_monthly"]); } if (array_key_exists("bank_card_details_pass_through_plus", $vo_json)) { $o_bc_details->setPassThroughPlus($vo_json["bank_card_details_pass_through_plus"]); } if (array_key_exists("bank_card_details_pin_debit_atm_transaction", $vo_json)) { $o_bc_details->setPinDebitAtmTransaction($vo_json["bank_card_details_pin_debit_atm_transaction"]); } if (array_key_exists("bank_card_details_payment_url", $vo_json)) { $o_bc_details->setPaymentUrl($vo_json["bank_card_details_payment_url"]); } if (array_key_exists("bank_card_details_qual_rate", $vo_json)) { $o_bc_details->setQualRate($vo_json["bank_card_details_qual_rate"]); } if (array_key_exists("bank_card_details_recurring", $vo_json)) { $o_bc_details->setRecurring($vo_json["bank_card_details_recurring"]); } if (array_key_exists("bank_card_details_transaction_fee", $vo_json)) { $o_bc_details->setTransactionFee($vo_json["bank_card_details_transaction_fee"]); } if (array_key_exists("bank_card_details_wireless_fee", $vo_json)) { $o_bc_details->setWirelessFee($vo_json["bank_card_details_wireless_fee"]); } if (array_key_exists("bank_card_details_cardholder_charged", $vo_json)) { $o_bc_details->setCardholderCharged($vo_json["bank_card_details_cardholder_charged"]); } if (array_key_exists("bank_card_details_cardholder_data_stored_locally", $vo_json)) { $o_bc_details->setCardholderDataStoredLocally($vo_json["bank_card_details_cardholder_data_stored_locally"]); } if (array_key_exists("bank_card_details_debit_signature_cards_requested", $vo_json)) { $o_debit_signature_cards = $vo_json["bank_card_details_debit_signature_cards_requested"]; for ($n_index = 0, $n_size = count($o_debit_signature_cards); $n_index < $n_size; $n_index++) { $o_bc_details->addDebitSignatureCardsRequested($o_debit_signature_cards[$n_index]); } } if (array_key_exists("bank_card_details_prev_term_as_a_visa_mc_merchant", $vo_json)) { $o_bc_details->setPreviouslyTerminatedAsVisaMastercardMerchant($vo_json["bank_card_details_prev_term_as_a_visa_mc_merchant"]); } if (array_key_exists("bank_card_details_visa_mc_signage", $vo_json)) { $o_bc_details->setVisaMastercardSignage($vo_json["bank_card_details_visa_mc_signage"]); } if (array_key_exists("bank_card_details_3rd_party_access_to_cardholder_data", $vo_json)) { $o_bc_details->set3rdPartyAccessToCardholderData($vo_json["bank_card_details_3rd_party_access_to_cardholder_data"]); } if (array_key_exists("bank_card_details_other_brands_requested", $vo_json)) { $o_other_brands = $vo_json["bank_card_details_other_brands_requested"]; for ($n_index = 0, $n_size = count($o_other_brands); $n_index < $n_size; $n_index++) { $o_bc_details->addOtherBrandsRequested($o_other_brands[$n_index]); } } if (array_key_exists("bank_card_details_mail_order_percentage", $vo_json)) { $o_bc_details->setMailOrderPercentage($vo_json["bank_card_details_mail_order_percentage"]); } if (array_key_exists("bank_card_details_telephone_order_percentage", $vo_json)) { $o_bc_details->setTelephoneOrderPercentage($vo_json["bank_card_details_telephone_order_percentage"]); } if (array_key_exists("bank_card_details_duplicates", $vo_json)) { $o_bc_details->setDuplicates($vo_json["bank_card_details_duplicates"]); } if (array_key_exists("bank_card_details_debit_brands_requested", $vo_json)) { $o_debit_brands = $vo_json["bank_card_details_debit_brands_requested"]; for ($n_index = 0, $n_size = count($o_debit_brands); $n_index < $n_size; $n_index++) { $o_bc_details->addDebitBrandsRequested($o_debit_brands[$n_index]); } } if (array_key_exists("bank_card_details_credit_signature_cards_requested", $vo_json)) { $o_credit_signature_cards_requested = $vo_json["bank_card_details_credit_signature_cards_requested"]; for ($n_index = 0, $n_size = count($o_credit_signature_cards_requested); $n_index < $n_size; $n_index++) { $o_bc_details->addCreditSignatureCardsRequested($o_credit_signature_cards_requested[$n_index]); } } if (array_key_exists("bank_card_details_credit_requested", $vo_json)) { $o_credit = $vo_json["bank_card_details_credit_requested"]; for ($n_index = 0, $n_size = count($o_credit); $n_index < $n_size; $n_index++) { $o_bc_details->addCreditRequested($o_credit[$n_index]); } } if (array_key_exists("bank_card_details_unpaid_item_fee", $vo_json)) { $o_bc_details->setUnpaidItemFee($vo_json["bank_card_details_unpaid_item_fee"]); } if (array_key_exists("bank_card_details_retrieval_fee", $vo_json)) { $o_bc_details->setRetrievalFee($vo_json["bank_card_details_retrieval_fee"]); } return $o_bc_details; }