Wednesday, May 2, 2018

Introduction:  
This article narrates some of the essential steps in getting a small lightweight eCommerce website up and running in minimal time. We assume that the users for this website will be recognized, their transactions on the website will be remembered and the processing for each order will be transparent to the user.  
The registration of the user occurs with a membership provider – this can be an ASP.Net membership provider, a third party identity provider such as login with Google or  an IAM vendor that honors authentication and authorization protocols such as OAuth or SAML  
Assuming a simple python Django application suffices as a middle-tier REST service API, we can rely on Django’s native support for different authentication backends such as model based authentication backend or remote user backend. To support Google user automatic recognition, we just include the markup in the user interface as  
<div class="g-signin2" data-onsuccess="onSignIn"></div> 
function onSignIn(googleUser) { 
  var profile = googleUser.getBasicProfile(); 
  console.log('ID: ' + profile.getId()); // Do not send to your backend! Use an ID token instead. 
  console.log('Name: ' + profile.getName()); 
  console.log('Image URL: ' + profile.getImageUrl()); 
  console.log('Email: ' + profile.getEmail()); // This is null if the 'email' scope is not present. 
} 
The transactions on the website for a recognized user is maintained with the help of session management. 

Django has native support for session management and in addition allows us to write our own middleware  
The order history is maintained in the form of relevant details from the orders in the Order table. Create, update, delete of the orders are tracked from this table. Status field on the order table is progressive in the form of initialized, processing, completed and canceled. Timestamps are maintained for created as well as modified. 
Sample App: http://shrink-text.westus2.cloudapp.azure.com:8668/add 
#codingexercise 
https://ideone.com/6ms4Vz

No comments:

Post a Comment