cancel
Showing results for 
Search instead for 
Did you mean: 

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

zbob
Member
2 REPLIES 2

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

RaynorC1emen7
Expert

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