<?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 C# SDK v1.7 CIM.UpdatePaymentProfile() throws Null Reference Exception in Integration and Testing</title>
    <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/C-SDK-v1-7-CIM-UpdatePaymentProfile-throws-Null-Reference/m-p/24087#M12930</link>
    <description>&lt;P&gt;Version 1.7 of the SDK throws a Null Reference Exception when attempting to use &lt;EM&gt;&lt;STRONG&gt;CustomerGateway.UpdatePaymentProfile()&lt;/STRONG&gt;&lt;/EM&gt;. &amp;nbsp;This problem was also present in pervious SDK versions. &amp;nbsp;The root of the problem is inside &lt;EM&gt;&lt;STRONG&gt;PaymentProfile.ToApi()&lt;/STRONG&gt;&lt;/EM&gt; where &lt;EM&gt;&lt;STRONG&gt;result.payment&lt;/STRONG&gt;&lt;/EM&gt; is never initialized before setting&lt;EM&gt;&lt;STRONG&gt;&amp;nbsp;result.payment.Item = card&lt;/STRONG&gt;&lt;/EM&gt;. &amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'd also like to call out the fact that your SDK has no Unit Tests. &amp;nbsp;I'd like to think that if the SDK had unit tests, it wouldn't be plagued by these kinds of simple errors.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;﻿﻿"Every single line of code that you write should be tested. Period'. ('Uncle Bob' Martin - The Clean Coder)&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.amazon.com/Clean-Coder-Conduct-Professional-Programmers/dp/0137081073/ref=sr_1_1?ie=UTF8&amp;amp;qid=1331074205&amp;amp;sr=8-1" target="_blank"&gt;http://www.amazon.com/Clean-Coder-Conduct-Professional-Programmers/dp/0137081073/ref=sr_1_1?ie=UTF8&amp;amp;qid=1331074205&amp;amp;sr=8-1&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 06 Mar 2012 22:54:17 GMT</pubDate>
    <dc:creator>Location3</dc:creator>
    <dc:date>2012-03-06T22:54:17Z</dc:date>
    <item>
      <title>C# SDK v1.7 CIM.UpdatePaymentProfile() throws Null Reference Exception</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/C-SDK-v1-7-CIM-UpdatePaymentProfile-throws-Null-Reference/m-p/24087#M12930</link>
      <description>&lt;P&gt;Version 1.7 of the SDK throws a Null Reference Exception when attempting to use &lt;EM&gt;&lt;STRONG&gt;CustomerGateway.UpdatePaymentProfile()&lt;/STRONG&gt;&lt;/EM&gt;. &amp;nbsp;This problem was also present in pervious SDK versions. &amp;nbsp;The root of the problem is inside &lt;EM&gt;&lt;STRONG&gt;PaymentProfile.ToApi()&lt;/STRONG&gt;&lt;/EM&gt; where &lt;EM&gt;&lt;STRONG&gt;result.payment&lt;/STRONG&gt;&lt;/EM&gt; is never initialized before setting&lt;EM&gt;&lt;STRONG&gt;&amp;nbsp;result.payment.Item = card&lt;/STRONG&gt;&lt;/EM&gt;. &amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'd also like to call out the fact that your SDK has no Unit Tests. &amp;nbsp;I'd like to think that if the SDK had unit tests, it wouldn't be plagued by these kinds of simple errors.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;﻿﻿"Every single line of code that you write should be tested. Period'. ('Uncle Bob' Martin - The Clean Coder)&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.amazon.com/Clean-Coder-Conduct-Professional-Programmers/dp/0137081073/ref=sr_1_1?ie=UTF8&amp;amp;qid=1331074205&amp;amp;sr=8-1" target="_blank"&gt;http://www.amazon.com/Clean-Coder-Conduct-Professional-Programmers/dp/0137081073/ref=sr_1_1?ie=UTF8&amp;amp;qid=1331074205&amp;amp;sr=8-1&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Mar 2012 22:54:17 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/C-SDK-v1-7-CIM-UpdatePaymentProfile-throws-Null-Reference/m-p/24087#M12930</guid>
      <dc:creator>Location3</dc:creator>
      <dc:date>2012-03-06T22:54:17Z</dc:date>
    </item>
    <item>
      <title>Re: C# SDK v1.7 CIM.UpdatePaymentProfile() throws Null Reference Exception</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/C-SDK-v1-7-CIM-UpdatePaymentProfile-throws-Null-Reference/m-p/24339#M13053</link>
      <description>&lt;P&gt;Hi Location3,&lt;BR /&gt;&lt;BR /&gt;Thanks for the 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:53 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/C-SDK-v1-7-CIM-UpdatePaymentProfile-throws-Null-Reference/m-p/24339#M13053</guid>
      <dc:creator>Joy</dc:creator>
      <dc:date>2012-03-12T21:35:53Z</dc:date>
    </item>
    <item>
      <title>Re: C# SDK v1.7 CIM.UpdatePaymentProfile() throws Null Reference Exception</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/C-SDK-v1-7-CIM-UpdatePaymentProfile-throws-Null-Reference/m-p/32024#M16661</link>
      <description>&lt;P&gt;9 months down the line they still dont fix a SIMPLE problem.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For all who are having the problem with the c# SDK for CIM when using UpdatePaymentProfile, just download the SDK and add one line to fix the null exception.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Open the file PaymentProfile.cs and locate the customerPaymentProfileExType method. under the line&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;var result = new customerPaymentProfileExType();&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;add&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;result.payment = new APICore.paymentType();&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;save, compile and add the generated dll to your project and problem fixed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope this helps the community.&lt;/P&gt;</description>
      <pubDate>Sun, 09 Dec 2012 13:16:24 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/C-SDK-v1-7-CIM-UpdatePaymentProfile-throws-Null-Reference/m-p/32024#M16661</guid>
      <dc:creator>henda79</dc:creator>
      <dc:date>2012-12-09T13:16:24Z</dc:date>
    </item>
    <item>
      <title>Re: C# SDK v1.7 CIM.UpdatePaymentProfile() throws Null Reference Exception</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/C-SDK-v1-7-CIM-UpdatePaymentProfile-throws-Null-Reference/m-p/32026#M16662</link>
      <description>&lt;P&gt;Or just skip the dll. Just use the web service call.&lt;/P&gt;</description>
      <pubDate>Sun, 09 Dec 2012 13:46:59 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/C-SDK-v1-7-CIM-UpdatePaymentProfile-throws-Null-Reference/m-p/32026#M16662</guid>
      <dc:creator>RaynorC1emen7</dc:creator>
      <dc:date>2012-12-09T13:46:59Z</dc:date>
    </item>
    <item>
      <title>Re: C# SDK v1.7 CIM.UpdatePaymentProfile() throws Null Reference Exception</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/C-SDK-v1-7-CIM-UpdatePaymentProfile-throws-Null-Reference/m-p/32044#M16671</link>
      <description>&lt;P&gt;I have just encounted the problem with UpdatePaymentProfile.&amp;nbsp; Here's my code&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim gate As CustomerGateway = New CustomerGateway("xxxxxxxxxx", "xxxxxxxxx", ServiceMode.Test)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim c1 As New Customer&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim pid As String = ""&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; c1 = gate.GetCustomer("11062943")&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim p1 As PaymentProfile&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; p1 = c1.PaymentProfiles(0)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pid = p1.ProfileID&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;p1.CardExpiration = "2017-12"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; gate.UpdatePaymentProfile(pid, p1)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Expiration is masked as XXXX and CardNumber is masked as XXXX1111&lt;/P&gt;&lt;P&gt;I am intending to change expiration and I get a record cannot be found error.&amp;nbsp; c1 contains the customer profile and pid contains the correct payment profile ID.&amp;nbsp; p1 contains the correct and only payment profile on this customer profile.&lt;/P&gt;&lt;P&gt;So why does it tell me a record cannot be found?&amp;nbsp; I applied the update below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;add this line to customerPaymentProfileExType after the 'var result = new customerPaymentProfileExType();'&amp;nbsp;line:&lt;/P&gt;&lt;P&gt;result.payment = &lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;&lt;FONT color="#0000ff" size="2" face="Consolas"&gt;new&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt; APICore.&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#2b91af" size="2" face="Consolas"&gt;&lt;FONT color="#2b91af" size="2" face="Consolas"&gt;&lt;FONT color="#2b91af" size="2" face="Consolas"&gt;paymentType&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt;();&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;EM&gt;Error processing request: E00040 - The record cannot be found.&lt;/EM&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Dec 2012 23:27:25 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/C-SDK-v1-7-CIM-UpdatePaymentProfile-throws-Null-Reference/m-p/32044#M16671</guid>
      <dc:creator>dmetting</dc:creator>
      <dc:date>2012-12-10T23:27:25Z</dc:date>
    </item>
    <item>
      <title>Re: C# SDK v1.7 CIM.UpdatePaymentProfile() throws Null Reference Exception</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/C-SDK-v1-7-CIM-UpdatePaymentProfile-throws-Null-Reference/m-p/32046#M16672</link>
      <description>&lt;P&gt;UpdatePaymentProfile the first param is the customer profile ID and not the customer payment profile ID.&lt;/P&gt;&lt;P&gt;so in your case would be "11062943"&lt;/P&gt;</description>
      <pubDate>Mon, 10 Dec 2012 23:44:37 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/C-SDK-v1-7-CIM-UpdatePaymentProfile-throws-Null-Reference/m-p/32046#M16672</guid>
      <dc:creator>RaynorC1emen7</dc:creator>
      <dc:date>2012-12-10T23:44:37Z</dc:date>
    </item>
  </channel>
</rss>

