The first step is to scan a customer’s ticket at the gate. I wrote a program to simulate this. It will create a randomish “ticketscan” document in a “tickets” bucket on Couchbase.
Before scanning tickets, I needed to prepopulate the bucket with some data.
I’ve decided that customers 1 through 9 are the VIPs, and any other customer is a “regular joe”.
_bucket.Upsert("customer::1", new { Name = "George Clooney" });
_bucket.Upsert("customer::2", new { Name = "Josh Hutcherson" });
_bucket.Upsert("customer::3", new { Name = "Darius Rucker" });
_bucket.Upsert("customer::4", new { Name = "Brooklyn Decker" });
_bucket.Upsert("customer::5", new { Name = "Eddie Vedder" });
_bucket.Upsert("customer::6", new { Name = "Nick Lachey" });
_bucket.Upsert("customer::7", new { Name = "Nick Goepper" });
_bucket.Upsert("customer::8", new { Name = "Johnny Bench" });
_bucket.Upsert("customer::9", new { Name = "Ryan Collins" });
Fun Note: these VIPs are all actual Reds fans!
I also created 3 concierges and divided up the VIPs amongst them.
_bucket.Upsert("concierge::1", new
{
Name = "Matt Groves",
CellNumber = _yourVerifiedNumber,
vips = new List<string> { "customer::1", "customer::2", "customer::9" }
});
_bucket.Upsert("concierge::2", new
{
Name = "Mr. Redlegs",
CellNumber = _yourVerifiedNumber,
vips = new List<string> { "customer::3", "customer::4", "customer::5" }
});
_bucket.Upsert("concierge::3", new
{
Name = "Rosie Red",
CellNumber = _yourVerifiedNumber,
vips = new List<string> { "customer::6", "customer::7", "customer::8" }
});
In the above example, I’m assigning customers 1, 2, and 9 to “Matt Groves”. This means that George Clooney, Josh Hutcherson, and Ryan Collins are the VIPs that concierge Matt Groves is assigned to take care of. (Replace _yourVerifiedNumber
with the phone number that you’ve confirmed with Twilio).
I’m also storing Twilio credentials in a document. I did this because I’ll need the credentials inside of a Couchbase Function, and I didn’t want to hard-code them there. The credential document looks like:
{
"url": "https://api.twilio.com/2010-04-01/Accounts/< twilio user name here >/Messages.json",
"username": "< twilio user name here >",
"password": "< twilio password name here >",
"fromNumber": "< twilio 'from' number here >"
}
I’ve created a console app that will create a new “ticketscan” document. When you run it, you can choose to create a VIP scan or a “regular Joe” scan.
Console.WriteLine("1 - Simulate a VIP ticket scan.");
Console.WriteLine("2 - Simulate a regular joe ticket scan.");
Console.WriteLine("Q - End simulation.");
var choice = Console.ReadKey().KeyChar;
A ticketscan document contains only three fields: the ID of the customer document, a timestamp, and a seat number.
_bucket.Upsert(ticketScanId, new {CustomerId = customerId, Timestamp = ticketScanTimestamp, Seat = seatInformation });
You can find the full source code on Github.