Retrieving customised inventory prices in bulk  Topic is solved

Discussions relating to the REST API of Jiwa 7.

Retrieving customised inventory prices in bulk

Postby mls » Thu Jul 21, 2022 6:44 pm

Hi. Looking for some advice on how best to integrate Jiwa with a custom ecommerce site. We are running Jiwa 07.02.01 and using PHP to communicate with the REST API.

Our first challenge is to display real-time customised inventory prices to our users when they browse and search our site.

Each user on our site will be linked to a debtor record in Jiwa — we're hoping to use the REST API to fetch inventory items with Jiwa's pricing logic already applied for that user/debtor, rather than having to replicate that logic in our own system.

Is there any way to efficiently retrieve a list of priced inventory items for a particular user (i.e. given a DebtorID and multiple InventoryIDs)? I've searched the API docs but haven't found any obvious way to do this, so any advice would be much appreciated

Thanks,
Michael
mls
Occasional Contributor
Occasional Contributor
 
Posts: 16
Joined: Tue Jul 05, 2022 5:50 am
Topics Solved: 1

Re: Retrieving customised inventory prices in bulk

Postby Mike.Sheen » Thu Jul 21, 2022 6:58 pm

mls wrote:Is there any way to efficiently retrieve a list of priced inventory items for a particular user (i.e. given a DebtorID and multiple InventoryIDs)? I've searched the API docs but haven't found any obvious way to do this, so any advice would be much appreciated


We don't have anything out-of-the-box, but creating such a route should be fairly easy for anyone familiar with Jiwa plugins and our REST API.

We have an existing route to get a price for a given product, customer, location, date and quantity - the route is /Inventory/{InventoryID}/Pricing/{DebtorID}/{IN_LogicalID}/{Date}/{Quantity}

If you look at the code behind that request in the REST API plugin, it simply creates an instance of our PriceScheme object and calls the GetPrice method. You could create a new route to adapt that to accept a list of products instead of a single product, and have it iterate the list of products calling GetPrice repeatedly and then return a list of products, prices with quantity breaks.

That may not perform well, depending on a lot of factors - but it's worth starting with that and if it doesn't perform well enough, you could then look at changing the logic to not use the GetPrice method and use another approach.

If you've no experience making plugins for Jiwa, especially ones to add custom REST API routes then you might want to engage our services on our helpdesk and we can do it for you.
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2444
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 756

Re: Retrieving customised inventory prices in bulk

Postby mls » Thu Jul 21, 2022 7:07 pm

Hi Mike,

Thanks for the quick reply. From a quick glance at your docs it looks like plugins can only be developed in C# or VB.NET — is that correct?

Michael
mls
Occasional Contributor
Occasional Contributor
 
Posts: 16
Joined: Tue Jul 05, 2022 5:50 am
Topics Solved: 1

Re: Retrieving customised inventory prices in bulk

Postby SBarnes » Thu Jul 21, 2022 7:10 pm

Having been there and done this with a client, my best advice is as follows:

1. Given the complexity of how Jiwa's pricing works trying to replicate the pricing functionality is not a good idea and keeping the two in sync would be a nightmare.
2. Also given the complexity trying to calculating the price for possibly a long list of prices on the fly is also not a good idea.

What our customer did was as follows:

1. Show the default price for a product but then give the user the ability to enter a quantity and have a button to show their price
2. When a product was added to the cart at a given quantity show the price the customer would be charged.

To support this we developed a custom route that would take a debtor id, the date to calculate the prices at and a list of products and quantities and then return the list with prices for each item in the list.

Part of your problem whilst under inventory functionality of the api whilst you can retrieve prices such as debtor specific prices there is functionality called a scheme that determines how the different prices can be compared.
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1619
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 175

Re: Retrieving customised inventory prices in bulk

Postby SBarnes » Thu Jul 21, 2022 7:24 pm

Thanks for the quick reply. From a quick glance at your docs it looks like plugins can only be developed in C# or VB.NET — is that correct?


Yes that is correct.
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1619
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 175

Re: Retrieving customised inventory prices in bulk

Postby mls » Fri Jul 22, 2022 3:26 pm

Thanks for the replies Stuart. For now we're going to test some other solutions before diving into Jiwa plugins.

Another question:

We have an existing route to get a price for a given product, customer, location, date and quantity - the route is /Inventory/{InventoryID}/Pricing/{DebtorID}/{IN_LogicalID}/{Date}/{Quantity}


Is this the only built-in route which can retrieve a price for a given product and customer? What if we want to search across all locations?

Also, would it make any sense to get prices by creating a stateful SalesQuote/SalesOrder?

Thanks,
Michael
mls
Occasional Contributor
Occasional Contributor
 
Posts: 16
Joined: Tue Jul 05, 2022 5:50 am
Topics Solved: 1

Re: Retrieving customised inventory prices in bulk

Postby SBarnes » Fri Jul 22, 2022 3:37 pm

There is an argument to be put forward to support Quotes through the api however, this would not a small amount of work.

I would point out that in thinking about it yes, you could create a Stateful sales order and let Jiwa price things that way and then abandon the sales order, so it may make doing quotes redundant and just go with sales orders but all pricing work including a warehouse.
Last edited by SBarnes on Fri Jul 22, 2022 3:39 pm, edited 1 time in total.
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1619
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 175

Re: Retrieving customised inventory prices in bulk

Postby Mike.Sheen » Fri Jul 22, 2022 3:39 pm

SBarnes wrote:There is an argument to be put forward to support Quotes through the api however, this would not a small amount of work.

I would point out that in thinking about it yes, you could create a Stateful sales order and let Jiwa price things that way and then abandon the sales order, so it may make doing quotes redundant and just go with sales orders.


Umm... we already have full support for quotes in the API.
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2444
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 756

Re: Retrieving customised inventory prices in bulk

Postby SBarnes » Fri Jul 22, 2022 3:41 pm

Ah, I looked for a section called quotes on https://api.jiwa.com.au/ at least I looked at the documentation, just a naming issue :lol:
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1619
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 175

Re: Retrieving customised inventory prices in bulk  Topic is solved

Postby mls » Fri Jul 22, 2022 5:20 pm

Mike.Sheen wrote:we already have full support for quotes in the API.


Hey Mike, does it make sense to you to use a stateful SalesQuote (or SalesOrder) to solve this problem?
mls
Occasional Contributor
Occasional Contributor
 
Posts: 16
Joined: Tue Jul 05, 2022 5:50 am
Topics Solved: 1

Next

Return to REST API

Who is online

Users browsing this forum: No registered users and 2 guests