address_module
Project: http://git-wip-us.apache.org/repos/asf/incubator-fineract/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-fineract/commit/b086e005 Tree: http://git-wip-us.apache.org/repos/asf/incubator-fineract/tree/b086e005 Diff: http://git-wip-us.apache.org/repos/asf/incubator-fineract/diff/b086e005 Branch: refs/heads/develop Commit: b086e005ab20480064681f05ae4791b7c98a51ec Parents: 5ac0da0 Author: nikpawar89 <nikhilpa...@yahoo.in> Authored: Tue Jul 19 11:38:06 2016 +0530 Committer: nikpawar89 <nikhilpa...@yahoo.in> Committed: Thu Aug 11 17:59:31 2016 +0530 ---------------------------------------------------------------------- api-docs/apiLive.htm | 740 +++++++++++++++++-- .../commands/service/CommandWrapperBuilder.java | 23 +- .../data/GlobalConfigurationPropertyData.java | 30 + .../ConfigurationReadPlatformService.java | 2 + .../ConfigurationReadPlatformServiceImpl.java | 16 + .../EntityFieldConfigurationApiResources.java | 99 +++ .../portfolio/address/data/AddressData.java | 188 +++++ .../address/data/ClientAddressData.java | 46 ++ .../address/data/FieldConfigurationData.java | 82 ++ .../portfolio/address/domain/Address.java | 393 ++++++++++ .../address/domain/AddressRepository.java | 26 + .../address/domain/FieldConfiguration.java | 59 ++ .../domain/FieldConfigurationRepository.java | 27 + .../exception/AddressNotFoundException.java | 34 + .../AddressCommandFromApiJsonDeserializer.java | 272 +++++++ .../service/AddressReadPlatformService.java | 37 + .../service/AddressReadPlatformServiceImpl.java | 246 ++++++ .../service/AddressWritePlatformService.java | 31 + .../AddressWritePlatformServiceImpl.java | 284 +++++++ .../FieldConfigurationReadPlatformService.java | 30 + ...eldConfigurationReadPlatformServiceImpl.java | 89 +++ .../client/api/ClientAddressApiResources.java | 151 ++++ .../client/api/ClientApiConstants.java | 5 +- .../portfolio/client/data/ClientData.java | 31 +- .../portfolio/client/domain/ClientAddress.java | 100 +++ .../client/domain/ClientAddressRepository.java | 35 + .../domain/ClientAddressRepositoryWrapper.java | 50 ++ .../handler/AddClientAddressCommandHandler.java | 45 ++ .../UpdateClientAddressCommandHandler.java | 51 ++ .../ClientAddressReadPlatformService.java | 29 + .../ClientAddressReadPlatformServiceImpl.java | 76 ++ .../service/ClientReadPlatformServiceImpl.java | 28 +- ...ntWritePlatformServiceJpaRepositoryImpl.java | 28 +- .../V312__address_module_tables_metadat.sql | 122 +++ 34 files changed, 3411 insertions(+), 94 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/b086e005/api-docs/apiLive.htm ---------------------------------------------------------------------- diff --git a/api-docs/apiLive.htm b/api-docs/apiLive.htm index 696e066..6868349 100644 --- a/api-docs/apiLive.htm +++ b/api-docs/apiLive.htm @@ -292,6 +292,22 @@ <td></td> <td></td> </tr> + <tr> + <td><a href="#client_address">Client Address</a></td> + <td>client/{clientId}/addresses</td> + <td><a href="#client_address_create">Create an address for a Client</a></td> + <td><a href="#client_address_list">List all Addresses for a Client</a></td> + <td><a href="#client_address_update">Update an address for a Client</a></td> + <td></td> + </tr> + <tr> + <td><a href="#entity_field_list">Entity Field Configuration</a></td> + <td>fieldconfiguration/{entity}</td> + td></td> + <td><a href="#entity_field_list">List all configuration for a entity</a></td> + <td></td> + <td></td> + </tr> <tr> <td><a href="#client_identifiers">Client Identifiers</a></td> <td>clients/{clientId}/identifiers</td> @@ -1024,7 +1040,7 @@ <td></td> <td></td> </tr> - + <tr> <td></td> <td>accounts/share/{accountId}?command=activate</td> @@ -1057,7 +1073,7 @@ <td></td> <td></td> </tr> - + <tr> <td></td> <td>accounts/share/{accountId}?command=rejectadditionalshares</td> @@ -1066,7 +1082,7 @@ <td></td> <td></td> </tr> - + <tr> <td></td> <td>accounts/share/{accountId}?command=redeemshares</td> @@ -1075,12 +1091,12 @@ <td></td> <td></td> </tr> - + </table> </div> </div> </div> - + <div class="flybar-nav"> <h2 class="flybar-button">Loan</h2> <div id="toc-menu-loan" class="flybar-menu"> @@ -1976,7 +1992,7 @@ <td></td> <td></td> </tr> - + <tr> <td></td> <td>savingsproducts/{productId}</td> @@ -2032,7 +2048,7 @@ <td><a href="#shareproducts_retrieve">Retrieve a Share product</a></td> <td><a href="#shareproducts_update">Update a Share product</a></td> </tr> - + <tr> <td><a href="#configs">Currency</a></td> <td>currencies</td> @@ -4460,6 +4476,187 @@ GET https://DomainName/api/v1/clients/template } </code> </div> + + <div class="method-example"> + <code class="method-declaration"> + GET https://DomainName/api/v1/clients/template + </code> + <code class="method-response"> + { + "activationDate":[2014,3,4], + "officeId":1, + "officeOptions":[{ + "id":1, + "name":"Head Office", + "nameDecorated":"Head Office" + }], + "staffOptions":[{ + "id":1, + "firstname":"xyz", + "lastname":"sjs", + "displayName":"sjs, xyz", + "officeId":1, + "officeName":"Head Office", + "isLoanOfficer":true, + "isActive":true + }], + "savingProductOptions":[{ + "id":4, + "name":"account overdraft", + "withdrawalFeeForTransfers":false, + "allowOverdraft":false + }] + } + </code> + </div> + + <div class="method-example"> + <p>if address is enabled</p> + <code class="method-declaration"> + GET https://DomainName/api/v1/clients/template + </code> + <code class="method-response"> + + + { + "activationDate": + [ + 2016, + 8, + 11 + ], + "officeId": 1, + "officeOptions": + [ + { + "id": 1, + "name": "Head Office", + "nameDecorated": "Head Office" + } + ], + "savingProductOptions": + [ + ], + "genderOptions": + [ + { + "id": 748, + "name": "Female", + "position": 1, + "isActive": true + }, + { + "id": 749, + "name": "Male", + "position": 2, + "isActive": true + } + ], + "clientTypeOptions": + [ + { + "id": 761, + "name": "JLG", + "position": 1, + "description": "", + "isActive": true + }, + { + "id": 760, + "name": "individual", + "position": 2, + "description": "", + "isActive": true + } + ], + "clientClassificationOptions": + [ + ], + "clientNonPersonConstitutionOptions": + [ + ], + "clientNonPersonMainBusinessLineOptions": + [ + ], + "clientLegalFormOptions": + [ + { + "id": 1, + "code": "legalFormType.person", + "value": "PERSON" + }, + { + "id": 2, + "code": "legalFormType.entity", + "value": "ENTITY" + } + ], + "address": + { + "countryIdOptions": + [ + { + "id": 802, + "name": "INDIA", + "position": 1, + "isActive": true + }, + { + "id": 803, + "name": "BANGLADESH", + "position": 2, + "isActive": true + }, + { + "id": 807, + "name": "UNITED STATES", + "position": 3, + "isActive": true + } + ], + "stateProvinceIdOptions": + [ + { + "id": 800, + "name": "MAHARASHTRA", + "position": 1, + "isActive": true + }, + { + "id": 801, + "name": "GUJRAT", + "position": 2, + "isActive": true + } + ], + "addressTypeIdOptions": + [ + { + "id": 804, + "name": "PERMANENT ADDRESS", + "position": 1, + "isActive": true + }, + { + "id": 805, + "name": "OFFICE ADDRESS", + "position": 2, + "isActive": true + }, + { + "id": 806, + "name": "CURRENT ADDRESS", + "position": 3, + "isActive": true + } + ] + }, + "isAddressEnabled": true + } + + + </code> + </div> </div> <a id="clients_create" name="clients_create" class="old-syle-anchor"> </a> @@ -4467,10 +4664,13 @@ GET https://DomainName/api/v1/clients/template <div class="method-description"> <h4>Create a Client</h4> <p> - <b>Note:</b> You can enter either:<br> + <b>Note:</b>1. You can enter either:<br> firstname/middlename/lastname - for a person (middlename is optional) OR<br> fullname - for a business or organisation (or person known by one name).<br> + 2.If address is enable(enable-address=true), then additional field <br> + called address has to be passed + </p> <table class=matrixHeading> <tr class="matrixHeadingBG"> @@ -4478,6 +4678,7 @@ GET https://DomainName/api/v1/clients/template </tr> <tr class=alt> <td>firstname and lastname OR fullname,<br> officeId,<br> active=true and activationDate OR active=false,<br> + if(address enabled) address </td> </tr> </table> @@ -4520,6 +4721,45 @@ Content-Type: application/json Request Body: } </code> </div> + <div class="method-example"> + <code class="method-declaration"> + <p>if address is enabled</p> + POST https://DomainName/api/v1/clients + </code> + <code class="method-request"> + POST clients + Content-Type: application/json Request Body: + { + + "firstname": "Petra", + "lastname": "Yton", + "externalId": "786YYH7", + "dateFormat": "dd MMMM yyyy", + "locale": "en", + "active": true, + "activationDate": "04 March 2009", + "submittedOnDate":"04 March 2009", + "officeId":1, + "address":[ + { + "addressTypeId": 805, + "isActive": true, + "street": "rapchik", + "stateProvinceId": 800, + "countryId": 802 + } + ] + } + </code> + <code class="method-response"> + { + "officeId": 1, + "clientId": 1, + "resourceId": 1, + "savingsId": 10 + } + </code> + </div> <div class="method-example"> <code class="method-request"> POST clients @@ -5324,11 +5564,358 @@ GET https://DomainName/api/v1/clients/{clientId}/accounts } } ] -} - </code> - </div> +}</code> + </div> </div> + <!-- start of entity field configuration api --> + <a id="entity_field_configuration" name="entity_field_configuration" class="old-syle-anchor"> </a> + <div class="method-section"> + <div class="method-description"> + <h3>Entity Field Configuration </h3> + <p>Entity Field configuration API is a generic and extensible <br> + wherein various entities and subentities can be related.<br> + Also it gives the user an ability to enable/disable fields,<br> add regular expression for validation</p> + <table class=matrixHeading> + <tr class="matrixHeadingBG"> + <td><div class="fineractHeading2">Field Descriptions</div></td> + </tr> + <tr class=alt> + <td>entity</td> + </tr> + <tr> + <td class=fielddesc>Entity to which relationship is to be established + </br> </td> + </tr> + <tr class=alt> + <td>subentity</td> + </tr> + <tr> + <td class=fielddesc>Entity which uses/relies on other entity for addional description + </td> + </tr> + <tr class=alt> + <td>field</td> + </tr> + <tr> + <td class=fielddesc>Field of the Enity which is to be configured + </td> + </tr> + <tr class=alt> + <td>validation_regex</td> + </tr> + <tr> + <td class=fielddesc>Regular expression for validating field's data + </td> + </tr> + <tr class=alt> + <td>is_enabled</td> + </tr> + <tr> + <td class=fielddesc>This is used to enable/disable field + </td> + </tr> + <tr class=alt> + <td>is_mandatory</td> + </tr> + <tr> + <td class=fielddesc>This is used to make field mandatory + </td> + </tr> + + </table> + </div> + </div> + <a id="entity_field_list" name="entity_field_list" class="old-syle-anchor"> </a> + <div class="method-section"> + <div class="method-example"> + <code class="method-declaration"> + GET https://DomainName/api/v1/fieldconfiguration/{entity} + </code> + <code class="method-response"> + [ + { + "fieldConfigurationId": 1, + "entity": "ADDRESS", + "subentity": "CLIENT", + "field": "addressType", + "is_enabled": true, + "is_mandatory": false, + "validation_regex": "" + }, + { + "fieldConfigurationId": 2, + "entity": "ADDRESS", + "subentity": "CLIENT", + "field": "street", + "is_enabled": true, + "is_mandatory": true, + "validation_regex": "" + }, + { + "fieldConfigurationId": 3, + "entity": "ADDRESS", + "subentity": "CLIENT", + "field": "addressLine1", + "is_enabled": true, + "is_mandatory": false, + "validation_regex": "" + }, + { + "fieldConfigurationId": 4, + "entity": "ADDRESS", + "subentity": "CLIENT", + "field": "addressLine2", + "is_enabled": true, + "is_mandatory": false, + "validation_regex": "" + }, + { + "fieldConfigurationId": 5, + "entity": "ADDRESS", + "subentity": "CLIENT", + "field": "addressLine3", + "is_enabled": true, + "is_mandatory": false, + "validation_regex": "" + } + ] + </code> + </div> + </div> + + + + <!-- start of client address api docs --> + <a id="client_address" name="client_address" class="old-syle-anchor"> </a> + <div class="method-section"> + <div class="method-description"> + <h3>Client Address</h3> + <p>Address module is an optional module and can be configured<br> + into the system by using GlobalConfiguration setting: enable-address.<br> + In order to activate Address module, we need to enable the configuration,<br> + enable-address by setting its value to true. + </p> + <table class=matrixHeading> + <tr class="matrixHeadingBG"> + <td><div class="fineractHeading2">Field Descriptions</div></td> + </tr> + <tr class=alt> + <td>addressTypeId</td> + </tr> + <tr> + <td class=fielddesc>Address module has the ability to store<br> + multiple types of address of clients.addressTypeId is basically a code whose value<br> + are used to store the different types of addresses. + </br> </td> + </tr> + <tr class=alt> + <td>street,addressLine1,addressLine2,addressLine3,townVillage,city,<br> + countyDistrict,stateProvinceId,<br> + countryId,postalCode,latitude,longitude,createdBy,createdOn,<br> + updatedBy,updatedOn</td> + </tr> + <tr> + <td class=fielddesc>The above are the fields of address<br> + which are configurable using settings stored for each field in<br> + m_field_configuration table. + </td> + </tr> + + </table> + </div> + </div> + + <a id="client_address_list" name="client_address_list" class="old-syle-anchor"> </a> + <div class="method-section"> + <div class="method-description"> + <h4>List all addresses for a Client</h4> + <p>Example Requests:</p> + <div class=apiClick>client/1/addresses</div> + <br> + <br> + <div class=apiClick>clients/1/addresses?status=false,true&&type=1,2,3</div> + + </div> + <div class="method-example"> + <code class="method-declaration"> + GET https://DomainName/api/v1/client/{clientid}/addresses + </code> + <code class="method-response"> + [ + { + "client_id": 111755, + "addressType": "PERMANENT ADDRESS", + "addressId": 14, + "addressTypeId": 804, + "isActive": false, + "street": "anki's home", + "addressLine1": "test123", + "addressLine2": "iuyt", + "addressLine3": "", + "townVillage": "", + "city": "mumbai", + "countyDistrict": "", + "stateProvinceId": 801, + "countryName": "UNITED STATES", + "stateName": "GUJRAT", + "countryId": 807, + "postalCode": "400095", + "createdBy": "", + "updatedBy": "" + }, + { + "client_id": 111755, + "addressType": "PERMANENT ADDRESS", + "addressId": 17, + "addressTypeId": 804, + "isActive": false, + "street": "anki's home", + "addressLine1": "", + "addressLine2": "", + "addressLine3": "", + "townVillage": "", + "city": "", + "countyDistrict": "", + "stateProvinceId": 800, + "countryName": "INDIA", + "stateName": "MAHARASHTRA", + "countryId": 802, + "postalCode": "", + "createdBy": "", + "updatedBy": "" + }, + { + "client_id": 111755, + "addressType": "OFFICE ADDRESS", + "addressId": 18, + "addressTypeId": 805, + "isActive": false, + "street": "anki's office", + "addressLine1": "", + "addressLine2": "", + "addressLine3": "", + "townVillage": "", + "city": "", + "countyDistrict": "", + "stateProvinceId": 0, + "countryId": 0, + "postalCode": "", + "createdBy": "", + "updatedBy": "" + } + ] + </code> + </div> + + <div class="method-example"> + <code class="method-declaration"> + GET https://DomainName/api/v1/client/{clientid}/addresses?type=804&&status=false + </code> + <code class="method-response"> + [ + { + "client_id": 111755, + "addressType": "PERMANENT ADDRESS", + "addressId": 14, + "addressTypeId": 804, + "isActive": false, + "street": "anki's home", + "addressLine1": "test123", + "addressLine2": "iuyt", + "addressLine3": "", + "townVillage": "", + "city": "mumbai", + "countyDistrict": "", + "stateProvinceId": 801, + "countryName": "UNITED STATES", + "stateName": "GUJRAT", + "countryId": 807, + "postalCode": "400095", + "createdBy": "", + "updatedBy": "" + } + } + ] + </code> + </div> + </div> + + <a id="client_address_create" name="client_address_create" class="old-syle-anchor"> </a> + <div class="method-section"> + <div class="method-description"> + <h4>Create an address for a Client</h4> + <table class=matrixHeading> + <tr class="matrixHeadingBG"> + <td><div class="fineractHeading2">Mandatory Fields</div></td> + </tr> + <tr class=alt> + <td>type and clientId + </td> + </tr> + </table> + </div> + <div class="method-example"> + <code class="method-declaration"> + POST https://DomainName/api/v1/client/{clientId}/addresses?type={addressTypeId} + </code> + <code class="method-request"> + POST client/1/address?type=805 + Content-Type: application/json Request Body: + { + "street":"Ipca", + "addressLine1":"Kandivali", + "addressLine2":"plot47", + "addressLine3":"charkop", + "city":"Mumbai", + "stateProvinceId":800, + "countryId":802, + "postalCode":"400064" + } + </code> + <code class="method-response"> + { + "resourceId":15 + } + </code> + </div> + </div> + + <a id="client_address_update" name="client_address_update" class="old-syle-anchor"> </a> + <div class="method-section"> + <div class="method-description"> + <h4>update an address for a Client</h4> + <p>All the address fields can be updated by using update client address API</p> + <table class=matrixHeading> + <tr class="matrixHeadingBG"> + <td><div class="fineractHeading2">Mandatory Fields</div></td> + </tr> + <tr class=alt> + <td>type and addressId + </td> + </tr> + </table> + </div> + <div class="method-example"> + <code class="method-declaration"> + PUT https://DomainName/api/v1/client/{clientId}/addresses?type={addressTypeId} + </code> + <code class="method-request"> + POST client/1/addresses?type=805 + Content-Type: application/json Request Body: + { + "addressId":67, + "street":"goldensource" + } + </code> + <code class="method-response"> + { + "resourceId":67 + } + </code> + </div> + </div> + <!-- start of client Identifiers API docs--> <a id="client_identifiers" name="client_identifiers" class="old-syle-anchor"> </a> <div class="method-section"> @@ -10152,8 +10739,8 @@ No Request Body: <dd> <b>'foreclosure'</b><br> "transaction date" is set to the current date by default<br> "transaction amount" is set - to the sum of total loan outstanding principal - and total Interest/ Fee/ Charges / Penalties + to the sum of total loan outstanding principal + and total Interest/ Fee/ Charges / Penalties till foreclosure date. </dd> </dl> @@ -19748,7 +20335,7 @@ Content-Type: application/json <tr class=alt><td>taxGroupId</td></tr> <tr><td class=fielddesc><b>Optional</b>: If withhold tax set as true, with hold tax will be applied as per the tax group provided </td></tr> - + </table> </div> </div> @@ -20320,12 +20907,12 @@ Content-Type: application/json <br/> <table class=matrixHeading> <tr class="matrixHeadingBG"><td><div class="fineractHeading2">Optional Fields</div></td></tr> - <tr class=alt><td>sharesIssued, minimumShares, maximumShares, minimumActivePeriodForDividends, minimumactiveperiodFrequencyType, + <tr class=alt><td>sharesIssued, minimumShares, maximumShares, minimumActivePeriodForDividends, minimumactiveperiodFrequencyType, lockinPeriodFrequency, lockinPeriodFrequencyType, marketPricePeriods, chargesSelected</tr> </table> </div> <div class="method-example"> - + <code class="method-declaration">POST https://Domain Name/api/v1/products/share</code> <code class="method-request">POST shareproducts Content-Type: application/json @@ -20358,7 +20945,7 @@ Request Body: "chargesSelected": [{ "id": 20 }], -"accountingRule": "1" +"accountingRule": "1" } </code> @@ -20402,7 +20989,7 @@ Request Body: "shareReferenceId": 5, "shareSuspenseId": 8, "shareEquityId": 66, -"incomeFromFeeAccountId": 2 +"incomeFromFeeAccountId": 2 } </code> <code class="method-response"> @@ -20775,10 +21362,10 @@ Request Body: <div class=apiClick>shareproducts</div> </div> <div class="method-example"> - + <code class="method-declaration">GET https://Domain Name/api/v1/products/share?limit=10&offset=0</code> <code class="method-response"> - + { "totalFilteredRecords": 1, "pageItems": [{ @@ -20791,7 +21378,7 @@ Request Body: </code> </div> </div> - + <a id="savingsproducts_create" name="savingsproducts_create" class="old-syle-anchor"> </a> <div class="method-section"> <div class="method-description"> @@ -22178,7 +22765,7 @@ Content-Type: application/json <div class="method-section"> <div class="method-description"> <h2>Share Account:</h2> - <p>Share accounts are instances of a praticular share product created for an individual. + <p>Share accounts are instances of a praticular share product created for an individual. An application process around the creation of accounts is also supported.</p> <table class=matrixHeading> @@ -22260,7 +22847,7 @@ Content-Type: application/json </table> </div> </div> - + <a id="shareaccount_template" name="shareaccount_template" class="old-syle-anchor"> </a> <div class="method-section"> <div class="method-description"> @@ -22331,7 +22918,7 @@ Content-Type: application/json "value": "Flat" }, "amount": 1.000000, - + }], "lockinPeriodFrequencyTypeOptions": [{ "id": 0, @@ -22402,7 +22989,7 @@ Request Body: { "clientId": "7", "productId": 1, - + "requestedShares": 100, "externalId": "1", "submittedDate": "01 May 2016", @@ -22426,7 +23013,7 @@ Request Body: "chargeId": 23, "amount": 2 }], - + "savingsAccountId": 13 } </code> @@ -22437,7 +23024,7 @@ Request Body: </code> </div> </div> - + <a id="shareaccount_approve" name="shareaccount_approve" class="old-syle-anchor"> </a> <div class="method-section"> <div class="method-description"> @@ -22458,7 +23045,7 @@ Request Body: </code> <code class="method-response"> { - + "resourceId": 1, "changes": { "status": { @@ -22496,7 +23083,7 @@ Request Body: </code> <code class="method-response"> { - + "resourceId": 1, "changes": { "status": { @@ -22515,7 +23102,7 @@ Request Body: </code> </div> </div> - + <a id="shareaccount_reject" name="shareaccount_reject" class="old-syle-anchor"> </a> <div class="method-section"> <div class="method-description"> @@ -22535,7 +23122,7 @@ Request Body: </code> <code class="method-response"> { - + "resourceId": 1, "changes": { "status": { @@ -22613,7 +23200,7 @@ Request Body: </tr> </table> <br /> - + </div> <div class="method-example"> <code class="method-declaration">POST https://Domain Name/api/v1/accounts/share/{shareAccountId}?command=close</code> @@ -22629,7 +23216,7 @@ Request Body: </code> <code class="method-response"> { - + "resourceId":5, "changes":{ "status":{ @@ -22648,7 +23235,7 @@ Request Body: "note":"close note" } } - + </code> </div> </div> @@ -22659,7 +23246,7 @@ Request Body: <h2>Apply additional shares on a share account</h2> <p><i>requestedDate</i> is requsted date of share purchase</p> <p><i>requestedShares</i> is number of shares to be purchase</p> - + <table class=matrixHeading> <tr class="matrixHeadingBG"> <td><div class="fineractHeading2">Mandatory Fields</div></td> @@ -22669,7 +23256,7 @@ Request Body: </tr> </table> <br /> - + </div> <div class="method-example"> <code class="method-declaration">POST https://Domain Name/api/v1/accounts/share/{shareAccountId}?command=applyadditionalshares</code> @@ -22685,10 +23272,10 @@ Request Body: </code> <code class="method-response"> { - + "resourceId":5, } - + </code> </div> </div> @@ -22698,7 +23285,7 @@ Request Body: <div class="method-description"> <h2>Approve additional shares request on a share account</h2> <p><i>requestedShares</i> is Share purchase transaction ids</p> - + <table class=matrixHeading> <tr class="matrixHeadingBG"> <td><div class="fineractHeading2">Mandatory Fields</div></td> @@ -22708,7 +23295,7 @@ Request Body: </tr> </table> <br /> - + </div> <div class="method-example"> <code class="method-declaration">POST https://Domain Name/api/v1/accounts/share/{shareAccountId}?command=approveadditionalshares</code> @@ -22723,10 +23310,10 @@ Request Body: </code> <code class="method-response"> { - + "resourceId":5, } - + </code> </div> </div> @@ -22736,7 +23323,7 @@ Request Body: <div class="method-description"> <h2>Reject additional shares request on a share account</h2> <p><i>requestedShares</i> is Share purchase transaction ids</p> - + <table class=matrixHeading> <tr class="matrixHeadingBG"> <td><div class="fineractHeading2">Mandatory Fields</div></td> @@ -22746,7 +23333,7 @@ Request Body: </tr> </table> <br /> - + </div> <div class="method-example"> <code class="method-declaration">POST https://Domain Name/api/v1/accounts/share/{shareAccountId}?command=rejectadditionalshares</code> @@ -22759,10 +23346,10 @@ Request Body: </code> <code class="method-response"> { - + "resourceId":5, } - + </code> </div> </div> @@ -22774,7 +23361,7 @@ Request Body: <p>Results redeem some/all shares from share account.</p> <p><i>requestedDate</i> is requsted date of shares redeem</p> <p><i>requestedShares</i> is number of shares to be redeemed</p> - + <table class=matrixHeading> <tr class="matrixHeadingBG"> <td><div class="fineractHeading2">Mandatory Fields</div></td> @@ -22784,7 +23371,7 @@ Request Body: </tr> </table> <br /> - + </div> <div class="method-example"> <code class="method-declaration">POST https://Domain Name/api/v1/accounts/share/{shareAccountId}?command=redeemshares</code> @@ -22800,10 +23387,10 @@ Request Body: </code> <code class="method-response"> { - + "resourceId":5, } - + </code> </div> </div> @@ -22814,7 +23401,7 @@ Request Body: <h2>List share applications/accounts</h2> <p>Example Requests:</p> <div class=apiClick>shareaccount</div> - + </div> <div class="method-example"> <code class="method-declaration">GET https://Domain Name/api/v1/accounts/share</code> @@ -22829,7 +23416,7 @@ Request Body: "clientName": "Client Name", "productId": 1, "productName": "Share Product Name", - + "status": { "id": 100, "code": "shareAccountStatusType.submitted.and.pending.approval", @@ -22862,7 +23449,7 @@ Request Body: "purchasedPrice": 5 } ], - + "summary": { "currency": { "code": "USD", @@ -22884,7 +23471,7 @@ Request Body: <div class="method-section"> <div class="method-description"> <h2>Retrieve a share application/account:</h2> - + <p>Example Requests : </p> <div class=apiClick>shareaccount/1</div> </div> @@ -23271,7 +23858,7 @@ No Request Body: </code> <code class="method-response"> { - + "resourceId": 1, "changes": { "dateFormat": "dd MMMM yyyy", @@ -23283,7 +23870,7 @@ No Request Body: </code> </div> </div> - + <!-- end of share accounts api doc <!-- start of savings accounts api --> <a id="savingsaccounts" name="savingsaccounts" class="old-syle-anchor"> </a> @@ -23388,7 +23975,7 @@ No Request Body: <tr class=alt><td>overdraftLimit</td></tr> <tr><td class=fielddesc><b>Optional</b>: If provided, sets the maximum allowed overdraft amount for a savings account e.g. <b>5,000</b> else set the limit as zero</td></tr> - + <tr class=alt><td>withHoldTax</td></tr> <tr><td class=fielddesc><b>Optional</b>: If tax group provided at product level, will allow to Enable or disable withhold tax on interest posting for savings account </td></tr> @@ -24476,8 +25063,8 @@ No Request Body: </code> </div> </div> - - + + <a id="savingsaccounts_withholdtaxupdate" name="savingsaccounts_withholdtaxupdate" class="old-syle-anchor"> </a> <div class="method-section"> <div class="method-description"> @@ -27062,7 +27649,7 @@ No Request Body: <tr class=alt><td>withHoldTax</td></tr> <tr><td class=fielddesc><b>Optional</b>: If tax group provided at product level, will allow to Enable or disable withhold tax on interest posting for savings account </td></tr> - + </table> </div> </div> @@ -39552,7 +40139,7 @@ No Request Body: </div> </div> <!-- End of floatingrates --> - + <!-- Tax components--> <a id="taxcomponent" name="taxcomponent" class="old-syle-anchor"> </a> <div class="method-section"> @@ -39716,7 +40303,7 @@ No Request Body: 4, 11], "taxComponentHistories": [{ - + }] }, { @@ -39737,9 +40324,9 @@ No Request Body: 4, 11], "taxComponentHistories": [{ - + }] - }] + }] </code> </div> </div> @@ -39777,7 +40364,7 @@ No Request Body: 4, 11], "taxComponentHistories": [{ - + }] } </code> @@ -39940,7 +40527,7 @@ No Request Body: "startDate": "11 April 2016" }], "dateFormat": "dd MMMM yyyy" - } + } </code> <code class="method-response"> { @@ -39992,7 +40579,7 @@ No Request Body: 4, 11] }] - }] + }] </code> </div> </div> @@ -43002,8 +43589,8 @@ Request Body: </code> </div> </div> - - + + <a id="selfloanapply" name="selfloanapply" class="old-syle-anchor"> </a> <div class="method-section"> <div class="method-description"> @@ -44201,7 +44788,7 @@ No Request Body: </tr> </table> </div> - + <div class="method-example"> <code class="method-declaration">POST https://DomainName/api/v1/self/beneficiaries/tpt </code> @@ -44216,7 +44803,7 @@ Request Body: "accountNumber": "0000001", "accountType": 1, "transferLimit": 1000 - + } </code> <code class="method-response"> @@ -44235,7 +44822,7 @@ Request Body: <p>Example Requests:</p> <div class=apiClick>/self/beneficiaries/tpt</div> </div> - + <div class="method-example"> <code class="method-declaration">GET https://DomainName/api/v1/self/beneficiaries/tpt </code> @@ -44295,7 +44882,7 @@ Content-Type: application/json </tr> </table> </div> - + <div class="method-example"> <code class="method-declaration">PUT https://DomainName/api/v1/self/beneficiaries/tpt/{beneficiaryId} </code> @@ -44306,7 +44893,7 @@ Request Body: { "name": "beneficiary nick name", "transferLimit": 1000 - + } </code> <code class="method-response"> @@ -44329,7 +44916,7 @@ Request Body: <p>Example Requests:</p> <div class=apiClick>/self/beneficiaries/tpt/{beneficiaryId}</div> </div> - + <div class="method-example"> <code class="method-declaration">DELETE https://DomainName/api/v1/self/beneficiaries/tpt/{beneficiaryId} </code> @@ -44593,6 +45180,7 @@ No Request Body: <td></td> <td></td> </tr> + <tr> <td><a href="#client_identifiers">Client Identifiers</a></td> <td>clients/{clientId}/identifiers</td> @@ -46298,7 +46886,7 @@ No Request Body: <td></td> <td></td> </tr> - + <tr> <td></td> <td>shareproducts/template</td> http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/b086e005/fineract-provider/src/main/java/org/apache/fineract/commands/service/CommandWrapperBuilder.java ---------------------------------------------------------------------- diff --git a/fineract-provider/src/main/java/org/apache/fineract/commands/service/CommandWrapperBuilder.java b/fineract-provider/src/main/java/org/apache/fineract/commands/service/CommandWrapperBuilder.java index 3b26e1d..dea6a9e 100755 --- a/fineract-provider/src/main/java/org/apache/fineract/commands/service/CommandWrapperBuilder.java +++ b/fineract-provider/src/main/java/org/apache/fineract/commands/service/CommandWrapperBuilder.java @@ -41,12 +41,31 @@ public class CommandWrapperBuilder { private String transactionId; private Long productId; private Long templateId; + public CommandWrapper build() { return new CommandWrapper(this.officeId, this.groupId, this.clientId, this.loanId, this.savingsId, this.actionName, - this.entityName, this.entityId, this.subentityId, this.href, this.json, this.transactionId, this.productId, this.templateId); + this.entityName, this.entityId, this.subentityId, this.href, this.json, this.transactionId, this.productId, + this.templateId); } - + + public CommandWrapperBuilder addClientAddress(final long clientId,final long addressTypeId) { + this.actionName = "CREATE"; + this.entityName = "ADDRESS"; + this.entityId = addressTypeId; + this.href = "/clients/"+clientId+"/addresses"; + this.clientId=clientId; + return this; + } + + public CommandWrapperBuilder updateClientAddress(final long clientId) { + this.actionName = "UPDATE"; + this.entityName = "ADDRESS"; + this.href = "/clients/"+clientId+"/addresses"; + this.clientId=clientId; + return this; + } + public CommandWrapperBuilder withLoanId(final Long withLoanId) { this.loanId = withLoanId; return this; http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/b086e005/fineract-provider/src/main/java/org/apache/fineract/infrastructure/configuration/data/GlobalConfigurationPropertyData.java ---------------------------------------------------------------------- diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/configuration/data/GlobalConfigurationPropertyData.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/configuration/data/GlobalConfigurationPropertyData.java index 7b3a0ab..40aede7 100755 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/configuration/data/GlobalConfigurationPropertyData.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/configuration/data/GlobalConfigurationPropertyData.java @@ -60,4 +60,34 @@ public class GlobalConfigurationPropertyData { this.description = description; this.trapDoor = isTrapDoor; } + + public String getName() { + return this.name; + } + + public boolean isEnabled() { + return this.enabled; + } + + public Long getValue() { + return this.value; + } + + public Date getDateValue() { + return this.dateValue; + } + + public Long getId() { + return this.id; + } + + public String getDescription() { + return this.description; + } + + public boolean isTrapDoor() { + return this.trapDoor; + } + + } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/b086e005/fineract-provider/src/main/java/org/apache/fineract/infrastructure/configuration/service/ConfigurationReadPlatformService.java ---------------------------------------------------------------------- diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/configuration/service/ConfigurationReadPlatformService.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/configuration/service/ConfigurationReadPlatformService.java index 27a7349..2c9c9c1 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/configuration/service/ConfigurationReadPlatformService.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/configuration/service/ConfigurationReadPlatformService.java @@ -24,6 +24,8 @@ import org.apache.fineract.infrastructure.configuration.data.GlobalConfiguration public interface ConfigurationReadPlatformService { GlobalConfigurationPropertyData retrieveGlobalConfiguration(Long configId); + + GlobalConfigurationPropertyData retrieveGlobalConfiguration(String name); GlobalConfigurationData retrieveGlobalConfiguration(boolean survey); http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/b086e005/fineract-provider/src/main/java/org/apache/fineract/infrastructure/configuration/service/ConfigurationReadPlatformServiceImpl.java ---------------------------------------------------------------------- diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/configuration/service/ConfigurationReadPlatformServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/configuration/service/ConfigurationReadPlatformServiceImpl.java index 80c7047..ab7f30f 100755 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/configuration/service/ConfigurationReadPlatformServiceImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/configuration/service/ConfigurationReadPlatformServiceImpl.java @@ -66,6 +66,21 @@ public class ConfigurationReadPlatformServiceImpl implements ConfigurationReadPl return new GlobalConfigurationData(globalConfiguration); } + + + + @Override + public GlobalConfigurationPropertyData retrieveGlobalConfiguration(String name) { + + this.context.authenticatedUser(); + + final String sql = "SELECT c.id, c.name, c.enabled, c.value, c.date_value, c.description, c.is_trap_door FROM " + + "c_configuration c where c.name=? order by c.id"; + final GlobalConfigurationPropertyData globalConfiguration = this.jdbcTemplate.queryForObject(sql, this.rm, + new Object[] { name }); + + return globalConfiguration; + } @Override public GlobalConfigurationPropertyData retrieveGlobalConfiguration(Long configId) { @@ -80,6 +95,7 @@ public class ConfigurationReadPlatformServiceImpl implements ConfigurationReadPl return globalConfiguration; } + private static final class GlobalConfigurationRowMapper implements RowMapper<GlobalConfigurationPropertyData> { @Override http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/b086e005/fineract-provider/src/main/java/org/apache/fineract/portfolio/address/api/EntityFieldConfigurationApiResources.java ---------------------------------------------------------------------- diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/address/api/EntityFieldConfigurationApiResources.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/address/api/EntityFieldConfigurationApiResources.java new file mode 100644 index 0000000..838e419 --- /dev/null +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/address/api/EntityFieldConfigurationApiResources.java @@ -0,0 +1,99 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.fineract.portfolio.address.api; + +import java.util.Arrays; +import java.util.Collection; +import java.util.HashSet; +import java.util.Set; + +import javax.ws.rs.Consumes; +import javax.ws.rs.GET; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.UriInfo; + +import org.apache.fineract.commands.domain.CommandWrapper; +import org.apache.fineract.commands.service.CommandWrapperBuilder; +import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService; +import org.apache.fineract.infrastructure.core.api.ApiRequestParameterHelper; +import org.apache.fineract.infrastructure.core.data.CommandProcessingResult; +import org.apache.fineract.infrastructure.core.serialization.ApiRequestJsonSerializationSettings; +import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSerializer; +import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext; +import org.apache.fineract.portfolio.address.data.AddressData; +import org.apache.fineract.portfolio.address.data.FieldConfigurationData; +import org.apache.fineract.portfolio.address.service.AddressReadPlatformServiceImpl; +import org.apache.fineract.portfolio.address.service.FieldConfigurationReadPlatformService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Scope; +import org.springframework.stereotype.Component; + +@Path("/fieldconfiguration/{entity}") +@Component +@Scope("singleton") +public class EntityFieldConfigurationApiResources { + + private final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("clientAddressId", "client_id", + "address_id", "address_type_id", "isActive", "fieldConfigurationId", "entity", "table", "field", + "is_enabled", "is_mandatory", "validation_regex")); + private final String resourceNameForPermissions = "Address"; + private final PlatformSecurityContext context; + private final DefaultToApiJsonSerializer<AddressData> toApiJsonSerializer; + private final FieldConfigurationReadPlatformService readPlatformServicefld; + private final DefaultToApiJsonSerializer<FieldConfigurationData> toApiJsonSerializerfld; + private final ApiRequestParameterHelper apiRequestParameterHelper; + private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService; + + @Autowired + public EntityFieldConfigurationApiResources(final PlatformSecurityContext context, + final DefaultToApiJsonSerializer<AddressData> toApiJsonSerializer, + final FieldConfigurationReadPlatformService readPlatformServicefld, + final DefaultToApiJsonSerializer<FieldConfigurationData> toApiJsonSerializerfld, + final ApiRequestParameterHelper apiRequestParameterHelper, + final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService) { + this.context = context; + this.toApiJsonSerializer = toApiJsonSerializer; + this.readPlatformServicefld = readPlatformServicefld; + this.toApiJsonSerializerfld = toApiJsonSerializerfld; + this.apiRequestParameterHelper = apiRequestParameterHelper; + this.commandsSourceWritePlatformService = commandsSourceWritePlatformService; + } + + @GET + @Consumes({ MediaType.APPLICATION_JSON }) + @Produces({ MediaType.APPLICATION_JSON }) + public String getAddresses(@PathParam("entity") final String entityname, @Context final UriInfo uriInfo) { + this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermissions); + + final Collection<FieldConfigurationData> fldconfig = this.readPlatformServicefld + .retrieveFieldConfiguration(entityname); + + final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper + .process(uriInfo.getQueryParameters()); + return this.toApiJsonSerializerfld.serialize(settings, fldconfig, this.RESPONSE_DATA_PARAMETERS); + + } + + +} http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/b086e005/fineract-provider/src/main/java/org/apache/fineract/portfolio/address/data/AddressData.java ---------------------------------------------------------------------- diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/address/data/AddressData.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/address/data/AddressData.java new file mode 100644 index 0000000..8601b46 --- /dev/null +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/address/data/AddressData.java @@ -0,0 +1,188 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.fineract.portfolio.address.data; + +import java.math.BigDecimal; +import java.util.Collection; +import java.util.Date; + +import org.apache.fineract.infrastructure.codes.data.CodeValueData; + +public class AddressData { + private final Long client_id; + + private final String addressType; + + private final Long addressId; + + private final Long addressTypeId; + + private final Boolean isActive; + + private final String street; + + private final String addressLine1; + + private final String addressLine2; + + private final String addressLine3; + + private final String townVillage; + + private final String city; + + private final String countyDistrict; + + private final Long stateProvinceId; + + private final String countryName; + + private final String stateName; + + private final Long countryId; + + private final String postalCode; + + private final BigDecimal latitude; + + private final BigDecimal longitude; + + private final String createdBy; + + private final Date createdOn; + + private final String updatedBy; + + private final Date updatedOn; + + // template holder + private final Collection<CodeValueData> countryIdOptions; + private final Collection<CodeValueData> stateProvinceIdOptions; + private final Collection<CodeValueData> addressTypeIdOptions; + + private AddressData(final String addressType, final Long client_id, final Long addressId, final Long addressTypeId, + final Boolean is_active, final String street, final String addressLine1, final String addressLine2, + final String addressLine3, final String townVillage, final String city, final String countyDistrict, + final Long stateProvinceId, final Long countryId, final String stateName, final String countryName, + final String postalCode, final BigDecimal latitude, final BigDecimal longitude, final String createdBy, + final Date createdOn, final String updatedBy, final Date updatedOn, + final Collection<CodeValueData> countryIdOptions, final Collection<CodeValueData> stateProvinceIdOptions, + final Collection<CodeValueData> addressTypeIdOptions) { + this.addressType = addressType; + this.client_id = client_id; + this.addressId = addressId; + this.addressTypeId = addressTypeId; + this.isActive = is_active; + this.street = street; + this.addressLine1 = addressLine1; + this.addressLine2 = addressLine2; + this.addressLine3 = addressLine3; + this.townVillage = townVillage; + this.city = city; + this.countyDistrict = countyDistrict; + this.stateProvinceId = stateProvinceId; + this.countryId = countryId; + this.stateName = stateName; + this.countryName = countryName; + this.postalCode = postalCode; + this.latitude = latitude; + this.longitude = longitude; + this.createdBy = createdBy; + this.createdOn = createdOn; + this.updatedBy = updatedBy; + this.updatedOn = updatedOn; + this.countryIdOptions = countryIdOptions; + this.stateProvinceIdOptions = stateProvinceIdOptions; + this.addressTypeIdOptions = addressTypeIdOptions; + } + + public static AddressData instance(final String addressType, final Long client_id, final Long addressId, + final Long addressTypeId, final Boolean is_active, final String street, final String addressLine1, + final String addressLine2, final String addressLine3, final String townVillage, final String city, + final String countyDistrict, final Long stateProvinceId, final Long countryId, final String stateName, + final String countryName, final String postalCode, final BigDecimal latitude, final BigDecimal longitude, + final String createdBy, final Date createdOn, final String updatedBy, final Date updatedOn) { + + return new AddressData(addressType, client_id, addressId, addressTypeId, is_active, street, addressLine1, + addressLine2, addressLine3, townVillage, city, countyDistrict, stateProvinceId, countryId, + stateName, countryName, postalCode, latitude, longitude, createdBy, createdOn, updatedBy, + updatedOn, null, null, null); + } + + public static AddressData instance1(final Long addressId, final String street, final String addressLine1, + final String addressLine2, final String addressLine3, final String townVillage, final String city, + final String countyDistrict, final Long stateProvinceId, final Long countryId, final String postalCode, + final BigDecimal latitude, final BigDecimal longitude, final String createdBy, final Date createdOn, + final String updatedBy, final Date updatedOn) { + return new AddressData(null, null, addressId, null, false, street, addressLine1, addressLine2, + addressLine3, townVillage, city, countyDistrict, stateProvinceId, countryId, null, null, + postalCode, latitude, longitude, createdBy, createdOn, updatedBy, updatedOn, null, null, null); + } + + public static AddressData template(final Collection<CodeValueData> countryIdOptions, + final Collection<CodeValueData> stateProvinceIdOptions, + final Collection<CodeValueData> addressTypeIdOptions) { + final Long client_idtemp = null; + + final Long addressIdtemp = null; + + final Long addressTypeIdtemp = null; + + final Boolean is_activetemp = null; + + final String streettemp = null; + + final String addressLine1temp = null; + + final String addressLine2temp = null; + + final String addressLine3temp = null; + + final String townVillagetemp = null; + + final String citytemp = null; + + final String countyDistricttemp = null; + + final Long stateProvinceIdtemp = null; + + final Long countryIdtemp = null; + + final String postalCodetemp = null; + + final BigDecimal latitudetemp = null; + + final BigDecimal longitudetemp = null; + + final String createdBytemp = null; + + final Date createdOntemp = null; + + final String updatedBytemp = null; + + final Date updatedOntemp = null; + + return new AddressData(null, client_idtemp, addressIdtemp, addressTypeIdtemp, is_activetemp, streettemp, + addressLine1temp, addressLine2temp, addressLine3temp, townVillagetemp, citytemp, + countyDistricttemp, stateProvinceIdtemp, countryIdtemp, null, null, postalCodetemp, latitudetemp, + longitudetemp, createdBytemp, createdOntemp, updatedBytemp, updatedOntemp, countryIdOptions, + stateProvinceIdOptions, addressTypeIdOptions); + } + +} http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/b086e005/fineract-provider/src/main/java/org/apache/fineract/portfolio/address/data/ClientAddressData.java ---------------------------------------------------------------------- diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/address/data/ClientAddressData.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/address/data/ClientAddressData.java new file mode 100644 index 0000000..dc55e05 --- /dev/null +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/address/data/ClientAddressData.java @@ -0,0 +1,46 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.fineract.portfolio.address.data; + +public class ClientAddressData { + + private final long clientAddressId; + + private final long client_id; + + private final long address_id; + + private final long address_type_id; + + private final boolean isActive; + + private ClientAddressData(final long clientAddressId, final long client_id, final long address_id, + final long address_type_id, final boolean isActive) { + this.clientAddressId = clientAddressId; + this.client_id = client_id; + this.address_id = address_id; + this.address_type_id = address_type_id; + this.isActive = isActive; + } + + public static ClientAddressData instance(final long clientAddressId, final long client_id, final long address_id, + final long address_type_id, final boolean isActive) { + return new ClientAddressData(clientAddressId, client_id, address_id, address_type_id, isActive); + } +} http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/b086e005/fineract-provider/src/main/java/org/apache/fineract/portfolio/address/data/FieldConfigurationData.java ---------------------------------------------------------------------- diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/address/data/FieldConfigurationData.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/address/data/FieldConfigurationData.java new file mode 100644 index 0000000..ae0495d --- /dev/null +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/address/data/FieldConfigurationData.java @@ -0,0 +1,82 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.fineract.portfolio.address.data; + +public class FieldConfigurationData { + private final long fieldConfigurationId; + + private final String entity; + + private final String subentity; + + private final String field; + + private final boolean is_enabled; + + private final boolean is_mandatory; + + private final String validation_regex; + + private FieldConfigurationData(final long fieldConfigurationId, final String entity, final String subentity, + final String field, final boolean is_enabled, final boolean is_mandatory, final String validation_regex) { + this.fieldConfigurationId = fieldConfigurationId; + this.entity = entity; + this.subentity = subentity; + this.field = field; + this.is_enabled = is_enabled; + this.is_mandatory = is_mandatory; + this.validation_regex = validation_regex; + } + + public static FieldConfigurationData instance(final long fieldConfigurationId, final String entity, + final String subentity, final String field, final boolean is_enabled, final boolean is_mandatory, + final String validation_regex) { + return new FieldConfigurationData(fieldConfigurationId, entity, subentity, field, is_enabled, is_mandatory, + validation_regex); + } + + public long getFieldConfigurationId() { + return this.fieldConfigurationId; + } + + public String getEntity() { + return this.entity; + } + + public String getSubEntity() { + return this.subentity; + } + + public String getField() { + return this.field; + } + + public boolean isIs_enabled() { + return this.is_enabled; + } + + public boolean isIs_mandatory() { + return this.is_mandatory; + } + + public String getValidation_regex() { + return this.validation_regex; + } + +} http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/b086e005/fineract-provider/src/main/java/org/apache/fineract/portfolio/address/domain/Address.java ---------------------------------------------------------------------- diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/address/domain/Address.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/address/domain/Address.java new file mode 100644 index 0000000..6143a5b --- /dev/null +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/address/domain/Address.java @@ -0,0 +1,393 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.fineract.portfolio.address.domain; + +import java.math.BigDecimal; +import java.util.Date; +import java.util.Locale; +import java.util.Set; + +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.Table; + +import org.apache.fineract.infrastructure.codes.domain.CodeValue; +import org.apache.fineract.infrastructure.core.api.JsonCommand; +import org.apache.fineract.portfolio.client.domain.ClientAddress; +import org.joda.time.LocalDate; +import org.joda.time.format.DateTimeFormat; +import org.joda.time.format.DateTimeFormatter; +import org.springframework.data.jpa.domain.AbstractPersistable; + +import com.google.gson.JsonObject; + +@Entity +@Table(name = "m_address") +public class Address extends AbstractPersistable<Long> { + + /* + * @OneToMany(mappedBy = "address", cascade = CascadeType.ALL) private + * List<ClientAddress> clientaddress = new ArrayList<>(); + */ + + @OneToMany(mappedBy = "address", cascade = CascadeType.ALL) + private Set<ClientAddress> clientaddress; + + @Column(name = "street") + private String street; + + @Column(name = "address_line_1") + private String addressLine1; + + @Column(name = "address_line_2") + private String addressLine2; + + @Column(name = "address_line_3") + private String addressLine3; + + @Column(name = "town_village") + private String townVillage; + + @Column(name = "city") + private String city; + + @Column(name = "county_district") + private String countyDistrict; + + @ManyToOne + @JoinColumn(name = "state_province_id") + private CodeValue stateProvince; + + @ManyToOne + @JoinColumn(name = "country_id") + private CodeValue country; + + @Column(name = "postal_code") + private String postalCode; + + @Column(name = "latitude") + private BigDecimal latitude; + + @Column(name = "longitude") + private BigDecimal longitude; + + @Column(name = "created_by") + private String createdBy; + + @Column(name = "created_on") + private Date createdOn; + + @Column(name = "updated_by") + private String updatedBy; + + @Column(name = "updated_on") + private Date updatedOn; + + private Address(final String street, final String addressLine1, final String addressLine2, + final String addressLine3, final String townVillage, final String city, final String countyDistrict, + final CodeValue stateProvince, final CodeValue country, final String postalCode, final BigDecimal latitude, + final BigDecimal longitude, final String createdBy, final LocalDate createdOn, final String updatedBy, + final LocalDate updatedOn) { + this.street = street; + this.addressLine1 = addressLine1; + this.addressLine2 = addressLine2; + this.addressLine3 = addressLine3; + this.townVillage = townVillage; + this.city = city; + this.countyDistrict = countyDistrict; + this.stateProvince = stateProvince; + this.country = country; + this.postalCode = postalCode; + this.latitude = latitude; + this.longitude = longitude; + this.createdBy = createdBy; + //this.createdOn = createdOn; + this.updatedBy = updatedBy; + //this.updatedOn = updatedOn; + + if (createdOn != null) { + this.createdOn = createdOn.toDate(); + + } + + if (updatedOn != null) { + this.updatedOn = updatedOn.toDate(); + } + + } + + public Address() { + + } + + public static Address fromJson(final JsonCommand command, final CodeValue stateProvince, final CodeValue country) { + + final String street = command.stringValueOfParameterNamed("street"); + + final String addressLine1 = command.stringValueOfParameterNamed("addressLine1"); + + final String addressLine2 = command.stringValueOfParameterNamed("addressLine2"); + + final String addressLine3 = command.stringValueOfParameterNamed("addressLine3"); + + final String townVillage = command.stringValueOfParameterNamed("townVillage"); + + final String city = command.stringValueOfParameterNamed("city"); + + final String countyDistrict = command.stringValueOfParameterNamed("countyDistrict"); + + final String postalCode = command.stringValueOfParameterNamed("postalCode"); + + final BigDecimal latitude = command.bigDecimalValueOfParameterNamed("latitude"); + + final BigDecimal longitude = command.bigDecimalValueOfParameterNamed("longitude"); + + final String createdBy = command.stringValueOfParameterNamed("createdBy"); + + final LocalDate createdOn = command.localDateValueOfParameterNamed("createdOn"); + + final String updatedBy = command.stringValueOfParameterNamed("updatedBy"); + + final LocalDate updatedOn = command.localDateValueOfParameterNamed("updatedOn"); + + + + return new Address(street, addressLine1, addressLine2, addressLine3, townVillage, city, countyDistrict, + stateProvince, country, postalCode, latitude, longitude, createdBy, createdOn, updatedBy, updatedOn); + } + + public static Address fromJsonObject(final JsonObject jsonObject, final CodeValue state_province, + final CodeValue country) { + String street = ""; + String addressLine1 = ""; + String addressLine2 = ""; + String addressLine3 = ""; + String townVillage = ""; + String city = ""; + String countyDistrict = ""; + String postalCode = ""; + BigDecimal latitude = BigDecimal.ZERO; + BigDecimal longitude = BigDecimal.ZERO; + String createdBy = ""; + Locale locale = Locale.ENGLISH; + String updatedBy = ""; + LocalDate updatedOnDate = null; + LocalDate createdOnDate = null; + + if (jsonObject.has("street")) { + street = jsonObject.get("street").getAsString(); + + } + + if (jsonObject.has("addressLine1")) { + addressLine1 = jsonObject.get("addressLine1").getAsString(); + } + if (jsonObject.has("addressLine2")) { + + addressLine2 = jsonObject.get("addressLine2").getAsString(); + } + if (jsonObject.has("addressLine3")) { + addressLine3 = jsonObject.get("addressLine3").getAsString(); + } + if (jsonObject.has("townVillage")) { + townVillage = jsonObject.get("townVillage").getAsString(); + } + if (jsonObject.has("city")) { + city = jsonObject.get("city").getAsString(); + } + if (jsonObject.has("countyDistrict")) { + countyDistrict = jsonObject.get("countyDistrict").getAsString(); + } + if (jsonObject.has("postalCode")) { + + postalCode = jsonObject.get("postalCode").getAsString(); + } + if (jsonObject.has("latitude")) { + + latitude = jsonObject.get("latitude").getAsBigDecimal(); + } + if (jsonObject.has("longitude")) { + + longitude = jsonObject.get("longitude").getAsBigDecimal(); + } + + if (jsonObject.has("createdBy")) { + createdBy = jsonObject.get("createdBy").getAsString(); + } + if (jsonObject.has("createdOn")) { + String createdOn = jsonObject.get("createdOn").getAsString(); + DateTimeFormatter formatter = DateTimeFormat.forPattern("yyyy-MM-dd"); + createdOnDate = LocalDate.parse(createdOn, formatter); + + } + if (jsonObject.has("updatedBy")) { + updatedBy = jsonObject.get("updatedBy").getAsString(); + } + if (jsonObject.has("updatedOn")) { + String updatedOn = jsonObject.get("updatedOn").getAsString(); + DateTimeFormatter formatter = DateTimeFormat.forPattern("yyyy-MM-dd"); + updatedOnDate = LocalDate.parse(updatedOn, formatter); + } + + return new Address(street, addressLine1, addressLine2, addressLine3, townVillage, city, countyDistrict, + state_province, country, postalCode, latitude, longitude, createdBy, createdOnDate, updatedBy, + updatedOnDate); + } + + public Set<ClientAddress> getClientaddress() { + return this.clientaddress; + } + + public void setClientaddress(Set<ClientAddress> clientaddress) { + this.clientaddress = clientaddress; + } + + public String getStreet() { + return this.street; + } + + public void setStreet(String street) { + this.street = street; + } + + public String getAddressLine1() { + return this.addressLine1; + } + + public void setAddressLine1(String addressLine1) { + this.addressLine1 = addressLine1; + } + + public String getAddressLine2() { + return this.addressLine2; + } + + public void setAddressLine2(String addressLine2) { + this.addressLine2 = addressLine2; + } + + public String getAddressLine3() { + return this.addressLine3; + } + + public void setAddressLine3(String addressLine3) { + this.addressLine3 = addressLine3; + } + + public String getTownVillage() { + return this.townVillage; + } + + public void setTownVillage(String townVillage) { + this.townVillage = townVillage; + } + + public String getCity() { + return this.city; + } + + public void setCity(String city) { + this.city = city; + } + + public String getCountyDistrict() { + return this.countyDistrict; + } + + public void setCountyDistrict(String countyDistrict) { + this.countyDistrict = countyDistrict; + } + + public CodeValue getStateProvince() { + return this.stateProvince; + } + + public void setStateProvince(CodeValue stateProvince) { + this.stateProvince = stateProvince; + } + + public CodeValue getCountry() { + return this.country; + } + + public void setCountry(CodeValue country) { + this.country = country; + } + + public String getPostalCode() { + return this.postalCode; + } + + public void setPostalCode(String postalCode) { + this.postalCode = postalCode; + } + + public BigDecimal getLatitude() { + return this.latitude; + } + + public void setLatitude(BigDecimal latitude) { + this.latitude = latitude; + } + + public BigDecimal getLongitude() { + return this.longitude; + } + + public void setLongitude(BigDecimal longitude) { + this.longitude = longitude; + } + + public String getCreatedBy() { + return this.createdBy; + } + + public void setCreatedBy(String createdBy) { + this.createdBy = createdBy; + } + + public Date getCreatedOn() { + return this.createdOn; + } + + public void setCreatedOn(LocalDate createdOn) { + this.createdOn = createdOn.toDate(); + } + + public String getUpdatedBy() { + return this.updatedBy; + } + + public void setUpdatedBy(String updatedBy) { + this.updatedBy = updatedBy; + } + + public Date getUpdatedOn() { + return this.updatedOn; + } + + public void setUpdatedOn(LocalDate updatedOn) { + this.updatedOn = updatedOn.toDate();; + } + +} http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/b086e005/fineract-provider/src/main/java/org/apache/fineract/portfolio/address/domain/AddressRepository.java ---------------------------------------------------------------------- diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/address/domain/AddressRepository.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/address/domain/AddressRepository.java new file mode 100644 index 0000000..4087002 --- /dev/null +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/address/domain/AddressRepository.java @@ -0,0 +1,26 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.fineract.portfolio.address.domain; + +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; + +public interface AddressRepository extends JpaRepository<Address, Long>, JpaSpecificationExecutor<Address> { + +} http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/b086e005/fineract-provider/src/main/java/org/apache/fineract/portfolio/address/domain/FieldConfiguration.java ---------------------------------------------------------------------- diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/address/domain/FieldConfiguration.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/address/domain/FieldConfiguration.java new file mode 100644 index 0000000..8afcb93 --- /dev/null +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/address/domain/FieldConfiguration.java @@ -0,0 +1,59 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.fineract.portfolio.address.domain; + +import javax.persistence.Entity; +import javax.persistence.Table; + +import org.apache.fineract.infrastructure.core.api.JsonCommand; +import org.springframework.data.jpa.domain.AbstractPersistable; + +@Entity +@Table(name = "m_field_configuration") +public class FieldConfiguration extends AbstractPersistable<Long> { + + private String entity; + + private String table; + + private String field; + + private boolean is_enabled; + + public FieldConfiguration() { + + } + + private FieldConfiguration(final String entity, final String table, final String field, final boolean is_enabled) { + this.entity = entity; + this.table = table; + this.field = field; + this.is_enabled = is_enabled; + + } + + private static FieldConfiguration fromJson(final JsonCommand command) { + final String entity = command.stringValueOfParameterNamed("entity"); + final String table = command.stringValueOfParameterNamed("table"); + final String field = command.stringValueOfParameterNamed("field"); + final boolean is_enabled = command.booleanPrimitiveValueOfParameterNamed("implementationKey"); + + return new FieldConfiguration(entity, table, field, is_enabled); + } +} http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/b086e005/fineract-provider/src/main/java/org/apache/fineract/portfolio/address/domain/FieldConfigurationRepository.java ---------------------------------------------------------------------- diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/address/domain/FieldConfigurationRepository.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/address/domain/FieldConfigurationRepository.java new file mode 100644 index 0000000..070373c --- /dev/null +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/address/domain/FieldConfigurationRepository.java @@ -0,0 +1,27 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.fineract.portfolio.address.domain; + +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; + +public interface FieldConfigurationRepository + extends JpaRepository<FieldConfiguration, Long>, JpaSpecificationExecutor<FieldConfiguration> { + +}