/**
  * Get the details of the list of business passed in the construtor
  *
  */
 public function get()
 {
     $business_id_array = $this->_business_id_array;
     $domain_name = $this->_domain_name;
     $result = array();
     foreach ($business_id_array as $business_id) {
         $attributes = SimpleDbPersister::getAttributes($domain_name, $business_id, array("business_name", "business_id"));
         if (empty($attributes) === TRUE) {
             continue;
         }
         $record = array();
         foreach ($attributes as $attribute) {
             $attribute_name = $attribute["Name"];
             $attribute_value = $attribute["Value"];
             $record[$attribute_name] = $attribute_value;
         }
         array_push($result, $record);
     }
     return $result;
 }
    return;
}
//If a new business entry, check whether it exists already
if ($is_update_operation === FALSE && CoreAttributesUtils::exists($data) === TRUE) {
    $error_json = array("status" => "error", "error" => "Business already exists");
    echo json_encode($error_json);
    return;
}
//If an update operation, don't re-generate business_id and set $replace to true
if ($is_update_operation === TRUE) {
    $attributes = SimpleDbUtils::genSimpleDbAttributesArray($data, true);
} else {
    $is_busines_id_already_taken = false;
    /* Check whether the unique business id that is generated is already not
     * taken.
     */
    do {
        $business_id = BusinessIdGenerator::generate($data["pincode"]);
        $data["business_id"] = $business_id;
        $result = SimpleDbPersister::getAttributes($domain_name, $business_id, array("business_id"));
        $is_business_id_already_taken = empty($result) ? false : true;
    } while ($is_business_id_already_taken === TRUE);
    $attributes = SimpleDbUtils::genSimpleDbAttributesArray($data);
}
$message = CoreAttributesUtils::generateSMSMessage($data);
SMS::send($sms_number, $message);
$business_id = $data["business_id"];
SimpleDbPersister::save($domain_name, $business_id, $attributes);
$success_json = array("status" => "success", "business_id" => $business_id, "created_by_user" => $data["created_by_user"], "created_time" => $data["created_time"]);
echo json_encode($success_json);
return;
<?php

require_once "config.php";
use citibytes\ChainList;
use citibytes\Environment;
use citibytes\utils\SimpleDbUtils;
use citibytes\persister\SimpleDbPersister;
$chain_name = $_REQUEST["chain_name"];
$domain_name = Environment::getChainListDomain();
if (empty($chain_name) === TRUE) {
    $error_json = array("status" => "error", "error" => "chain_name parameter cannot be empty");
    echo json_encode($error_json);
    return;
}
$chain_list = new ChainList();
$item_name = $chain_name;
$result = SimpleDbPersister::getAttributes($domain_name, $item_name);
if (empty($result) === TRUE) {
    $chain_list->save($chain_name);
    $success_json = array("status" => "success");
    echo json_encode($success_json);
} else {
    $error_json = array("status" => "error", "error" => "Chain name already exists");
    echo json_encode($error_json);
}
 private function getBusinessDetails($business_id)
 {
     $domain_name = $this->_domain_name;
     $attributes = SimpleDbPersister::getAttributes($domain_name, $business_id);
     return $attributes;
 }
<?php

//Temporary code till SMS gets fixed
date_default_timezone_set("Asia/Calcutta");
//
require_once "config.php";
use citibytes\Environment;
use citibytes\utils\SimpleDbUtils;
use citibytes\persister\SimpleDbPersister;
use citibytes\CoreAttributesSchemaValidator;
$otp = $_REQUEST["otp"];
$business_id = $_REQUEST["business_id"];
$domain_name = Environment::getCoreAttirbutesDomain();
$result = SimpleDbPersister::getAttributes($domain_name, $business_id, array("otp", "last_updated_time"));
if (empty($result) === TRUE) {
    $error_json = array("status" => "error", "error" => "{$business_id} business id doesn't exist");
    echo json_encode($error_json);
    return;
}
/* Temporary code till SMS gets fixed. 
 *	Loop to get value of otp and last_updated_time from simpledb
 */
if ($result[1]["Name"] === "otp") {
    $last_updated_time = $result[0]["Value"];
    $result[0]["Value"] = $result[1]["Value"];
} else {
    $last_updated_time = $result["1"]["Value"];
}
//
/* Temporary code till SMS gets fixed.
 * Have a default OTP of 00000 if SMS not delivered after 1 minute