0

I have followed setting up Broadleaf to make it running by following its documentation (http://docs.broadleafcommerce.org/current/REST-Tutorials.html). I wanted to do checking out the cart using REST Api; that's, /cart/checkout. Therefore, I looked inside the code in order to understand how the JSON format being sent will look alike. By looking through the code, I found that it is required to pass the JSON data as shown following:

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

However, I have no idea such the JSON data looks like. Therefore, if anyone who has ever used the api, please help me by showing an example of data in order to make the request. Looking forward to the answers.

Thanks in advance.

Community
  • 1
  • 1
xlives
  • 211
  • 1
  • 4
  • 11

2 Answers2

0

All of our REST APIs are exposed through a 'wrapper' concept. For instance, there is a CustomerWrapper, OrderWrapper, etc. These wrappers define which properties are serialized back and forth with the REST APIs.

For your specific case, you should look at PaymentReferenceMapWrapper.

phillipuniverse
  • 2,025
  • 1
  • 14
  • 15
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"
                }
            ]
        }
    ]
}

This is the same json you will get from /cart?customerId="" with method GET after successfully executing /cart/checkout/payment

Noopur Dabhi
  • 1,867
  • 25
  • 38