0

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

提前致谢。

4

2 回答 2

0

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

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

于 2013-04-15T19:32:19.950 回答
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/checkout/payment 后使用方法 GET 从 /cart?customerId="" 获得的相同 json

于 2015-10-07T06:56:47.437 回答