Google Express - Заказ счета-фактуры: создание счета-фактуры - PullRequest
1 голос
/ 12 марта 2019

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

{
 "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 doc: 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"
      }
    }
  }
}

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

1 Ответ

0 голосов
/ 12 марта 2019

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

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

  1. invoiceId
  2. operationId
  3. shipmentGroupId
  4. lineItemInvoices []
  5. lineItemInvoices []. shipmentUnitIds []
  6. lineItemInvoices []. unitInvoice
  7. lineItemInvoices []. unitInvoice.unitPrice
  8. lineItemInvoices []. UnitInvoice.unitPriceTaxes []. TaxType
  9. lineItemInvoices []. UnitInvoice.unitPriceTaxes []. TaxAmount
  10. lineItemInvoices []. UnitInvoice.I*
  11. lineItemInvoices []. UnitInvoice.promotions []. PromoAmount
  12. lineItemInvoices []. UnitInvoice.promotions []. PromoAmount.pretax
  13. lineItemInvoices []. UnitInvoice.promotions [].promoAmount.tax
  14. lineItemInvoices []. unitInvoice.additionalCharges []. тип
  15. lineItemInvoices []. unitInvoice.additionalCharges []. AdditionalChargeAmount
  16. lineItemInvoices []. unitInvoice.additionalCharges []. AdditionalChargeAmount.pretax
  17. lineItemInvoices []. unitInvoice.additionalCharges []. AdditionalChargeAmount.tax
  18. lineItemInvoices []. unitInvoice.additionalCharges [] .o] [].1040 *
  19. lineItemInvoices []. UnitInvoice.additionalCharges []. AdditionalChargePromotions []. PromoAmount
  20. lineItemInvoices []. UnitInvoice.additionalCharges []. AdditionalChargePromotions [].[] .unitInvoice.additionalCharges []. AdditionalChargePromotions []. promoAmount.tax
  21. invoiceSummary
  22. invoiceSummary.productTotal
  23. invoiceSummary.productTotal.preum *.productTotal.tax
  24. invoiceSummary.* invoiceSummary.additionalChargeSummaries []. кtalAmount.tax
  25. invoiceSummary.promotionSummaries []. PromotionId
  26. invoiceSummary.promotionSummaries []. PromotionAmount
  27. invoiceSummary.promotionSummaries []. promoAmount.pretax
  28. invoiceSummary.merchantBalance.pretax
  29. invoiceSummary.merchantBalance.tax
  30. invoiceSummary.customerBalance.pretax
  31. invoiceSummary.googleBalance.pretax
  32. invoiceSummary.googleBalance.tax
...