<?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: Get Customer Profile unable to reffrence cardNumber in Integration and Testing</title>
    <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Get-Customer-Profile-unable-to-reffrence-cardNumber/m-p/69155#M42238</link>
    <description>&lt;P&gt;Man, thank you! Been pulling my hair out on this one.&lt;/P&gt;</description>
    <pubDate>Wed, 18 Sep 2019 20:25:00 GMT</pubDate>
    <dc:creator>jdeloach3</dc:creator>
    <dc:date>2019-09-18T20:25:00Z</dc:date>
    <item>
      <title>Get Customer Profile unable to reffrence cardNumber</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Get-Customer-Profile-unable-to-reffrence-cardNumber/m-p/59438#M34022</link>
      <description>&lt;P&gt;How do I cast the masked CC numbers from the responce?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried doing a foreach (var s in response.profile.paymentProfiles)&lt;/P&gt;&lt;P&gt;and then drilling into s.payment.item.cardNumber But that does not seem to be option.&lt;/P&gt;</description>
      <pubDate>Thu, 17 Aug 2017 19:14:52 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/Get-Customer-Profile-unable-to-reffrence-cardNumber/m-p/59438#M34022</guid>
      <dc:creator>PaceDev</dc:creator>
      <dc:date>2017-08-17T19:14:52Z</dc:date>
    </item>
    <item>
      <title>Re: Get Customer Profile unable to reffrence cardNumber</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Get-Customer-Profile-unable-to-reffrence-cardNumber/m-p/59441#M34025</link>
      <description>&lt;P&gt;It's odd that the API shows the responce&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;creditCard&lt;/TD&gt;&lt;TD&gt;Contains credit card payment information for the customer profile.&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;cardNumber&lt;/TD&gt;&lt;TD&gt;The customer’s credit card number.&lt;BR /&gt;All sensitive payment information in the output is masked.&lt;/TD&gt;&lt;TD&gt;&lt;DIV&gt;13 to 16 digits.&lt;/DIV&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But the responce has it as Item.&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;paymentProfiles&amp;nbsp;&amp;nbsp; &amp;nbsp;{AuthorizeNet.Api.Contracts.V1.customerPaymentProfileMaskedType[1]}&amp;nbsp;&amp;nbsp; &amp;nbsp;AuthorizeNet.Api.Contracts.V1.customerPaymentProfileMaskedType[]&lt;BR /&gt;-&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;[0]&amp;nbsp;&amp;nbsp; &amp;nbsp;{AuthorizeNet.Api.Contracts.V1.customerPaymentProfileMaskedType}&amp;nbsp;&amp;nbsp; &amp;nbsp;AuthorizeNet.Api.Contracts.V1.customerPaymentProfileMaskedType&lt;BR /&gt;+&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;billTo&amp;nbsp;&amp;nbsp; &amp;nbsp;{AuthorizeNet.Api.Contracts.V1.customerAddressType}&amp;nbsp;&amp;nbsp; &amp;nbsp;AuthorizeNet.Api.Contracts.V1.customerAddressType&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;customerPaymentProfileId&amp;nbsp;&amp;nbsp; &amp;nbsp;"2501154857"&amp;nbsp;&amp;nbsp; &amp;nbsp;string&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;customerProfileId&amp;nbsp;&amp;nbsp; &amp;nbsp;null&amp;nbsp;&amp;nbsp; &amp;nbsp;string&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;customerType&amp;nbsp;&amp;nbsp; &amp;nbsp;individual&amp;nbsp;&amp;nbsp; &amp;nbsp;AuthorizeNet.Api.Contracts.V1.customerTypeEnum&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;customerTypeSpecified&amp;nbsp;&amp;nbsp; &amp;nbsp;false&amp;nbsp;&amp;nbsp; &amp;nbsp;bool&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;defaultPaymentProfile&amp;nbsp;&amp;nbsp; &amp;nbsp;false&amp;nbsp;&amp;nbsp; &amp;nbsp;bool&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;defaultPaymentProfileSpecified&amp;nbsp;&amp;nbsp; &amp;nbsp;false&amp;nbsp;&amp;nbsp; &amp;nbsp;bool&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;driversLicense&amp;nbsp;&amp;nbsp; &amp;nbsp;null&amp;nbsp;&amp;nbsp; &amp;nbsp;AuthorizeNet.Api.Contracts.V1.driversLicenseMaskedType&lt;BR /&gt;-&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;payment&amp;nbsp;&amp;nbsp; &amp;nbsp;{AuthorizeNet.Api.Contracts.V1.paymentMaskedType}&amp;nbsp;&amp;nbsp; &amp;nbsp;AuthorizeNet.Api.Contracts.V1.paymentMaskedType&lt;BR /&gt;-&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;Item&amp;nbsp;&amp;nbsp; &amp;nbsp;{AuthorizeNet.Api.Contracts.V1.creditCardMaskedType}&amp;nbsp;&amp;nbsp; &amp;nbsp;object {AuthorizeNet.Api.Contracts.V1.creditCardMaskedType}&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;cardArt&amp;nbsp;&amp;nbsp; &amp;nbsp;null&amp;nbsp;&amp;nbsp; &amp;nbsp;AuthorizeNet.Api.Contracts.V1.cardArt&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;cardNumber&amp;nbsp;&amp;nbsp; &amp;nbsp;"XXXX1111"&amp;nbsp;&amp;nbsp; &amp;nbsp;string&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;cardType&amp;nbsp;&amp;nbsp; &amp;nbsp;"Visa"&amp;nbsp;&amp;nbsp; &amp;nbsp;string&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;expirationDate&amp;nbsp;&amp;nbsp; &amp;nbsp;"XXXX"&amp;nbsp;&amp;nbsp; &amp;nbsp;string&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;and when you call:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;string ppId = response.profile.paymentProfiles[0].customerPaymentProfileId;&lt;/P&gt;&lt;P&gt;string ccnum = response.profile.paymentProfiles[0].payment.Item.cardNumber;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Severity&amp;nbsp;&amp;nbsp; &amp;nbsp;Code&amp;nbsp;&amp;nbsp; &amp;nbsp;Description&amp;nbsp;&amp;nbsp; &amp;nbsp;Project&amp;nbsp;&amp;nbsp; &amp;nbsp;File&amp;nbsp;&amp;nbsp; &amp;nbsp;Line&amp;nbsp;&amp;nbsp; &amp;nbsp;Suppression State&lt;BR /&gt;Error&amp;nbsp;&amp;nbsp; &amp;nbsp;CS1061&amp;nbsp;&amp;nbsp; &amp;nbsp;'object' does not contain a definition for 'cardNumber' and no extension method 'cardNumber' accepting a first argument of type 'object' could be found&lt;/P&gt;</description>
      <pubDate>Thu, 17 Aug 2017 20:54:54 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/Get-Customer-Profile-unable-to-reffrence-cardNumber/m-p/59441#M34025</guid>
      <dc:creator>PaceDev</dc:creator>
      <dc:date>2017-08-17T20:54:54Z</dc:date>
    </item>
    <item>
      <title>Re: Get Customer Profile unable to reffrence cardNumber</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Get-Customer-Profile-unable-to-reffrence-cardNumber/m-p/59446#M34030</link>
      <description>&lt;P&gt;Found a way around the problem but surely there has to be a better way.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Dictionary&amp;lt;string, string&amp;gt; CcLookup = new Dictionary&amp;lt;string, string&amp;gt;();
        string MaskedCcNumber = string.Empty;

        foreach (customerPaymentProfileMaskedType item in response.profile.paymentProfiles)
        {
            MaskedCcNumber = string.Empty;
            string j = GetXMLFromObject(item.payment.Item);
            XmlDocument doc = new XmlDocument();
            doc.LoadXml(j);

            XmlNodeList CardNumberTags = doc.GetElementsByTagName("cardNumber");
            if (CardNumberTags.Count &amp;lt;= 0)
            {
                
            }
            else
            {
                MaskedCcNumber = CardNumberTags[0].InnerText;
            }
            CcLookup.Add(item.customerPaymentProfileId, MaskedCcNumber);
        }

        if (response != null &amp;amp;&amp;amp; response.messages.resultCode == messageTypeEnum.Ok)
        {

        }
        else if (response != null)
        {

        }

        return CcLookup;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;    public static string GetXMLFromObject(object o)
    {
        StringWriter sw = new StringWriter();
        XmlTextWriter tw = null;
        try
        {
            XmlSerializer serializer = new XmlSerializer(o.GetType());
            tw = new XmlTextWriter(sw);
            serializer.Serialize(tw, o);
        }
        catch (Exception ex)
        {
            //Handle Exception Code
        }
        finally
        {
            sw.Close();
            if (tw != null)
            {
                tw.Close();
            }
        }
        return sw.ToString();
    }&lt;/PRE&gt;</description>
      <pubDate>Fri, 18 Aug 2017 16:53:13 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/Get-Customer-Profile-unable-to-reffrence-cardNumber/m-p/59446#M34030</guid>
      <dc:creator>PaceDev</dc:creator>
      <dc:date>2017-08-18T16:53:13Z</dc:date>
    </item>
    <item>
      <title>Re: Get Customer Profile unable to reffrence cardNumber</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Get-Customer-Profile-unable-to-reffrence-cardNumber/m-p/63673#M37743</link>
      <description>&lt;P&gt;Here's a much simpler method:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;var cardNumber = ((dynamic)apiResponse.profile.paymentProfiles[0].payment.Item).cardNumber;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jul 2018 11:05:00 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/Get-Customer-Profile-unable-to-reffrence-cardNumber/m-p/63673#M37743</guid>
      <dc:creator>bkcarroll</dc:creator>
      <dc:date>2018-07-12T11:05:00Z</dc:date>
    </item>
    <item>
      <title>Re: Get Customer Profile unable to reffrence cardNumber</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Get-Customer-Profile-unable-to-reffrence-cardNumber/m-p/67571#M40952</link>
      <description>&lt;P&gt;I know this is an old thread, but I thought I'd post my solution anyway since I couldn't find anything when I was searching for an answer.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you do a type comparison you can successfully cast the paymentMaskedType to a specific masked type and therefore gain access to its named values.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Just as a quick example,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;var account = "";&lt;BR /&gt;var type = "";&lt;BR /&gt;&lt;BR /&gt;// if item matches credit card type
if (transaction.payment.Item is creditCardMaskedType)
{
    var creditCard = (creditCardMaskedType)transaction.payment.Item;
    account = creditCard.cardNumber;
    type = creditCard.cardType;
}
// if item matches bank account type
else if (transaction.payment.Item is bankAccountMaskedType)
{
    var bankAccount = (bankAccountMaskedType)transaction.payment.Item;
    account = bankAccount.accountNumber;&lt;BR /&gt;    type = bankAccount.accountType;
}&lt;/PRE&gt;</description>
      <pubDate>Tue, 30 Apr 2019 22:01:25 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/Get-Customer-Profile-unable-to-reffrence-cardNumber/m-p/67571#M40952</guid>
      <dc:creator>jasonsmith4050</dc:creator>
      <dc:date>2019-04-30T22:01:25Z</dc:date>
    </item>
    <item>
      <title>Re: Get Customer Profile unable to reffrence cardNumber</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Get-Customer-Profile-unable-to-reffrence-cardNumber/m-p/69155#M42238</link>
      <description>&lt;P&gt;Man, thank you! Been pulling my hair out on this one.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Sep 2019 20:25:00 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/Get-Customer-Profile-unable-to-reffrence-cardNumber/m-p/69155#M42238</guid>
      <dc:creator>jdeloach3</dc:creator>
      <dc:date>2019-09-18T20:25:00Z</dc:date>
    </item>
    <item>
      <title>Re: Get Customer Profile unable to reffrence cardNumber</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Get-Customer-Profile-unable-to-reffrence-cardNumber/m-p/69570#M42569</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://community.developer.cybersource.com/t5/user/viewprofilepage/user-id/30119"&gt;@jasonsmith4050&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;I know this is an old thread, but I thought I'd post my solution anyway since I couldn't find anything when I was searching for an answer.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you do a type comparison you can successfully cast the paymentMaskedType to a specific masked type and therefore gain access to its named values.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Just as a quick example,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;var account = "";&lt;BR /&gt;var type = "";&lt;BR /&gt;&lt;BR /&gt;// if item matches credit card type
if (transaction.payment.Item is creditCard&lt;A href="https://liteblue.guru" target="_self"&gt;&lt;FONT color="#333300"&gt;liteblue&lt;/FONT&gt;&lt;/A&gt;Type)
{
    var creditCard = (creditCardMaskedType)transaction.payment.Item;
    account = creditCard.cardNumber;
    type = creditCard.cardType;
}
// if item matches bank account type
else if (transaction.payment.Item is bankAccountMaskedType)
{
    var bankAccount = (bankAccountMaskedType)transaction.payment.Item;
    account = bankAccount.accountNumber;&lt;BR /&gt;    type = bankAccount.accountType;
}&lt;/PRE&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Thank you so much&lt;/P&gt;</description>
      <pubDate>Thu, 31 Oct 2019 23:32:33 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/Get-Customer-Profile-unable-to-reffrence-cardNumber/m-p/69570#M42569</guid>
      <dc:creator>riqpuig08</dc:creator>
      <dc:date>2019-10-31T23:32:33Z</dc:date>
    </item>
  </channel>
</rss>

