تنفيذ إجراءات التسليم المتقدّمة

ربط خلاصات القائمة بعناصر سلة التسوّق للتوصيل

عندما يضيف العملاء سلعًا من خلاصة قائمة الطعام إلى سلة التسوّق ويدفعون، تُرسِل 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 يمكن أن يتضمّن أيضًا عناصر 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"
    }
  ]
}

يحتوي هذا المثال على عنصر قائمة يتضمّن عنصر قائمة إضافيًا واحدًا أو أكثر.

عناصر القائمة في خلاصة قائمة:

{
  "@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. يمكنك استخدام هذا الردّ لتحديد خطأ واحد أو أكثر حدث أثناء المعالجة.

هناك طريقتان لمعالجة الأخطاء:

  • الأخطاء القابلة للاسترداد: لا يُطلب من المستخدم تعديل سلة التسوّق لإرسال ال سفارش. على سبيل المثال، إذا تبيّن لك أنّه تم تسجيل تغيير في سعر أحد السلع في 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 أم لا.

في حال تصحيح 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: تنفيذ Checkout، يجب أن تُجري نقطة نهاية التسليم عملية التحقّق من كل 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
JSONJSONJSONJSON
{
  "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.
JSONJSONJSONJSONJSON
{
  "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"
                    }
                  }
                }
              ]
            }
          }
        }
      ]
    }
  }
}