Git Product home page Git Product logo

javascript-sdk's People

Contributors

lazreg87 avatar nicolasbonduel avatar tigo0 avatar wesleygeorge avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

javascript-sdk's Issues

Refactor the way we handle methods for endpoints and for the returned instance

As part of our discussion on how to handle sorting and filtering better,
we came to the conclusion of separating more between endpoints that handle collections and the specific instances of such a collection. E.g.

Payments:
collection specific methods, like:
get all payments, supporting filters and sort

Payment instance
instance specific methods, like:
update this instance
refresh this instance

Implement cart

To make it easier to use the SDK on clients, we should create the notion of cart, which encapsulates the order logic.
E.g:
Cart().addProduct({productId, quantity}) - Don't have to be authenticated
Cart().removeProduct({productId, quantity}) - Don't have to be authenticated
Cart().empty() - Don't have to be authenticated
Cart().removeProduct({productId, quantity}) - Don't have to be authenticated
Cart().checkout(paymentMethodId, deliveryAddress, resumeOrderId) - Have to be authenticated

Paginating with size 0 breaks the SDK

Paginating with a size of 0 seems to break the SDK:

builton.orders.search('581398', { size: 0, page: 0 }).then((orders) => {
  console.log(orders);
});

Output:

Pagination {
  page: 0,
  size: 0,
  current: 
   Order {
     id: null,
     paginate: [Function],
     query: [Function],
     get: [Function: get],
     refresh: [Function: refresh],
     update: [Function: update],
     apiPath: 'orders' },
  paginationTotal: undefined,
  _query: [Function],
  next: [Function],
  previous: [Function],
  goToPage: [Function] }

Avoid nesting of object to update properties on model

We currently have to send in the properties to update in a nested object, e.g.

user.update({ body: { mobile_phone_number: phoneNumber } }).then(console.log).catch(console.warn);

Would maybe be more userfriendly if we just sent it in as:
user.update({ mobile_phone_number: phoneNumber }).then(console.log).catch(console.warn);

Cleanup test json files

Some of the test json files are very big. We should use simpler examples so developers could read the json files more easily to understand what to expect as responses.

See provider.json, orders.json, products.json, payments.json

Add confirm payment endpoint

As a step to support SCA, Builton API now has a /payments/{PAYMENT_ID}/confirm endpoint which can be reached (doesn't require authentication)

Update SDK with more tests

  • Increase testcoverage so that the tests provide documentation of functionality and expected result
  • Update payment method tests to demonstrate new SCA Stripe payment method flow

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.