Google Express – Заказ счетов-фактур: createchargeinvoice

Я интегрирую Google Express с Magento, но API создания счетов-фактур не работает. Я попытался создать счет из опции «Попробовать этот API» продавца Google, но он выдает следующую ошибку:

{
 "error": {
  "errors": [
   {
    "domain": "content.ContentErrorDomain",
    "reason": "invalid_transition",
    "message": "The requested order is not supported by orderinvoices service"
   }
  ],
  "code": 400,
  "message": "The requested order is not supported by orderinvoices service"
 }
}

Документ API createchargeinvoice: https://developers.google.com/shopping-content/v2/reference/v2/orderinvoices/createchargeinvoice

Тело моего запроса:

{
  "invoiceId": "invoice1",
  "operationId": "charge1",
  "shipmentGroupId": "shipmentgroup1",
  "lineItemInvoices": [
    {
      "productId": "online:en:US:d3k3245",
      "shipmentUnitIds": [
        "2"
      ],
      "unitInvoice": {
        "unitPricePretax": {
          "value": "140",
          "currency": "USD"
        },
        "unitPriceTaxes": [
          {
            "taxType": "sales",
            "taxAmount": {
              "value": "14",
              "currency": "USD"
            }
          }
        ],
        "promotions": [
          {
            "promotionId": "111",
            "promotionAmount": {
              "tax": {
                "currency": "USD",
                "value": "0"
              },
              "pretax": {
                "currency": "USD",
                "value": "0"
              }
            }
          }
        ],
        "additionalCharges": [
          {
            "additionalChargeAmount": {
              "pretax": {
                "currency": "USD",
                "value": "0"
              },
              "tax": {
                "currency": "USD",
                "value": "0"
              }
            },
            "additionalChargePromotions": [
              {
                "promotionAmount": {
                  "pretax": {
                    "currency": "USD",
                    "value": "0"
                  },
                  "tax": {
                    "currency": "USD",
                    "value": "0"
                  }
                },
                "promotionId": "111"
              }
            ],
            "type": "shipping"
          }
        ]
      }
    }
  ],
  "invoiceSummary": {
    "productTotal": {
      "pretax": {
        "value": "561.20",
        "currency": "USD"
      },
      "tax": {
        "value": "55.98",
        "currency": "USD"
      }
    },
    "additionalChargeSummaries": [
      {
        "totalAmount": {
          "pretax": {
            "value": "561.20",
            "currency": "USD"
          },
          "tax": {
            "value": "55.98",
            "currency": "USD"
          }
        },
        "type": "shipping"
      }
    ],
    "promotionSummaries": [
      {
        "promotionAmount": {
          "pretax": {
            "value": "561.20",
            "currency": "USD"
          },
          "tax": {
            "value": "55.98",
            "currency": "USD"
          }
        },
        "promotionId": "111"
      }
    ],
    "merchantBalance": {
      "pretax": {
        "value": "561.20",
        "currency": "USD"
      },
      "tax": {
        "value": "55.98",
        "currency": "USD"
      }
    },
    "customerBalance": {
      "pretax": {
        "value": "561.20",
        "currency": "USD"
      },
      "tax": {
        "value": "55.98",
        "currency": "USD"
      }
    }
  }
}

Кто-нибудь сталкивался с этой проблемой?


person abhilashv    schedule 12.03.2019    source источник
comment
Ошибка указывает на неправильно сформированное тело запроса. Поделитесь, пожалуйста, телом запроса.   -  person Kamran Feroz    schedule 12.03.2019
comment
@KamranFeroz: я обновил свой вопрос телом запроса.   -  person abhilashv    schedule 12.03.2019


Ответы (1)


Согласно документу Google (которым вы поделились), для тела запроса есть около 40 обязательных полей. В текущем общем тексте запроса у вас менее половины обязательных полей.

Обязательные поля:

  1. идентификатор счета
  2. идентификатор операции
  3. отгрузкаGroupId
  4. LineItemInvoices[]
  5. lineItemInvoices[].shipmentUnitIds[]
  6. lineItemInvoices[].unitInvoice
  7. lineItemInvoices[].unitInvoice.unitPricePretax
  8. lineItemInvoices[].unitInvoice.unitPriceTaxes[].taxType
  9. lineItemInvoices[].unitInvoice.unitPriceTaxes[].taxAmount
  10. lineItemInvoices[].unitInvoice.promotions[].promotionId
  11. lineItemInvoices[].unitInvoice.promotions[].promotionAmount
  12. lineItemInvoices[].unitInvoice.promotions[].promotionAmount.pretax
  13. lineItemInvoices[].unitInvoice.promotions[].promotionAmount.tax
  14. lineItemInvoices[].unitInvoice.additionalCharges[].type
  15. lineItemInvoices[].unitInvoice.additionalCharges[].additionalChargeAmount
  16. lineItemInvoices[].unitInvoice.additionalCharges[].additionalChargeAmount.pretax
  17. lineItemInvoices[].unitInvoice.additionalCharges[].additionalChargeAmount.tax
  18. lineItemInvoices[].unitInvoice.additionalCharges[].additionalChargePromotions[].promotionId
  19. lineItemInvoices[].unitInvoice.additionalCharges[].additionalChargePromotions[].promotionAmount
  20. lineItemInvoices[].unitInvoice.additionalCharges[].additionalChargePromotions[].promotionAmount.pretax
  21. lineItemInvoices[].unitInvoice.additionalCharges[].additionalChargePromotions[].promotionAmount.tax
  22. инвойсСводка
  23. invoiceSummary.productTotal
  24. invoiceSummary.productTotal.pretax
  25. invoiceSummary.productTotal.tax
  26. invoiceSummary.additionalChargeSummaries[].type
  27. invoiceSummary.additionalChargeSummaries[].totalAmount
  28. invoiceSummary.additionalChargeSummaries[].totalAmount.pretax
  29. invoiceSummary.additionalChargeSummaries[].totalAmount.tax
  30. invoiceSummary.promotionSummaries[].promotionId
  31. invoiceSummary.promotionSummaries[].promotionAmount
  32. invoiceSummary.promotionSummaries[].promotionAmount.pretax
  33. invoiceSummary.promotionSummaries[].promotionAmount.tax
  34. invoiceSummary.merchantBalance.pretax
  35. invoiceSummary.merchantBalance.tax
  36. invoiceSummary.customerBalance.pretax
  37. invoiceSummary.customerBalance.tax
  38. invoiceSummary.googleBalance.pretax
  39. invoiceSummary.googleBalance.tax
person Kamran Feroz    schedule 12.03.2019
comment
Я обновил тело запроса со всеми необходимыми полями, но все равно получаю ту же ошибку. Это как-то связано со статусом заказа GE? Мой заказ сейчас находится в статусе «Отправлен». - person abhilashv; 12.03.2019