etereo-io / edge-next

EDGE / Dynamic Site on the edge
https://etereo-edge.ew.r.appspot.com/
30 stars 4 forks source link

RFC: Purchase items #41

Open rafinskipg opened 3 years ago

rafinskipg commented 3 years ago

Allow items to be bought and sold.

Mark content as purchasable

In edge.config.js content can be marked as purchasable (purchasable: boolean). Add permissions to purchase.

purchasing :  {
    enabled: true,
    permissions: {
         purchase: [roles.USER],
         sell: [roles.OTHER_ROLE],
         ship: [roles.OTHER_USER],
         admin: [roles.ADMIN]
    }
}

The permissions are platform wide, and also per each content type.

Shopping carts

There is an API to create, retrieve and update shopping carts. Users with the role "buy" can create shopping carts.

Orders

There is an API to create orders. This API should be called after a checkout is fulfilled in order to create the order. Later on users with the role "order" may manage the orders. An order needs to be created for each seller. The sellers should be able to see their orders and change the status. The buyer should see different orders, one for each seller. With the status "shipped", "blocked", etc.

Selling

If permissions.sell is enabled for a user, a settings from will appear when creating new content:

Shipping

A user with permissions orders permission will be able to see orders, and mark them as shipped.

Admin

A user with admin permissions will be able to edit orders from any user.

Purchasing

If permission.buy is enabled for a user, a shopping button will appear on the content detail. The shopping button will add the item (or items) to the shopping cart. The shopping cart will be stored on every change (API)

Once the user decides to pay, it will be prompted with a form to fulfill the payment and the shipping information. If the user is Logged, we will retrieve previous used shipping information and allow to edit it or add a new one. If the user is not logged, we will ask the user to register or login at the end of the shopping process. And link this order with this user.

Paying

The payment process will not be implemented. Delegating this to the choice of the developer (Paypal, stripe, etc) Leaving only the API endpoints to mark payments as completed and create the order.

Invoicing

Invoicing will not be implemented. Leaving it for the developer.

Analytics

Analytics will not be implemented

rafinskipg commented 3 years ago