function get_item_id($item_name) { $item_list = make_get_call("items"); foreach ($item_list as $key => $value) { if (strtolower($value) == $item_name) { return $key; } } return $item_list; }
function send_notifications($vendor_id, $item_id) { $requests = make_get_call("request_ID"); $outgoing; foreach ($requests as $key => $value) { if ($value->{"notify"} == TRUE and $value->{"vendor_id"} == $vendor_id and $value->{"item_id"} == $item_id) { /*$client->account->messages->create(array( 'To' => $value->{"phone"}, 'From' => $account_phone, 'Body' => "Hey there! " . $vendor_id . " has " . $item_id . " in stock now!", ));*/ //update notify sent $outgoing = "hey"; } } return $outgoing; }
echo "\n \n"; echo "###########################################\n"; echo "Voiding Authorization ...\n"; $void = array(); $json = json_encode($void); $json_resp = make_post_call($void_url, $json); echo "Void processed " . $json_resp['id'] . " with state '" . $json_resp['state'] . "'"; echo "\n \n"; echo "###########################################\n"; echo "Obtaining Authorization details...\n"; $json_resp = make_get_call($auth_detail_url); echo "Authorization details obtained for: " . $json_resp['id'] . " with state '" . $json_resp['state'] . "'"; echo "\n \n"; echo "###########################################\n"; echo "Obtaining parent Payment Details for the Authorization ... \n"; $json_resp = make_get_call($payment_detail_url); $related_resource_count = 0; $related_resources = ""; foreach ($json_resp['transactions'] as $transaction) { if ($transaction['related_resources']) { $related_resource_count = count($transaction['related_resources']); foreach ($transaction['related_resources'] as $related_resource) { if ($related_resource['authorization']) { $related_resources = $related_resources . "authorization "; } else { if ($related_resource['capture']) { $related_resources = $related_resources . "capture "; } else { if ($related_resource['refund']) { $related_resources = $related_resources . "refund "; }