17 require_once SQ_PACKAGES_PATH.
'/ecommerce/checkout_action/checkout_action.inc';
18 require_once SQ_ATTRIBUTES_PATH.
'/http_request/http_request.inc';
19 require_once SQ_ATTRIBUTES_PATH.
'/email_format/email_format.inc';
21 define(
'ECOM_CHECKOUT_REST_ACTION_LOG_FILE',
'ecom_rest_checkout_action');
43 parent::__construct();
56 if (!isset($settings[
'http_request'])) {
57 $req_settings = serialize(Array());
59 $req_settings = $settings[
'http_request'];
62 if (!isset($settings[
'email_format'])) {
63 $email_settings = serialize(Array());
65 $email_settings = $settings[
'email_format'];
74 echo
'<p class="sq-backend-section-subheading">REST Request</p>';
75 echo
'<div id="'.$prefix.
'"_http_request_div" style="padding: 0.5em 0px 2em 30px;">';
76 $http_request->paint($prefix.
'_hr');
80 echo
'<p class="sq-backend-section-subheading">Order Array Configuration</p>';
81 echo
'<div id="'.$prefix.
'"_order_array_div" style="padding: 0.5em 0px 2em 30px;">';
82 self::_paintOrderArraySetup($checkout, $settings, $o, $prefix);
86 echo
'<p class="sq-backend-section-subheading"> Error Response Notification Email</p>';
87 echo
'<div id="'.$prefix.
'"_email_format_div" style="padding: 0.5em 0px 2em 30px;">';
88 $email_format->paint($prefix.
'_email');
92 echo
'<p class="sq-backend-section-subheading">Available Keywords</p>';
93 echo
'<div id="'.$prefix.
'"_keywords_list_div" style="padding: 0.5em 0px 2em 30px;">';
94 self::_paintAvailableKeywords($prefix, $o, $settings);
108 $order_array = array_get_index($settings,
'order_array', Array());
110 $current_customisation = self::_getCurrentCustomisation($prefix, $settings);
113 $dropdown_field = $prefix.
'_asset_type_customise';
116 <table style=
"width:100%">
117 <tr><td><b>Customise
Order Asset Types</b></td></tr>
120 $configured_assets = array_keys($order_array);
121 if (!empty($configured_assets)) { ?>
123 <table
class=
"sq-backend-table" style=
"width:50%">
125 <td
class=
"sq-backend-table-header">Customised
Order Asset Types</td>
126 <td
class=
"sq-backend-table-header">Remove</td>
130 foreach ($configured_assets as $key) {
132 $type_name = ucwords(str_replace(
'_',
' ', $key));
138 $src =
'Javascript: document.getElementById(\''.$dropdown_field.
'\').value = \
''.$key.
'\';
';
139 $src .= 'main_form.submit()
';
143 <a href="<?php echo $src?>"><?php echo $type_name; ?></a>
145 <td style="width:10%">
146 <?php check_box($dropdown_field.'_remove[
'.$key.']
', 1, FALSE); ?>
156 hidden_field($dropdown_field, '');
158 // Dropdown to select the Project asset type
159 $current_customisation = self::_getCurrentCustomisation($prefix, $settings);
160 self::_paintAssetTypeChooser($prefix.'_asset_type_selected
', $current_customisation);
163 // Interface to setup the paramters for the "Order Array"
164 if (!empty($current_customisation)) {
166 <tr><td> </td></tr>
167 <tr><td><b>Parameter Setup for "<?php echo ucwords(str_replace('_
', ' ', $current_customisation)); ?>"</b></td></tr>
170 $customised_values = array_get_index($order_array, $current_customisation, Array());
171 if (!empty($customised_values)) {
174 <table class="sq-backend-table" style="width:60%">
176 <td class="sq-backend-table-header">Array Item Name</td>
177 <td class="sq-backend-table-header">Value</td>
178 <td class="sq-backend-table-header">Remove</td>
181 foreach($customised_values as $param => $value) {
183 echo '<td>
'.$param.'</td>
';
185 text_box($prefix.'_params_value[
'.$param.']
', $value, 50);
187 echo '<td style=
"width:10%">
';
188 check_box($prefix.'_params_remove[
'.$param.']
', 1, FALSE);
198 echo "Add new parameter: ";
199 text_box($prefix.'_new_param
', '', 21);
200 hidden_field($prefix.'_asset_type_submitted
', $current_customisation);
202 submit_button($prefix.'_new_param_button
', translate('go
'), 'document.getElementById(\
''.$dropdown_field.
'\').value = \
''.$current_customisation.
'\'; main_form.submit()
');
208 }// _paintOrderArraySetup()
218 private static function _paintAvailableKeywords($prefix, Backend_Outputter $o, $settings)
220 $asset_type = self::_getCurrentCustomisation($prefix, $settings);
222 <table style="width:100%">
224 if (!empty($asset_type)) {
225 $asset_type_name = ucwords(str_replace('_
', ' ', $asset_type));
226 $order_array_keywords = self::_getOrderArrayKeywords($asset_type);
228 <tr><td><b>In Order Array for "<?php echo $asset_type_name ?>" Type Asset (Order Items Keywords)</b></td></tr>
230 <table class="sq-backend-table" style="width:80%">
232 <td class="sq-backend-table-header" style="width:30%">Keywords</td>
233 <td class="sq-backend-table-header">Description</td>
236 foreach($order_array_keywords as $keyword => $desc) {
238 echo '<td>%
'.$keyword.'%</td>
';
239 echo '<td>
'.$desc.'</td>
';
244 <tr><td colspan="2">NOTE: Generic asset keywords (%asset_assetid%, %asset_name%, etc) and metadata keywords (%asset_metadata_<MFIELD_NAME>%) for the product item assets are also available</td></tr>
247 <tr><td> </td></tr>
251 $rest_keywords = self::_getRestRequestKeywords();
253 <tr><td><b>In REST Request (Order Keywords)</b></td></tr>
255 <table class="sq-backend-table" style="width:80%">
257 <td class="sq-backend-table-header" style="width:30%">Keywords</td>
258 <td class="sq-backend-table-header">Description</td>
261 foreach($rest_keywords as $keyword => $desc) {
263 echo '<td>%
'.$keyword.'%</td>
';
264 echo '<td>
'.$desc.'</td>
';
271 <tr><td> </td></tr>
274 $email_keywords = self::_getEmailFormatKeywords();
276 <tr><td><b>In Error Response Notification Email</b></td></tr>
278 <table class="sq-backend-table" style="width:80%">
280 <td class="sq-backend-table-header" style="width:30%">Keywords</td>
281 <td class="sq-backend-table-header">Description</td>
284 foreach($email_keywords as $keyword => $desc) {
286 echo '<td>%
'.$keyword.'%</td>
';
287 echo '<td>
'.$desc.'</td>
';
292 <tr><td colspan="2">NOTE: All keywords in the "Order Keywords" list are also available</td></tr>
313 private static function _paintAssetTypeChooser($field_name, $selected_type_code)
315 // All "product"/"ecommerce product" type assets in the system
316 $asset_types = $GLOBALS['SQ_SYSTEM
']->am->getTypeDescendants('product
', TRUE);
317 $asset_types_info = Array();
318 foreach ($asset_types as $type_code) {
319 $asset_types_info[$type_code] = $GLOBALS['SQ_SYSTEM
']->am->getTypeInfo($type_code, 'name
');
321 $asset_types_info = array_unique($asset_types_info);
322 arsort($asset_types_info);
323 $asset_types_info[''] = '';
324 $asset_types_info = array_reverse($asset_types_info);
326 echo "Add Product asset type to customise: ";
327 combo_box($field_name, $asset_types_info, FALSE, $selected_type_code);
329 submit_button($field_name.'_go
', translate('go
'), 'main_form.submit()
');
331 }//end _paintAssetTypeChooser()
343 private static function _getCurrentCustomisation($prefix, $settings)
345 $key = array_get_index($_POST, $prefix.'_asset_type_selected
', '');
347 // if there was nothing selected to customise, check for a current customisation in process
349 $key = array_get_index($_POST, $prefix.'_asset_type_current
', '');
352 // check to see if a current customisation was selected
353 if (isset($_POST[$prefix.'_asset_type_customise
']) && !empty($_POST[$prefix.'_asset_type_customise
'])) {
354 $key = $_POST[$prefix.'_asset_type_customise
'];
357 // if still nothing, get the first one from the list of customised assets
359 $customised_assets = array_keys(array_get_index($settings, 'order_array
', Array()));
360 $key = isset($customised_assets[0]) ? $customised_assets[0] : '';
365 }//end _getCurrentCustomisation()
374 public static function processInlineInterface(Ecommerce_Checkout $checkout, &$settings, Backend_Outputter $o, $prefix)
376 // Process "http request" settings
377 if (!isset($settings['http_request
'])) {
378 $req_settings = serialize(Array());
380 $req_settings = $settings['http_request
'];
382 $http_request = new Asset_Attribute_HTTP_Request(0, $req_settings);
383 $http_request->process($prefix.'_hr
');
384 $settings['http_request
'] = $http_request->value;
386 // Process "email format" settings
387 if (!isset($settings['email_format
'])) {
388 $email_settings = serialize(Array());
390 $email_settings = $settings['email_format
'];
392 $email_format = new Asset_Attribute_Email_Format(0, $email_settings);
393 $email_format->process($prefix.'_email
');
394 $settings['email_format
'] = $email_format->value;
396 // Process "order array" data
397 self::_processOrderArraySetup($checkout, $settings, $o, $prefix);
401 }//end processInlineInterface()
410 public static function _processOrderArraySetup(Ecommerce_Checkout $checkout, &$settings, Backend_Outputter $o, $prefix)
412 $order_array = isset($settings['order_array
']) ? $settings['order_array
'] : Array();
413 $selected_asset_type = isset($_POST[$prefix.'_asset_type_submitted
']) ? $_POST[$prefix.'_asset_type_submitted
'] : '';
416 if (!empty($selected_asset_type)) {
418 if (!isset($order_array[$selected_asset_type])) {
419 $order_array[$selected_asset_type] = Array();
422 // Add new parameter for the selected asset type
423 if (!empty($_POST[$prefix.'_new_param
'])) {
424 $order_array[$selected_asset_type][$_POST[$prefix.'_new_param
']] = '';
427 // Update parameter data
428 $update_params = isset($_POST[$prefix.'_params_value
']) ? $_POST[$prefix.'_params_value
'] : Array();
429 foreach($update_params as $param_name => $param_value) {
430 $order_array[$selected_asset_type][$param_name] = $param_value;
433 // Remove the selected params
434 $remove_params = isset($_POST[$prefix.'_params_remove
']) ? $_POST[$prefix.'_params_remove
'] : Array();
435 foreach($remove_params as $param_name => $param_value) {
436 if (isset($order_array[$selected_asset_type][$param_name])) {
437 unset($order_array[$selected_asset_type][$param_name]);
441 // Remove the selected customised asset types
442 $remove_types = isset($_POST[$prefix.'_asset_type_customise_remove
']) ? $_POST[$prefix.'_asset_type_customise_remove
'] : Array();
443 foreach($remove_types as $asset_type => $val) {
444 if (isset($order_array[$asset_type])) {
445 unset($order_array[$asset_type]);
449 // Update the "order array" value
450 $settings['order_array
'] = $order_array;
454 }//end _processOrderArraySetup()
463 public static function paintSummary(Ecommerce_Checkout $checkout, $settings, Backend_Outputter $o, $prefix)
465 if (!isset($settings['http_request
'])) {
466 $req_settings = Array();
468 $req_settings = unserialize($settings['http_request
']);
471 ?><table class="no-borders">
478 <td class="sq-backend-table-cell" style="vertical-align: top"><p><strong><?php echo translate('http_request_method
'); ?></strong></p></td>
479 <td class="sq-backend-table-cell" style="vertical-align: top"><p><?php
481 // Get manually-entered "method" settings.
482 if (!empty($req_settings['method
'])) {
483 echo $req_settings['method
'];
485 ?><span class="sq-backend-warning">No method specified.</span><?php
490 <td class="sq-backend-table-cell" style="vertical-align: top"><p><strong><?php echo translate('http_request_urls
'); ?></strong></p></td>
491 <td class="sq-backend-table-cell" style="vertical-align: top"><p><?php
492 if (!empty($req_settings['urls
'])) {
493 foreach ($req_settings['urls
'] as $url) {
494 echo ellipsisize($url, 512).'<br />
';
497 ?><span class="sq-backend-warning">No URLs specified.</span><?php
504 }//end paintSummary()
513 public static function execute(Ecommerce_Checkout $checkout, Ecommerce_Order $order, $settings)
515 $req_settings = $settings['http_request
'];
517 // Set up http request object
518 $http_request = new Asset_Attribute_HTTP_Request(0, $req_settings);
519 $current_value = @unserialize($http_request->value);
521 // Get list of keywords in http request
522 $keywords_list = Array();
523 if (isset($current_value['urls
'])) {
524 $keywords_list = array_merge(
526 extract_keywords(implode(',
', $current_value['urls
']))
530 if (isset($current_value['request_headers
'])) {
531 $keywords_list = array_merge(
533 extract_keywords(implode(',
', $current_value['request_headers
']))
537 if (isset($current_value['request_body
'])) {
538 $keywords_list = array_merge(
540 extract_keywords($current_value['request_body
'])
544 if (isset($current_value['http_auth_options
'])) {
545 $keywords_list = array_merge(
547 extract_keywords(implode(',
', $current_value['http_auth_options
']))
551 // Setup the email format attribute
552 $email_settings = $settings['email_format
'];
553 $email_format = new Asset_Attribute_Email_Format(0, $email_settings);
554 $email_val = @unserialize($email_format->value);
556 // Get list of keywords in email attribute
557 $keywords_list = array_merge($keywords_list, extract_keywords($email_val['html_format
'].',
'.$email_val['text_format
'].',
'.$email_val['subject
'].',
'.$email_val['from
'].',
'.$email_val['reply_to
'].',
'.implode(',
', $email_val['to
'])));
560 $order_xml = $order->attr('order_xml
');
561 // If "strip HTML tags" global preference is enabled,
562 // then we will need to decode the encoded xml data to get proper xml
563 if (strpos($order_xml, '<
') === FALSE) {
564 $order_xml = htmlspecialchars_decode($order_xml, ENT_COMPAT);
566 $order_data = xml_to_array($order_xml);
568 // If the order was tax exempted (i.e. for non-taxable country)
569 if (isset($order_data['cart
'][0]['total_tax
'][0]) && ($order_data['cart
'][0]['total_tax
'][0] > 0)) {
570 $order_data['taxable
'] = TRUE;
572 $order_data['cart
'][0]['total_tax
'][0] = '0
';
573 $order_data['taxable
'] = FALSE;
576 // Get all the keyword replacements
577 $keywords_list = array_unique($keywords_list);
578 $replacements = Array();
579 foreach($keywords_list as $full_keyword) {
581 $keyword = parse_keyword($full_keyword, $modifiers);
583 $replacement = '%
'.$keyword.'%
';
585 case 'order_subtotal
':
586 $replacement = @$order_data['cart
'][0]['sub_total
'][0];
589 case 'order_total_tax
':
590 $replacement = @$order_data['cart
'][0]['total_tax
'][0];
593 case 'order_total_delivery
':
594 $replacement = @$order_data['cart
'][0]['delivery_total
'][0];
597 case 'order_grand_total_excl_delivery
':
598 $replacement = @$order_data['cart
'][0]['grand_total_ex_delivery
'][0];
601 case 'order_grand_total
':
602 $replacement = @$order_data['cart
'][0]['grand_total
'][0];
605 case 'order_currency_symbol
':
606 $replacement = @$order_data['cart
'][0]['currency_symbol
'][0];
609 case 'order_item_count
':
610 $items = @$order_data['cart
'][0]['products
'][0]['product
'];
612 if (!is_null($items)) {
613 foreach($items as $item) {
614 if (isset($item['quantity
'])) {
615 $item_count += $item['quantity
'][0];
619 $replacement = $item_count;
622 case 'order_item_type_count
':
623 $items = @$order_data['cart
'][0]['products
'][0]['product
'];
624 $replacement = count($items);
628 $timezone_offset = substr(date('O
', $order->created), 0, 1).str_pad(date('Z
', $order->created)/60, 3, '0
', STR_PAD_LEFT);
629 $replacement = date('YmdHis000
', $order->created).$timezone_offset;
632 case 'order_date_reg
':
633 $replacement = date('Y-m-d H:i:s
', $order->created);
637 $replacement = self::_evaluateOrderArrayKeywordReplacement($order_data, $settings);
642 // Delivery form response keywords
644 if (preg_match('|order_response_q(\d+)|i
', $keyword, $matches) && isset($matches[1])) {
645 $delivery_form_values = $order->attr('order_form_value
');
646 if (isset($delivery_form_values['q
'.$matches[1]])) {
647 $replacement = $delivery_form_values['q
'.$matches[1]];
651 // Get remaining replacements for the Ecomm order asset
652 if ($replacement == '%
'.$keyword.'%
') {
653 $replacement = $order->getKeywordReplacement($keyword);
656 // If keyword been replaced, apply the modifiers
657 if (!is_null($replacement) && $replacement != '%
'.$keyword.'%
') {
658 apply_keyword_modifiers($replacement, $modifiers);
659 $replacements[$full_keyword] = $replacement;
663 // Set them to the http request object
664 $http_request->setKeywordReplacements($replacements);
667 $res = $http_request->run();
668 $rest_request = @$res['request
'];
669 $rest_response = @$res['response
'];
671 // Write the info in the log file
672 self::_log('--
Order Assetid --
');
673 self::_log($order->id);
674 self::_log('-- REST Request --
');
675 self::_log($rest_request);
676 self::_log('-- REST Response --
');
677 self::_log($rest_response);
679 // Send the notification email if REST resource returns non-2xx response
680 $http_response_code = @$res['response
']['info
']['http_code
'];
681 if (strpos($http_response_code, '2
') !== 0) {
682 foreach($replacements as $key => $val) {
683 $replacements[$key] = urldecode($val);
685 // Further add these additionals keyword replacements specified to the email
686 $request_headers = '';
687 foreach($rest_request['headers
'] as $key => $val) {
688 $request_headers .= $key.':
'.$val.'<br />
';
690 $replacements['rest_request_headers
'] = $request_headers;
691 $replacements['rest_request_body
'] = isset($rest_request['body
']) ? $rest_request['body
'] : '';
693 $response_headers = '';
694 foreach($rest_response['headers
'] as $key => $val) {
695 $response_headers .= $key.':
'.$val.'<br />
';
697 $replacements['rest_response_headers
'] = $response_headers;
698 $replacements['rest_response_body
'] = isset($rest_response['body
']) ? $rest_response['body
'] : '';
700 $email_format->sendMail($replacements);
714 private static function _evaluateOrderArrayKeywordReplacement($order_info, $settings)
717 $ordered_items_raw = @$order_info['cart
'][0]['products
'][0]['product
'];
718 $params = @$settings['order_array
'];
720 if (empty($params) || empty($ordered_items_raw)) {
725 foreach($ordered_items_raw as $item) {
726 if (isset($item['id'][0])) {
727 $ordered_items[$item['id'][0]] = $item;
731 $taxable = $order_info['taxable
'];
732 $items_asset_info = $GLOBALS['SQ_SYSTEM
']->am->getAssetInfo(array_keys($ordered_items));
734 foreach($items_asset_info as $item_id => $item_asset_info) {
735 $item_data = $ordered_items[$item_id];
736 $item_type = $item_asset_info['type_code
'];
738 // Parameters configured for this Product type
739 $item_params = isset($params[$item_type]) ? $params[$item_type] : FALSE;
743 $item_asset = $GLOBALS['SQ_SYSTEM
']->am->getAsset($item_id);
744 foreach($item_params as $param_name => $value) {
745 // Extract and replace the keywords in the parameter value, if any
746 $keywords = extract_keywords($value);
747 if (empty($keywords)) {
748 $parm_value = $value;
750 $replacements = Array();
751 foreach($keywords as $full_keyword) {
752 $keyword = parse_keyword($full_keyword, $modifiers);
753 $replacement = '%
'.$keyword.'%
';
754 if (strpos($keyword, 'product_
') !== FALSE) {
755 $item_index_name = substr($keyword, 8);
756 if (isset($item_data[$item_index_name])) {
757 switch ($item_index_name) {
758 case 'item_price_incl_tax
':
759 // The product pricing data in the order will include tax value,
760 // so for tax exempted order, fix the pricings for the keyword replcements here
762 $replacement = @$item_data['item_price
'][0];
764 $replacement = $item_data[$item_index_name][0];
768 case 'total_item_price_incl_tax
':
770 $replacement = @$item_data['total_item_price
'][0];
772 $replacement = $item_data[$item_index_name][0];
780 $replacement = $item_data[$item_index_name][0];
784 case 'total_item_tax
':
788 $replacement = $item_data[$item_index_name][0];
793 $replacement = $item_data[$item_index_name][0];
797 } else if ($keyword == 'item_array_index
') {
798 $replacement = str_pad($array_index, 4, '0
', STR_PAD_LEFT);
800 if ($replacement == '%
'.$keyword.'%
') {
801 $replacement = $item_asset->getKeywordReplacement($keyword);
804 // If keyword was replaced apply the modifiers
805 if ($replacement != '%
'.$keyword.'%
') {
806 apply_keyword_modifiers($replacement, $modifiers);
808 // Blank out the keywords not replaced
811 $replacements[$full_keyword] = $replacement;
813 replace_keywords($value, $replacements);
816 // Add the parameter to the array
817 $order_array .= $param_name.'[
'.$array_index.']=
'.urlencode($value).'&
';
824 $order_array = rtrim($order_array, '&
');
828 }//end _evaluateOrderArrayKeywordReplacement()
837 public static function isValid(Ecommerce_Checkout $checkout, $settings)
839 if (!isset($settings['http_request
'])) {
840 $req_settings = Array();
842 $req_settings = unserialize($settings['http_request
']);
845 // if either no method or urls are set, won't be able to send the request...
846 if (empty($req_settings[
'method']))
return FALSE;
847 if (empty($req_settings[
'urls']))
return FALSE;
860 private static function _getAvailableKeywords($asset_type, $ommit_generic_keywords=TRUE)
862 $GLOBALS[
'SQ_SYSTEM']->am->includeAsset($asset_type);
863 $temp_asset =
new $asset_type();
864 $keywords = $temp_asset->getAvailableKeywords();
866 if ($ommit_generic_keywords) {
868 foreach($keywords as $keyword => $desc) {
869 if (strpos($keyword,
'asset_attribute_') === FALSE) {
870 unset($keywords[$keyword]);
890 private static function _getOrderArrayKeywords($asset_type)
893 $keywords[
'item_array_index'] =
'Four digit item\'s position value in the "order array"';
894 $keywords[
'asset_attribute_name'] =
"The full name of the product item";
895 $keywords[
'product_quantity'] =
"Total number of the items of the given type in the order";
896 $keywords[
'product_item_price'] =
"Product item unit price excluding tax";
897 $keywords[
'product_item_price_incl_tax'] =
"Product item unit price including tax";
898 $keywords[
'product_item_tax'] =
"Product item unit tax amount";
899 $keywords[
'product_total_item_price'] =
"Total price of the items of the given type in the order excluding tax";
900 $keywords[
'product_total_item_price_incl_tax'] =
"Total price of the items of the given type in the order including tax";
901 $keywords[
'product_total_item_tax'] =
"Total tax for the given item type in the order";
903 $keywords += self::_getAvailableKeywords($asset_type);
916 private static function _getRestRequestKeywords()
920 'order_array' =>
'Array of data for the each item in the order (as configured in the "Order Array" section)',
921 'order_response_qX' =>
'Response submitted for Delivery Method\'s question "X"',
922 'order_item_count' =>
'Total number of quantity in the order',
923 'order_item_type_count' =>
'Total number of item types in the order',
924 'order_subtotal' =>
'Total transaction amount excluding tax and delivery',
925 'order_total_tax' =>
'Total transaction amount including tax',
926 'order_total_delivery' =>
'Total delivery amount',
927 'order_grand_total_excl_delivery' =>
'Grand total transaction amount excluding delivery',
928 'order_grand_total' =>
'Grand total transaction amount',
929 'order_date' =>
'Order date timestamp in YYYYMMDDHHNNSSKKKs000 format',
930 'order_date_reg' =>
'Order date timestamp in YYYY:MM:DD HH:MM:SS format',
931 'order_currency_symbol' =>
'Currency symbol for the transaction amount',
935 $keywords += self::_getAvailableKeywords(
'ecommerce_order');
948 private static function _getEmailFormatKeywords()
952 'rest_request_headers' =>
'REST request headers',
953 'rest_request_body' =>
'REST request body content',
954 'rest_response_headers' =>
'Response headers returned by the REST resource',
955 'rest_response_body' =>
'Response body returned by the REST resource',
974 private static function _log($message, $level = E_USER_NOTICE, $encode=FALSE)
976 if (is_array($message)) {
977 $message = print_r($message, TRUE);
980 log_write($message, ECOM_CHECKOUT_REST_ACTION_LOG_FILE, $level, $encode);