Reply
Highlighted
Member
Posts: 2
Registered: ‎04-11-2013

CIM SOAP VB.net getcustomerpaymentprofile

I am trying to retrieve the masked credit card for the customer profile but can not seem to get the credit card number.

 

How do i get the cc from p2.paymentprofile.payment.  (this is the problem credit card is not an option.

 

Thanks

 

PublicSharedFunction GetCustomerProfile(profile_id AsLong) As CustomerProfileWS.CustomerProfileMaskedType

           

Dim response_type As CustomerProfileWS.GetCustomerProfileResponseType = SoapAPIUtilities.Service.GetCustomerProfile(SoapAPIUtilities.MerchantAuthentication, profile_id)

                     

Console.WriteLine(response_type.profile.customerProfileId)

ForEach p As CustomerProfileWS.CustomerPaymentProfileMaskedTypeIn response_type.profile.paymentProfiles

Console.WriteLine(p.customerPaymentProfileId)

Dim p2 As CustomerProfileWS.GetCustomerPaymentProfileResponseType = SoapAPIUtilities.Service.GetCustomerPaymentProfile(SoapAPIUtilities.MerchantAuthentication, profile_id, p.customerPaymentProfileId)

 

Next

       

Return response_type.profile

       EndFunction

Highlighted
Expert
Posts: 4,525
Registered: ‎03-08-2010

Re: CIM SOAP VB.net getcustomerpaymentprofile

[ Edited ]

p2.paymentprofile.payment is an object, you need to cast it to the correct type CreditCardMaskedType

Highlighted
Member
Posts: 2
Registered: ‎04-11-2013

Re: CIM SOAP VB.net getcustomerpaymentprofile

Thank you for the help, this is what I used for anyone interested.

 

PublicSharedFunction GetCustomerProfile(profile_id AsLong) As CustomerProfileWS.CustomerProfileMaskedType

           

Dim response_type As CustomerProfileWS.GetCustomerProfileResponseType = SoapAPIUtilities.Service.GetCustomerProfile(SoapAPIUtilities.MerchantAuthentication, profile_id)

           

           

Console.WriteLine(response_type.profile.customerProfileId)

           

           

ForEach p As CustomerProfileWS.CustomerPaymentProfileMaskedTypeIn response_type.profile.paymentProfiles

               

Console.WriteLine(p.customerPaymentProfileId)

Console.WriteLine(DirectCast(p.payment.Item, CreditCardMaskedType).cardNumber)

Console.WriteLine(DirectCast(p.payment.Item, CreditCardMaskedType).cardType)

Console.WriteLine(DirectCast(p.payment.Item, CreditCardMaskedType).expirationDate)

           

Next

           

Return response_type.profile

       

EndFunction