/// <summary> /// Generates a Loyalty Object /// </summary> /// <param name="issuerId"> </param> /// <param name="classId"> </param> /// <param name="objectId"> </param> /// <returns> loyaltyObject </returns> public static LoyaltyObject generateLoyaltyObject(string issuerId, string classId, string objectId) { // Define Barcode Barcode barcode = new Barcode() { Type = "qrCode", Value = "28343E3", AlternateText = "12345" }; // Define Points LoyaltyPoints points = new LoyaltyPoints() { Label = "Points", PointsType = "points", Balance = new LoyaltyPointsBalance() { String = "500" } }; // Define Text Module Data IList <TextModuleData> textModulesData = new List <TextModuleData>(); TextModuleData textModuleData = new TextModuleData() { Header = "Jane's Baconrista Rewards", Body = "Save more at your local Mountain View store Jane. " + "You get 1 bacon fat latte for every 5 coffees purchased. " + "Also just for you, 10% off all pastries in the Mountain View store." }; textModulesData.Add(textModuleData); // Define Links Module Data IList <Uri> uris = new List <Uri>(); Uri uri1 = new Uri() { Description = "My Baconrista Account", UriValue = "http://www.baconrista.com/myaccount?id=1234567890" }; uris.Add(uri1); LinksModuleData linksModuleData = new LinksModuleData() { Uris = uris }; // Define Info Module IList <LabelValue> row0cols = new List <LabelValue>(); LabelValue row0col0 = new LabelValue() { Label = "Next Reward in", Value = "2 coffees" }; LabelValue row0col1 = new LabelValue() { Label = "Member Since", Value = "01/15/2013" }; row0cols.Add(row0col0); row0cols.Add(row0col1); IList <LabelValue> row1cols = new List <LabelValue>(); LabelValue row1col0 = new LabelValue() { Label = "Local Store", Value = "Mountain View" }; row1cols.Add(row1col0); IList <LabelValueRow> rows = new List <LabelValueRow>(); LabelValueRow row0 = new LabelValueRow() { Columns = row0cols }; LabelValueRow row1 = new LabelValueRow() { Columns = row1cols }; rows.Add(row0); rows.Add(row1); InfoModuleData infoModuleData = new InfoModuleData() { ShowLastUpdateTime = true, LabelValueRows = rows }; // Define general messages IList <WalletObjectMessage> messages = new List <WalletObjectMessage>(); WalletObjectMessage message = new WalletObjectMessage() { Header = "Hi Jane!", Body = "Thanks for joining our program. Show this message to " + "our barista for your first free coffee on us!", ActionUri = new Uri() { UriValue = "http://baconrista.com" } }; messages.Add(message); // Define Wallet Instance LoyaltyObject loyaltyObj = new LoyaltyObject() { ClassId = issuerId + "." + classId, Id = issuerId + "." + objectId, Version = 1, State = "active", Barcode = barcode, AccountName = "Jane Doe", AccountId = "1234567890", LoyaltyPoints = points, Messages = messages, InfoModuleData = infoModuleData, TextModulesData = textModulesData, LinksModuleData = linksModuleData }; return(loyaltyObj); }
/// <summary> /// Generates a Loyalty Object /// </summary> /// <param name="issuerId"> </param> /// <param name="classId"> </param> /// <param name="objectId"> </param> /// <returns> loyaltyObject </returns> public static LoyaltyObject generateLoyaltyObject(string issuerId, string classId, string objectId) { // Define Barcode Barcode barcode = new Barcode() { Type = "qrCode", Value = "28343E3", AlternateText = "12345" }; // Define Points LoyaltyPoints points = new LoyaltyPoints() { Label = "Points", PointsType = "points", Balance = new LoyaltyPointsBalance() { String = "500" } }; // Define Text Module Data IList<TextModuleData> textModulesData = new List<TextModuleData>(); TextModuleData textModuleData = new TextModuleData() { Header = "Jane's Baconrista Rewards", Body = "Save more at your local Mountain View store Jane. " + "You get 1 bacon fat latte for every 5 coffees purchased. " + "Also just for you, 10% off all pastries in the Mountain View store." }; textModulesData.Add(textModuleData); // Define Links Module Data IList<Uri> uris = new List<Uri>(); Uri uri1 = new Uri() { Description = "My Baconrista Account", UriValue = "http://www.baconrista.com/myaccount?id=1234567890" }; uris.Add(uri1); LinksModuleData linksModuleData = new LinksModuleData() { Uris = uris }; // Define Info Module IList<LabelValue> row0cols = new List<LabelValue>(); LabelValue row0col0 = new LabelValue() { Label = "Next Reward in", Value = "2 coffees" }; LabelValue row0col1 = new LabelValue() { Label = "Member Since", Value = "01/15/2013" }; row0cols.Add(row0col0); row0cols.Add(row0col1); IList<LabelValue> row1cols = new List<LabelValue>(); LabelValue row1col0 = new LabelValue() { Label = "Local Store", Value = "Mountain View" }; row1cols.Add(row1col0); IList<LabelValueRow> rows = new List<LabelValueRow>(); LabelValueRow row0 = new LabelValueRow() { Columns = row0cols }; LabelValueRow row1 = new LabelValueRow() { Columns = row1cols }; rows.Add(row0); rows.Add(row1); InfoModuleData infoModuleData = new InfoModuleData() { ShowLastUpdateTime = true, LabelValueRows = rows }; // Define general messages IList<WalletObjectMessage> messages = new List<WalletObjectMessage>(); WalletObjectMessage message = new WalletObjectMessage() { Header = "Hi Jane!", Body = "Thanks for joining our program. Show this message to " + "our barista for your first free coffee on us!", ActionUri = new Uri() { UriValue = "http://baconrista.com" } }; messages.Add(message); // Define Wallet Instance LoyaltyObject loyaltyObj = new LoyaltyObject() { ClassId = issuerId + "." + classId, Id = issuerId + "." + objectId, Version = 1, State = "active", Barcode = barcode, AccountName = "Jane Doe", AccountId = "1234567890", LoyaltyPoints = points, Messages = messages, InfoModuleData = infoModuleData, TextModulesData = textModulesData, LinksModuleData = linksModuleData }; return loyaltyObj; }
/// <summary> /// Generates a Loyalty Object /// </summary> /// <param name="issuerId"> </param> /// <param name="classId"> </param> /// <param name="objectId"> </param> /// <returns> loyaltyObject </returns> public static LoyaltyObject generateLoyaltyObject(string issuerId, string classId, string objectId) { // Define Barcode Barcode barcode = new Barcode() { Type = "qrCode", Value = "28343E3" }; // Define Points LoyaltyPoints points = new LoyaltyPoints() { Label = "Points", Balance = new LoyaltyPointsBalance() { String = "500" } }; // Define Text Module Data IList<TextModuleData> textModulesData = new List<TextModuleData>(); TextModuleData textModuleData = new TextModuleData() { Header = "Jane's Baconrista Rewards", Body = "You are 5 coffees away from receiving a free bacon fat latte" }; textModulesData.Add(textModuleData); // Define Uris IList<Uri> uris = new List<Uri>(); Uri uri1 = new Uri() { Description = "My Baconrista Account", UriValue = "http://www.baconrista.com/myaccount?id=1234567890" }; Uri uri2 = new Uri() { Description = "uri 2 description", UriValue = "http://www.google.com" }; uris.Add(uri1); uris.Add(uri2); LinksModuleData linksModuleData = new LinksModuleData() { Uris = uris }; // Define Info Module IList<LabelValue> row0cols = new List<LabelValue>(); LabelValue row0col0 = new LabelValue() { Label = "Member Name", Value = "Jane Doe" }; LabelValue row0col1 = new LabelValue() { Label = "Membership #", Value = "1234567890" }; row0cols.Add(row0col0); row0cols.Add(row0col1); IList<LabelValue> row1cols = new List<LabelValue>(); LabelValue row1col0 = new LabelValue() { Label = "Next Reward in", Value = "2 coffees" }; LabelValue row1col1 = new LabelValue() { Label = "Member Since", Value = "01/15/2013" }; row1cols.Add(row1col0); row1cols.Add(row1col1); IList<LabelValueRow> rows = new List<LabelValueRow>(); LabelValueRow row0 = new LabelValueRow() { HexBackgroundColor = "#BBCCFC", Columns = row0cols }; LabelValueRow row1 = new LabelValueRow() { HexBackgroundColor = "#FFFB00", Columns = row1cols }; rows.Add(row0); rows.Add(row1); InfoModuleData infoModuleData = new InfoModuleData() { HexFontColor = "#FFFFFF", HexBackgroundColor = "#FC058C", ShowLastUpdateTime = true, LabelValueRows = rows }; // Define Wallet Instance LoyaltyObject loyaltyObj = new LoyaltyObject() { ClassId = issuerId + "." + classId, Id = issuerId + "." + objectId, Version = "1", State = "active", Barcode = barcode, AccountName = "Jane Doe", AccountId = "1234567890", LoyaltyPoints = points, InfoModuleData = infoModuleData, TextModulesData = textModulesData, LinksModuleData = linksModuleData }; return loyaltyObj; }