public static void creditCardMaskedType(creditCardMaskedType request) { }
public List <SaveCardViewModel> GetCardInfo(string CustomerProfileId, string ANET_ApiLoginID, string ANET_ApiTransactionKey) { //SaveCardViewModel saveCardView = new SaveCardViewModel(); List <SaveCardViewModel> lstsaveCards = new List <SaveCardViewModel>(); ApiOperationBase <ANetApiRequest, ANetApiResponse> .RunEnvironment = AuthorizeNet.Environment.PRODUCTION; // define the merchant information (authentication / transaction id) ApiOperationBase <ANetApiRequest, ANetApiResponse> .MerchantAuthentication = new merchantAuthenticationType() { name = ANET_ApiLoginID, ItemElementName = ItemChoiceType.transactionKey, Item = ANET_ApiTransactionKey, }; var request = new getCustomerProfileRequest(); request.customerProfileId = CustomerProfileId; // instantiate the controller that will call the service var controller = new getCustomerProfileController(request); controller.Execute(); // get the response from the service (errors contained if any) var response = controller.GetApiResponse(); if (response != null && response.messages.resultCode == messageTypeEnum.Ok) { Console.WriteLine(response.messages.message[0].text); Console.WriteLine("Customer Profile Id: " + response.profile.customerProfileId); if (response.subscriptionIds != null && response.subscriptionIds.Length > 0) { Console.WriteLine("List of subscriptions : "); for (int i = 0; i < response.subscriptionIds.Length; i++) { Console.WriteLine(response.subscriptionIds[i]); } } for (int i = 0; i < response.profile.paymentProfiles.Length; i++) { SaveCardViewModel saveCardView = new SaveCardViewModel(); if (response.profile.paymentProfiles[i].payment.Item.GetType() == typeof(creditCardMaskedType)) { creditCardMaskedType objItem = (creditCardMaskedType)response.profile.paymentProfiles[i].payment.Item; saveCardView.cardNumber = objItem.cardNumber; saveCardView.cardType = objItem.cardType; saveCardView.expirationDate = objItem.expirationDate; saveCardView.customerPaymentProfileId = response.profile.paymentProfiles[i].customerPaymentProfileId; } else if (response.profile.paymentProfiles[i].payment.Item.GetType() == typeof(bankAccountMaskedType)) { bankAccountMaskedType objItem = (bankAccountMaskedType)response.profile.paymentProfiles[i].payment.Item; saveCardView.cardNumber = objItem.accountNumber; saveCardView.cardType = objItem.bankName; saveCardView.customerPaymentProfileId = response.profile.paymentProfiles[i].customerPaymentProfileId; } lstsaveCards.Add(saveCardView); } } else if (response != null) { Console.WriteLine("Error: " + response.messages.message[0].code + " " + response.messages.message[0].text); } return(lstsaveCards); }