function constructMessage(&$xmlt, $msg_data, $type, $xml_messages_list) { global $message_id_prefix, $message_id_counter; $message_id_counter++; $timestamp = time(); $date_created = tradebyte::getDateFormat($timestamp); $xml_message = $xmlt->drawTag($xml_messages_list, 'MESSAGE'); $xmlt->drawTag($xml_message, 'MESSAGE_ID', $message_id_prefix . $message_id_counter); $xmlt->drawTag($xml_message, 'MESSAGE_TYPE', tradebyte::getMessageType($type)); $xmlt->drawTag($xml_message, 'TB_ORDER_ID', $msg_data['tb_order_id']); $xmlt->drawTag($xml_message, 'TB_ORDER_ITEM_ID', $msg_data['tb_order_item_id']); $xmlt->drawTag($xml_message, 'SKU', $msg_data['sku']); $xmlt->drawTag($xml_message, 'CHANNEL_SIGN', $msg_data['channel']); $xmlt->drawTag($xml_message, 'QUANTITY', intval($msg_data['qty'])); //EXCLUDE CANCELATIONS FROM ADDING CARRIER/IDCODE TAG if ($type == 'S' || $type == 'R') { $xmlt->drawTag($xml_message, 'CARRIER_PARCEL_TYPE', 'DHL_STD_NATIONAL'); if ($type == 'S') { $xmlt->drawTag($xml_message, 'IDCODE', $msg_data['idcode_ship']); $xmlt->drawTag($xml_message, 'IDCODE_RETURN_PROPOSAL', $msg_data['idcode_ret']); } elseif ($type == 'R') { $xmlt->drawTag($xml_message, 'IDCODE', $msg_data['idcode_ret']); } } //DATE_CREATED $xmlt->drawTag($xml_message, 'DATE_CREATED', $date_created); }
function constructMessage(&$xmlt, $msg_data, $type, $xml_messages_list) { global $message_id_prefix, $message_id_counter; $message_id_counter++; $timestamp = time(); $date_created = tradebyte::getDateFormat($timestamp); $xml_message = $xmlt->drawTag($xml_messages_list, 'MESSAGE'); $xmlt->drawTag($xml_message, 'MESSAGE_ID', $message_id_prefix . $message_id_counter); $xmlt->drawTag($xml_message, 'MESSAGE_TYPE', tradebyte::getMessageType($type)); $xmlt->drawTag($xml_message, 'TB_ORDER_ID', $msg_data['tb_order_id']); $xmlt->drawTag($xml_message, 'CHANNEL_SIGN', $msg_data['channel']); $xmlt->drawTag($xml_message, 'QUANTITY', intval($msg_data['qty'])); $xmlt->drawTag($xml_message, 'COMMENT', 'Payment state is "paid"'); //DATE_CREATED $xmlt->drawTag($xml_message, 'DATE_CREATED', $date_created); }