LoyaltyClientUpdateMember Method |
Update a Member Detail, from the submitted values.
public Result UpdateMember( ManagementGroupRequestOfMember request )
using (var svc = new LoyaltyService.LoyaltyClient()) { var request = new LoyaltyService.ManagementGroupRequestOfMember(); request.Token = "Token";//Required - Token returned from AccountService.ManagementGroupLogin request.ManagementGroup = "Management group";//Required - ManagementGroup supplied when calling AccountService.ManagementGroupLogin var member = new LoyaltyService.Member(); member.Member_RSN = new Guid("38ce49a4-dfb7-41c2-ba33-35fd082aa046");; // Required - RSN of member member.Member_Type = "Person"; //Optional - Valid values are : 'Person' or 'Organisation'. Defaults to 'Person' if not supplied var profile = new LoyaltyService.Profile(); //Required profile.Member_RSN = Guid.NewGuid();//Optional - will be generated if not supplied profile.Member_Type = "Person"; //Optional - Valid values are : 'Person' or 'Organisation'. Defaults to 'Person' if not supplied //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 profile.CompanyName = "";//Optional - Required if Member_Type set to 'Organisation' profile.TradingAs = "";//Optional - only used if Member_Type set to 'Organisation' profile.BankAccountHolderName = "J Doe";//Optional profile.BankAccountNumberBank = "12";//Optional profile.BankAccountNumberBranch = "1234";//Optional profile.BankAccountNumberAccount = "1234567";//Optional profile.BankAccountNumberSuffix = "123";//Optional profile.DefaultPartnerOrganisation_RSN = Guid.Empty;//Optional //Contact Info //One or more ContactPoint must be provided (Postal Address, Home Phone or Email) var shippingContact = new LoyaltyService.ProfileContact(); //Postal Address var shippingAddress = new LoyaltyService.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 LoyaltyService.Address[1] { shippingAddress }; //Home phone var homePhone = new LoyaltyService.Phone(); homePhone.ContactType = "HOME"; // Should always be 'HOME' for PhoneContact for this method homePhone.IDD = "64"; //Optional - Country code (optional) homePhone.STD = "9"; //Optional - Entire phone number (excluding IDD) can be placed in Local parameter depending on setup homePhone.Local = "926 5400";//Required shippingContact.PhoneContact = new LoyaltyService.Phone[1] { homePhone }; //Home email var homeEmail = new LoyaltyService.Email(); homeEmail.ContactType = "HOME"; // Should always be 'HOME' for EmailContact for this method homeEmail.Address = "Email address"; //Required - Must be a valid email address shippingContact.EmailContact = new LoyaltyService.Email[1] { homeEmail }; //add shippingContact to profile profile.Contact = shippingContact; // Required //Opt Ins var emailOptIn = new LoyaltyService.ProfileOptIn(); emailOptIn.OptInType = "EMAIL"; //Required - Valid values are : 'EMAIL', 'MAIL' or 'SMS' emailOptIn.OptIn = true; //Required - True for Opt in, False for Opt out var mailOptIn = new LoyaltyService.ProfileOptIn(); mailOptIn.OptInType = "MAIL"; //Required - Valid values are : 'EMAIL', 'MAIL' or 'SMS' mailOptIn.OptIn = false; //Required - True for Opt in, False for Opt out var smsOptIn = new LoyaltyService.ProfileOptIn(); smsOptIn.OptInType = "SMS"; //Required - Valid values are : 'EMAIL', 'MAIL' or 'SMS' smsOptIn.OptIn = true; //Required - True for Opt in, False for Opt out //add optIns to profile profile.OptIn = new LoyaltyService.ProfileOptIn[3] { emailOptIn, mailOptIn, smsOptIn };//Optional var profileCustomFields = new LoyaltyService.ProfileCustomFieldValues(); profileCustomFields.CustomText_1 = string.Empty; //Optional CustomText_2 - CustomText_15 available profileCustomFields.CustomBoolean_1 = false; //Optional CustomBoolean_2 - CustomBoolean_20 available profileCustomFields.CustomDate_1 = DateTime.MinValue; //Optional CustomDate_2 - CustomDate_15 available profileCustomFields.CustomDecimal_1 = 0.0M; //Optional CustomDecimal_2 - CustomDecimal_5 available profileCustomFields.CustomInteger_1 = 0; //Optional CustomInteger_2 - CustomInteger_10 available //add custom fields to profile profile.CustomFieldValues = profileCustomFields;//Optional //set member profile member.Profile = profile; //Required var programMembership = new LoyaltyService.ProgramMembership(); programMembership.RSN = new Guid("3016b4f6-2e2c-4406-8c4c-1cdd5aca60d7");;//Required - RSN of program membership //programMembership.MemberRSN ignored //programMembership.DisplayValue ignored //programMembership.ProgramRSN ignored programMembership.OriginalStartDate = DateTime.Now; //Optional programMembership.StartDate = DateTime.Now; //Optional programMembership.EndDate = DateTime.Now.AddYears(1); //Optional - leave blank or set to DateTime.Min to have a program membership that does not expire programMembership.BranchName = "Albany Branch"; //Optional //programMembership.JoiningKeyCode ignored 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("5aa52e0e-4542-4019-a94a-f4e2caea6413");;//Optional - RSN of home branch (partner or outlet). May be required depending on Program configuration programMembership.PromotionalPointsConversionFactor = 0.0m;//Optional programMembership.PointsConversionFactor = 0.0m;//Optional var programMembershipCustomFields = new LoyaltyService.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 //add custom fields to program membership programMembership.CustomFieldValues = programMembershipCustomFields;//Optional //set member program membership member.ProgramMemberships = new LoyaltyService.ProgramMembership[] { programMembership };//Required //add member to request request.Value = member; LoyaltyService.Result result = svc.UpdateMember(request); if (result.FaultCode == 0) { //Request succeeded } else { //Request failed throw new Exception(result.FaultDescription); } }