Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Task marked complete

...

 

Code Block
languagejs
titleRequestBody
linenumberstrue
collapsetrue
[
  {
    "requestId" : 1,
    "relativeUrl" : "clients",
    "method" : "POST",
    "headers": [{"name": "Content-type", "value": "text/html"}, {"name": "X-Mifos-Platform-TenantId", "value": "text/html"}],    
    "body" : "{ \"officeId\": 1, \"firstname\": \"Petra\", \"lastname\": \"Yton\", \"externalId\": \"76YYP7\",  \"dateFormat\": \"dd MMMM yyyy\", \"locale\": \"en\", \"active\": true, \"activationDate\": \"04 March 2009\",
    \"submittedOnDate\": \"04 March 2009\", \"savingsProductId\" : 1 } "
  },
  { 
	"requestId" : 2,
  	"relativeUrl" : "loans",
    "method" : "POST",    
    "headers":  [{"name": "Content-type", "value": "text/html"}],    
    "reference": 1,
    "body" : "{ \"clientId\" : \"{$data$.clientId}\", \"productId\" : 1}"
  },
  {
    "requestId" : 3,
    "method" : "POST",
    "relativeUrl" : "clients",
	"headers":  [{"name": "Content-type", "value": "text/html"}],
    "body" : "{ \"officeId\": 1, \"fullname\": \"Pocahontas\", ... }"
  },
  {
    "requestId" : 4,
    "method" : "POST",
    "relativeUrl" : "savingsaccount",
	"headers":  [{"name": "Content-type", "value": "text/html"}],
	"reference": 3,
    "body" : "{ \"clientId\" : \"{$data$.clientId}\", \"productId\" : 1, ...}"
  }
]
Code Block
languagejs
titleResponseBody
linenumberstrue
collapsetrue
[
  {
    "requestId" : 1,
    "statusCode" : 201,
    "headers" : [
      {
        "name" : "Content-Type",
        "value" : "application/json; charset=UTF-8"
      }
    ],
    "body" : "{ \"officeId\": 1, \"clientId\": 1, ...}"
  },
  {
    "requestId" : 2,
    "statusCode" : 201,
    "headers" : [
      {
        "name" : "Content-Type",
        "value" : "application/json; charset=UTF-8"
      }
    ],
    "body" : "{ \"officeId\": 1, \"clientId\": 1, \"loanId\": 1, ...}"
  },
  {
    "requestId" : 3,
    "statusCode" : 201,
    "headers" : [
      {
        "name" : "Content-Type",
        "value" : "application/json; charset=UTF-8"
      }
    ],
    "body" : "{ \"officeId\": 1, \"clientId\": 2, ...}"
  },
  {
    "requestId" : 4,
    "statusCode" : 201,
    "headers" : [
      {
        "name" : "Content-Type",
        "value" : "application/json; charset=UTF-8"
      }
    ],
    "body" : "{ \"officeId\": 1, \"clientId\": 2, \"savingsId\": 1, ...}"
  }
]

Proposal

BatchApiResource acts like a proxy to BatchApiService and de-serializes incoming JSON to a set of BatchRequests and serialize a set of BatchResponses to JSON.
BatchApiService iterates the set of BatchRequests and obtaines the appropriate CommandStrategy from the CommandStrategyFactory. This utilizes the Strategy Pattern  in combination with the Factory Pattern to ease the extension for future requirements.

...

  •  Create new packages and classes
  •  Add simple mock implementation for BatchApiService (including erroneous BatchResponses if requested)
  •  Implement use case 1 and 2
  •  Implement use case 3 and needed dependency resolution
  •  Implement use case 4 and needed dependency resolution
  •  Implement use case 5
  •  Extend community app and offer a collection sheet that uses the Batch API to retrieve and store multiple charges

Link to GitHub repo

https://github.com/rishy/mifosx/tree/Batch-API/mifosng-provider/src/main/java/org/mifosplatform/batch