LoyaltyClientCreateCardForMember Method |
Create a new Card and link to an existing Member, from the submitted values. The Card and Member are linked via Program Membership.
public ResultOfCardCredentials CreateCardForMember( ManagementGroupRequestOfCreateCard request )
using (var svc = new LoyaltyService.LoyaltyClient()) { var request = new LoyaltyService.ManagementGroupRequestOfCreateCard(); request.Token = "Token";//Required - Token returned from AccountService.ManagementGroupLogin request.ManagementGroup = "Management group";//Required - ManagementGroup supplied when calling AccountService.ManagementGroupLogin var createCard = new LoyaltyService.CreateCard(); createCard.CardStatus = "ACTIVE";//Required - Valid values are : 'ACTIVE', 'INACTIVE' or 'PEDNINGACTIVATION' createCard.CardType = "STANDARD";//Required - Valid values are : 'STANDARD' or 'VIRTUAL' createCard.SendEmail = true;//Optional - Sends welcome email to new member if true var programMembership = new LoyaltyService.ProgramMembership(); //programMembership.RSN ignored programMembership.MemberRSN = new Guid("d8d55e7e-6d98-4a89-8962-3e921385e824");;//Required - RSN of member programMembership.DisplayValue = "Simplicity Rewards - John Doe";//Required programMembership.ProgramRSN = new Guid("84dcaf0b-07b6-4c53-92d7-4a21a57dbe25");; //Required - RSN of program 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 = "";//Optional programMembership.RedemptionOnHold = false;//Optional programMembership.PointsExpiredExemption = false;//Optional programMembership.HomeBranch_Organisation_RSN = new Guid("62b9bce0-3a4b-44e0-85dc-506af579825d");;//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 createCardAndMember program membership createCard.Membership = programMembership; //add createCard to request request.Value = createCard; LoyaltyService.ResultOfCardCredentials result = svc.CreateCardForMember(request); if (result.FaultCode == 0) { //Request succeeded } else { //Request failed throw new Exception(result.FaultDescription); } }