使用Google Transactions API和Google动作Java SDK的MalformedResponse

时间:2019-12-13 12:29:39

标签: dialogflow actions-on-google

我正在尝试将Google Transactions API应用于我们正在开发的演示中,但是我一直无法获得响应:textPayload:“ MalformedResponse:由于无效的平台响应,未能将Dialogflow响应解析为AppResponse:试图解析数据从系统意图出发,却失败了”,尽管考虑到我使用了Google SDK上的操作,并试图遵循文档和参考(尽管质量很差)。

以下是我从日志中获得的信息

textPayload: "MalformedResponse: Failed to parse Dialogflow response into AppResponse because of invalid platform response: Tried to parse data from system intent but failed
{
  "presentationOptions": {
    "actionDisplayName": "PLACE_ORDER"
  },
  "orderOptions": {
    "requestDeliveryAddress": false
  },
  "paymentParameters": {
    "merchantPaymentOption": {
      "managePaymentMethodUrl": "https://(redacted)",
      "merchantPaymentMethod": [{
        "paymentMethodDisplayInfo": {
          "paymentMethodDisplayName": "(cardtype): 457110XXXXXX0000",
          "paymentType": "PAYMENT_CARD"
        },
        "paymentMethodId": "b35ccab5-7648-464d-b5fd-986d022d953c"
      }, {
        "paymentMethodDisplayInfo": {
          "paymentMethodDisplayName": "(cardtype): xxxx xxxx xxxx 3155",
          "paymentType": "PAYMENT_CARD"
        },
        "paymentMethodId": "2fc341cb-e518-4388-840f-fb050ac1f909"
      }]
    }
  },
  "@type": "type.googleapis.com/google.actions.transactions.v3.TransactionDecisionValueSpec",
  "order": {
    "buyerInfo": {
      "displayName": "Pepper Meme-Machine",
      "email": "(redacted)",
      "firstName": "Pepper",
      "lastName": "Meme-Machine",
      "phoneNumbers": [{
        "e164PhoneNumber": "+45xxxxxxxx"
      }]
    },
    "contents": {
      "lineItems": [{
        "id": "6966dc1d-f963-414a-828d-8d4036304755|2c443609-4853-4721-af30-0655e66baf1e",
        "name": "(name)",
        "notes": ["(redacted): fe1c6706-54b1-45ae-860f-935ebbd6c1f3"],
        "priceAttributes": [{
          "amount": {
            "amountInMicros": 3000000.0,
            "currencyCode": "DKK"
          },
          "name": "Pris incl. moms",
          "state": "ACTUAL",
          "taxIncluded": true,
          "type": "TOTAL"
        }, {
          "amount": {
            "amountInMicros": 750000.0,
            "currencyCode": "DKK"
          },
          "name": "heraf moms 25 procent",
          "state": "ACTUAL",
          "taxIncluded": true,
          "type": "TAX"
        }],
        "purchase": {
          "quantity": 1.0,
          "unitMeasure": {
            "measure": 1.0,
            "unit": "Parts"
          }
        }
      }, {
        "id": "4a82b2cd-32fd-476c-8801-785176dab3a6|2c443609-4853-4721-af30-0655e66baf1e",
        "name": "(name)",
        "notes": ["(redacted): 7bbaa0e5-bf56-4e31-bd40-968a7d99c572"],
        "priceAttributes": [{
          "amount": {
            "amountInMicros": 1.495E7,
            "currencyCode": "DKK"
          },
          "name": "Pris incl. moms",
          "state": "ACTUAL",
          "taxIncluded": true,
          "type": "TOTAL"
        }, {
          "amount": {
            "amountInMicros": 3737500.0,
            "currencyCode": "DKK"
          },
          "name": "heraf moms 25 procent",
          "state": "ACTUAL",
          "taxIncluded": true,
          "type": "TAX"
        }],
        "purchase": {
          "quantity": 1.0,
          "unitMeasure": {
            "measure": 1.0,
            "unit": "Parts"
          }
        }
      }, {
        "id": "ad2aca75-7cfc-42c3-8377-02d7f7518607|2c443609-4853-4721-af30-0655e66baf1e",
        "name": "(name)",
        "notes": ["(redacted): 670b5189-6010-433e-bd5c-dc204bd0662a"],
        "priceAttributes": [{
          "amount": {
            "amountInMicros": 4950000.0,
            "currencyCode": "DKK"
          },
          "name": "Pris incl. moms",
          "state": "ACTUAL",
          "taxIncluded": true,
          "type": "TOTAL"
        }, {
          "amount": {
            "amountInMicros": 1237500.0,
            "currencyCode": "DKK"
          },
          "name": "heraf moms 25 procent",
          "state": "ACTUAL",
          "taxIncluded": true,
          "type": "TAX"
        }],
        "purchase": {
          "quantity": 1.0,
          "unitMeasure": {
            "measure": 1.0,
            "unit": "Parts"
          }
        }
      }]
    },
    "createTime": "2019-12-13T12:18:18.202582Z",
    "lastUpdateTime": "2019-12-13T12:18:18.202582Z",
    "merchantOrderId": "c2e19a21-7d14-42b4-8e8f-ebb561a72cb2",
    "priceAttributes": [{
      "amount": {
        "amountInMicros": 2.29E7,
        "currencyCode": "DKK"
      },
      "name": "Total",
      "state": "ACTUAL",
      "taxIncluded": true,
      "type": "TOTAL"
    }, {
      "amount": {
        "amountInMicros": 5725000.0,
        "currencyCode": "DKK"
      },
      "name": "heraf moms 25 procent",
      "state": "ACTUAL",
      "taxIncluded": true,
      "type": "TAX"
    }],
    "purchase": {
      "fulfillmentInfo": {
        "expectedFulfillmentTime": {
          "timeIso8601": "2019-12-20"
        },
        "fulfillmentContact": {
          "displayName": "(redacted)",
          "email": "(redacted)"
        },
        "fulfillmentType": "DELIVERY",
        "id": "e0536713-ce2b-44d0-b9e7-517ad1d9776a",
        "location": {
          "city": "(redacted)",
          "phoneNumber": "+45xxxxxxxx",
          "postalAddress": {
            "addressLines": ["(redacted)"],
            "locality": "(redacted - same as city above)",
            "postalCode": "(redacted)",
            "recipients": ["Pepper Meme-Machine"]
          },
          "zipCode": "(redacted - same as postalCode above)"
        }
      },
      "purchaseLocationType": "ONLINE_PURCHASE",
      "returnsInfo": {
        "daysToReturn": 0.0,
        "isReturnable": false,
        "policyUrl": "(redacted)"
      },
      "status": "CREATED",
      "type": "PURCHASE_TYPE_UNSPECIFIED",
      "userVisibleStatusLabel": "CREATED"
    },
    "transactionMerchant": {
      "name": "(redacted) på vegne af: (redacted)"
    },
    "userVisibleOrderId": "(redacted) Compound order ID - individual IDs will arrive by email"
  }

有什么办法可以告知失败的原因吗?

0 个答案:

没有答案