Green Places is an Android and iOS application which permits owners of legal light drugs shops to register and create their own online shop showcase, then casual users can see the shop data and look at the products that it sells. Potential buyers can also directly be guided to the store via Google Maps, call directly, check shop website or send an email (if the shop has such data).

 

How MBurger has been used

MBurger system has been used to simplify app development and to manage the shopkeepers and their shops. This project makes use of the standard Nooko platform capabilities to create custom objects that can be used inside the app, as well as its Stripe integration to manage the retailer monthly fee to use the service.

Firstly it has been created a new MBurger account on the and created two “blocks” which are an abstraction for “type of object” inside the application.

It has been created two major blocks: “Shops” and “Products”. Each shop has a name, an address, a description, a phone number, a website, an email address and two images maximum. Also each shop is connected to a specific user which has been registered through the application. Shopkeepers can only create shops and products through the app, the MBurger dashboard can not be accessed by anyone apart from the developers, also each shopkeeper can have only one shop at the time.
Products have a name, a category, a description, price, thc percentage, cbd percentage, a unique code (if the retailer wish to add it) and 2 images maximum, each product is also connected to a particular shop using an unique ID wich identifies that the item can be present only in one shop.

During the registration of a retailer, it is required to add a credit card information to start the subscription and pay the monthly fee. After confirming all the data, MBurger automatically creates a new Stripecustomer and manage the credit card added. Stripe uses banking security to save customers and credit cards information and MBurger uses HTTPS encrypted REST calls both from the app SDK and from the server to Stripe™, so every data is safely transfered and stored.
The subscription status is entirely managed by the application, MBurger backend just ensures that user is connected to a Stripe customer.

The application was developed for Android using Java language on the Android Studio IDE with minimum OS version Jelly Bean 4.2 and for iOS in Swift 4 using XCode with iOS 10 minimum OS version supported. Both versions integrate Google Places SDK and Stripe Mobile SDK.

 

App Walkthrough

When any user installs the app will immediately see a list of shops, with the possibility to search for a specific one or show them on a map.

 

In this screen MBurger SDK asks for all the “sections” (an abscraction for single item) for the “Shops” block, the developer then uses an automatic mapping method to create custom objects in order to create a “Shop” object for the app, way more easy to manage than the MBurger “NKSection” object. The mapping uses Apache Common library methods to automatically insert the data from the NKSection object to the custom developer object, the developer just has to insert the name of the value chosen on the MBurger dashboard and the name of the value from the custom object.

With the MBurger SDK calling for all the shops is very easy, developers don’t have to deal with opening HTTPS connections and JSON results, it’s all dealt from the SDK, so calling for the shop list results in:

MBurgerTasks.askForSections(context, SHOPS_BLOCK_ID, null, true, listener);

Where “SHOPS_BLOCK_ID” is the unique identifier of the block which can be found on the MBurger dashboard under the desired block settings.

Asking only for shops for the map view (so see only a portion of the available shops), requires only to obtain the actual map visible bound and add a filter to the call, which are an optional list of objects which permit to obtain only a certain set of sections. The call will result:

LatLngBounds bounds = map.getProjection().getVisibleRegion().latLngBounds;
ArrayList <Object> filters = new ArrayList<>();

filters.add(new NKGeofenceParameter(bounds.northeast.latitude, 
bounds.northeast.longitude, 
bounds.southwest.latitude, 
bounds.southwest.longitude));

MBurgerTasks.askForSections(getActivity(), SHOPS_BLOCK_ID, filters, true, listener);

And the result will be a list of “NKSections” relative only to the actual visible portion of Google Map.

The object mapping process for both the list and the map requires to know the name of the custom object fields and the block fields name, so the result will be:

MBFieldsMapping fieldsMapping = new MBFieldsMapping();  
fieldsMapping.putMap("name", "title"); 

//... add other fields to map  
Shop s = (Shop) MBurgerMapper.mapToCustomObject(section, fieldsMapping, new Shop(), false);  

Tapping on a shop item will shop the shop detail and trigger another API call from MBurger SDK, which will return the products associated with the shop.

 

 

 

 

 

 

 

 

 

 

 

 

 

Even this API call is done by asking for sections using filters, in this case the shop ID.

If a user has a shop to register in Green Places he must first register itself, settings the business name, legal address, email, password and other necessary data, then he has to add a payment card in order to subscribe to the fee. Once he has set all the fields MBurger calls a “registration” API which creates a new user on the database. Is important to notice that the basic data required for the registration API on Green Places are not enough to store all the data set during sign-up process, so a “metadata” text field has been added to permit all developers to add custom data if needed.

After the sign-up API, the Stripe SDK is used to create a new Stripe token which will create a new customer and associate it with the newly created user. The credit card set will be the default one for paying the monthly fee, but it’s possible to add other cards, delete them and set one different as default once the customer has been created.


The API call for subscribing to the fee plan and create a Stripe customer will then be:

MBurgerPayTasks.subscribeToPlan(context, listener, STRIPE_SUBSCRIPTION_PLAN, 
card_token, null, null, -1, -1);

The “profile” MBurger API will then return also the subscription status of the current logged user, so the developer can check if the subscription is still active or not. As a design choice the subscription management is left to the developer work because different apps may have different requirements, so customers will not be contacted if subscriptions are not paid, but it must be managed via code by the developer.

After the sign-up the retailer can create its shop. MBurger can create “sections” for “blocks” from API calling static SDK methods, the system will take care to upload multiple images via multi-part requests. It can also edit and delete existing one using a “write & edit” token, which can be created from the dashboard. Simpler apps can only request the “read” permission, in to create a read-only application and add and edit content only from the MBurger dashboard.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Developers should only be aware of the name of the fields from the MBurger dashboard, so the system can put the user inserted data on the correct area. For image and media upload the multi-part load is automatic but the developer should be aware of the location of the media file, the mime type and the file name.
This call for a new shop section will then result:

ArrayList < MBAdminParameter > params = new ArrayList <> ();
params.add(new MBAdminParameter("title", name));  
params.add(new MBAdminParameter("phone", phone));
//Add more data

ArrayList <MBAdminParameterFile> params_file = new ArrayList <> ();
ArrayList <MBAdminSingleFile> images = new ArrayList <> ();

if (img_uri_1 != null) {
    images.add(new MBAdminSingleFile(
       getFileName(getApplicationContext(), img_uri_1), 
       getMimeType(getApplicationContext(), img_uri_1), 
       getUriRealPath(getApplicationContext(), img_uri_1)))
}
  
if (img_uri_2 != null) {
    images.add(new MBAdminSingleFile(
       getFileName(getApplicationContext(), img_uri_2), 
       getMimeType(getApplicationContext(), img_uri_2), 
       getUriRealPath(getApplicationContext(), img_uri_2)));
}

params_file.add(new MBAdminParameterFile("image", images));

MBurgerAdminTasks.addSection(getApplicationContext(), SHOPS_BLOCK_ID, this, 
params, params_file, Locale.getDefault().getLanguage());

Pay attention for the “language” parameter, MBurger would give you different content based on the user device language, so if you wish you can set different content for each of your application supported language.

 

The final bite

Developing with MBurger simplifies app development and makes easier for developers to create complex contentful apps without knowing anything about server configuration or development. Its powerful SDK and easy-to-implement API really speeds up development and content management, making MBurger system a tasty way to make rich and beautiful Android and iOS applications.
If you wish to make your first MBurger app please refer to the official documentation for Android and iOS or come in contact with us partecipating to our developers community.