コード例 #1
0
ファイル: TransactionMgmt.php プロジェクト: awgtek/myedb
	function get_checkout_form_xml()
	{
		//put together a record and pending transaction in one xml doc
		$doc = new DOMDocument('1.0', 'UTF-8');
		$doc->formatOutput = true;
		$checkout_form = $doc->createElement('checkout_form');
		$checkout_form = $doc->appendChild($checkout_form);
		//add user record xml
		$user_rec_doc = new DOMDocument('1.0','UTF-8');
		$eidsrc_rec_xml = TransMgmt_RecordsSystem::get_record_xml(TransMgmt_SecuritySystem::get_user_eid());
		$user_rec_doc->loadXML($eidsrc_rec_xml);
		$user_node = $doc->importNode($user_rec_doc->firstChild,true);
		$checkout_form->appendChild($user_node);
		//add transactions
		$trans_recs_doc = new DOMDocument('1.0','UTF-8');
		$trans_xml = $this->get_transactions();
		$trans_recs_doc->loadXML($trans_xml);
		$transactions_node = $doc->importNode($trans_recs_doc->firstChild,true);
		$checkout_form->appendChild($transactions_node);
		$xml_string = $doc->saveXML();
		return $xml_string;
	}
コード例 #2
0
ファイル: TravelProcessor.php プロジェクト: awgtek/myedb
	function initiate_travel_order()
	{
		$doc = new DOMDocument('1.0','UTF-8');
		$doc->formatOutput = true;
		
		$travel_res_info = $doc->createElement($this->details_encap_elem);
		$travel_res_info = $doc->appendChild($travel_res_info);
		
		$travel_res_submitted_fields = $doc->createElement('travel_res_submitted_fields');
		$travel_res_submitted_fields = $travel_res_info->appendChild($travel_res_submitted_fields);
		
		foreach ($_REQUEST as $post_key => $post_val)
		{
			$post_val = myedb_strip_slashes($post_val);
			if (ereg("^travel_res__(.*)$",$post_key,$regs))
			{
				$travel_res_submit_field = $doc->createElement('travel_res_submit_field');
				$travel_res_submit_field = $travel_res_submitted_fields->appendChild($travel_res_submit_field);
				$travel_res_submit_field->setAttribute("res_field_name",$post_key);
				$res_field_value = $doc->createElement('res_field_value');
				$res_field_value = $travel_res_submit_field->appendChild($res_field_value);
				$value = $doc->createTextNode($post_val);
				$res_field_value->appendChild($value);
				$res_field_label = $doc->createElement('res_field_label');
				$res_field_label = $travel_res_submit_field->appendChild($res_field_label);
				$label = $doc->createTextNode($_REQUEST['trav_res_lab__'.$regs[1]]);
				$res_field_label->appendChild($label);
				
				//save in case of "go back" button pressed
				$_SESSION[$post_key] = $post_val;
			}
		}
		//Get product info
		$docproduct = new DOMDocument('1.0','UTF-8');
		$filter_properties = array(1,4,5,10,12,13,14,15,16,17,33);// echo "in here: ".print_r($filter_properties,true);
		$eiddst_rec_xml = TransMgmt_RecordsSystem::get_record_xml_filtered($_REQUEST['eiddst'],$filter_properties);
		$docproduct->loadXML($eiddst_rec_xml);
		$simple_lookups_product = simplexml_load_string($eiddst_rec_xml);
		
		//get buyer user info
		$cur_user_eid = Output_SecuritySystem::get_user_eid();
		$docuser = new DOMDocument('1.0','UTF-8');
		$filter_properties = array(9,36,55);// echo "in here: ".print_r($filter_properties,true);
		$eiduser_rec_xml = TransMgmt_RecordsSystem::get_record_xml_filtered($cur_user_eid, $filter_properties);
		$docuser->loadXML($eiduser_rec_xml);
		$simple_lookups_user = simplexml_load_string($eiduser_rec_xml);
			
		//insert travel product into xml detail
		$travel_product_element = $doc->createElement('travel_product');
		$travel_product_element = $travel_res_info->appendChild($travel_product_element);
		$node = $doc->importNode($docproduct->firstChild,true);
		$travel_product_element->appendChild($node);

		//insert buyer user record into xml detail
		$buyer_info_element = $doc->createElement('buyer_info');
		$buyer_info_element = $travel_res_info->appendChild($buyer_info_element);
		$buyer_node = $doc->importNode($docuser->firstChild,true);
		$buyer_info_element->appendChild($buyer_node);
		//var_dump($buyer_info_element); die();
		
		//set up lookups info for product city, state, zip
		$travel_lookups_element = $doc->createElement('travel_lookups');
		$travel_lookups_element = $travel_res_info->appendChild($travel_lookups_element);
		
		$lookup_ids = array();
		foreach (array($simple_lookups_product, $simple_lookups_user) as $simple_lookups)
		{
			
			$lookup_xml = $simple_lookups->xpath('//property[@prop_id="12"]');
			foreach($lookup_xml as $lookup)
			{
				$lookup_ids[] = $lookup->value * 1;
			}
			
		}
		$this->add_lookup_table_list(OutputSys_ClientServerDataOps::get_LookupTableObj(),"city",
		'lookup_table_cities',$doc,$travel_lookups_element,$lookup_ids);
		
		
		$lookup_ids = array();
		foreach (array($simple_lookups_product, $simple_lookups_user) as $simple_lookups)
		{
			$lookup_xml = $simple_lookups->xpath('//property[@prop_id="13"]');
			foreach($lookup_xml as $lookup)
			{
				$lookup_ids[] = $lookup->value * 1;
			}
		}
		$this->add_lookup_table_list(OutputSys_ClientServerDataOps::get_LookupTableObj(),"state",
		'lookup_table_states',$doc,$travel_lookups_element,$lookup_ids);

		$lookup_ids = array();
		foreach (array($simple_lookups_product, $simple_lookups_user) as $simple_lookups)
		{
			$lookup_xml = $simple_lookups->xpath('//property[@prop_id="14"]');
			foreach($lookup_xml as $lookup)
			{
				$lookup_ids[] = $lookup->value * 1;
			}
		}
		$this->add_lookup_table_list(OutputSys_ClientServerDataOps::get_LookupTableObj(),"zip",
		'lookup_table_zips',$doc,$travel_lookups_element,$lookup_ids);
		
		$saved_res_info = $doc->saveXML();
		$_SESSION['saved_res_info'] = $saved_res_info; 
		return $saved_res_info;
	}
コード例 #3
0
ファイル: CheckoutProcessor.php プロジェクト: awgtek/myedb
	function finalize_order()
	{
		$eid = $_REQUEST['rec_eid']; //should be current user's eid.
		$logged_in_user = AppEntities_Facade::get_user_instance();
		$logged_in_user_id = $logged_in_user->user_id;
		if ($eid != $logged_in_user_id) die("Security error: 3390kflsi33");
		
		TransactionMgmt::get_transactions();
		$details_xml = "'<details_xml><order><blah></blah></order></details_xml>'"; //placeholder
		
		$doc = new DOMDocument('1.0', 'UTF-8');
		$doc->formatOutput = true;
		//create root node
		$order_info = $doc->createElement('order_info');
		$order_info = $doc->appendChild($order_info);

		//insert transactions
			$doc2 = new DOMDocument('1.0','UTF-8');
			$trans_xml = TransactionMgmt::get_transactions();
			$doc2->loadXML($trans_xml);
			$node = $doc->importNode($doc2->firstChild,true);
		$order_info->appendChild($node);
		
		//insert ship address
		$ship_info = $doc->createElement('ship_info');
		$ship_info = $order_info->appendChild($ship_info);
		$ship_dest = $doc->createElement('ship_dest');
		$ship_dest = $ship_info->appendChild($ship_dest);
		$ship_dest->setAttribute('pgiron',$_REQUEST['order_ship_addr']);	
		
			$doc3 = new DOMDocument('1.0','UTF-8');
			$eidsrc_rec_xml = TransMgmt_RecordsSystem::get_record_xml($eid);
			$doc3->loadXML($eidsrc_rec_xml);
			$node2 = $doc->importNode($doc3->firstChild,true);
		$order_info->appendChild($node2);
		
		//insert credit card info
		/*$cc_info = $doc->createElement('cc_info');
		$cc_info = $order_info->appendChild($cc_info);
		$cc_number = $doc->createTextNode($_REQUEST['CCinfo']);
		$cc_info->appendChild($cc_number);
		$order_info->appendChild($cc_info);
*/
		$check_out_elements = array(
		//"cc_info",
		//"CCexpdate",
		//"CChldrname",
		"co_account_number",
		"co_business_name",
		"co_name",
		"chkout_order_phone",
		"order_ship_addr","shipaddr_addr1","shipaddr_addr2",
		"shipaddr_city", "shipaddr_state","shipaddr_zip",
		"chkout_special_requests");
		
		foreach ($check_out_elements as $elem)
		{
			$ship_elem = $doc->createElement($elem);
			$ship_elem = $order_info->appendChild($ship_elem);
			$ship_elem_txt = $doc->createTextNode($_REQUEST[$elem]);
			$ship_elem->appendChild($ship_elem_txt);
			$order_info->appendChild($ship_elem);
		}
		
		$details_xml = $doc->saveXML();
		$details_xml = "'".addslashes($details_xml)."'";
		
		TransMgmt_EntityManagementSystems::finalize_order($eid, $details_xml);
		
		if (!isset($_SESSION['finalized_order_id'])) { die("Transaction failed. error: 2kdjs;aii3i3"); }
		$order_id = $_SESSION['finalized_order_id'];
		$doc = new DOMDocument('1.0', 'UTF-8');
		$order_id_elem = $doc->createElement('final_order_id',$order_id);
		$doc->appendChild($order_id_elem);
		return $doc->saveXML();
		
		
			
	}