Page 1 of 1

BLC 3.0 - Add shipping to Order via REST API?

Posted: Thu Jun 27, 2013 6:55 am
by janschraepen
We've started using Broadleaf 3.0 through the REST API and we're a little bit stuck with the following issue:

We've created a new Cart and are able to add some Products to the Cart. For completing the Order, we were able to extend the REST API and retrieve the shipping options (fixed FulfillmentOptions). Only now we're wondering how to apply a chosen option to the Order (in order for it to apply to the Order and recalculate the total).

Is there a simple way to accomplish this via a REST API call? There isn'r really one available I think, or plz prove us wrong when there is one and we've looked over it. And if there isn't one.. can someone plz explain us, how we can do this - what logic needs to be implemented, in order that an shipping option can be applied to the Order/Cart.

Thx in advance!
Jan

Re: BLC 3.0 - Add shipping to Order via REST API?

Posted: Tue Jul 16, 2013 5:19 pm
by ktisdell
You are correct. There is no way, out of the box, to do that now.
I created an issue for this here that will target version 3.0.1:
https://github.com/BroadleafCommerce/Br ... issues/193

In the mean time, you can create a new endpoint yourself that allows you to do this. You should likely add a method to your fulfillment endpoint for this. Essentially, you will need to find the FulfillmentOption by id (according to the one you pass in the request), and set it on the fulfillment group. You will also want to set the fulfillment type on the fulfillment group. It should, as a general rule, be set to the same fulfillment type as the fulfillment option's fulfillment type. The reason that we store fulfillment type on the fulfillment group, in addition to having it on the fulfillment option, is that before you know which fulfillment option the customer wants, you may need to group the items according to type. This should be quite easy to implement as a custom extension.

Re: BLC 3.0 - Add shipping to Order via REST API?

Posted: Wed Jul 17, 2013 9:01 am
by janschraepen
Thx! This worked perfectly..

Could you also be so kind, to share how phone aan shipping address could be added? Lookking at the code, it looks like this has to be added to the to fulfillmentGroup? Correct me if I'm wrong. But looking at the endpoint, I don't see a ready-to-use methods that does this. The documentation mentions a method "/cart/fulfillment/group/{fulfillmentGroupId}" which could be used to update a present fulfillmentGroup. Though in the FulfillmentEndpoint I don't see any method that has this functionality??

And.. I assume that the phone and addres in the fulfillmentGroup are the shipping phone and address info. Where do the billing phone and shipping info have to added to??

Any help/advice would be appreciated!

Thx in advance!

Gr,
Jan

Re: BLC 3.0 - Add shipping to Order via REST API?

Posted: Wed Jun 17, 2015 2:19 pm
by phillipuniverse
@noopuraspire - you will need a custom endpoint.