private void MakeAddress( IEnumerable <CustomerAddress> newAddress, Iesi.Collections.Generic.ISet <CustomerAddress> prevAddress, CustomerAddressType prevAddressType, Iesi.Collections.Generic.ISet <CustomerAddress> currentAddress, CustomerAddressType currentAddressType ) { var newAddresses = newAddress as IList <CustomerAddress> ?? newAddress.ToList(); var addAddress = newAddresses.Where(i => i.AddressId == 0).ToList(); var curAddress = addAddress.LastOrDefault() ?? currentAddress.LastOrDefault(); if (curAddress == null) { return; } foreach (var address in newAddresses) { address.Director = currentAddress.First().Director; address.Customer = currentAddress.First().Customer; address.Company = currentAddress.First().Company; } // for each new address foreach (var item in currentAddress) { item.AddressType = prevAddressType; prevAddress.Add(item); } // for each old address curAddress.AddressType = currentAddressType; currentAddress.Add(curAddress); } // MakeAddress
public static CustomerPaymentProfileType CreatePaymentProfileType(CustomerAddressType addressType, PaymentType paymentType) { return(new CustomerPaymentProfileType() { billTo = addressType, payment = paymentType }); }
public int this[CustomerAddressType nType] { get { if (m_oAddressCount.ContainsKey(nType)) { return(m_oAddressCount[nType]); } return(0); } } // indexer
} // indexer public void Add(IDataRecord oRow) { int nAddressType = Convert.ToInt32(oRow["AddressTypeID"]); if (Enum.IsDefined(typeof(CustomerAddressType), nAddressType)) { CustomerAddressType at = (CustomerAddressType)Enum.ToObject(typeof(CustomerAddressType), nAddressType); m_oAddressCount[at] = Convert.ToInt32(oRow["AddressCount"]); } // if } // Add
public CIMResponse UpdatePaymentProfile(long paymentProfileId, CustomerAddressType address, string creditCardNumber, string cardCode, Int32 expMonth, Int32 expYear) { var serviceCtx = new ServiceProcessContext(); string expDate = ServiceTools.GetAuthNetExpirationDate(expMonth, expYear); var paymentType = ServiceTools.CreatePaymentType(creditCardNumber, cardCode, expDate); var paymentProfileType = ServiceTools.CreatePaymentProfileExType(paymentProfileId, address, paymentType); var response = serviceCtx.Service.UpdateCustomerPaymentProfile(serviceCtx.MerchantAuthenticationType, this.ProfileId, paymentProfileType, ValidationMode); return(ServiceTools.ParseDirectResponse(response.validationDirectResponse)); }
public void CreatePaymentProfile(Customer customer, Address billingAddress, string cardType, string number, string cvv, DateTime expirationDate) { var profileId = GetProfileId(customer); if (profileId == 0) { profileId = CreateProfile(customer); } var profileManager = new ProfileManager( customerId: customer.CustomerID, email: customer.EMail, profileId: profileId); var address = new CustomerAddressType { address = billingAddress.Address1, city = billingAddress.City, company = billingAddress.Company, country = billingAddress.Country, faxNumber = billingAddress.Fax, firstName = billingAddress.FirstName, lastName = billingAddress.LastName, phoneNumber = billingAddress.Phone, state = billingAddress.State, zip = billingAddress.Zip }; var paymentProfile = profileManager.CreatePaymentProfile( address: address, creditCardNumber: number, cardCode: cvv, expMonth: expirationDate.Month, expYear: expirationDate.Year); if (!string.IsNullOrEmpty(paymentProfile.ErrorCode)) { throw new WalletException(paymentProfile.ErrorMessage); } DataUtility.SavePaymentProfile( customerid: customer.CustomerID, addressId: billingAddress.AddressID, paymentProfileId: paymentProfile.PaymentProfileId, expirationMonth: expirationDate.Month.ToString(), expirationYear: expirationDate.Year.ToString(), cardType: cardType); }
public CIMResponse CreatePaymentProfile(CustomerAddressType address, string creditCardNumber, string cardCode, Int32 expMonth, Int32 expYear) { var serviceCtx = new ServiceProcessContext(); string expDate = ServiceTools.GetAuthNetExpirationDate(expMonth, expYear); var paymentType = ServiceTools.CreatePaymentType(creditCardNumber, cardCode, expDate); var paymentProfileType = ServiceTools.CreatePaymentProfileType(address, paymentType); var response = serviceCtx.Service.CreateCustomerPaymentProfile(serviceCtx.MerchantAuthenticationType, this.ProfileId, paymentProfileType, ValidationMode); var retResponse = ServiceTools.ParseDirectResponse(response.validationDirectResponse); if (response.resultCode == MessageTypeEnum.Error) { retResponse.ErrorMessage = response.messages[0].text; retResponse.ErrorCode = response.messages[0].code; retResponse.Success = false; } retResponse.PaymentProfileId = response.customerPaymentProfileId; return(retResponse); }
//TODO: check it out private HousingType DetermineHousingType(CustomerAddressType addressType, CustomerPropertyStatus propertyStatus) { if (addressType == CustomerAddressType.PersonalAddress) { switch (propertyStatus) { case CustomerPropertyStatus.NotYetFilled://should not happen because we require to supply HousingType Log.Error("Got not yet filled"); break; case CustomerPropertyStatus.IOwnOnlyThisProperty: return(HousingType.OwnProperty); case CustomerPropertyStatus.IOwnThisPropertyAndOtherProperties: return(HousingType.OwnProperty); case CustomerPropertyStatus.ILiveInTheAboveAndOwnOtherProperties: // could not determine break; case CustomerPropertyStatus.IHomeOwner: return(HousingType.OwnProperty); case CustomerPropertyStatus.Renting: return(HousingType.Renting); case CustomerPropertyStatus.SocialHouse: return(HousingType.Social); case CustomerPropertyStatus.LivingWithParents: return(HousingType.LivingWithParents); default: throw new ArgumentOutOfRangeException("propertyStatus", propertyStatus, null); } } if (addressType == CustomerAddressType.PrevPersonAddresses) { switch (propertyStatus) { case CustomerPropertyStatus.NotYetFilled: //should not happen because we require to supply HousingType Log.Error("Got not yet filled"); break; case CustomerPropertyStatus.IOwnOnlyThisProperty: //could not determine return(HousingType.OwnProperty); case CustomerPropertyStatus.IOwnThisPropertyAndOtherProperties: //could not determine return(HousingType.OwnProperty); case CustomerPropertyStatus.ILiveInTheAboveAndOwnOtherProperties: // could not determine break; case CustomerPropertyStatus.IHomeOwner: // could not determine return(HousingType.OwnProperty); case CustomerPropertyStatus.Renting: // could not determine return(HousingType.Renting); case CustomerPropertyStatus.SocialHouse: //could not determine return(HousingType.Social); case CustomerPropertyStatus.LivingWithParents: //could not determine return(HousingType.LivingWithParents); default: throw new ArgumentOutOfRangeException("propertyStatus", propertyStatus, null); } } return(HousingType.OwnProperty); }
public static CustomerPaymentProfileExType CreatePaymentProfileExType(Int64 paymentProfileId, CustomerAddressType addressType, PaymentType paymentType) { return(new CustomerPaymentProfileExType() { billTo = addressType, payment = paymentType, customerPaymentProfileId = paymentProfileId }); }