/// <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;
        }
Exemplo n.º 2
0
 public AuthorizeNet.APICore.getCustomerProfileResponse GetCustomerProfile(long profileId)
 {
     AuthorizeNet.APICore.getCustomerProfileRequest req = new AuthorizeNet.APICore.getCustomerProfileRequest();
     req.customerProfileId = profileId.ToString();
     AuthorizeNet.HttpXmlUtility util = new AuthorizeNet.HttpXmlUtility(ServiceMode, MerchantAuthenticationType.name, MerchantAuthenticationType.transactionKey);
     return (AuthorizeNet.APICore.getCustomerProfileResponse)util.Send(req);
 }