如何调用JSON格式检查Broadleaf商业的REST Api

时间:2013-04-09 17:27:36

标签: rest broadleaf-commerce

我已经按照其文档(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,请通过显示数据示例来帮助我,以便提出请求。期待着答案。

提前致谢。

2 个答案:

答案 0 :(得分:0)

我们所有的REST API都是通过“包装”概念公开的。例如,有一个CustomerWrapper,OrderWrapper等。这些包装器定义了使用REST API来回串行化的属性。

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

答案 1 :(得分:0)

{
    "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获得的json相同吗?customerId =""成功执行/ cart / checkout / payment后,使用方法GET