Exemple #1
0
        /// <summary>
        /// Call the Loyalty API CloverConnector.SetCustomerInfo with a simple CustomerInfo object assembled from parameters
        /// </summary>
        private void SendCustomerInfoMessage(string name, string phone, string welcome, string id, string points)
        {
            // create a customer object with a first name and sample home phone number - in real life this would be looked up in a customer data source
            Customer customer = new Customer
            {
                firstName    = name,
                phoneNumbers = new List <PhoneNumber>()
                {
                    new PhoneNumber {
                        id = "home", phoneNumber = phone
                    }
                }
            };

            // create the customer info request object with some canned offers
            SetCustomerInfoRequest request = new SetCustomerInfoRequest
            {
                customer      = customer,
                displayString = welcome,
                externalId    = id,
                extras        =
                {
                    ["POINTS"] = points,
                    ["OFFERS"] = SampleOffer.OfferList(
                        "5_PCT",        "5% off this order",
                        "MUG",          "Free Branded Coffee Mug",
                        "FRIEND",       "Giftcard for Sharing")
                }
            };

            // Custom Activity data, not part of the Clover API, can be anything serializable to json and understood by a custom activity
            Data.CloverConnector.SetCustomerInfo(request);
        }
Exemple #2
0
 public void SetCustomerInfo(SetCustomerInfoRequest request)
 {
     if (websocket != null)
     {
         SetCustomerInfoRequestMessage msg = new SetCustomerInfoRequestMessage();
         msg.payload = request;
         websocket.Send(JsonUtils.Serialize(msg));
     }
 }
Exemple #3
0
 public void SetCustomerInfo(SetCustomerInfoRequest request)
 {
     Send("/SetCustomerInfo", request);
 }
Exemple #4
0
 public override Task <Empty> SetCustomerInfo(SetCustomerInfoRequest request, ServerCallContext context)
 {
     Program.WriteLine("SetCustomerInfo");
     Connector.SetCustomerInfo(Translate.From(request));
     return(Task.FromResult(new Empty()));
 }