<?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: Invalid child element in PHP CIM SDK when updating payment profile. in Integration and Testing</title>
    <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Invalid-child-element-in-PHP-CIM-SDK-when-updating-payment/m-p/24337#M13052</link>
    <description>&lt;P&gt;Hi Mark,&lt;BR /&gt;&lt;BR /&gt;Thanks for the bug report, we'll document it for our Development team to take a review and fix in a future update.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;Joy&lt;/P&gt;</description>
    <pubDate>Mon, 12 Mar 2012 21:35:00 GMT</pubDate>
    <dc:creator>Joy</dc:creator>
    <dc:date>2012-03-12T21:35:00Z</dc:date>
    <item>
      <title>Invalid child element in PHP CIM SDK when updating payment profile.</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Invalid-child-element-in-PHP-CIM-SDK-when-updating-payment/m-p/24085#M12929</link>
      <description>&lt;P&gt;I'm using the provided PHP SDK to make CIM calls.&amp;nbsp; So far, I have correctly made calls to createCustomerProfile, createCustomerPaymentProfile, and getCustomerPaymentProfile.&amp;nbsp; Updating, however, is causing some issues for me.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In order to update the payment profile, I call getCustomerPaymentProfile, make my necessary changes, and pass it back using updateCustomerPaymentProfile.&amp;nbsp; The result from that call includes an error stating that the 'paymentProfile' element has an invalid child element 'payment'.&amp;nbsp; I've tried removing all the changes I make to the profile, and just resubmitting it as I receive it, but that didn't help.&amp;nbsp; Browsing the forums, I saw that the order of the elements may matter.&amp;nbsp; In case the SDK was printing the elements in the wrong order, I dumped the xml it produced, to verify it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It turned out the xml for the paymentProfile contained the customerPaymentProfileId &lt;EM&gt;before&lt;/EM&gt; either the payment or billTo elements.&amp;nbsp; Since the xml element is coming straight from the response to the getCustomerPaymentProfile call, I think this may be a bug in the SDK.&amp;nbsp; As a temporary workaround, I unset the customerPaymentProfileId field before sending it back, since the update method sets it again anyway.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below is the code I used to expose this bug:&lt;/P&gt;&lt;PRE&gt;$request = new AuthorizeNetCIM;
$response = $request-&amp;gt;getCustomerPaymentProfile($cpid, $ppid);
if ($response-&amp;gt;isOk()) {
  $profile = $response-&amp;gt;xml-&amp;gt;paymentProfile;

  $request = new AuthorizeNetCIM;
  $response = $request-&amp;gt;updateCustomerPaymentProfile($cpid, $ppid, $profile);

  if (!$response-&amp;gt;isOk()) {
    print_r(array($profile, $response));
  }
}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;And here is the xml it sent (before implementing my workaround):&lt;/P&gt;&lt;PRE&gt;&amp;lt;!--?xml version="1.0" encoding="utf-8"?--&amp;gt;
&amp;lt;updatecustomerpaymentprofilerequest xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd"&amp;gt;
  &amp;lt;merchantauthentication&amp;gt;
    &amp;lt;name&amp;gt;--snip--&amp;lt;/name&amp;gt;
    &amp;lt;transactionkey&amp;gt;--snip--&amp;lt;/transactionkey&amp;gt;
  &amp;lt;/merchantauthentication&amp;gt;
  &amp;lt;customerprofileid&amp;gt;--snip--&amp;lt;/customerprofileid&amp;gt;
  &amp;lt;paymentprofile&amp;gt;
    &amp;lt;customertype&amp;gt;individual&amp;lt;/customertype&amp;gt;
    &amp;lt;customerpaymentprofileid&amp;gt;--snip--&amp;lt;/customerpaymentprofileid&amp;gt;
    &amp;lt;payment&amp;gt;
      &amp;lt;creditcard&amp;gt;
        &amp;lt;cardnumber&amp;gt;XXXX1111&amp;lt;/cardnumber&amp;gt;
        &amp;lt;expirationdate&amp;gt;XXXX&amp;lt;/expirationdate&amp;gt;
      &amp;lt;/creditcard&amp;gt;
    &amp;lt;/payment&amp;gt;
  &amp;lt;/paymentprofile&amp;gt;
&amp;lt;/updatecustomerpaymentprofilerequest&amp;gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;Thank you for your time.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-Mark&lt;/P&gt;</description>
      <pubDate>Tue, 06 Mar 2012 21:54:21 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/Invalid-child-element-in-PHP-CIM-SDK-when-updating-payment/m-p/24085#M12929</guid>
      <dc:creator>mmillford</dc:creator>
      <dc:date>2012-03-06T21:54:21Z</dc:date>
    </item>
    <item>
      <title>Re: Invalid child element in PHP CIM SDK when updating payment profile.</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Invalid-child-element-in-PHP-CIM-SDK-when-updating-payment/m-p/24337#M13052</link>
      <description>&lt;P&gt;Hi Mark,&lt;BR /&gt;&lt;BR /&gt;Thanks for the bug report, we'll document it for our Development team to take a review and fix in a future update.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;Joy&lt;/P&gt;</description>
      <pubDate>Mon, 12 Mar 2012 21:35:00 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/Invalid-child-element-in-PHP-CIM-SDK-when-updating-payment/m-p/24337#M13052</guid>
      <dc:creator>Joy</dc:creator>
      <dc:date>2012-03-12T21:35:00Z</dc:date>
    </item>
  </channel>
</rss>

