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; }