コード例 #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, '');
 }
コード例 #2
0
 /**
  * Submits a merchant application
  * 
  * @param MerchantApplication $vo_merch_app the merchant application
  * @return array of the merchant application
  * @throws BaseCommerceClientException if invalid credentials were given or if there was an internal server error. Please contact tech support if there is an internal server error.
  * @author Rob Kurst <*****@*****.**>
  */
 public function submitApplication(MerchantApplication $vo_merch_app)
 {
     $o_triple_des = new TripleDESService($this->is_key);
     $o_query = array();
     $o_query['gateway_username'] = $this->is_gateway_username;
     $o_query['gateway_password'] = $this->is_gateway_password;
     $o_query['payload'] = $o_triple_des->encrypt($vo_merch_app->getJSON());
     $s_query = json_encode($o_query);
     $response = $this->do_post_request('/pcms/?f=newSubmitApplication', $s_query, $o_triple_des, 0);
     //        printf("well");
     //        print_r($response);
     //        printf("well2\n");
     $o_merchant_applications = array();
     for ($n_index = 0, $n_size = count($response); $n_index < $n_size; $n_index++) {
         array_push($o_merchant_applications, MerchantApplication::buildFromJSON($response[$n_index]));
     }
     return $o_merchant_applications;
 }
コード例 #3
0
 public static function buildFromJSON($vo_json)
 {
     $o_merch_app = new MerchantApplication();
     if (array_key_exists("merchant_application_salesforce_id", $vo_json)) {
         $o_merch_app->setSalesforceID($vo_json["merchant_application_salesforce_id"]);
     }
     if (array_key_exists("merchant_application_account", $vo_json)) {
         //        if ( array_key_exists( "merchant_application_account", $vo_json ) ) {
         //        if
         //            var_dump( $vo_json[ "merchant_application_account" ] );
         $o_merch_app->setAccount(Account::buildFromJSON($vo_json["merchant_application_account"]));
     } else {
         //var_dump( "welp, this sucks" );
         //var_dump( $vo_json["merchant_application_accounts"] );
     }
     if (array_key_exists("merchant_application_locations", $vo_json)) {
         $o_locations = $vo_json["merchant_application_locations"];
         for ($n_index = 0, $n_size = count($o_locations); $n_index < $n_size; $n_index++) {
             //var_dump( $o_locations[ $n_index ] );
             $o_location = Location::buildFromJSON($o_locations[$n_index]);
             $o_merch_app->addLocation($o_location);
         }
     }
     if (array_key_exists("merchant_application_response_messages", $vo_json)) {
         foreach ($vo_json["merchant_application_response_messages"] as $key => $val) {
             $o_merch_app->addResponseMessage($key, $val);
         }
         //            $o_response_messages = $vo_json[ "merchant_application_response_messages" ];
         //            for ( $n_index = 0, $n_size = count( $o_response_messages ); $n_index < $n_size; $n_index++ ) {
         //                $o_merch_app->addResponseMessage( $o_response_messages[ $n_index ] );
         //            }
     }
     if (array_key_exists("merchant_application_response_code", $vo_json)) {
         $o_merch_app->setResponseCode($vo_json["merchant_application_response_code"]);
     }
     if (array_key_exists("merchant_application_api_version", $vo_json)) {
         $o_merch_app->setApiVersion($vo_json["merchant_application_api_version"]);
     }
     if (array_key_exists("merchant_application_key", $vo_json)) {
         $o_merch_app->setKey($vo_json["merchant_application_key"]);
     }
     if (array_key_exists("merchant_application_id", $vo_json)) {
         $o_merch_app->setId($vo_json["merchant_application_id"]);
     }
     if (array_key_exists("merchant_application_code", $vo_json)) {
         $o_merch_app->setCode($vo_json["merchant_application_code"]);
     }
     return $o_merch_app;
 }