Coder Social home page Coder Social logo

oms-api's Introduction

oms-api

The OMS API package comes with prebuilt methods that helps communicate with HotWax Commerce OMS using Rest API

Build Notes (Users)

  1. Download the package from release page and extract it.
  2. Go to the package directory.
  3. Run following command to download dependencies
    npm i
  4. Build the package using npm run build

Build Notes (Contributors)

  1. Open a Terminal window.
  2. Clone package using the command: git clone https://github.com/hotwax/oms-api.git <repository-name>
  3. Go to the directory using command: cd <repository-name>
  4. Run following command to download dependencies npm i
  5. Build the package using npm run build

Usage

  1. Install OMS API package in the application using npm
npm i @hotwax/oms-api
  1. Define init method on app load that will be used to set the initial configuration for the package.

    Note: In case of vue project, you can define it inside mounted hook in App.vue file

import { init } from '@hotwax/oms-api'
...
...
init(token, instanceURL, cacheAge)
  1. Add following method calls to clear the token and instance url when app unmounts. Also, you can use the same method whenever user logout from the app.

    Note: In case of vue project, you can define it inside unmounted hook in App.vue file

import { resetConfig } from '@hotwax/oms-api'
...
...
resetConfig()
  1. Update the token or instance URL whenever needed by using the following methods:
  • updateToken: For updating the token value
  • updateInstanceUrl: For updating the instanceURL / backendURL.
  1. Now you can use any method from the package by directly importing it from @hotwax/oms-api

Contribution Guideline

  1. Fork the repository and clone it locally from the main branch. Before starting your work make sure it's up to date with current main branch.
  2. Pick an issue from here. Write in the issue comment that you want to pick it, if you can't assign yourself. Please stay assigned to one issue at a time to not block others.
  3. Create a branch for your edits. Use the following branch naming conventions: oms-api/issue-number.
  4. Please add issue number to your commit message.
  5. Propose a Pull Request to main branch containing issue number and issue title.
  6. Use Pull Request template (it's automatically added to each PR) and fill as much fields as possible to describe your solution.
  7. Reference any relevant issues or other information in your PR.
  8. Wait for review and adjust your PR according to it.
  9. Congrats! Your PR should now be merged in!

If you can't handle some parts of the issue then please ask for help in the comment. If you have any problems during the implementation of some complex issue, feel free to implement just a part of it.

Report a bug or request a feature

Always define the type of issue:

  • Bug report
  • Feature request

While writing issues, please be as specific as possible. All requests regarding support with implementation or application setup should be sent to.

Join the community on Discord

If you have any questions or ideas feel free to join our Discord channel

The license

Oms-api is completely free and released under the Apache v2.0 License. Check LICENSE for more details.

oms-api's People

Contributors

ymaheshwari1 avatar adityasharma7 avatar ravilodhi avatar amansinghbais avatar k2maan avatar azkyakhan avatar dixitdeepak avatar

Stargazers

Disha Talreja avatar Aditya Patel avatar Ravindra Purohit avatar  avatar

Watchers

Anil K Patel avatar Jacopo Cappellato avatar Pranay Pandey avatar Mridul Pathak avatar  avatar  avatar  avatar  avatar  avatar

oms-api's Issues

Update functions in oms api package to return a rejected promise in case of errors

What is the motivation for adding/enhancing this feature?

Returning a rejected promise will help in easily handle the errors on app side.

What are the acceptance criteria?

  • OMS-API should return a rejected promise for error

Can you complete this feature request by yourself?

  • YES
  • NO

Additional information

Concluded about using this pattern in #40

Define method to check for products stock on multiple facilities and add support to search stock using skus

What is the motivation for adding/enhancing this feature?

In some cases we need to check for stock of products on multiple facilities at once. Also there are some cases where we need to search the stock on the basis of product skus

What are the acceptance criteria?

  • Stock search should work on skus
  • We can search for multiple combinations like single productId on single facility, multiple productIds on single facility, single productId on multiple facilities and multiple productIds on multiple facilities

Can you complete this feature request by yourself?

  • YES
  • NO

Additional information

Having error when the response is not an object

What is the motivation for adding/enhancing this feature?

Currently, when getting response from api, and if the response is not an object then the app breaks.

What are the acceptance criteria?

  • Update the hasError method to handle the case when the response is not an object

Can you complete this feature request by yourself?

  • YES
  • NO

Additional information

Handle Operators through enumeration

What is the motivation for adding/enhancing this feature?

We should define operator enumeration that can be used while making any query. Different APIs and servers may have different statements for example some APIs may have equals while others only eq. The app should use the defined enumerations from the package. The package should handle the corresponding mapping for the server or API

https://github.com/apache/ofbiz-framework/blob/fad3f6b3bbb80bd716506828d1b305267d8e8c32/framework/common/src/org/ofbiz/common/FindServices.java#L74
Footer

What are the acceptance criteria?

  • ...

Can you complete this feature request by yourself?

  • YES
  • NO

Additional information

Define method to fetch stock for specific product on all facilities

What is the motivation for adding/enhancing this feature?

Currently, we have support for fetching product stock for specific facilities, but we have requirements to fetch stock for all the facilities.

What are the acceptance criteria?

  • ...

Can you complete this feature request by yourself?

  • YES
  • NO

Additional information

Define schema for stock

What is the motivation for adding/enhancing this feature?

What are the acceptance criteria?

  • Function to get stock for product
  • Stock Schema
  • Transformation rule

Can you complete this feature request by yourself?

  • YES
  • NO

Additional information

Unable to use resetConfig method from oms-api

Current behavior

When trying to import resetConfig getting error method not defined

Expected behavior

We should be able to use the method as it will be used for updating the configuration.

Steps to reproduce the issue

  • Try importing resetConfig method in any app where oms-api package is used.

Can you handle fixing this bug by yourself?

  • YES
  • NO

Environment details

  • Browser:
  • OS:
  • Code Version:

Additional information

Define product specific api and actions in the package

What is the motivation for adding/enhancing this feature?

Define all the product related actions and apis in the oms package, adding this will help in a centralized place to manage logic and api calls.

What are the acceptance criteria?

  • Define methods to handle product specific operations

Can you complete this feature request by yourself?

  • YES
  • NO

Additional information

Define success response type

What is the motivation for adding/enhancing this feature?

Currently, for product specific methods the return type is any | Response but using any is not a recommended way so we need to define a type for ProductResponse

What are the acceptance criteria?

  • Update return type for product specific methods

Can you complete this feature request by yourself?

  • YES
  • NO

Additional information

Approach:

Define a separate type in Product type named ProductResponse that contain two properties.

interface ProductResponse {
  products: Product[],
  total: number
} | {
  product: Product
}

Identify practices for handling errors

What is the motivation for adding/enhancing this feature?

Possible ways we could think of handling errors:

  1. Throw an error, passing details of the server error in a defined format. In app specific code, we could handle success in then() and error in the catch(). The developer may choose to go with the async await pattern too. This behavior is more close to how API calls behave, so more preferred.
  2. Instead of throwing errors, a single response object for both cases with certain attributes that helps identifying the error. Helps to skip having catch blocks everwhere, handling the error centralised in package and asserting success/failure based upon the defined attributes in response

What are the acceptance criteria?

  • ...

Can you complete this feature request by yourself?

  • YES
  • NO

Additional information

Update readme instructions

What is the motivation for adding/enhancing this feature?

We need to define basic instructions for setting up oms package, to use inside an app.

What are the acceptance criteria?

  • Add basic steps to use oms package

Can you complete this feature request by yourself?

  • YES
  • NO

Additional information

Define user specific api and actions in the package

What is the motivation for adding/enhancing this feature?

Add function to call user specific apis(login, check permission etc) using oms package

What are the acceptance criteria?

  • Define and handle the api calls in oms package

Can you complete this feature request by yourself?

  • YES
  • NO

Additional information

Add support to define the responseType when making a request

What is the motivation for adding/enhancing this feature?

Current when we are expecting a response other than json/text, then we doesn't have any way to define the custom responseType.

What are the acceptance criteria?

  • When using api method for requests, there should be an option to define the response type

Can you complete this feature request by yourself?

  • YES
  • NO

Additional information

Update oms-api package product schema to return good identifications

What is the motivation for adding/enhancing this feature?

Sometimes, we need to display product identifications on UI, those are not available in the product root and are present inside goodIdentifications.

What are the acceptance criteria?

  • Product response from the oms package should contains identifications

Can you complete this feature request by yourself?

  • YES
  • NO

Additional information

Approach:

Store the goodIdentifications in the indentifications property of product schema, having properties in the format.

label: <identification-name>,
idValue: <identification-value>

As of now in product schema, we don't have any property inside identifications to store the label for the identification, so the above mentioned label proeprty, needs to be added in the identification.

So, if we have a goodIdentification in the format name/value, the identification in product schema will be label: name, idValue: value.

Define a method to prepare solr query

What is the motivation for adding/enhancing this feature?

We can define a method that will be responsible to prepare the solr query based on the passed params, so that we don't need to define the same code whenever using solr-query.

What are the acceptance criteria?

  • Define a helper method to prepare solr query

Can you complete this feature request by yourself?

  • YES
  • NO

Additional information

We can even create separate solr helpers for separate modules.

Update the structure for oms-api package to store modules in a single place

What is the motivation for adding/enhancing this feature?

Currently, modules (product, user, order etc) are all stored in the root structure.

What are the acceptance criteria?

  • Define a single modules directory to store module in it

Can you complete this feature request by yourself?

  • YES
  • NO

Additional information

Define schema for shipment

What is the motivation for adding/enhancing this feature?

What are the acceptance criteria?

  • Define shipment schema
  • Define basic methods for shipment

Can you complete this feature request by yourself?

  • YES
  • NO

Additional information

Define user schema

What is the motivation for adding/enhancing this feature?

What are the acceptance criteria?

  • ...

Can you complete this feature request by yourself?

  • YES
  • NO

Additional information

Define a single method to clear all values when app unmounts

What is the motivation for adding/enhancing this feature?

Currently, we are using update method for clearing the values.

What are the acceptance criteria?

  • Use a single method to clear the values initialized

Can you complete this feature request by yourself?

  • YES
  • NO

Additional information

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.