הטמעת פעולות מתקדמות של מילוי הזמנות

מיפוי של פידים של תפריטים ופריטים בעגלת הקניות לצורך השלמת ההזמנה

כשלקוחות מוסיפים פריטים מפיד התפריט לעגלת הקניות ומבצעים תשלום, Google שולחת את הפריטים האלה לנקודת הקצה לטיפול בהזמנות כדי לאמת את המחיר והזמינות שלהם. אחרי האימות של המחיר והזמינות, הלקוח יכול לבצע את ההזמנה. בקטע הזה מוסבר איך למפות פריטים בפיד התפריט לפריטים בעגלת הקניות לצורך מילוי.

הדוגמאות בקטע הזה הן גרסאות מקוצרות של פיד התפריט וסכימת עגלת הקניות. מוצגים רק שדות שרלוונטיים להמחשת המיפוי בין פיד התפריט לבין האובייקט של עגלת הקניות. הסכימה המלאה מופיעה במאמרים Menu ו-Cart.

פריטים בפיד Menu שנוספים לעגלת קניות נשלחים באובייקט Cart גם בתהליך התשלום וגם בשליחת ההזמנה.

  • MenuItem פשוט מיוצג כ-LineItem במערך lineItems, כאשר offerId הוא offer.id של פריט התפריט שנבחר בפיד התפריט.
  • MenuItem עם MenuItemOption נדרש מיוצג בתור LineItem במערך lineItems, כאשר offerId הוא הערך של offer.id של פריט התפריט שנבחר מהפיד 'תפריט'.
  • AddOnMenuItem של LineItem מיוצג כ-FoodItemOption במערך options של FoodItemExtension. לכל אפשרות יש offerId שתואם ל-offer.id של פריט התפריט שנבחר בתוסף מהפיד 'תפריט'. שימו לב שאפשר גם להוסיף ל-AddOnMenuItem תפריטי תוספים בתצוגת עץ, שמיוצגים כ-subOptions בתוך כל אפשרות.

בדוגמאות הבאות מפורטת המיפוי של פריטי התפריט בין פיד התפריט לעגלת ההזמנות.

JSONJSONJSON

הדוגמה הזו מכילה רשימה של פריטים פשוטים בתפריט.

אפשרויות בתפריט בפיד תפריט:

{
  "@type": "Menu",
  "@id": "menu_id",
  "hasMenuItem": [
    {
      "@type": "MenuItem",
      "@id": "menuitem_id_1",
      "offers": [
        {
          "@type": "Offer",
          "@id": "menuitem_offer_id_1",
          "price": "p_1",
          "priceCurrency": "USD"
        }
      ]
    },
    {
      "@type": "MenuItem",
      "@id": "menuitem_id_2",
      "offers": [
        {
          "@type": "Offer",
          "@id": "menuitem_offer_id_2",
          "price": "p_2",
          "priceCurrency": "USD"
        }
      ]
    }
  ]
}

פריטי תפריט שממופים לעגלת הזמנות לטיפול:

{
  "@type": "Cart",
  "lineItems": [
    {
      "offerId": "menuitem_offer_id_1",
      "price": {
        "amount": {
          "currencyCode": "USD",
          "units": "dollar(q_1*p_1)",
          "nanos": "cent(q_1*p_1)"
        }
      },
      "quantity": "q_1"
    },
    {
      "offerId": "menuitem_offer_id_2",
      "price": {
        "amount": {
          "currencyCode": "USD",
          "units": "dollar(q_2*p_2)",
          "nanos": "cent(q_2*p_2)"
        }
      },
      "quantity": "q_2"
    }
  ]
}

הדוגמה הזו מכילה פריט תפריט עם AddOnMenuItem אחד או יותר.

אפשרויות בתפריט בפיד תפריט:

{
  "@type": "Menu",
  "@id": "menu_id",
  "hasMenuItem": [
    {
      "@type": "MenuItem",
      "@id": "menuitem_id_1",
      "offers": [
        {
          "@type": "Offer",
          "@id": "menuitem_offer_id_1",
          "price": "p_1",
          "priceCurrency": "USD"
        }
      ],
      "menuAddOn": [
        {
          "@type": "MenuAddOnSection",
          "@id": "menuaddon_section_id_1",
          "hasMenuItem": [
            {
              "@type": "AddOnMenuItem",
              "@id": "menuitem_addon_id_1",
              "offers": [
                {
                  "@type": "Offer",
                  "@id": "menuitem_addon_offer_id_1",
                  "price": "addon_p_1",
                  "priceCurrency": "USD"
                }
              ]
            },
            {
              "@type": "AddOnMenuItem",
              "@id": "menuitem_addon_id_2",
              "offers": [
                {
                  "@type": "Offer",
                  "@id": "menuitem_addon_offer_id_2",
                  "price": "addon_p_2",
                  "priceCurrency": "USD"
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "@type": "MenuItem",
      "@id": "menuitem_id_2",
      "offers": [
        {
          "@type": "Offer",
          "@id": "menuitem_offer_id_2",
          "price": "p_2",
          "priceCurrency": "USD"
        }
      ]
    }
  ]
}

פריטי תפריט שממופים לעגלת הזמנות לטיפול:

{
  "@type": "Cart",
  "lineItems": [
    {
      "offerId": "menuitem_offer_id_1",
      "price": {
        "amount": {
          "currencyCode": "USD",
          "units": "dollar(q_1*(p_1 + addon_q_1*addon_p_1 + addon_q_2*addon_p_2))",
          "nanos": "cent(q_1*(p_1 + addon_q_1*addon_p_1 + addon_q_2*addon_p_2))"
        }
      },
      "quantity": "q_1",
      "extension": {
        "@type": "FoodItemExtension",
        "options": [
          {
            "offerId": "menuitem_addon_offer_id_1",
            "price": {
                "currencyCode": "USD",
                "units": "dollar(addon_q_1*addon_p_1)",
                "nanos": "cent(addon_q_1*addon_p_1)"
            },
            "quantity": "addon_q_1"
          },
          {
            "offerId": "menuitem_addon_offer_id_2",
            "price": {
                "currencyCode": "USD",
                "units": "dollar(addon_q_2*addon_p_2)",
                "nanos": "cent(addon_q_2*addon_p_2)"
            },
            "quantity": "addon_q_2"
          }
        ]
      }
    },
    {
      "offerId": "menuitem_offer_id_2",
      "price": {
        "amount": {
          "currencyCode": "USD",
          "units": "dollar(q_2*p_2)",
          "nanos": "cent(q_2*p_2)"
        }
      },
      "quantity": "q_2"
    }
  ]
}

הדוגמה הזו מכילה פריט תפריט עם אפשרויות של פריטי תפריט, AddOnMenuItems ו-AddOnMenuItems בתצוגת עץ

אפשרויות בתפריט בפיד תפריט:

{
  "@type": "MenuItem",
  "@id": "menuitem_id_1",
  "hasMenuItemOptions": [
    {
      "@type": "MenuItemOption",
      "value": {
        "@type": "PropertyValue",
        "name": "OPTION",
        "value": "Large",
        "offers": [
          {
            "@type": "Offer",
            "@id": "menuitem_option_offer_id_1",
            "price": "p_1",
            "priceCurrency": "USD"
          }
        ],
        "menuAddOn": [
          {
            "@type": "AddOnMenuSection",
            "@id": "menuitem_option_addon_section_id_1",
            "hasMenuItem": [
              {
                "@type": "AddOnMenuItem",
                "@id": "menuitem_option_addon_id_1",
                "offers": [
                  {
                    "@type": "Offer",
                    "@id": "menuitem_option_addon_offer_id_1",
                    "price": "addon_p_1",
                    "priceCurrency": "USD"
                  }
                ]
              },
              {
                "@type": "AddOnMenuItem",
                "@id": "menuitem_option_addon_id_2",
                "offers": [
                  {
                    "@type": "Offer",
                    "@id": "menuitem_option_addon_offer_id_2",
                    "price": "addon_p_2",
                    "priceCurrency": "USD"
                  }
                ],
                "menuAddOn": [
                  {
                    "@type": "AddOnMenuSection",
                    "@id": "menuitem_option_subaddon_section_id_1",
                    "hasMenuItem": [
                      {
                        "@type": "AddOnMenuItem",
                        "@id": "menuitem_option_subaddon_id_1",
                        "offers": [
                          {
                            "@type": "Offer",
                            "@id": "menuitem_option_subaddon_offer_id_1",
                            "price": "subaddon_p_1",
                            "priceCurrency": "USD"
                          }
                        ]
                      }
                    ]
                  }
                ]
              }
            ]
          }
        ]
      }
    }
  ]
}

פריטי תפריט שממופים לעגלת הזמנות לטיפול:

{
  "@type": "Cart",
  "lineItems": [
    {
      "offerId": "menuitem_option_offer_id_1",
      "price": {
        "amount": {
          "currencyCode": "USD",
          "units": "dollar(q_1*(p_1 + addon_q_1*addon_p_1 + addon_q_2*(addon_p_2 + subaddon_q_1*subaddon_p_1)))",
          "nanos": "cent(q_1*(p_1 + addon_q_1*addon_p_1 + addon_q_2*(addon_p_2 + subaddon_q_1*subaddon_p_1)))"
        }
      },
      "quantity": "q_1",
      "extension": {
        "@type": "FoodItemExtension",
        "options": [
          {
            "offerId": "menuitem_option_addon_offer_id_1",
            "price": {
              "currencyCode": "USD",
              "units": "dollar(addon_q_1*addon_p_1)",
              "nanos": "cent(addon_q_1*addon_p_1)"
            },
            "quantity": "addon_q_1"
          },
          {
            "offerId": "menuitem_option_addon_offer_id_2",
            "price": {
              "currencyCode": "USD",
              "units": "dollar(addon_q_2*(addon_p_2 + subaddon_q_1*subaddon_p_1))",
              "nanos": "cent(addon_q_2*(addon_p_2 + subaddon_q_1*subaddon_p_1))"
            },
            "quantity": "addon_q_2",
            "subOptions": [
              {
                "offerId": "menuitem_option_subaddon_offer_id_1",
                "price": {
                  "currencyCode": "USD",
                  "units": "dollar(subaddon_q_1*subaddon_p_1)",
                  "nanos": "cent(subaddon_q_1*subaddon_p_1)"
                },
                "quantity": "subaddon_q_1"
              }
            ]
          }
        ]
      }
    }
  ]
}

טיפול בשגיאות

אם נתקלת בבעיות בזמן העיבוד של CheckoutRequestMessage, אפשר להשיב עם CheckoutResponseMessage שמכיל FoodErrorExtension במקום CheckoutResponse. אפשר להשתמש בתגובה הזו כדי לזהות שגיאה אחת או יותר שהתרחשו במהלך העיבוד.

יש 2 דרכים לטפל בשגיאות:

  • שגיאות שניתן לשחזר: המשתמש לא נדרש לערוך את עגלת הקניות כדי לשלוח את ההזמנה. לדוגמה, אם אתם קובעים שפריט ב-Cart עבר שינוי במחיר, תוכלו להשיב עם FoodOrderError מסוג השגיאה PRICE_CHANGED, יחד עם correctedProposedOrder ו-paymentOptions. Google תודיע למשתמש על השינוי, אבל תאפשר לו לשלוח את הבקשה באמצעות correctedProposedOrder. המשתמש יכול גם לחזור אחורה ולערוך את עגלת הקניות, אם הוא רוצה. תקבלו CheckoutRequestMessage חדש או SubmitOrderRequestMessage.
  • שגיאות שלא ניתן לשחזר: המשתמש נדרש לערוך את עגלת הקניות לפני שליחת ההזמנה. לדוגמה, אם אתם קובעים שהמסעדה סגורה, תוכלו להשיב עם FoodOrderError מסוג השגיאה CLOSED. Google תודיע למשתמש ותנהל את האינטראקציה כדי לעדכן אותו למסעדה החדשה. תקבלו CheckoutRequestMessage חדש לעגלת קניות חדשה.

באופן כללי, כדאי להגדיר שגיאות ברמת עגלת הקניות כבלתי ניתנות לשחזור ושגיאות ברמת הפריט כניתנות לשחזור. רשימה מלאה של סוגי השגיאות והמשמעות שלהן מופיעה במאמר FoodOrderError.

טיפול בשינויים במחירים

שינויים במחיר במהלך התשלום

אם נתקלתם בבעיה במחיר במהלך עיבוד הבקשה של לקוח לתשלום, עליכם לבצע את הפעולות הבאות:

  1. משיב להודעת ה-CheckoutRequestMessage באמצעות הודעה מסוג CheckoutResponseMessage שמכילה את FoodErrorExtension, כפי שמתואר בקטע טיפול בשגיאות.
  2. בתגובה לשגיאה, משתמשים ב-correctedProposedOrder.cart כדי לעדכן את המחיר לערך הנכון. Google מקבלת את הצו המתוקן ועשויה להנפיק CheckoutRequestMessage חדש.

אחרי התשלום, Google מציגה למשתמש הקצה דף אישור הזמנה, גם אם השדה ProposedOrder השתנה וגם אם לא.

אם ההזמנה תתוקן, Google עשויה להציג אזהרות נוספות כדי ליידע את המשתמש על השינויים. אם המשתמש יאשר את ההזמנה, לא יוצגו בקשות נוספות לתשלום. התהליך ממשיך לשליחת ההזמנה, עם ProposedOrder המתוקן.

עם זאת, המשתמש תמיד יכול לשנות את דעתו ולערוך את עגלת הקניות שוב. כשהעגלה מתעדכנת כך, Google שולחת אירוע CheckoutRequestMessage חדש.

שינויים במחיר במהלך שליחת ההזמנה

אם נתקלתם בבעיה במחיר במהלך עיבוד שליחת ההזמנה (הכוונה actions.intent.TRANSACTION_DECISION הופעלה), אל תשלחו תשובה עם הודעת שגיאה או תעדכנו את המחיר בתשובה. אם המחירים, הכמויות או פרטים אחרים ב-SubmitOrderRequestMessage לא תואמים לנתונים שלכם, עליכם להשיב עם הערך orderState מוגדר כ-REJECTED כדי לציין שלא ניתן לבצע את ההזמנה כפי שביקשו.

לאחר מכן, אם ההזמנה ופרטי התשלום תקינים, מגדירים את orderState לערך CREATED או CONFIRMED. בנוסף, צריך לכלול את הערך actionOrderId כדי לייצג את מזהה ההזמנה במערכת. צריך להשתמש במזהה הזה כששולחים עדכונים נוספים.

אם אין לכם אפשרות לעבד את התשלום וכבר שלחתם את ההודעה SubmitOrderRequestMessage, תוכלו לשלוח הודעה AsyncOrderUpdateRequestMessage עם הערך orderState שמוגדר כ-REJECTED כדי להודיע למשתמש שההזמנה לא תבוצע.

שינויים במחיר לאחר שליחת ההזמנה

אם אתם קובעים שמחיר השתנה מהמחיר שהלקוח השתמש בו כששלח את ההזמנה, אתם יכולים להנפיק AsyncOrderUpdateRequestMessage עם המחיר החדש, כפי שמתואר במאמר הטמעת עדכוני הזמנות אסינכררוניים.

כדי לעדכן מחירים באמצעות עדכוני הזמנות אסינכרונים:

  1. משנים את המחיר ב-lineItemUpdates[x].price. הערך הזה משקף את העלות הכוללת של הפריט, כולל תוספים, כפול הכמות. (מידע נוסף זמין בתיאור השדה price של LineItem).
  2. מזינים הסבר ב-lineItemUpdates[x].reason.
  3. מגדירים את lineItemUpdates[x].orderState ל-CONFIRMED.

אתם יכולים לנסות לחייב את אמצעי התשלום לפני או אחרי שליחת AsyncOrderUpdateRequestMessage, לפי שיקול דעתכם. אם העסקה נכשלת (יכול להיות בגלל ששינויי המחירים גדולים מדי), שולחים הודעה מסוג AsyncOrderUpdateRequestMessage עם ההגדרות הבאות בשדה OrderUpdate כדי להודיע ל-Google על הכישלון:

  • מגדירים את orderState להיות REJECTED.
  • מתארים את התקלה בשדה label.

אימות של תהליך התשלום

כפי שמתואר בקטע שלב 4: הטמעת תהליך התשלום, נקודת הקצה לטיפול בהזמנות צריכה לבצע אימות של כל CheckoutRequestMessage נכנסת ולהשיב עם CheckoutResponseMessage.

דוגמה ל-CheckoutResponseMessage בתוקף:

תרחיש לדוגמה איך מטמיעים
תרחיש לדוגמה 1: האימות מסתיים בהצלחה חזרה ב-CheckoutResponse. הוא חייב לכלול את הערכים ProposedOrder ו-PaymentOptions. ProposedOrder כולל מסים, עמלות והמחיר הכולל של עגלת הקניות.
JSON
{
  "expectUserResponse": false,
  "finalResponse": {
    "richResponse": {
      "items": [
        {
          "structuredResponse": {
            "checkoutResponse": {
              "proposedOrder": {
                "id": "sample_proposed_order_id_1",
                "otherItems": [
                  {
                    "name":"New customer discount",
                    "price": {
                      "type":"ESTIMATE",
                      "amount": {
                        "currencyCode":"USD",
                        "units":"-5",
                        "nanos": -500000000
                      }
                    },
                    "type": "DISCOUNT"
                  },
                  {
                    "name": "Delivery fee",
                    "price": {
                      "type": "ESTIMATE",
                      "amount": {
                        "currencyCode": "USD",
                        "units": "3",
                        "nanos": 500000000
                      }
                    },
                    "type": "DELIVERY"
                  },
                  {
                    "name": "Tax",
                    "price": {
                      "type": "ESTIMATE",
                      "amount": {
                        "currencyCode": "USD",
                        "units": "1",
                        "nanos": 500000000
                      }
                    },
                    "type": "TAX"
                  }
                ],
                "cart": {
                  "merchant": {
                    "id": "https://www.exampleprovider.com/merchant/id1",
                    "name": "Falafel Bite"
                  },
                  "lineItems": [
                    {
                      "name": "Pita Chips",
                      "type": "REGULAR",
                      "id": "sample_item_offer_id_1",
                      "offerId": "https://www.exampleprovider.com/menu/item/offer/id1",
                      "quantity": 1,
                      "price": {
                        "type": "ESTIMATE",
                        "amount": {
                          "currencyCode": "USD",
                          "units": "2",
                          "nanos": 750000000
                        }
                      },
                      "subLines": [
                        {
                          "note": "Notes for this item."
                        }
                      ],
                      "extension": {
                        "@type": "type.googleapis.com/google.actions.v2.orders.FoodItemExtension",
                        "options": [
                          {
                            "id": "sample_addon_offer_id_1",
                            "offerId": "https://www.exampleprovider.com/menu/item/addon/offer/id1",
                            "name": "Honey Mustard",
                            "price": {
                              "currencyCode": "USD"
                            },
                            "quantity": 1
                          },
                          {
                            "id": "sample_addon_offer_id_2",
                            "offerId": "https://www.exampleprovider.com/menu/item/addon/offer/id2",
                            "name": "BBQ Sauce",
                            "price": {
                              "currencyCode": "USD",
                              "nanos": 500000000
                            },
                            "quantity": 1
                          }
                        ]
                      }
                    },
                    {
                      "name": "Chicken Shwarma Wrap",
                      "type": "REGULAR",
                      "id": "sample_item_offer_id_2",
                      "offerId": "https://www.exampleprovider.com/menu/item/offer/id2",
                      "quantity": 1,
                      "price": {
                        "type": "ESTIMATE",
                        "amount": {
                          "currencyCode": "USD",
                          "units": "8"
                        }
                      },
                      "extension": {
                        "@type": "type.googleapis.com/google.actions.v2.orders.FoodItemExtension"
                      }
                    },
                    {
                      "name": "Greek Salad",
                      "type": "REGULAR",
                      "id": "sample_item_offer_id_3",
                      "offerId": "https://www.exampleprovider.com/menu/item/offer/id3",
                      "quantity": 1,
                      "price": {
                        "type": "ESTIMATE",
                        "amount": {
                          "currencyCode": "USD",
                          "units": "9",
                          "nanos": 990000000
                        }
                      },
                      "extension": {
                        "@type": "type.googleapis.com/google.actions.v2.orders.FoodItemExtension"
                      }
                    },
                    {
                      "name": "Prawns Biryani",
                      "type": "REGULAR",
                      "id": "sample_item_offer_id_4",
                      "offerId": "https://www.exampleprovider.com/menu/item/offer/id4",
                      "quantity": 1,
                      "price": {
                        "type": "ESTIMATE",
                        "amount": {
                          "currencyCode": "USD",
                          "units": "15",
                          "nanos": 990000000
                        }
                      },
                      "extension": {
                        "@type": "type.googleapis.com/google.actions.v2.orders.FoodItemExtension"
                      }
                    }
                  ],
                  "extension": {
                    "@type": "type.googleapis.com/google.actions.v2.orders.FoodCartExtension",
                    "fulfillmentPreference": {
                      "fulfillmentInfo": {
                        "delivery": {
                          "deliveryTimeIso8601": "P90M"
                        }
                      }
                    },
                    "location": {
                      "coordinates": {
                        "latitude": 37.788783,
                        "longitude": -122.41384
                      },
                      "formattedAddress": "1350 CHARLESTON ROAD, MOUNTAIN VIEW, CA, United States",
                      "zipCode": "94043",
                      "city": "Mountain View",
                      "postalAddress": {
                        "regionCode": "US",
                        "postalCode": "94043",
                        "administrativeArea": "CA",
                        "locality": "Mountain View",
                        "addressLines": [
                          "1350 Charleston Road"
                        ]
                      },
                      "notes": "Gate code is #111"
                     }
                   }
                },
                "totalPrice": {
                  "type": "ESTIMATE",
                  "amount": {
                    // Represents $36.73
                    "currencyCode": "USD",
                    "units": "36",
                    "nanos": 730000000
                  }
                },
                "extension": {
                  "@type": "type.googleapis.com/google.actions.v2.orders.FoodOrderExtension",
                  "availableFulfillmentOptions": [
                    {
                      "fulfillmentInfo": {
                        "delivery": {
                          "deliveryTimeIso8601": "P90M"
                        }
                      },
                      "expiresAt": "2017-07-17T12:30:00Z"
                    }
                  ]
                }
              },
              "paymentOptions": {
                "googleProvidedOptions": {
                  "tokenizationParameters": {
                    "tokenizationType": "PAYMENT_GATEWAY",
                    "parameters": {
                      "gateway": "stripe",
                      "stripe:publishableKey": "pk_live_stripe_client_key",
                      "stripe:version": "2017-04-06"
                    }
                  },
                  "supportedCardNetworks": [
                    "AMEX",
                    "DISCOVER",
                    "MASTERCARD",
                    "JCB",
                    "VISA"
                  ],
                  "prepaidCardDisallowed": true
                }
              }
            }
          }
        }
      ]
    }
  }
}

אימות הכתובת למשלוח

נקודת הקצה לטיפול בהזמנות צריכה לאמת את הכתובת למשלוח שמופיעה בכל CheckoutRequestMessage.

אם יש בעיה בכתובת למשלוח, למשל שהיא מחוץ לטווח של שירות המשלוחים, הערך CheckoutResponseMessage שהשירות מחזיר צריך לכלול FoodOrderError מהסוג המתאים.

תרחיש לדוגמה איך מטמיעים
תרחיש לדוגמה 1: האימות נכשל כי כתובת המשלוח לא בטווח או שיש בעיה בכתובת המשלוח הפונקציה מחזירה את הערך FoodErrorExtension עם הערך FoodOrderError מסוג השגיאה OUT_OF_SERVICE_AREA.
JSON
{
  "expectUserResponse": false,
  "finalResponse": {
    "richResponse": {
      "items": [
        {
          "structuredResponse": {
            "error": {
              "@type": "type.googleapis.com/google.actions.v2.orders.FoodErrorExtension",
              "foodOrderErrors": [
                {
                  "error": "OUT_OF_SERVICE_AREA",
                  "description": "Sorry, the restaurant cannot deliver to your address."
                }
              ]
            }
          }
        }
      ]
    }
  }
}

אימות ערך הזמנה מינימלי

נקודת הקצה לטיפול בהזמנות צריכה לאמת את ערך ההזמנה המינימלי של כל CheckoutRequestMessage.

אם ערך ההזמנה לא עומד בערך המינימלי, הערך של CheckoutResponseMessage שמוחזר על ידי שירות המילוי צריך להכיל FoodOrderError מסוג השגיאה REQUIREMENTS_NOT_MET.

תרחיש לדוגמה איך מטמיעים
תרחיש לדוגמה 1: אימות נכשל כי לא צוין ערך הזמנה מינימלי הפונקציה מחזירה את הערך FoodErrorExtension עם הערך FoodOrderError מסוג השגיאה REQUIREMENTS_NOT_MET.
JSON
{
  "expectUserResponse": false,
  "finalResponse": {
    "richResponse": {
      "items": [
        {
          "structuredResponse": {
            "error": {
              "@type": "type.googleapis.com/google.actions.v2.orders.FoodErrorExtension",
              "foodOrderErrors": [
                {
                  "error": "REQUIREMENTS_NOT_MET",
                  "description": "The cart subtotal must be over $20."
                }
              ]
            }
          }
        }
      ]
    }
  }
}

אימות חלון ההזמנות

נקודת הקצה לטיפול בהזמנות צריכה לאמת את כל הגורמים שעשויים להשפיע על חלון ההזמנות של כל CheckoutRequestMessage.

לדוגמה, אם המסעדה סגורה או שהיא לא מקבלת הזמנות כרגע, הערך של CheckoutResponseMessage שהשירות יספק צריך לכלול FoodOrderError מסוג השגיאה CLOSED או NO_CAPACITY, בהתאמה.

תרחיש לדוגמה איך מטמיעים
תרחיש לדוגמה 1: האימות נכשל כי המסעדה סגורה או כבר לא נתמכת הפונקציה מחזירה את הערך FoodErrorExtension עם הערך FoodOrderError מסוג השגיאה CLOSED.
תרחיש לדוגמה 2: האימות נכשל כי המסעדה עמוסה ולא מקבלת כרגע הזמנות הפונקציה מחזירה את הערך FoodErrorExtension עם הערך FoodOrderError מסוג השגיאה NO_CAPACITY.
JSONJSON
{
  "expectUserResponse": false,
  "finalResponse": {
    "richResponse": {
      "items": [
        {
          "structuredResponse": {
            "error": {
              "@type": "type.googleapis.com/google.actions.v2.orders.FoodErrorExtension",
              "foodOrderErrors": [
                {
                  "error": "CLOSED",
                  "description": "The restaurant is closed."
                }
              ]
            }
          }
        }
      ]
    }
  }
}
{
  "expectUserResponse": false,
  "finalResponse": {
    "richResponse": {
      "items": [
        {
          "structuredResponse": {
            "error": {
              "@type": "type.googleapis.com/google.actions.v2.orders.FoodErrorExtension",
              "foodOrderErrors": [
                {
                  "error": "NO_CAPACITY",
                  "description": "Sorry, the restaurant is busy at the moment."
                }
              ]
            }
          }
        }
      ]
    }
  }
}

אימות הפריטים בעגלת הקניות

נקודת הקצה לטיפול בהזמנות צריכה לאמת את התמחור והזמינות של כל פריט עגלת קניות שמופיע ב-CheckoutRequestMessage.

אם הזמינות או התמחור השתנו, השדה CheckoutResponseMessage שהשירות שלכם מחזיר צריך לכלול FoodOrderError מסוג השגיאה AVAILABILITY_CHANGED או PRICE_CHANGED, בהתאמה.

תרחיש לדוגמה איך מטמיעים
תרחיש לדוגמה 1: האימות נכשל כי חלק מפריטי התפריט ו/או ההתאמות אישיות שלהם לא תקינים או שחסרים במלאי החזרת FoodErrorExtension עם correctedProposedOrder,‏ PaymentOptions ו-FoodOrderError מסוג השגיאה AVAILABILITY_CHANGED. צריך להסיר פריטים לא תקינים מ-CorrectedProposedOrder.
תרחיש לדוגמה 2: האימות נכשל כי חלק מפריטי התפריט ו/או ההתאמות אישיות שלהם לא תקינים או שחסרים במלאי. ערך ההזמנה בעגלה המתוקנת כבר לא עומד בדרישת ערך ההזמנה המינימלי. הפונקציה מחזירה את הערך FoodErrorExtension עם FoodOrderError של סוגי השגיאות AVAILABILITY_CHANGED ו- REQUIREMENTS_NOT_MET.
תרחיש לדוגמה 3: האימות נכשל כי מחירים של חלק מפריטי התפריט ו/או מחירים של התאמה אישית השתנו החזרת FoodErrorExtension עם correctedProposedOrder,‏ PaymentOptions ו-FoodOrderError מסוג השגיאה PRICE_CHANGED. מחירים לא עדכניים צריך לעדכן ב-CorrectedProposedOrder.
תרחיש לדוגמה 4: האימות נכשל כי מחירים של חלק מהפריטים בתפריט ו/או מחירי ההתאמה אישית השתנו. ערך ההזמנה בעגלה המתוקנת לא עומד יותר בדרישת ערך ההזמנה המינימלי הפונקציה מחזירה את הערך FoodErrorExtension עם FoodOrderError של סוגי השגיאות PRICE_CHANGED ו- REQUIREMENTS_NOT_MET.
{
  "expectUserResponse": false,
  "finalResponse": {
    "richResponse": {
      "items": [
        {
          "structuredResponse": {
            "error": {
              "@type": "type.googleapis.com/google.actions.v2.orders.FoodErrorExtension",
              "foodOrderErrors": [
                {
                  "error": "AVAILABILITY_CHANGED",
                  "id": "sample_item_offer_id_1",
                  "description": "The item is no longer available."
                },
                {
                  "error": "AVAILABILITY_CHANGED",
                  "id": "sample_item_offer_id_2",
                  "description": "The item is no longer available."
                }
              ],
              "correctedProposedOrder": {
                "id": "sample_corrected_proposed_order_id_1",
                "otherItems": [
                  {
                    "name":"New customer discount",
                    "price": {
                      "type":"ESTIMATE",
                      "amount": {
                        "currencyCode":"USD",
                        "units":"-5",
                        "nanos": -500000000
                      }
                    },
                    "type": "DISCOUNT"
                  },
                  {
                    "name": "Delivery fee",
                    "price": {
                      "type": "ESTIMATE",
                      "amount": {
                        "currencyCode": "USD",
                        "units": "3",
                        "nanos": 500000000
                      }
                    },
                    "type": "DELIVERY"
                  },
                  {
                    "name": "Tax",
                    "price": {
                      "type": "ESTIMATE",
                      "amount": {
                        "currencyCode": "USD",
                        "units": "1",
                        "nanos": 500000000
                      }
                    },
                    "type": "TAX"
                  }
                ],
                "cart": {
                  "merchant": {
                    "id": "https://www.exampleprovider.com/merchant/id1",
                    "name": "Falafel Bite"
                  },
                  "lineItems": [
                    {
                      "name": "Greek Salad",
                      "type": "REGULAR",
                      "id": "sample_item_offer_id_3",
                      "offerId": "https://www.exampleprovider.com/menu/item/offer/id3",
                      "quantity": 1,
                      "price": {
                        "type": "ESTIMATE",
                        "amount": {
                          "currencyCode": "USD",
                          "units": "9",
                          "nanos": 990000000
                        }
                      },
                      "extension": {
                        "@type": "type.googleapis.com/google.actions.v2.orders.FoodItemExtension"
                      }
                    },
                    {
                      "name": "Prawns Biryani",
                      "type": "REGULAR",
                      "id": "sample_item_offer_id_4",
                      "offerId": "https://www.exampleprovider.com/menu/item/offer/id4",
                      "quantity": 1,
                      "price": {
                        "type": "ESTIMATE",
                        "amount": {
                          "currencyCode": "USD",
                          "units": "15",
                          "nanos": 990000000
                        }
                      },
                      "extension": {
                        "@type": "type.googleapis.com/google.actions.v2.orders.FoodItemExtension"
                      }
                    }
                  ],
                  "extension": {
                    "@type": "type.googleapis.com/google.actions.v2.orders.FoodCartExtension",
                    "fulfillmentPreference": {
                      "fulfillmentInfo": {
                        "delivery": {
                          "deliveryTimeIso8601": "P90M"
                        }
                      }
                    },
                    "location": {
                      "coordinates": {
                        "latitude": 37.788783,
                        "longitude": -122.41384
                      },
                      "formattedAddress": "1350 CHARLESTON ROAD, MOUNTAIN VIEW, CA, United States",
                      "zipCode": "94043",
                      "city": "Mountain View",
                      "postalAddress": {
                        "regionCode": "US",
                        "postalCode": "94043",
                        "administrativeArea": "CA",
                        "locality": "Mountain View",
                        "addressLines": [
                          "1350 Charleston Road"
                        ]
                      },
                      "notes": "Gate code is #111"
                     }
                   }
                },
                "totalPrice": {
                  "type": "ESTIMATE",
                  "amount": {
                    "currencyCode": "USD",
                    "units": "36",
                    "nanos": 730000000
                  }
                },
                "extension": {
                  "@type": "type.googleapis.com/google.actions.v2.orders.FoodOrderExtension",
                  "availableFulfillmentOptions": [
                    {
                      "fulfillmentInfo": {
                        "delivery": {
                          "deliveryTimeIso8601": "P90M"
                        }
                      },
                      "expiresAt": "2017-07-17T12:30:00Z"
                    }
                  ]
                }
              },
              "paymentOptions": {
                "googleProvidedOptions": {
                  "tokenizationParameters": {
                    "tokenizationType": "PAYMENT_GATEWAY",
                    "parameters": {
                      "gateway": "stripe",
                      "stripe:publishableKey": "pk_live_stripe_client_key",
                      "stripe:version": "2017-04-06"
                    }
                  },
                  "supportedCardNetworks": [
                    "AMEX",
                    "DISCOVER",
                    "MASTERCARD",
                    "JCB",
                    "VISA"
                  ],
                  "prepaidCardDisallowed": true
                }
              }
            }
          }
        }
      ]
    }
  }
}
{
  "expectUserResponse": false,
  "finalResponse": {
    "richResponse": {
      "items": [
        {
          "structuredResponse": {
            "error": {
              "@type": "type.googleapis.com/google.actions.v2.orders.FoodErrorExtension",
              "foodOrderErrors": [
                {
                  "error": "REQUIREMENTS_NOT_MET",
                  "description": "The cart subtotal must be over $20."
                },
                {
                  "error": "AVAILABILITY_CHANGED",
                  "id": "cart_lineitem_id"
                  "description": "cart_lineitem_id is no longer available."
                }
              ]
            }
          }
        }
      ]
    }
  }
}
{
  "expectUserResponse": false,
  "finalResponse": {
    "richResponse": {
      "items": [
        {
          "structuredResponse": {
            "error": {
              "@type": "type.googleapis.com/google.actions.v2.orders.FoodErrorExtension",
              "foodOrderErrors": [
                {
                  "error": "PRICE_CHANGED",
                  "id": "sample_item_offer_id_1",
                  "description": "The price has changed.",
                  "updatedPrice": {
                    "currencyCode": "USD",
                    "units": "2",
                    "nanos": 750000000
                  }
                },
                {
                  "error": "PRICE_CHANGED",
                  "id": "sample_item_offer_id_2",
                  "description": "The price has changed.",
                  "updatedPrice": {
                    "currencyCode": "USD",
                    "units": "8"
                  }
                }
              ],
              "correctedProposedOrder": {
                "id": "sample_corrected_proposed_order_id_1",
                "otherItems": [
                  {
                    "name":"New customer discount",
                    "price": {
                      "type":"ESTIMATE",
                      "amount": {
                        "currencyCode":"USD",
                        "units":"-5",
                        "nanos": -500000000
                      }
                    },
                    "type": "DISCOUNT"
                  },
                  {
                    "name": "Delivery fee",
                    "price": {
                      "type": "ESTIMATE",
                      "amount": {
                        "currencyCode": "USD",
                        "units": "3",
                        "nanos": 500000000
                      }
                    },
                    "type": "DELIVERY"
                  },
                  {
                    "name": "Tax",
                    "price": {
                      "type": "ESTIMATE",
                      "amount": {
                        "currencyCode": "USD",
                        "units": "1",
                        "nanos": 500000000
                      }
                    },
                    "type": "TAX"
                  }
                ],
                "cart": {
                  "merchant": {
                    "id": "https://www.exampleprovider.com/merchant/id1",
                    "name": "Falafel Bite"
                  },
                  "lineItems": [
                    {
                      "name": "Pita Chips",
                      "type": "REGULAR",
                      "id": "sample_item_offer_id_1",
                      "offerId": "https://www.exampleprovider.com/menu/item/offer/id1",
                      "quantity": 1,
                      "price": {
                        "type": "ESTIMATE",
                        "amount": {
                          "currencyCode": "USD",
                          "units": "2",
                          "nanos": 750000000
                        }
                      },
                      "subLines": [
                        {
                          "note": "Notes for this item."
                        }
                      ],
                      "extension": {
                        "@type": "type.googleapis.com/google.actions.v2.orders.FoodItemExtension",
                        "options": [
                          {
                            "id": "sample_addon_offer_id_1",
                            "offerId": "https://www.exampleprovider.com/menu/item/addon/offer/id1",
                            "name": "Honey Mustard",
                            "price": {
                              "currencyCode": "USD"
                            },
                            "quantity": 1
                          },
                          {
                            "id": "sample_addon_offer_id_2",
                            "offerId": "https://www.exampleprovider.com/menu/item/addon/offer/id2",
                            "name": "BBQ Sauce",
                            "price": {
                              "currencyCode": "USD",
                              "nanos": 500000000
                            },
                            "quantity": 1
                          }
                        ]
                      }
                    },
                    {
                      "name": "Chicken Shwarma Wrap",
                      "type": "REGULAR",
                      "id": "sample_item_offer_id_2",
                      "offerId": "https://www.exampleprovider.com/menu/item/offer/id2",
                      "quantity": 1,
                      "price": {
                        "type": "ESTIMATE",
                        "amount": {
                          "currencyCode": "USD",
                          "units": "8"
                        }
                      },
                      "extension": {
                        "@type": "type.googleapis.com/google.actions.v2.orders.FoodItemExtension"
                      }
                    },
                    {
                      "name": "Greek Salad",
                      "type": "REGULAR",
                      "id": "sample_item_offer_id_3",
                      "offerId": "https://www.exampleprovider.com/menu/item/offer/id3",
                      "quantity": 1,
                      "price": {
                        "type": "ESTIMATE",
                        "amount": {
                          "currencyCode": "USD",
                          "units": "9",
                          "nanos": 990000000
                        }
                      },
                      "extension": {
                        "@type": "type.googleapis.com/google.actions.v2.orders.FoodItemExtension"
                      }
                    },
                    {
                      "name": "Prawns Biryani",
                      "type": "REGULAR",
                      "id": "sample_item_offer_id_4",
                      "offerId": "https://www.exampleprovider.com/menu/item/offer/id4",
                      "quantity": 1,
                      "price": {
                        "type": "ESTIMATE",
                        "amount": {
                          "currencyCode": "USD",
                          "units": "15",
                          "nanos": 990000000
                        }
                      },
                      "extension": {
                        "@type": "type.googleapis.com/google.actions.v2.orders.FoodItemExtension"
                      }
                    }
                  ],
                  "extension": {
                    "@type": "type.googleapis.com/google.actions.v2.orders.FoodCartExtension",
                    "fulfillmentPreference": {
                      "fulfillmentInfo": {
                        "delivery": {
                          "deliveryTimeIso8601": "P90M"
                        }
                      }
                    },
                    "location": {
                      "coordinates": {
                        "latitude": 37.788783,
                        "longitude": -122.41384
                      },
                      "formattedAddress": "1350 CHARLESTON ROAD, MOUNTAIN VIEW, CA, United States",
                      "zipCode": "94043",
                      "city": "Mountain View",
                      "postalAddress": {
                        "regionCode": "US",
                        "postalCode": "94043",
                        "administrativeArea": "CA",
                        "locality": "Mountain View",
                        "addressLines": [
                          "1350 Charleston Road"
                        ]
                      },
                      "notes": "Gate code is #111"
                     }
                   }
                },
                "totalPrice": {
                  "type": "ESTIMATE",
                  "amount": {
                    "currencyCode": "USD",
                    "units": "36",
                    "nanos": 730000000
                  }
                },
                "extension": {
                  "@type": "type.googleapis.com/google.actions.v2.orders.FoodOrderExtension",
                  "availableFulfillmentOptions": [
                    {
                      "fulfillmentInfo": {
                        "delivery": {
                          "deliveryTimeIso8601": "P90M"
                        }
                      },
                      "expiresAt": "2017-07-17T12:30:00Z"
                    }
                  ]
                }
              },
              "paymentOptions": {
                "googleProvidedOptions": {
                  "tokenizationParameters": {
                    "tokenizationType": "PAYMENT_GATEWAY",
                    "parameters": {
                      "gateway": "stripe",
                      "stripe:publishableKey": "pk_live_stripe_client_key",
                      "stripe:version": "2017-04-06"
                    }
                  },
                  "supportedCardNetworks": [
                    "AMEX",
                    "DISCOVER",
                    "MASTERCARD",
                    "JCB",
                    "VISA"
                  ],
                  "prepaidCardDisallowed": true
                }
              }
            }
          }
        }
      ]
    }
  }
}
{
  "expectUserResponse": false,
  "finalResponse": {
    "richResponse": {
      "items": [
        {
          "structuredResponse": {
            "error": {
              "@type": "type.googleapis.com/google.actions.v2.orders.FoodErrorExtension",
              "foodOrderErrors": [
                {
                  "error": "REQUIREMENTS_NOT_MET",
                  "description": "The cart subtotal must be over $20."
                },
                {
                  "error": "PRICE_CHANGED",
                  "id": "cart_lineitem_id"
                  "description": "cart_lineitem_id price has been updated."
                  "updatedPrice": {
                    "currencyCode": "USD",
                    "units": "2",
                    "nanos": 750000000
                  }
                }
              ]
            }
          }
        }
      ]
    }
  }
}

שליחת אישור הזמנה

כפי שמתואר בקטע שלב 7: הטמעת שליחת הזמנה, נקודת הקצה לטיפול בהזמנות צריכה לבצע אימות של כל SubmitOrderRequestMessage נכנסת ולהשיב ב-SubmitOrderResponseMessage.

דוגמה ל-SubmitOrderResponseMessage בתוקף:

תרחיש לדוגמה איך מטמיעים
תרחיש לדוגמה 1: ההזמנה נוצרה בהצלחה SubmitOrderResponseMessage עם סטטוס ההזמנה CREATED. חייבים להופיע בה actionOrderId,‏ userVisibleId,‏ orderManagementActions ו-estimatedFulfillmentTime.
תרחיש לדוגמה 2: ההזמנה נדחית בגלל בעיות בתשלום SubmitOrderResponseMessage עם סטטוס ההזמנה REJECTED. הוא חייב לכלול את השדות actionOrderId,‏ userVisibleId,‏ orderManagementActions ו-rejectionInfo מסוג PAYMENT_DECLINED.
תרחיש לדוגמה 3: ההזמנה נדחית כי המשתמש סומן כמוחרג SubmitOrderResponseMessage עם סטטוס ההזמנה REJECTED. הוא חייב לכלול את השדות actionOrderId,‏ userVisibleId,‏ orderManagementActions ו-rejectionInfo מסוג INELIGIBLE.
תרחיש שימוש 4: ההזמנה נדחית כי פרטי המשתמש לא מלאים או לא תקינים SubmitOrderResponseMessage עם סטטוס ההזמנה REJECTED. הוא חייב לכלול את השדות actionOrderId,‏ userVisibleId,‏ orderManagementActions ו-rejectionInfo מסוג INELIGIBLE.
תרחיש שימוש 5: ההזמנה נדחתה מסיבה לא ידועה SubmitOrderResponseMessage עם סטטוס ההזמנה REJECTED. הוא חייב לכלול את השדות actionOrderId,‏ userVisibleId,‏ orderManagementActions ו-rejectionInfo מסוג UNKNOWN.
{
  "expectUserResponse": false,
  "finalResponse": {
    "richResponse": {
      "items": [
        {
          "structuredResponse": {
            "orderUpdate": {
              "actionOrderId": "sample_action_order_id",
              "orderState": {
                "state": "CREATED",
                "label": "Order received"
              },
              "updateTime": "2017-05-10T02:30:00.000Z",
              "orderManagementActions": [
                {
                  "type": "CUSTOMER_SERVICE",
                  "button": {
                    "title": "Contact customer service",
                    "openUrlAction": {
                      "url": "mailto:support@example.com"
                    }
                  }
                },
                {
                  "type": "EMAIL",
                  "button": {
                    "title": "Email restaurant",
                    "openUrlAction": {
                      "url": "mailto:person@example.com"
                    }
                  }
                },
                {
                  "type": "CALL",
                  "button": {
                    "title": "Call restaurant",
                    "openUrlAction": {
                      "url": "tel:+16505554679"
                    }
                  }
                },
                {
                  "type": "VIEW_DETAILS",
                  "button": {
                    "title": "View order",
                    "openUrlAction": {
                      "url": "https://orderview.partner.com?orderid=sample_action_order_id"
                    }
                  }
                }
              ]
            }
          }
        }
      ]
    }
  }
}
{
  "expectUserResponse": false,
  "finalResponse": {
    "richResponse": {
      "items": [
        {
          "structuredResponse": {
            "orderUpdate": {
              "actionOrderId": "sample_action_order_id",
              "orderState": {
                "state": "REJECTED",
                "label": "Order rejected"
              },
              "updateTime": "2017-05-10T02:30:00.000Z",
              "rejectionInfo": {
                 "type": "PAYMENT_DECLINED",
                 "reason": "Insufficient funds"
              },
              "orderManagementActions": [
                {
                  "type": "CUSTOMER_SERVICE",
                  "button": {
                    "title": "Contact customer service",
                    "openUrlAction": {
                      "url": "mailto:support@example.com"
                    }
                  }
                },
                {
                  "type": "EMAIL",
                  "button": {
                    "title": "Email restaurant",
                    "openUrlAction": {
                      "url": "mailto:person@example.com"
                    }
                  }
                },
                {
                  "type": "CALL",
                  "button": {
                    "title": "Call restaurant",
                    "openUrlAction": {
                      "url": "tel:+16505554679"
                    }
                  }
                },
                {
                  "type": "VIEW_DETAILS",
                  "button": {
                    "title": "View order",
                    "openUrlAction": {
                      "url": "https://orderview.partner.com?orderid=sample_action_order_id"
                    }
                  }
                }
              ]
            }
          }
        }
      ]
    }
  }
}
{
  "expectUserResponse": false,
  "finalResponse": {
    "richResponse": {
      "items": [
        {
          "structuredResponse": {
            "orderUpdate": {
              "actionOrderId": "sample_action_order_id",
              "orderState": {
                "state": "REJECTED",
                "label": "Order rejected"
              },
              "updateTime": "2017-05-10T02:30:00.000Z",
              "rejectionInfo": {
                 "type": "INELIGIBLE",
                 "reason": "Sorry, we are not able to take orders from this user"
              },
              "orderManagementActions": [
                {
                  "type": "CUSTOMER_SERVICE",
                  "button": {
                    "title": "Contact customer service",
                    "openUrlAction": {
                      "url": "mailto:support@example.com"
                    }
                  }
                },
                {
                  "type": "EMAIL",
                  "button": {
                    "title": "Email restaurant",
                    "openUrlAction": {
                      "url": "mailto:person@example.com"
                    }
                  }
                },
                {
                  "type": "CALL",
                  "button": {
                    "title": "Call restaurant",
                    "openUrlAction": {
                      "url": "tel:+16505554679"
                    }
                  }
                },
                {
                  "type": "VIEW_DETAILS",
                  "button": {
                    "title": "View order",
                    "openUrlAction": {
                      "url": "https://orderview.partner.com?orderid=sample_action_order_id"
                    }
                  }
                }
              ]
            }
          }
        }
      ]
    }
  }
}
{
  "expectUserResponse": false,
  "finalResponse": {
    "richResponse": {
      "items": [
        {
          "structuredResponse": {
            "orderUpdate": {
              "actionOrderId": "sample_action_order_id",
              "orderState": {
                "state": "REJECTED",
                "label": "Order rejected"
              },
              "updateTime": "2017-05-10T02:30:00.000Z",
              "rejectionInfo": {
                 "type": "INELIGIBLE",
                 "reason": "Sorry, the phone number must not be blank"
              },
              "orderManagementActions": [
                {
                  "type": "CUSTOMER_SERVICE",
                  "button": {
                    "title": "Contact customer service",
                    "openUrlAction": {
                      "url": "mailto:support@example.com"
                    }
                  }
                },
                {
                  "type": "EMAIL",
                  "button": {
                    "title": "Email restaurant",
                    "openUrlAction": {
                      "url": "mailto:person@example.com"
                    }
                  }
                },
                {
                  "type": "CALL",
                  "button": {
                    "title": "Call restaurant",
                    "openUrlAction": {
                      "url": "tel:+16505554679"
                    }
                  }
                },
                {
                  "type": "VIEW_DETAILS",
                  "button": {
                    "title": "View order",
                    "openUrlAction": {
                      "url": "https://orderview.partner.com?orderid=sample_action_order_id"
                    }
                  }
                }
              ]
            }
          }
        }
      ]
    }
  }
}
{
  "expectUserResponse": false,
  "finalResponse": {
    "richResponse": {
      "items": [
        {
          "structuredResponse": {
            "orderUpdate": {
              "actionOrderId": "sample_action_order_id",
              "orderState": {
                "state": "REJECTED",
                "label": "Order rejected"
              },
              "updateTime": "2017-05-10T02:30:00.000Z",
              "rejectionInfo": {
                 "type": "UNKNOWN",
                 "reason": "Sorry, there is something wrong with this order."
              },
              "orderManagementActions": [
                {
                  "type": "CUSTOMER_SERVICE",
                  "button": {
                    "title": "Contact customer service",
                    "openUrlAction": {
                      "url": "mailto:support@example.com"
                    }
                  }
                },
                {
                  "type": "EMAIL",
                  "button": {
                    "title": "Email restaurant",
                    "openUrlAction": {
                      "url": "mailto:person@example.com"
                    }
                  }
                },
                {
                  "type": "CALL",
                  "button": {
                    "title": "Call restaurant",
                    "openUrlAction": {
                      "url": "tel:+16505554679"
                    }
                  }
                },
                {
                  "type": "VIEW_DETAILS",
                  "button": {
                    "title": "View order",
                    "openUrlAction": {
                      "url": "https://orderview.partner.com?orderid=sample_action_order_id"
                    }
                  }
                }
              ]
            }
          }
        }
      ]
    }
  }
}