【问题标题】:How JSON format for calling Checking out REST Api of Broadleaf commerce looks like调用 Checking out REST Api of Broadleaf commerce 的 JSON 格式如何
【发布时间】:2015-10-07 14:56:47
【问题描述】:

我已经按照文档 (http://docs.broadleafcommerce.org/current/REST-Tutorials.html) 设置了 Broadleaf 以使其运行。我想使用 REST Api 检查购物车;也就是说,/cart/checkout。因此,我查看了代码内部,以了解发送的 JSON 格式的外观。通过查看代码,我发现需要传递JSON数据,如下所示:

{
   "paymentInfo": {
      "id": ,
      "orderId": ,
      "type": ,
      "address": {
         "id":
         "firstname":
         "lastname":
         "addressLine1":
         "addressLine2":
         "city":
         "state":
         "country":
         "postalCode":
         
      },
      "phone": "",
      "additionalFields": "",
      "amount": "",
      "amountItems": "",
      "customerIpAddress": "",
      "referenceNumber": ""
   }, 
   "referenced": {
      "id": "",
      "referenceNumber": "",
      "type": "",
      "pan": "",
      "cvvCode:" "",
      "expirationMonth": "",
      "expirationYear": "",
      "accountNumber": "",
      "routingNumber": "",
      "pin": ""
   }
}

但是,我不知道 JSON 数据是什么样的。因此,如果有人曾经使用过 api,请通过显示数据示例来帮助我,以便提出请求。期待答案。

提前致谢。

【问题讨论】:

    标签: rest broadleaf-commerce


    【解决方案1】:

    我们所有的 REST API 都是通过“包装器”概念公开的。例如,有 CustomerWrapper、OrderWrapper 等。这些包装器定义了哪些属性通过 REST API 来回序列化。

    对于您的具体情况,您应该查看 PaymentReferenceMapWrapper。

    【讨论】:

      【解决方案2】:
      {
          "id": 1751,
          "status": "IN_PROCESS",
          "totalTax": {
              "amount": "0.00",
              "currency": "INR"
          },
          "totalShipping": {
              "amount": "0.00",
              "currency": "INR"
          },
          "subTotal": {
              "amount": "860.00",
              "currency": "INR"
          },
          "total": {
              "amount": "860.00",
              "currency": "INR"
          },
          "customer": {
              "id": 2600
          },
          "orderItems": [
              {
                  "id": 1752,
                  "name": "abc",
                  "quantity": 2,
                  "retailPrice": {
                      "amount": "430.00",
                      "currency": "INR"
                  },
                  "salePrice": {
                      "amount": "430.00",
                      "currency": "INR"
                  },
                  "orderId": 1751,
                  "categoryId": 10300,
                  "skuId": 10212,
                  "productId": 10212,
                  "isBundle": false,
                  "orderItemPriceDetails": [
                      {
                          "id": 1752,
                          "totalAdjustmentValue": {
                              "amount": "0.00",
                              "currency": "INR"
                          },
                          "totalAdjustedPrice": {
                              "amount": "860.00",
                              "currency": "INR"
                          },
                          "quantity": 2,
                          "adjustments": []
                      }
                  ],
                  "isDiscountingAllowed": true
              }
          ],
          "fulfillmentGroups": [
              {
                  "id": 1502,
                  "orderId": 1751,
                  "total": {
                      "amount": "860.00",
                      "currency": "INR"
                  },
                  "fulfillmentGroupItems": [
                      {
                          "id": 1752,
                          "fulfillmentGroupId": 1502,
                          "orderItemId": 1752,
                          "totalTax": {
                              "amount": "0.00",
                              "currency": "INR"
                          },
                          "quantity": 2,
                          "totalItemAmount": {
                              "amount": "860.00",
                              "currency": "INR"
                          }
                      }
                  ]
              }
          ],
          "payments": [
              {
                  "id": 601,
                  "orderId": 1751,
                  "type": "COD",
                  "amount": "860.00",
                  "currency": "INR",
                  "gatewayType": "Passthrough",
                  "transactions": [
                      {
                          "id": 601,
                          "orderPaymentId": 601,
                          "type": "AUTHORIZE_AND_CAPTURE",
                          "success": true,
                          "amount": "860.00",
                          "currency": "INR"
                      }
                  ]
              }
          ]
      }
      

      这是您在成功执行 /cart/checkout/payment 后使用方法 GET 从 /cart?customerId="" 获得的相同 json

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多