Click or drag to resize

LoyaltyClientCreateCardAndMember Method

Create a new Card and a new Member with a Security Account, from the submitted values.

Remarks
  • Card is created with the Card Status of "ACTIVE"
  • Cardholder can login using the credentials - User Name: Member Email Address, Password: Access Code
Syntax
C#
public ResultOfMemberCardCredentials CreateCardAndMember(
	ManagementGroupRequestOfCreateCardAndMember request
)

Parameters

request
Type: LoyaltyServiceManagementGroupRequestOfCreateCardAndMember

Return Value

Type: ResultOfMemberCardCredentials
Examples
C#
using (var svc = new LoyaltyService.LoyaltyClient())
{
  var request = new LoyaltyService.ManagementGroupRequestOfCreateCardAndMember();
  request.Token = "Token";//Required - Token returned from AccountService.ManagementGroupLogin
  request.ManagementGroup = "Management group";//Required - ManagementGroup supplied when calling AccountService.ManagementGroupLogin

  var createCardAndMember = new LoyaltyService.CreateCardAndMember(); //Required
  createCardAndMember.CardStatus = "ACTIVE";//Required - Valid values are : 'ACTIVE', 'INACTIVE' or 'PEDNINGACTIVATION'
  createCardAndMember.CardType = "STANDARD";//Required - Valid values are : 'STANDARD' or 'VIRTUAL'
  createCardAndMember.SendEmail = true;//Optional - Sends welcome email to new member if true

  var profile = new LoyaltyService.Profile();
  profile.Member_Password = "Password";//Required - Password must be between 8 and 20 characters long and include at least one letter and one number.
  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
  profile.CustomFieldValues = profileCustomFields;//Optional

  //set createCardAndMember profile
  createCardAndMember.Profile = profile; //Required


  var programMembership = new LoyaltyService.ProgramMembership();
  //programMembership.RSN ignored
  //programMembership.MemberRSN ignored
  programMembership.DisplayValue = "Simplicity Rewards - Mr John David Doe";//Required
  programMembership.ProgramRSN = new Guid("56555319-a30f-41a2-8bc9-b765d08cd030");; //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("335708c2-5871-42ac-a8eb-387b330e651a");;//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
  createCardAndMember.Membership = programMembership; //Required


  var customerAccount = new LoyaltyService.CustomerAccount(); // Optional
  //customerAccount.Member_RSN ignored
  customerAccount.CustomerAccount_RSN = Guid.NewGuid(); // Required
  customerAccount.CustomerAccount_ID = "CA_123"; // Required
  customerAccount.Partner_RSN = new Guid("9075c61d-5eed-4f76-83c4-6cdbcffb3116");; // Required - RSN of partner
  customerAccount.DisplayValue = "Simplicity Demo";//Optional - name of partner company
  customerAccount.Category = "Loyalty";//Optional
  customerAccount.SubCategory = "";//Optional

  //set createCardAndMember customer accounts
  createCardAndMember.CustomerAccounts = new LoyaltyService.CustomerAccount[] { customerAccount };// Optional

  //add createCardAndMember to request
  request.Value = createCardAndMember; //Required

  LoyaltyService.ResultOfMemberCardCredentials result = svc.CreateCardAndMember(request);

  if (result.FaultCode == 0)
  {
    //Request succeeded
  }
  else
  {
    //Request failed
    throw new Exception(result.FaultDescription);
  }
}
See Also