PointOfSaleClientUpdateMember Method |
Update a Member Detail, from the submitted values.
public ResultOfMemberUpdateInfo UpdateMember( RequestOfMemberUpdate request )
using (var svc = new PointOfSaleService.PointOfSaleClient()) { var request = new PointOfSaleService.RequestOfMemberUpdate(); request.Token = "Token";//Required - Token returned from PointOfSaleService.Authenticate var memberUpdate = new PointOfSaleService.MemberUpdate(); memberUpdate.Member_RSN = new Guid("93695f88-53c6-4736-80a7-4f541ac551db");;//Required - RSN of member memberUpdate.Member_Type = "Person"; //Valid values are : 'Person' or 'Organisation'. Defaults to 'Person' if not supplied memberUpdate.LanguagePreference_KeyCode = "en-nz"; //Optional - If provided must be a value supported by your implementation //member.DisplayValue ignored. value in profile is used //member.SequenceNumber ignored var profile = new PointOfSaleService.Profile(); //Name info profile.Title = "Mr"; //Required - Valid values are : 'Dr', 'Sir', 'Lady', 'Mr', 'Miss', 'Ms' or 'Mrs' (case sensitive)"; profile.GivenName = "John"; // Required profile.MiddleName = "David"; // Optional profile.FamilyName = "Doe"; // Required if (string.IsNullOrEmpty(profile.MiddleName)) { profile.DisplayValue = string.Concat(profile.Title, " ", profile.GivenName, " ", profile.FamilyName).Trim(); //Optional (it is recommended to give this property a value). } else { profile.DisplayValue = string.Concat(profile.Title, " ", profile.GivenName, " ", profile.MiddleName, " ", profile.FamilyName).Trim(); //Optional (it is recommended to give this property a value). } profile.Gender = "MALE"; //Required - Valid values are : 'MALE', 'FEMALE' or 'DONOTKNOW' profile.DateOfBirth = new DateTime(1950, 12, 25); // Optional //Contact Info //One or more ContactPoint must be provided (Postal Address, Home Phone or Email) var shippingContact = new PointOfSaleService.ProfileContact(); //Postal Address var shippingAddress = new PointOfSaleService.Postal(); shippingAddress.ContactType = "SHIPPING"; // Should always be 'SHIPPING' for AddressContact for this method shippingAddress.Line1 = "Level 1, Simplicity Building"; // Required shippingAddress.Line2 = "14-22 Triton Drive"; // Optional shippingAddress.Suburb = "Albany"; // Required shippingAddress.TownCityState = "Auckland"; // Required shippingAddress.PostCode = "0632"; // Required shippingAddress.Country = "New Zealand"; // Required shippingContact.AddressContact = new PointOfSaleService.Address[1] { shippingAddress }; //Home phone var homePhone = new PointOfSaleService.Phone(); homePhone.ContactType = "HOME"; // Should always be 'HOME' for PhoneContact for this method homePhone.IDD = "64"; // Country code (optional) homePhone.STD = "9"; // Entire phone number (excluding IDD) can be placed in Local parameter depending on setup homePhone.Local = "926 5400"; shippingContact.PhoneContact = new PointOfSaleService.Phone[1] { homePhone }; //Home email var homeEmail = new PointOfSaleService.Email(); homeEmail.ContactType = "HOME"; // Should always be 'HOME' for EmailContact for this method homeEmail.Address = "Email address"; //Must be a valid email address; shippingContact.EmailContact = new PointOfSaleService.Email[1] { homeEmail }; //set profile contact profile.Contact = shippingContact; // Required //Opt Ins var emailOptIn = new PointOfSaleService.ProfileOptIn(); emailOptIn.OptInType = "EMAIL"; //Valid values are : 'EMAIL', 'MAIL' or 'SMS' emailOptIn.OptIn = true; //True for Opt in, False for Opt out var mailOptIn = new PointOfSaleService.ProfileOptIn(); mailOptIn.OptInType = "MAIL"; //Valid values are : 'EMAIL', 'MAIL' or 'SMS' mailOptIn.OptIn = false; //True for Opt in, False for Opt out var smsOptIn = new PointOfSaleService.ProfileOptIn(); smsOptIn.OptInType = "SMS"; //Valid values are : 'EMAIL', 'MAIL' or 'SMS' smsOptIn.OptIn = true; //True for Opt in, False for Opt out profile.OptIn = new PointOfSaleService.ProfileOptIn[3] { emailOptIn, mailOptIn, smsOptIn }; //set member profile memberUpdate.Profile = profile; //Required var programMembership = new PointOfSaleService.ProgramMembership(); programMembership.RSN = new Guid("4f7c5c4b-27f5-48fc-8b64-064977e7ba62");;//Required - RSN of program membership programMembership.StartDate = DateTime.Now; //Optional programMembership.EndDate = DateTime.Now.AddYears(1); //Optional programMembership.OriginalStartDate = DateTime.Now; //Optional programMembership.BranchName = "Branch"; //Optional programMembership.CancelReason = "";//Optional - Used when cancelling a program membership. Valid values are : 'CANCELLED' or 'TERMINATED'. Leave empty if not cancelling programMembership.RedemptionOnHold = false; //Optional programMembership.PointsExpiredExemption = false;//Optional programMembership.HomeBranch_Organisation_RSN = new Guid("48194b69-a135-4db4-a332-b2c214eb9d17");;//Optional by default - Can be configured to be Required programMembership.PromotionalPointsConversionFactor = 0;//Optional programMembership.PointsConversionFactor = 0;//Optional var programMembershipCustomFields = new PointOfSaleService.ProfileCustomFieldValues(); programMembershipCustomFields.CustomText_1 = string.Empty; //Optional CustomText_2 - CustomText_15 available programMembershipCustomFields.CustomBoolean_1 = false; //Optional CustomBoolean_2 - CustomBoolean_20 available programMembershipCustomFields.CustomDate_1 = DateTime.MinValue; //Optional CustomDate_2 - CustomDate_15 available programMembershipCustomFields.CustomDecimal_1 = 0.0M; //Optional CustomDecimal_2 - CustomDecimal_5 available programMembershipCustomFields.CustomInteger_1 = 0; //Optional CustomInteger_2 - CustomInteger_10 available programMembership.CustomFieldValues = programMembershipCustomFields;//Optional //set member program memberships memberUpdate.ProgramMemberships = new PointOfSaleService.ProgramMembership[] { programMembership };//Required //add member to request request.Value = memberUpdate;//Required PointOfSaleService.ResultOfMemberUpdateInfo result = svc.UpdateMember(request); if (result.FaultCode == 0) { //Request succeeded } else { //Request failed throw new Exception(result.FaultDescription); } }