<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Can't set x_delim_char or x_encap_char in PHP CIM SDK when parsing responses in Integration and Testing</title>
    <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Can-t-set-x-delim-char-or-x-enca-char-in-PHP-CIM-SDK-when/m-p/22403#M12127</link>
    <description>&lt;P&gt;I have also found that the "_setPostString" function also does not correctly replace everything as it should:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;BAD:&lt;/P&gt;&lt;PRE&gt;$this-&amp;gt;_post_string = str_replace("&amp;lt;extraOptions&amp;gt;&amp;lt;/extraOptions&amp;gt;",'&amp;lt;extraOptions&amp;gt;&amp;lt;![CDATA[' . $this-&amp;gt;_extraOptions . ']]&amp;gt;&amp;lt;/extraOptions&amp;gt;', $this-&amp;gt;_xml-&amp;gt;asXML());&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;GOOD:&lt;/P&gt;&lt;PRE&gt;$this-&amp;gt;_post_string = str_replace(array("&amp;lt;extraOptions&amp;gt;&amp;lt;/extraOptions&amp;gt;","&amp;lt;extraOptions/&amp;gt;"),'&amp;lt;extraOptions&amp;gt;&amp;lt;![CDATA[' . $this-&amp;gt;_extraOptions . ']]&amp;gt;&amp;lt;/extraOptions&amp;gt;', $this-&amp;gt;_xml-&amp;gt;asXML());&lt;/PRE&gt;&lt;P&gt;I discovered that the library was creating an element as "&amp;lt;extraOptions/&amp;gt;" but the code wasn't set to do a string replace for the self-closing elements -- so even when I added the extra options in there (according to deviantintegral), the XML that was coming out still didn't have the values in there.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Making the code replace BOTH &amp;lt;extraOptions&amp;gt;&amp;lt;/extraOptions&amp;gt; AND &amp;lt;extraOptions/&amp;gt; fixed it for me!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope this helps!&lt;/P&gt;</description>
    <pubDate>Tue, 31 Jan 2012 21:00:05 GMT</pubDate>
    <dc:creator>maglfmn</dc:creator>
    <dc:date>2012-01-31T21:00:05Z</dc:date>
    <item>
      <title>Can't set x_delim_char or x_enca_char in PHP CIM SDK when parsing responses</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Can-t-set-x-delim-char-or-x-enca-char-in-PHP-CIM-SDK-when/m-p/10940#M6928</link>
      <description>&lt;P&gt;As is, these two properties can be set when creating a transaction, but they aren't used when parsing the response from AIM. This means that the output from getTransactionResponse() will be quite broken. Also, because it is hardcoded to use a comma as the delimiter, it means it's impossible to allow users to use commas in something like their billing address.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It would be great if there was a method to set these two values instead of using extraOptions, so that the class could use them when parsing responses.&lt;/P&gt;</description>
      <pubDate>Mon, 07 Mar 2011 18:07:54 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/Can-t-set-x-delim-char-or-x-enca-char-in-PHP-CIM-SDK-when/m-p/10940#M6928</guid>
      <dc:creator>deviantintegral</dc:creator>
      <dc:date>2011-03-07T18:07:54Z</dc:date>
    </item>
    <item>
      <title>Re: Can't set x_delim_char or x_encap_char in PHP CIM SDK when parsing responses</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Can-t-set-x-delim-char-or-x-enca-char-in-PHP-CIM-SDK-when/m-p/10942#M6929</link>
      <description>&lt;P&gt;Here's a patch that defaults to using the pipe character for x_encap_char anyone else who is running into this issue.&lt;/P&gt;&lt;PRE&gt;diff --git lib/AuthorizeNetCIM.php lib/AuthorizeNetCIM.php
index f228feb..dcd0d1d 100644
--- lib/AuthorizeNetCIM.php
+++ lib/AuthorizeNetCIM.php
@@ -113,7 +113,7 @@ class AuthorizeNetCIM extends AuthorizeNetRequest
         $transactionParent = $this-&amp;gt;_xml-&amp;gt;addChild("transaction");
         $transactionChild = $transactionParent-&amp;gt;addChild("profileTrans" . $transactionType);
         $this-&amp;gt;_addObject($transactionChild, $transaction);
-        $this-&amp;gt;_extraOptions = $extraOptionsString;
+        $this-&amp;gt;_extraOptions = $extraOptionsString + "&amp;amp;x_encap_char=|";
         return $this-&amp;gt;_sendRequest();
     }
     
@@ -433,7 +433,7 @@ class AuthorizeNetCIM_Response extends AuthorizeNetXMLResponse
      */
     public function getTransactionResponse()
     {
-        return new AuthorizeNetAIM_Response($this-&amp;gt;_getElementContents("directResponse"), ",", "", array());
+        return new AuthorizeNetAIM_Response($this-&amp;gt;_getElementContents("directResponse"), ",", "|", array());
     }
     
     /**
@@ -444,7 +444,7 @@ class AuthorizeNetCIM_Response extends AuthorizeNetXMLResponse
         $responses = (array)$this-&amp;gt;xml-&amp;gt;validationDirectResponseList;
         $return = array();
         foreach ((array)$responses["string"] as $response) {
-            $return[] = new AuthorizeNetAIM_Response($response, ",", "", array());
+            $return[] = new AuthorizeNetAIM_Response($response, ",", "|", array());
         }
         return $return;
     }
@@ -454,7 +454,7 @@ class AuthorizeNetCIM_Response extends AuthorizeNetXMLResponse
      */
     public function getValidationResponse()
     {
-        return new AuthorizeNetAIM_Response($this-&amp;gt;_getElementContents("validationDirectResponse"), ",", "", array());
+        return new AuthorizeNetAIM_Response($this-&amp;gt;_getElementContents("validationDirectResponse"), ",", "|", array());
     }
     
     /**&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Mar 2011 18:16:59 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/Can-t-set-x-delim-char-or-x-enca-char-in-PHP-CIM-SDK-when/m-p/10942#M6929</guid>
      <dc:creator>deviantintegral</dc:creator>
      <dc:date>2011-03-07T18:16:59Z</dc:date>
    </item>
    <item>
      <title>Re: Can't set x_delim_char or x_encap_char in PHP CIM SDK when parsing responses</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Can-t-set-x-delim-char-or-x-enca-char-in-PHP-CIM-SDK-when/m-p/10950#M6933</link>
      <description>&lt;P&gt;Here's an update that fixes an incorrect operator.&lt;/P&gt;&lt;PRE&gt;diff --git lib/AuthorizeNetCIM.php lib/AuthorizeNetCIM.php
index f228feb..dcd0d1d 100644
--- lib/AuthorizeNetCIM.php
+++ lib/AuthorizeNetCIM.php
@@ -113,7 +113,7 @@ class AuthorizeNetCIM extends AuthorizeNetRequest
         $transactionParent = $this-&amp;gt;_xml-&amp;gt;addChild("transaction");
         $transactionChild = $transactionParent-&amp;gt;addChild("profileTrans" . $transactionType);
         $this-&amp;gt;_addObject($transactionChild, $transaction);
-        $this-&amp;gt;_extraOptions = $extraOptionsString;
+        $this-&amp;gt;_extraOptions = $extraOptionsString . "&amp;amp;x_encap_char=|";
         return $this-&amp;gt;_sendRequest();
     }
     
@@ -433,7 +433,7 @@ class AuthorizeNetCIM_Response extends AuthorizeNetXMLResponse
      */
     public function getTransactionResponse()
     {
-        return new AuthorizeNetAIM_Response($this-&amp;gt;_getElementContents("directResponse"), ",", "", array());
+        return new AuthorizeNetAIM_Response($this-&amp;gt;_getElementContents("directResponse"), ",", "|", array());
     }
     
     /**
@@ -444,7 +444,7 @@ class AuthorizeNetCIM_Response extends AuthorizeNetXMLResponse
         $responses = (array)$this-&amp;gt;xml-&amp;gt;validationDirectResponseList;
         $return = array();
         foreach ((array)$responses["string"] as $response) {
-            $return[] = new AuthorizeNetAIM_Response($response, ",", "", array());
+            $return[] = new AuthorizeNetAIM_Response($response, ",", "|", array());
         }
         return $return;
     }
@@ -454,7 +454,7 @@ class AuthorizeNetCIM_Response extends AuthorizeNetXMLResponse
      */
     public function getValidationResponse()
     {
-        return new AuthorizeNetAIM_Response($this-&amp;gt;_getElementContents("validationDirectResponse"), ",", "", array());
+        return new AuthorizeNetAIM_Response($this-&amp;gt;_getElementContents("validationDirectResponse"), ",", "|", array());
     }
     
     /**&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Mar 2011 20:41:56 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/Can-t-set-x-delim-char-or-x-enca-char-in-PHP-CIM-SDK-when/m-p/10950#M6933</guid>
      <dc:creator>deviantintegral</dc:creator>
      <dc:date>2011-03-07T20:41:56Z</dc:date>
    </item>
    <item>
      <title>Re: Can't set x_delim_char or x_encap_char in PHP CIM SDK when parsing responses</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Can-t-set-x-delim-char-or-x-enca-char-in-PHP-CIM-SDK-when/m-p/22403#M12127</link>
      <description>&lt;P&gt;I have also found that the "_setPostString" function also does not correctly replace everything as it should:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;BAD:&lt;/P&gt;&lt;PRE&gt;$this-&amp;gt;_post_string = str_replace("&amp;lt;extraOptions&amp;gt;&amp;lt;/extraOptions&amp;gt;",'&amp;lt;extraOptions&amp;gt;&amp;lt;![CDATA[' . $this-&amp;gt;_extraOptions . ']]&amp;gt;&amp;lt;/extraOptions&amp;gt;', $this-&amp;gt;_xml-&amp;gt;asXML());&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;GOOD:&lt;/P&gt;&lt;PRE&gt;$this-&amp;gt;_post_string = str_replace(array("&amp;lt;extraOptions&amp;gt;&amp;lt;/extraOptions&amp;gt;","&amp;lt;extraOptions/&amp;gt;"),'&amp;lt;extraOptions&amp;gt;&amp;lt;![CDATA[' . $this-&amp;gt;_extraOptions . ']]&amp;gt;&amp;lt;/extraOptions&amp;gt;', $this-&amp;gt;_xml-&amp;gt;asXML());&lt;/PRE&gt;&lt;P&gt;I discovered that the library was creating an element as "&amp;lt;extraOptions/&amp;gt;" but the code wasn't set to do a string replace for the self-closing elements -- so even when I added the extra options in there (according to deviantintegral), the XML that was coming out still didn't have the values in there.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Making the code replace BOTH &amp;lt;extraOptions&amp;gt;&amp;lt;/extraOptions&amp;gt; AND &amp;lt;extraOptions/&amp;gt; fixed it for me!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope this helps!&lt;/P&gt;</description>
      <pubDate>Tue, 31 Jan 2012 21:00:05 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/Can-t-set-x-delim-char-or-x-enca-char-in-PHP-CIM-SDK-when/m-p/22403#M12127</guid>
      <dc:creator>maglfmn</dc:creator>
      <dc:date>2012-01-31T21:00:05Z</dc:date>
    </item>
    <item>
      <title>Re: Can't set x_delim_char or x_encap_char in PHP CIM SDK when parsing responses</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Can-t-set-x-delim-char-or-x-enca-char-in-PHP-CIM-SDK-when/m-p/22507#M12178</link>
      <description>&lt;P&gt;Thanks for the heads up on that.&amp;nbsp; Your example looks like a good solution,&amp;nbsp;I'll try to get it added soon to the official package.&amp;nbsp; It's unfortunate that simpleXML doesn't have native CDATA functionality so that we could avoid the str_replace altogether.&lt;/P&gt;</description>
      <pubDate>Wed, 01 Feb 2012 22:51:13 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/Can-t-set-x-delim-char-or-x-enca-char-in-PHP-CIM-SDK-when/m-p/22507#M12178</guid>
      <dc:creator>Trevor</dc:creator>
      <dc:date>2012-02-01T22:51:13Z</dc:date>
    </item>
  </channel>
</rss>

