using (var svc = new LoyaltyService.LoyaltyClient())
{
var request = new LoyaltyService.ManagementGroupRequestOfNewTransferCardMember();
request.Token = "Token";
request.ManagementGroup = "Management group";
var newTransferCardMember = new LoyaltyService.NewTransferCardMember();
newTransferCardMember.CardNumber = "21000005";
newTransferCardMember.SendWelcomeEmail = true;
newTransferCardMember.CardMergeSourceMember_TemplateID = "CARDMERGE_SOURCE_MEMBER";
newTransferCardMember.CardMergeTargetMember_TemplateID = "CARDMERGE_TARGET_MEMBER";
var profile = new LoyaltyService.Profile();
profile.Member_RSN = Guid.NewGuid();
profile.Member_Type = "Person";
profile.Title = "Mr";
profile.GivenName = "John";
profile.MiddleName = "David";
profile.FamilyName = "Doe";
if (string.IsNullOrEmpty(profile.MiddleName))
{
profile.DisplayValue = string.Concat(profile.Title, " ", profile.GivenName, " ", profile.FamilyName).Trim();
}
else
{
profile.DisplayValue = string.Concat(profile.Title, " ", profile.GivenName, " ", profile.MiddleName, " ", profile.FamilyName).Trim();
}
profile.Gender = "MALE";
profile.DateOfBirth = new DateTime(1950, 12, 25);
profile.CompanyName = "";
profile.TradingAs = "";
profile.BankAccountHolderName = "J Doe";
profile.BankAccountNumberBank = "12";
profile.BankAccountNumberBranch = "1234";
profile.BankAccountNumberAccount = "1234567";
profile.BankAccountNumberSuffix = "123";
profile.DefaultPartnerOrganisation_RSN = Guid.Empty;
var shippingContact = new LoyaltyService.ProfileContact();
var shippingAddress = new LoyaltyService.Postal();
shippingAddress.ContactType = "SHIPPING";
shippingAddress.Line1 = "Level 1, Simplicity Building";
shippingAddress.Line2 = "14-22 Triton Drive";
shippingAddress.Suburb = "Albany";
shippingAddress.TownCityState = "Auckland";
shippingAddress.PostCode = "0632";
shippingAddress.Country = "New Zealand";
shippingContact.AddressContact = new LoyaltyService.Address[1] { shippingAddress };
var homePhone = new LoyaltyService.Phone();
homePhone.ContactType = "HOME";
homePhone.IDD = "64";
homePhone.STD = "9";
homePhone.Local = "926 5400";
shippingContact.PhoneContact = new LoyaltyService.Phone[1] { homePhone };
var homeEmail = new LoyaltyService.Email();
homeEmail.ContactType = "HOME";
homeEmail.Address = "Email address";
shippingContact.EmailContact = new LoyaltyService.Email[1] { homeEmail };
profile.Contact = shippingContact;
var emailOptIn = new LoyaltyService.ProfileOptIn();
emailOptIn.OptInType = "EMAIL";
emailOptIn.OptIn = true;
var mailOptIn = new LoyaltyService.ProfileOptIn();
mailOptIn.OptInType = "MAIL";
mailOptIn.OptIn = false;
var smsOptIn = new LoyaltyService.ProfileOptIn();
smsOptIn.OptInType = "SMS";
smsOptIn.OptIn = true;
profile.OptIn = new LoyaltyService.ProfileOptIn[3] { emailOptIn, mailOptIn, smsOptIn };
var profileCustomFields = new LoyaltyService.ProfileCustomFieldValues();
profileCustomFields.CustomText_1 = string.Empty;
profileCustomFields.CustomBoolean_1 = false;
profileCustomFields.CustomDate_1 = DateTime.MinValue;
profileCustomFields.CustomDecimal_1 = 0.0M;
profileCustomFields.CustomInteger_1 = 0;
profile.CustomFieldValues = profileCustomFields;
newTransferCardMember.Profile = profile;
var programMembership = new LoyaltyService.ProgramMembership();
programMembership.OriginalStartDate = DateTime.Now;
programMembership.StartDate = DateTime.Now;
programMembership.EndDate = DateTime.Now.AddYears(1);
programMembership.BranchName = "Albany Branch";
programMembership.JoiningKeyCode = "";
programMembership.RedemptionOnHold = false;
programMembership.PointsExpiredExemption = false;
programMembership.HomeBranch_Organisation_RSN = new Guid("177853a2-c946-4f32-83df-810182a38096");;
programMembership.PromotionalPointsConversionFactor = 0.0m;
programMembership.PointsConversionFactor = 0.0m;
newTransferCardMember.ProgramMembership = programMembership;
var customerAccount = new LoyaltyService.CustomerAccount();
customerAccount.CustomerAccount_RSN = Guid.NewGuid();
customerAccount.CustomerAccount_ID = "CA_123";
customerAccount.Partner_RSN = new Guid("54dbec5e-73d2-42a2-a0fa-f4dc42c07e56");;
customerAccount.DisplayValue = "Simplicity Demo";
customerAccount.Category = "Loyalty";
customerAccount.SubCategory = "";
newTransferCardMember.CustomerAccounts = new LoyaltyService.CustomerAccount[] { customerAccount };
request.Value = newTransferCardMember;
LoyaltyService.ResultOfguid result = svc.CreateMemberForTransferCard(request);
if (result.FaultCode == 0)
{
}
else
{
throw new Exception(result.FaultDescription);
}
}