Esempio n. 1
0
        public void InvalidCredentialsTest()
        {
            LogHelper.info(Logger, "CreateProfileWithCreateTransactionRequestTest");

            var badCredentials = new merchantAuthenticationType {
                name = "mbld_api_-NPA5n9k", Item = "123123", ItemElementName = ItemChoiceType.transactionKey
            };

            ApiOperationBase <ANetApiRequest, ANetApiResponse> .MerchantAuthentication = badCredentials;
            ApiOperationBase <ANetApiRequest, ANetApiResponse> .RunEnvironment         = TestEnvironment;

            //create request
            var getCpReq = new getCustomerProfileRequest
            {
                customerProfileId = "1234"
            };

            var getCpCont = new getCustomerProfileController(getCpReq);

            getCpCont.Execute();
            getCustomerProfileResponse getCpResp = getCpCont.GetApiResponse();

            Assert.AreEqual("E00007", ((AuthorizeNet.Api.Contracts.V1.ANetApiResponse)(getCpResp)).messages.message[0].code);
            ValidateErrorCode(((AuthorizeNet.Api.Contracts.V1.ANetApiResponse)(getCpResp)).messages, "E00007");
        }
Esempio n. 2
0
        /// <summary>
        /// Retrieve an existing customer profile along with all the associated customer payment profiles and customer shipping addresses.
        /// </summary>
        /// <param name="profileID">The profile ID</param>
        /// <returns></returns>
        public Customer GetCustomer(string profileID)
        {
            var response = new getCustomerProfileResponse();
            var req      = new getCustomerProfileRequest();

            req.customerProfileId = profileID;

            response = (getCustomerProfileResponse)_gateway.Send(req);


            var result = new Customer();

            result.Email       = response.profile.email;
            result.Description = response.profile.description;
            result.ProfileID   = response.profile.customerProfileId;
            result.ID          = response.profile.merchantCustomerId;

            if (response.profile.shipToList != null)
            {
                for (int i = 0; i < response.profile.shipToList.Length; i++)
                {
                    result.ShippingAddresses.Add(new Address(response.profile.shipToList[i]));
                }
            }

            if (response.profile.paymentProfiles != null)
            {
                for (int i = 0; i < response.profile.paymentProfiles.Length; i++)
                {
                    result.PaymentProfiles.Add(new PaymentProfile(response.profile.paymentProfiles[i]));
                }
            }
            return(result);
        }
Esempio n. 3
0
        public void IllFormedCredentialsTest()
        {
            LogHelper.info(Logger, "CreateProfileWithCreateTransactionRequestTest");

            var badCredentials = new merchantAuthenticationType {
                name = "mbld_api_-NPA5n9k", Item = "123123"
            };                                                                                                   //, ItemElementName = ItemChoiceType.transactionKey };

            ApiOperationBase <ANetApiRequest, ANetApiResponse> .MerchantAuthentication = badCredentials;
            ApiOperationBase <ANetApiRequest, ANetApiResponse> .RunEnvironment         = TestEnvironment;

            //create request
            var getCpReq = new getCustomerProfileRequest
            {
                customerProfileId = "1234"
            };

            try
            {
                var getCpCont = new getCustomerProfileController(getCpReq);
                getCpCont.Execute();
                Assert.Fail("You should not reach here");
            }
            catch (Exception e)
            {
                Console.WriteLine("An exception expected: " + e.Message);
            }
        }
Esempio n. 4
0
        public static ANetApiResponse Run(String ApiLoginID, String ApiTransactionKey, string customerProfileId)
        {
            Console.WriteLine("Get Customer Profile sample");

            ApiOperationBase <ANetApiRequest, ANetApiResponse> .RunEnvironment = AuthorizeNet.Environment.SANDBOX;
            // define the merchant information (authentication / transaction id)
            ApiOperationBase <ANetApiRequest, ANetApiResponse> .MerchantAuthentication = new merchantAuthenticationType()
            {
                name            = ApiLoginID,
                ItemElementName = ItemChoiceType.transactionKey,
                Item            = ApiTransactionKey,
            };



            // ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;

            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]);
                    }
                }
            }
            else if (response != null)
            {
                Console.WriteLine("Error: " + response.messages.message[0].code + "  " +
                                  response.messages.message[0].text);
            }

            return(response);
        }
Esempio n. 5
0
        public static Customer[] Run(String ApiLoginID, String ApiTransactionKey, string customerProfileId)
        {
            ApiOperationBase <ANetApiRequest, ANetApiResponse> .RunEnvironment = AuthorizeNet.Environment.SANDBOX;
            // define the merchant information (authentication / transaction id)
            ApiOperationBase <ANetApiRequest, ANetApiResponse> .MerchantAuthentication = new merchantAuthenticationType()
            {
                name            = ApiLoginID,
                ItemElementName = ItemChoiceType.transactionKey,
                Item            = 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)
            {
                var profiles = response.profile.shipToList;

                Customer[] customers = new Customer[profiles.Length];

                for (int i = 0; i < profiles.Length; i++)
                {
                    customers[i]           = new Customer();
                    customers[i].LastName  = profiles[i].lastName;;
                    customers[i].FirstName = profiles[i].firstName;
                    customers[i].Email     = profiles[i].email;
                    customers[i].ProfileId = customerProfileId;
                }

                return(customers);
            }
            else
            {
                return(null);
            }
        }
Esempio n. 6
0
        public void MockgetCustomerProfileTest()
        {
            //define all mocked objects as final
            var mockController = GetMockController <getCustomerProfileRequest, getCustomerProfileResponse>();
            var mockRequest    = new getCustomerProfileRequest
            {
                merchantAuthentication = new merchantAuthenticationType {
                    name = "mocktest", Item = "mockKey", ItemElementName = ItemChoiceType.transactionKey
                },
            };
            var customerProfileMaskedType = new customerProfileMaskedType
            {
                customerProfileId = "1234",
            };
            var mockResponse = new getCustomerProfileResponse
            {
                refId        = "1234",
                sessionToken = "sessiontoken",
                profile      = customerProfileMaskedType,
            };

            var errorResponse = new ANetApiResponse();
            var results       = new List <String>();
            const messageTypeEnum messageTypeOk = messageTypeEnum.Ok;

            SetMockControllerExpectations <getCustomerProfileRequest, getCustomerProfileResponse, getCustomerProfileController>(
                mockController.MockObject, mockRequest, mockResponse, errorResponse, results, messageTypeOk);
            mockController.MockObject.Execute(AuthorizeNet.Environment.CUSTOM);
            //mockController.MockObject.Execute();
            // or var controllerResponse = mockController.MockObject.ExecuteWithApiResponse(AuthorizeNet.Environment.CUSTOM);
            var controllerResponse = mockController.MockObject.GetApiResponse();

            Assert.IsNotNull(controllerResponse);

            Assert.IsNotNull(controllerResponse.profile);
            LogHelper.info(Logger, "getCustomerProfile: Details:{0}", controllerResponse.profile);
        }
Esempio n. 7
0
        public static void Run(String ApiLoginID, String ApiTransactionKey)
        {
            Console.WriteLine("Get Customer Profile sample");

            ApiOperationBase <ANetApiRequest, ANetApiResponse> .RunEnvironment = AuthorizeNet.Environment.SANDBOX;
            // define the merchant information (authentication / transaction id)
            ApiOperationBase <ANetApiRequest, ANetApiResponse> .MerchantAuthentication = new merchantAuthenticationType()
            {
                name            = ApiLoginID,
                ItemElementName = ItemChoiceType.transactionKey,
                Item            = ApiTransactionKey,
            };

            var request = new getCustomerProfileRequest();

            request.customerProfileId = "36594444";

            // 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.messages.resultCode == messageTypeEnum.Ok)
            {
                Console.WriteLine(response.messages.message[0].text);
                Console.WriteLine("Customer Profile Id: " + response.profile.customerProfileId);
            }
            else
            {
                Console.WriteLine("Error: " + response.messages.message[0].code + "  " +
                                  response.messages.message[0].text);
            }
        }
        public void CreateTransactionFromProfile()
        {
            //Creates a customer profile and customer payment profile
            //Then uses those profiles to create a transaction request

            //Common code to set for all requests
            ApiOperationBase <ANetApiRequest, ANetApiResponse> .MerchantAuthentication = CustomMerchantAuthenticationType;
            ApiOperationBase <ANetApiRequest, ANetApiResponse> .RunEnvironment         = TestEnvironment;

            Random rnd = new Random(DateTime.Now.Millisecond);

            string profileRandom = rnd.Next(9999).ToString();

            //Create profile to use in transaction creation
            var profileShipTo = new customerAddressType
            {
                address     = profileRandom + " First St NE",
                city        = "Bellevue",
                state       = "WA",
                zip         = "98007",
                company     = "Sample Co " + profileRandom,
                country     = "USA",
                firstName   = "Sample" + profileRandom,
                lastName    = "Name" + profileRandom,
                phoneNumber = "425 123 4567",
            };

            var paymentProfile = new customerPaymentProfileType
            {
                billTo       = profileShipTo,
                customerType = customerTypeEnum.individual,
                payment      = new paymentType {
                    Item = new creditCardType {
                        cardNumber = "4111111111111111", expirationDate = "0622"
                    }
                },
            };

            var createProfileReq = new createCustomerProfileRequest
            {
                profile = new customerProfileType
                {
                    description     = "SampleProfile " + profileRandom,
                    email           = "SampleEmail" + profileRandom + "@Visa.com",
                    shipToList      = new customerAddressType[] { profileShipTo },
                    paymentProfiles = new customerPaymentProfileType[] { paymentProfile }
                }
            };

            var createProfileCont = new createCustomerProfileController(createProfileReq);

            createProfileCont.Execute();
            var createProfileResp = createProfileCont.GetApiResponse();

            //Get profile using getCustomerProfileRequest
            var getCustReq = new getCustomerProfileRequest {
                customerProfileId = createProfileResp.customerProfileId
            };
            var getCustCont = new getCustomerProfileController(getCustReq);

            getCustCont.Execute();
            var getCustResp = getCustCont.GetApiResponse();


            //Create Transaction
            //Create instance of customer payment profile using the profile IDs from the profile we loaded above.
            var custPaymentProfile = new AuthorizeNet.Api.Contracts.V1.customerProfilePaymentType {
                customerProfileId = getCustResp.profile.customerProfileId, paymentProfile = new paymentProfile {
                    paymentProfileId = getCustResp.profile.paymentProfiles[0].customerPaymentProfileId
                }
            };

            var testTxn = new transactionRequestType
            {
                profile         = custPaymentProfile,
                amount          = (decimal)rnd.Next(9999) / 100,
                transactionType = transactionTypeEnum.authCaptureTransaction.ToString()
            };

            var txnControler = new createTransactionController(new createTransactionRequest {
                transactionRequest = testTxn
            });

            txnControler.Execute();
            var txnControlerResp = txnControler.GetApiResponse();

            //verify transaction succeeded.
            Assert.AreEqual("1", txnControlerResp.transactionResponse.messages[0].code);
        }
Esempio n. 9
0
        //public static ANetApiResponse Run(String ApiLoginID, String ApiTransactionKey, string customerProfileId)
        //{
        //    Console.WriteLine("Get Customer Profile sample");

        //    ApiOperationBase<ANetApiRequest, ANetApiResponse>.RunEnvironment = AuthorizeNET.Environment.SANDBOX;
        //    // define the merchant information (authentication / transaction id)
        //    ApiOperationBase<ANetApiRequest, ANetApiResponse>.MerchantAuthentication = new merchantAuthenticationType()
        //    {
        //        name = ApiLoginID,
        //        ItemElementName = ItemChoiceType.transactionKey,
        //        Item = 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]);
        //        }

        //    }
        //    else if (response != null)
        //    {
        //        Console.WriteLine("Error: " + response.messages.message[0].code + "  " +
        //                          response.messages.message[0].text);
        //    }

        //    return response;
        //}



        public static void GetCustomerProfileExec(String ApiLoginID, String ApiTransactionKey)
        {
            using (CsvReader csv = new CsvReader(new StreamReader(new FileStream(@"../../../CSV_DATA/GetCustomerProfile.csv", FileMode.Open)), true))
            {
                int      flag       = 0;
                int      fieldCount = csv.FieldCount;
                string[] headers    = csv.GetFieldHeaders();
                //Append Data
                var item1 = DataAppend.ReadPrevData();
                // Writing to output CSV file
                using (CsvFileWriter writer = new CsvFileWriter(new FileStream(@"../../../CSV_DATA/Outputfile.csv", FileMode.Open)))
                {
                    while (csv.ReadNextRecord())
                    {
                        // Create Instance of Customer Api
                        ApiOperationBase <ANetApiRequest, ANetApiResponse> .RunEnvironment = AuthorizeNET.Environment.SANDBOX;
                        // define the merchant information (authentication / transaction id)
                        ApiOperationBase <ANetApiRequest, ANetApiResponse> .MerchantAuthentication = new merchantAuthenticationType()
                        {
                            name            = ApiLoginID,
                            ItemElementName = ItemChoiceType.transactionKey,
                            Item            = ApiTransactionKey,
                        };

                        //CustomersApi instance = new CustomersApi(EnvironmentSet.Sandbox);
                        // Customer Response Object
                        // Customer response = null;
                        //initialization


                        string customerProfileId = null;
                        string TestcaseID        = null;
                        for (int i = 0; i < fieldCount; i++)
                        {
                            switch (headers[i])
                            {
                            case "customerProfileId":
                                customerProfileId = csv[i];
                                break;

                            case "TestcaseID":
                                TestcaseID = csv[i];
                                break;

                            default:
                                break;
                            }
                        }
                        //Write to output file
                        CsvRow row = new CsvRow();
                        try
                        {
                            if (flag == 0)
                            {
                                row.Add("TestCaseId");
                                row.Add("APIName");
                                row.Add("Status");
                                row.Add("TimeStamp");
                                writer.WriteRow(row);
                                flag = flag + 1;
                                //Append Data
                                foreach (var item in item1)
                                {
                                    writer.WriteRow(item);
                                }
                            }
                            //response = instance.GetCustomer(customerId, authorization);

                            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)
                            getCustomerProfileResponse response = controller.GetApiResponse();
                            if (response != null && response.messages.resultCode == messageTypeEnum.Ok)
                            {
                                try
                                {
                                    //Assert.AreEqual(response.Id, customerProfileId);
                                    Console.WriteLine("Assertion Succeed! Valid CustomerId fetched.");
                                    CsvRow row1 = new CsvRow();
                                    row1.Add("GCP_00" + flag.ToString());
                                    row1.Add("GetCustomerProfile");
                                    row1.Add("Pass");
                                    row1.Add(DateTime.Now.ToString("yyyy/MM/dd" + "::" + "HH:mm:ss:fff"));
                                    writer.WriteRow(row1);
                                    //  Console.WriteLine("Success " + TestcaseID + " CustomerID : " + response.Id);
                                    flag = flag + 1;

                                    Console.WriteLine(response.messages.message[0].text);
                                    Console.WriteLine("Customer Profile Id: " + response.profile.customerProfileId);
                                }
                                catch
                                {
                                    CsvRow row1 = new CsvRow();
                                    row1.Add("GCP_00" + flag.ToString());
                                    row1.Add("GetCustomerProfile");
                                    row1.Add("Assertion Failed!");
                                    row1.Add(DateTime.Now.ToString("yyyy/MM/dd" + "::" + "HH:mm:ss:fff"));
                                    writer.WriteRow(row1);
                                    //Console.WriteLine("Assertion Failed! Invalid CustomerId fetched.");
                                    flag = flag + 1;
                                }
                            }
                            else
                            {
                                CsvRow row1 = new CsvRow();
                                row1.Add("GCP_00" + flag.ToString());
                                row1.Add("GetCustomerProfile");
                                row1.Add("Assertion Failed!");
                                row1.Add(DateTime.Now.ToString("yyyy/MM/dd" + "::" + "HH:mm:ss:fff"));
                                writer.WriteRow(row1);
                                ///Console.WriteLine("Assertion Failed! Invalid CustomerId fetched.");
                                flag = flag + 1;
                            }
                        }
                        catch (Exception e)
                        {
                            CsvRow row2 = new CsvRow();
                            row2.Add("GCP_00" + flag.ToString());
                            row2.Add("GetCustomerProfile");
                            row2.Add("Fail");
                            row2.Add(DateTime.Now.ToString("yyyy/MM/dd" + "::" + "HH:mm:ss:fff"));
                            writer.WriteRow(row2);
                            flag = flag + 1;
                            Console.WriteLine(TestcaseID + " Error Message " + e.Message);
                        }
                    }
                }
            }
        }
Esempio n. 10
0
 public static void getCustomerProfileRequest(getCustomerProfileRequest request)
 {
 }
Esempio n. 11
0
        public void CreateCustomerProfileFromECheckTransaction()
        {
            var    rnd          = new AnetRandom(DateTime.Now.Millisecond);
            string customerIndx = rnd.Next(99999).ToString();

            ApiOperationBase <ANetApiRequest, ANetApiResponse> .MerchantAuthentication = CustomMerchantAuthenticationType;
            ApiOperationBase <ANetApiRequest, ANetApiResponse> .RunEnvironment         = TestEnvironment;

            //set up data based on transaction
            var transactionAmount = SetValidTransactionAmount(Counter);
            var echeck            = new bankAccountType {
                accountNumber = "123456", accountType = bankAccountTypeEnum.checking, checkNumber = "1234", bankName = "Bank of Seattle", routingNumber = "125000024", echeckType = echeckTypeEnum.WEB, nameOnAccount = "Joe Customer"
            };

            //Create and submit transaction with customer info to create profile from.
            var paymentType = new paymentType {
                Item = echeck
            };
            var transactionRequest = new transactionRequestType
            {
                transactionType = transactionTypeEnum.authOnlyTransaction.ToString(),
                payment         = paymentType,
                amount          = (decimal)transactionAmount,
                customer        = new customerDataType
                {
                    email = string.Format("Customer{0}@visa.com", customerIndx),
                    taxId = string.Format("{0}{1}{2}", rnd.Next(999).ToString("000"), rnd.Next(99).ToString("00"), rnd.Next(9999).ToString("0000"))
                },
                billTo = new customerAddressType
                {
                    firstName = "New",
                    lastName  = string.Format("Customer{0}", customerIndx),
                    company   = "New Company",
                    address   = "1234 Sample St NE",
                    city      = "Bellevue",
                    state     = "WA",
                    zip       = "98001"
                },

                shipTo = new customerAddressType
                {
                    firstName = "New",
                    lastName  = string.Format("Customer{0}", customerIndx),
                    company   = "New Company",
                    address   = "1234 Sample St NE",
                    city      = "Bellevue",
                    state     = "WA",
                    zip       = "98001"
                }
            };
            var request = new createTransactionRequest {
                transactionRequest = transactionRequest
            };
            var controller = new createTransactionController(request);

            controller.Execute();
            var response = controller.GetApiResponse();

            //Verify that transaction was accepted and save the transaction ID
            Assert.AreEqual(messageTypeEnum.Ok, response.messages.resultCode);
            string txnID = response.transactionResponse.transId;


            //Build and submit request to create Customer Profile based on the accepted transaction
            createCustomerProfileFromTransactionRequest profileFromTransReq = new createCustomerProfileFromTransactionRequest();

            profileFromTransReq.transId = txnID;

            createCustomerProfileFromTransactionController profileFromTrxnController = new createCustomerProfileFromTransactionController(profileFromTransReq);

            profileFromTrxnController.Execute();
            createCustomerProfileResponse createProfResp = profileFromTrxnController.GetApiResponse();

            Assert.AreEqual(messageTypeEnum.Ok, createProfResp.messages.resultCode);

            //Get customer profile and verify that profile data matches the data submitted with the transaction
            getCustomerProfileRequest profileReq = new getCustomerProfileRequest
            {
                customerProfileId = createProfResp.customerProfileId
            };

            getCustomerProfileController getCustContr = new getCustomerProfileController(profileReq);

            getCustContr.Execute();
            var getCustResp = getCustContr.GetApiResponse();

            //validate
            Assert.AreEqual("1", response.transactionResponse.messages[0].code);
        }
Esempio n. 12
0
        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);
        }