Coder Social home page Coder Social logo

gary-rowe / multibit-merchant Goto Github PK

View Code? Open in Web Editor NEW
150.0 150.0 50.0 54.04 MB

⚠️ OBSOLETE. DO NOT USE! A free and open source Bitcoin ecommerce platform, with several representative clients (online shop, admin etc). Uses Dropwizard, HAL, MongoDB etc

Home Page: http://multibit.org

License: Other

Java 100.00%

multibit-merchant's Introduction

Hello, I'm Gary 👋

Developer, Director, Dad

For the past 30 years I’ve been a professional developer in a variety of languages. I’ve worked in a wide variety of sectors including aviation, telecommunications, government, distributed ledger, charity, financial and so on.

While I’m able to design a reasonable user interface I much prefer to work on back end and low-level systems.

You might want to take a look at my hid4java project or review my blog.

multibit-merchant's People

Contributors

brobatr avatar gary-rowe avatar jim618 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

multibit-merchant's Issues

Introduce paywall for digital media

One key feature for MBM is to provide a paywall for digital media. This could respond with a 402 Payment Required and could have a rel="payment" as an associated link structure.

Support for secure internal messages

Staff will need to communicate with each other to co-ordinate actions involving customers. This could be done out of band through email, but this approach

  • exposes customer details to a third-party
  • breaches privacy
  • is not easy to audit
  • introduces friction

A secure internal messaging system could be built up from the Atmosphere framework since a common use case for this is a chat window. This could

  • report the online status of other staff members
  • hold messages until the recipient comes online
  • support Markdown for making links out of system IDs (customer, invoice, order etc)
  • provide a general alert mechanism (broadcast to all)
  • provide a reminder mechanism to ensure staff keep in touch with customers
  • provide a memo system for customer email chains

HMAC Authorization header compatibility

In order to authenticate and authorise requests against a standard
As a platform client
I want to apply these guidelines and support the Warden HMAC Ruby gem

Estimated time (days): 0.5

Acceptance Criteria

Scenario 1: Title
Given a GET request with an AuthHMAC header
And some valid corresponding data
When I attempt to authenticate
Then I should authenticate

Research removing Spring and replacing with Guice

Viewing various open source projects, Spring is becoming the juggernaut it was meant to replace. So far Dropwizard has removed the need for much of the Spring framework, but dependency injection is still useful - perhaps Guice can assist with it?

Customer can perform CRUD through REST on Cart

In order to administer the Cart entity
As a Customer
I want to perform CRUD operations

Estimated time (days): 2

Acceptance Criteria

Scenario 1: Developer level acceptance
Given a running MBM platform
And a local in-memory database
When a GET request against /cart is issued with Customer credentials
Then the response will contain a HAL representation of all Carts owned by the Customer
Done?

Scenario 2: Developer level acceptance
Given a running MBM platform
And a local in-memory database
When a POST request against /cart is issued with Customer credentials
And the request contains a valid CreateCart entity represented in HAL
Then the response will contain a HAL representation of the new Cart
Done?

Scenario 3: Developer level acceptance
Given a running MBM platform
And a local in-memory database
When a PUT request against /cart/{cartId} is issued with Customer credentials
And the request contains a valid UpdateCart entity represented in HAL
Then the response will contain a HAL representation of the updated Cart
Done?

Scenario 4: Developer level acceptance
Given a running MBM platform
And a local in-memory database
When a DELETE request against /cart/{cartId} is issued with Customer credentials
Then the response will contain a confirmation of the delete
Done?

Research platform deployment

Questions that need answering are:

  1. Horizontal scalability - is it important at this stage?
    • Probably not - a single node should be able to handle the kind of load likely to be encountered by early adopters of the platform
  2. Can traditional SQL databases like H2 and HSQLDB operate in an arbitrary cloud? (EC2, Heroku, Linode etc)
  3. Is NoSQL a good choice for an ecommerce platform?
  4. Should MBM have a polyglot persistence solution where different DBs are used for different purposes?
    • It would greatly increase the complexity (plethora of DBs)
  5. Ease of maintenance
    • Consider schema changes, indexing, backups, restores, integrated security
    • Consider admin tool (see DBVis
  6. Avoidance of provider lock in
    • MBM is a general-purpose app that can be deployed by the user on a single box if necessary, but allows any part of it to be scaled out horizontally
    • Ideally, a Java-based open source DB is required to allow anyone to run it
      • OrientDB - NoSQL looks interesting
      • Neo4J - NoSQL too commercial
    • VoltDB - SQL with horizontal scaling support

Payment countdown timer

In order to reduce currency volatility risk
As a customer
I want to see a countdown timer during checkout

Estimated time (days): 1

Acceptance Criteria

Scenario 1: Making payment
Given a shopping cart with items
And the payment page
When I confirm the order
Then a timer will start against the online quote
And if I navigate away and come back the timer will continue from the original starting point

Research using Spock as the specification and testing framework

Require a way of binding user stories and acceptance tests together. This will allow continuous creation of business value in an agile manner.

Considered JBehave, Instinct, JUnit only, cuke4duke and others (see this question on Stack Overflow), and Spock seems the right way to go for me. As a useful side effect it introduces an additional JVM language (Groovy) into the mix which will stimulate greater learning.

Require a feature branch to explore how it can be integrated into the existing code.

Instructions for deployment to EC2

Require a wiki entry (or blog article) detailing how to deploy MBM to the EC2 platform.

The write up should emphasise the use of Amazon scripts (perhaps supply them as part of the download?) and which instances are most suitable and secure.

See this article

Link authentication to authorisation

Require a method of managing an Access Control List (ACL) within the Dropwizard environment. Something like the Spring Security approach, but blended with the simple @Auth annotation.

The intention is to restrict access based on the Role and Authority so that customers can get access to their private information through the public port. Staff will perform their operations against the restricted port (specific IP addresses, permitted access hours, permitted information etc).

Add support for bulk import of items

As an administrator I want to import a large collection of items using an industry standard format (or at least a very common one recognised by other ecommerce platforms) so that I don't have much hassle trying MBM out.

Provide HMAC authentication

Various API methods need authentication support. HMAC is probably the easiest to support as a general case.

Completed parts

  • Must be easy to code against (uses @RestrictedTo custom annotation) - done
  • Support for functional testing - done
  • ACL handling (via Authority enum) - done
  • Support for various hashing algorithms (SHA1, SHA256 etc) - done
  • Verify HTTP standards compliant (Authorization header use) - done subject to issues seen in MBM-50
  • Verify cross-client support is possible (JavaScript, Ruby etc) - done (Ruby OK, JavaScript OK, PHP OK)

Remaining work

  • Verify use across HTTP verbs (GET, POST, PUT, DELETE, OPTIONS) and different URL encoding - in progress

Administrator can perform CRUD through REST on User

In order to administer the User entity
As an administrator
I want to perform CRUD operations

Estimated time (days): 2

Acceptance Criteria

Scenario 1: Developer level acceptance
Given a running MBM platform
And a local in-memory database
When a GET request against /user is issued with admin credentials
Then the response will contain a HAL representation of all Users (paged)
Done? Yes

Scenario 2: Developer level acceptance
Given a running MBM platform
And a local in-memory database
When a POST request against /user is issued with admin credentials
And the request contains a valid CreateUser entity represented in HAL
Then the response will contain a HAL representation of the new User
Done?

Scenario 3: Developer level acceptance
Given a running MBM platform
And a local in-memory database
When a PUT request against /user/{userId} is issued with admin credentials
And the request contains a valid UpdateUser entity represented in HAL
Then the response will contain a HAL representation of the updated User
Done?

Scenario 4: Developer level acceptance
Given a running MBM platform
And a local in-memory database
When a DELETE request against /user/{userId} is issued with admin credentials
Then the response will contain a confirmation of the delete
Done?

Administrator can perform CRUD through REST on Item

In order to administer the Item entity
As an Administrator
I want to perform CRUD operations

Estimated time (days): 2

Acceptance Criteria

Scenario 1: Developer level acceptance
Given a running MBM platform
And a local in-memory database
When a GET request against /item is issued with admin credentials
Then the response will contain a HAL representation of all Items owned by the admin
Done?

Scenario 2: Developer level acceptance
Given a running MBM platform
And a local in-memory database
When a POST request against /item is issued with admin credentials
And the request contains a valid CreateItem entity represented in HAL
Then the response will contain a HAL representation of the new Item
Done?

Scenario 3: Developer level acceptance
Given a running MBM platform
And a local in-memory database
When a PUT request against /item/{itemId} is issued with admin credentials
And the request contains a valid UpdateItem entity represented in HAL
Then the response will contain a HAL representation of the updated Item
Done?

Scenario 4: Developer level acceptance
Given a running MBM platform
And a local in-memory database
When a DELETE request against /item/{itemId} is issued with admin credentials
Then the response will contain a confirmation of the delete
Done?

Administrator can perform CRUD through REST on Role

In order to administer the Role entity
As an administrator
I want to perform CRUD operations

Estimated time (days): 0.5 (relying on previously created User patterns)

Acceptance Criteria

Scenario 1: Developer level acceptance
Given a running MBM platform
And a local in-memory database
When a GET request against /role is issued with admin credentials
Then the response will contain a HAL representation of all Roles
Done?

Scenario 2: Developer level acceptance
Given a running MBM platform
And a local in-memory database
When a POST request against /role is issued with admin credentials
And the request contains a valid CreateRole entity represented in HAL
Then the response will contain a HAL representation of the new Role
Done?

Scenario 3: Developer level acceptance
Given a running MBM platform
And a local in-memory database
When a PUT request against /role/{roleId} is issued with admin credentials
And the request contains a valid UpdateRole entity represented in HAL
Then the response will contain a HAL representation of the updated Role
Done?

Scenario 4: Developer level acceptance
Given a running MBM platform
And a local in-memory database
When a DELETE request against /role/{RoleId} is issued with admin credentials
Then the response will contain a confirmation of the delete
Done?

Research JavaScript client support libraries

Clients will rely on JavaScript, which in turn depends on various possible support libraries.

Major choices include:

  • jQuery and jQuery UI - lightweight and well-known (fragmented widget library)
  • Dojo - single unified framework (ease of maintenance of widget library)
  • YUI - provides a complete framework

Minor choices include:

  • Mootools - similar scope to jQuery
  • Qooxdoo - seems to offer a complete Python based toolchain

Objective is to create a simple minimalistic UI that can be used as both a demonstrator and a real-life operational component.

Supporting articles
StackOverflow X vs Y

Instructions for deployment to Heroku

Require a wiki entry (or blog article) detailing how to deploy MBM to the Heroku platform.

The write up should emphasise the use of Heroku scripts (perhaps supply them as part of the download?) and which instances are most suitable and secure.

Database upgrade and rollback process

Require a mechanism to allow the local database to be patched and populated safely.

The following approach could be used (includes client UI and platform operations):

  1. MH From the admin screen user clicks the Upgrade button
  2. CH All active user sessions are sent an alert giving them 1 minute before forced log out
  3. CH New users arriving are shown a system maintenance screen
  4. MH All active users sessions are suspended, and no new ones permitted.
  5. MH Database is backed up to {currentVersion}-final-snapshot.zip
  6. MH Admin is given message that upgrade preparation is complete
  7. CH Call out to script to perform shutdown and launch upgrade
  8. MH On startup new version uses existing database as basis for upgrade
  9. MH The version table contains the previous version and is used as the basis for applying a sequence of one-way patches to reach the current version
  10. MH If a patch fails at all, the upgrade fails and a rollback procedure is started (see later)
  11. MH Admin is given message that upgrade is complete
  12. MH Customers are accepted back on to the system

For rollback the following process could be used (includes client UI and platform operations):

  1. MH From the admin screen user clicks the Rollback button. Only available if an upgrade has failed.
  2. MH Existing database is backed up to {currentVersion}-failed-upgrade.zip to allow for more sophisticated recovery operations if necessary
  3. MH Existing database removed and restored from most recent of {previousVersion}-final-snapshot.zip
  4. MH Admin is given message that rollback preparation is complete
  5. CH Call out to script to perform shutdown and launch previous version

Research returns and refunds process

The returns and refunds processes need research to cover

  • how a customer can report a return
  • paying refunds (probably through MultiBit in an out of band transaction)
  • failed delivery (poor quality, broken, stolen etc)
  • failed receipt (supplier failure etc)

Move to "master-develop" branching strategy

Introduce the "master-develop" branching strategy.

Requires

  • updates to the Wiki so that developers know what to do
  • integration with Maven build process (the develop branch version remain consistent)
  • creation of supporting branches in git
  • support in the CI server
  • support in the repository (should be automatic)

Research how to report profits

Need to determine how trading in foreign currencies is reported. Spot rate at time? Later? VAT? Seek advice from accountant, community etc

Provide link support for admin page

JSP client admin needs to support a collection of URIs to pass in as a model for head.jspf, cdn-scripts.jspf and so on.

This removes the need for mbm-scripts.jspf since it's now redundant.

This will give rise to a need to storing local preferences on the client since this kind of configuration is confined to clients rather than being provided at a platform level.

Research search architecture

Need to research how the searching for products will be done.

Main candidates are:

  • Full text search with the resident database
  • Using Lucene as a local search engine (see Lucene+Solr

Output from the search egnine, could be made to conform to OpenSearch which is a typical interpretation of rel="search" and offers a standard response format.

Research communication protocol

Need to decide on an application-level communication protocol for the platform. This will provide the main interface to the platform and needs to be easily understood by a wide variety of clients.

Candidates include:

Supporting research links
How to GET a cup of coffee
BigCommerce API to ease compatibility with traditional ecommerce solutions?

Research product description text format

When entering the text details of a product, it is important to do the following:

  • provide an easy to use markup language
  • provide instant visual feedback during data entry
  • make internal linking easy (permalinks to known resources)
  • support multiple languages

Candidates include Freemarker, Markdown, Mustache.

Would need to offer support for conversion from other formats such as HTML.

Supporting articles

Related issue:

Research report generation

Reports can be provided for a variety of purposes:

  • formatted emails
  • spreadsheets for accounting
  • customer receipts
  • purchase orders
  • invoices
  • delivery notes

Users will expect them to be customisable to

  • include own text
  • include own graphics (logos, banners, skyscrapers etc)

Need a generic approach to this, and to include recommendations for stationery and so on

Provide GPG signing for release to Maven Central

The final artifacts should be available in Maven Central. This will require registration and obtaining a suitable GPG key to sign the final artifacts. This key needs to be securely held outside of version control to allow genuine MBM releases to be distinguished from forks.

Introduce minimal impact UI for client

Consider a minimalistic approach for the JSP and JavaScript clients. Intention to provide an easy to use interface by a smartphone or tablet with access to a bitcoin wallet. The image load time should be as low as possible.

Supporting links
Shift icons - icon font
Riloadr - optimised loading of images through JavaScript on jQuery

Demonstration and walk-through support

Require a client-side mechanism that allows a user to see a walk-through of how to use MBM:

  • walk-through of making a purchase
  • walk-through of performing admin tasks

Supporting articles

User story template

In order to "some reason or business value"
As a "type of user"
I want "some feature"

Estimated time (days): 0.5, 1, 2, 3, 5, ?


Acceptance Criteria

Scenario 1: Title
Given [context]
And [some more context]...
When [event]
Then [outcome]
And [another outcome]...


When discussing, remember INVEST:

  • Independent – a user story should not be dependent upon another story.
  • Negotiable – the details of the story will be worked out during the conversation. Talk about the story before working on it.
  • Valuable – the user story needs to be valuable to someone.
  • Estimable – the estimation need not be perfect, but good enough so you can rank and schedule a story.
  • Small – small is easier to estimate. Label as Small: 0.5-1, Medium: 2-3, Large 5+.
  • Testable – make sure that you can validate the user story is done using automated tests.

See the Extreme Programming notes.

Update the Java JSP client

The Java JSP client has drifted from the current MBM platform RESTful API. Once the communication protocol has been decided then the client code needs to be updated to use it.

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.