调用检查Broadleaf商务的REST Api的JSON格式是什么样的?



我已经按照Broadleaf的文档(http://docs.broadleafcommerce.org/current/REST-Tutorials.html)设置了Broadleaf以使其运行。我想使用REST Api检查购物车;, /车/结帐。因此,我查看了代码内部,以便了解发送的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 api都是通过"包装器"概念公开的。例如,有CustomerWrapper、OrderWrapper等。这些包装器定义了使用REST api来回序列化哪些属性。

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

{
    "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"
                }
            ]
        }
    ]
}

这是相同的json你将从/cart?customerId="成功执行/购物车/结帐/付款后使用GET方法

最新更新