-
Notifications
You must be signed in to change notification settings - Fork 79
[#272] Added Billing-related Domains. #269
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
c8e5b97
Add Billing Domains to Iniz
ODORA0 54000c5
Align billableServicesLineProcessor and servicePricesLoader
ODORA0 711cf11
Add CashPoints Domain
ODORA0 5055f58
update tests
ODORA0 db8b3f6
Address clean up PR Comments
ODORA0 b154b8d
Refactor class to be more concise and seperate concerns more clearly
ODORA0 cdfea87
Address PR comments, validator dry run
ODORA0 ceb2276
Add intergration tests
ODORA0 00861f9
PR comments
ODORA0 e9f6402
PR comments
ODORA0 16bb47d
PR comments
ODORA0 860070c
Change dep to api sub modules, add integration tests for other domain…
ODORA0 3a96e62
Documentation PR comments
ODORA0 620fdcc
Add scenarios for integration test
ODORA0 846bb52
Module version, run loader once without redundant calls, ensure getRe…
ODORA0 2ddc8ba
PR comments
ODORA0 0f9777b
Improve tests
Ruhanga 777f242
Improve tests
Ruhanga df550bb
[#272]: Fix tests for Billable Services Domain
Ruhanga 8083779
[#272]: Fix api-2.3 test failures
Ruhanga b1b9dc5
Lower version of core 2.4.x to 2.4.3
Ruhanga 8a9e94b
Setup tests to run conviniently + formatting changes
Ruhanga 76c7b43
Enhance Integration Tests
ODORA0 3e5e8f1
Remove wildcards
ODORA0 5c12731
Refining tests and improving documentation.
Ruhanga 7ae0b77
Payment mode attribute types to be properly overridden
Ruhanga 903ef1e
Normalise java file names
Ruhanga 5f131d8
Update paymentmodes.md
Ruhanga f01d0b0
Changes to Readme
ODORA0 bff56c7
Reveiw changes
Ruhanga File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"java.configuration.updateBuildConfiguration" : "automatic", | ||
"java.debug.settings.onBuildFailureProceed" : true | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
...4/src/main/java/org/openmrs/module/initializer/api/billing/BillableServicesCsvParser.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
package org.openmrs.module.initializer.api.billing; | ||
|
||
import org.apache.commons.lang3.StringUtils; | ||
import org.openmrs.annotation.OpenmrsProfile; | ||
import org.openmrs.module.billing.api.IBillableItemsService; | ||
import org.openmrs.module.billing.api.model.BillableService; | ||
import org.openmrs.module.initializer.Domain; | ||
import org.openmrs.module.initializer.api.BaseLineProcessor; | ||
import org.openmrs.module.initializer.api.CsvLine; | ||
import org.openmrs.module.initializer.api.CsvParser; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.beans.factory.annotation.Qualifier; | ||
|
||
@OpenmrsProfile(modules = { "billing:1.1.0 - 9.*" }) | ||
public class BillableServicesCsvParser extends CsvParser<BillableService, BaseLineProcessor<BillableService>> { | ||
|
||
private final IBillableItemsService billableItemsService; | ||
|
||
private final BillableServicesLineProcessor billableServicesLineProcessor; | ||
|
||
@Autowired | ||
public BillableServicesCsvParser(@Qualifier("billableItemsService") IBillableItemsService billableItemsService, | ||
BillableServicesLineProcessor billableServicesLineProcessor) { | ||
super(billableServicesLineProcessor); | ||
this.billableItemsService = billableItemsService; | ||
this.billableServicesLineProcessor = billableServicesLineProcessor; | ||
} | ||
|
||
@Override | ||
public Domain getDomain() { | ||
return Domain.BILLABLE_SERVICES; | ||
} | ||
|
||
@Override | ||
public BillableService bootstrap(CsvLine line) throws IllegalArgumentException { | ||
String uuid = line.getUuid(); | ||
|
||
BillableService billableService = billableItemsService.getByUuid(uuid); | ||
|
||
if (billableService == null) { | ||
billableService = new BillableService(); | ||
if (!StringUtils.isEmpty(uuid)) { | ||
billableService.setUuid(uuid); | ||
} | ||
} | ||
|
||
return billableService; | ||
} | ||
|
||
@Override | ||
public BillableService save(BillableService instance) { | ||
return billableItemsService.save(instance); | ||
} | ||
|
||
@Override | ||
protected void setLineProcessors(String version) { | ||
lineProcessors.clear(); | ||
lineProcessors.add(billableServicesLineProcessor); | ||
} | ||
} |
56 changes: 56 additions & 0 deletions
56
...c/main/java/org/openmrs/module/initializer/api/billing/BillableServicesLineProcessor.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package org.openmrs.module.initializer.api.billing; | ||
|
||
import org.apache.commons.lang3.StringUtils; | ||
import org.openmrs.annotation.OpenmrsProfile; | ||
import org.openmrs.api.ConceptService; | ||
import org.openmrs.module.billing.api.model.BillableService; | ||
import org.openmrs.module.billing.api.model.BillableServiceStatus; | ||
import org.openmrs.module.initializer.api.BaseLineProcessor; | ||
import org.openmrs.module.initializer.api.CsvLine; | ||
import org.openmrs.module.initializer.api.utils.Utils; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.beans.factory.annotation.Qualifier; | ||
|
||
/** | ||
* This is the first level line processor for Billable Services | ||
*/ | ||
@OpenmrsProfile(modules = { "billing:1.1.0 - 9.*" }) | ||
public class BillableServicesLineProcessor extends BaseLineProcessor<BillableService> { | ||
|
||
protected static final String HEADER_NAME = "service name"; | ||
|
||
protected static final String HEADER_DESC = "short name"; | ||
|
||
protected static final String HEADER_SERVICE = "concept"; | ||
|
||
protected static final String HEADER_SERVICE_TYPE = "service type"; | ||
|
||
protected static final String HEADER_SERVICE_STATUS = "service status"; | ||
|
||
private final ConceptService conceptService; | ||
|
||
@Autowired | ||
public BillableServicesLineProcessor(@Qualifier("conceptService") ConceptService conceptService) { | ||
super(); | ||
this.conceptService = conceptService; | ||
} | ||
|
||
@Override | ||
public BillableService fill(BillableService billableService, CsvLine line) throws IllegalArgumentException { | ||
billableService.setName(line.get(HEADER_NAME, true)); | ||
billableService.setShortName(line.getString(HEADER_DESC)); | ||
|
||
String service = line.get(HEADER_SERVICE, true); | ||
billableService.setConcept(Utils.fetchConcept(service, conceptService)); | ||
|
||
String serviceType = line.get(HEADER_SERVICE_TYPE, true); | ||
billableService.setServiceType(Utils.fetchConcept(serviceType, conceptService)); | ||
|
||
String serviceStatus = line.getString(HEADER_SERVICE_STATUS); | ||
billableService.setServiceStatus( | ||
StringUtils.isNotBlank(serviceStatus) ? BillableServiceStatus.valueOf(serviceStatus.toUpperCase()) | ||
: BillableServiceStatus.ENABLED); | ||
|
||
return billableService; | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
api-2.4/src/main/java/org/openmrs/module/initializer/api/billing/BillableServicesLoader.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package org.openmrs.module.initializer.api.billing; | ||
|
||
import org.openmrs.annotation.OpenmrsProfile; | ||
import org.openmrs.module.billing.api.model.BillableService; | ||
import org.openmrs.module.initializer.api.loaders.BaseCsvLoader; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
|
||
@OpenmrsProfile(modules = { "billing:1.1.0 - 9.*" }) | ||
public class BillableServicesLoader extends BaseCsvLoader<BillableService, BillableServicesCsvParser> { | ||
|
||
@Autowired | ||
public void setParser(BillableServicesCsvParser parser) { | ||
this.parser = parser; | ||
} | ||
} |
51 changes: 51 additions & 0 deletions
51
api-2.4/src/main/java/org/openmrs/module/initializer/api/billing/CashPointsCsvParser.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package org.openmrs.module.initializer.api.billing; | ||
|
||
import org.apache.commons.lang3.StringUtils; | ||
import org.openmrs.annotation.OpenmrsProfile; | ||
import org.openmrs.module.billing.api.ICashPointService; | ||
import org.openmrs.module.billing.api.model.CashPoint; | ||
import org.openmrs.module.initializer.Domain; | ||
import org.openmrs.module.initializer.api.BaseLineProcessor; | ||
import org.openmrs.module.initializer.api.CsvLine; | ||
import org.openmrs.module.initializer.api.CsvParser; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.beans.factory.annotation.Qualifier; | ||
|
||
@OpenmrsProfile(modules = { "billing:1.1.0 - 9.*" }) | ||
public class CashPointsCsvParser extends CsvParser<CashPoint, BaseLineProcessor<CashPoint>> { | ||
|
||
private final ICashPointService iCashPointService; | ||
|
||
@Autowired | ||
public CashPointsCsvParser(@Qualifier("cashierCashPointService") ICashPointService iCashPointService, | ||
CashPointsLineProcessor processor) { | ||
super(processor); | ||
this.iCashPointService = iCashPointService; | ||
} | ||
|
||
@Override | ||
public Domain getDomain() { | ||
return Domain.CASH_POINTS; | ||
} | ||
|
||
@Override | ||
public CashPoint bootstrap(CsvLine line) throws IllegalArgumentException { | ||
String uuid = line.getUuid(); | ||
CashPoint cashPoint = null; | ||
if (StringUtils.isNotBlank(uuid)) { | ||
cashPoint = iCashPointService.getByUuid(uuid); | ||
} | ||
if (cashPoint == null) { | ||
cashPoint = new CashPoint(); | ||
if (StringUtils.isNotBlank(uuid)) { | ||
cashPoint.setUuid(uuid); | ||
} | ||
} | ||
return cashPoint; | ||
} | ||
|
||
@Override | ||
public CashPoint save(CashPoint instance) { | ||
return iCashPointService.save(instance); | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
...2.4/src/main/java/org/openmrs/module/initializer/api/billing/CashPointsLineProcessor.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package org.openmrs.module.initializer.api.billing; | ||
|
||
import org.openmrs.annotation.OpenmrsProfile; | ||
import org.openmrs.api.LocationService; | ||
import org.openmrs.module.billing.api.model.CashPoint; | ||
import org.openmrs.module.initializer.api.BaseLineProcessor; | ||
import org.openmrs.module.initializer.api.CsvLine; | ||
import org.openmrs.module.initializer.api.utils.Utils; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.beans.factory.annotation.Qualifier; | ||
|
||
@OpenmrsProfile(modules = { "billing:1.1.0 - 9.*" }) | ||
public class CashPointsLineProcessor extends BaseLineProcessor<CashPoint> { | ||
|
||
protected static final String HEADER_DESCRIPTION = "description"; | ||
|
||
protected static final String HEADER_LOCATION = "location"; | ||
|
||
private final LocationService locationService; | ||
|
||
@Autowired | ||
public CashPointsLineProcessor(@Qualifier("locationService") LocationService locationService) { | ||
super(); | ||
this.locationService = locationService; | ||
} | ||
|
||
@Override | ||
public CashPoint fill(CashPoint cashPoint, CsvLine line) throws IllegalArgumentException { | ||
cashPoint.setName(line.get(HEADER_NAME, true)); | ||
cashPoint.setDescription(line.getString(HEADER_DESCRIPTION)); | ||
String location = line.get(HEADER_LOCATION, true); | ||
cashPoint.setLocation(Utils.fetchLocation(location, locationService)); | ||
|
||
return cashPoint; | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
api-2.4/src/main/java/org/openmrs/module/initializer/api/billing/CashPointsLoader.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package org.openmrs.module.initializer.api.billing; | ||
|
||
import org.openmrs.annotation.OpenmrsProfile; | ||
import org.openmrs.module.billing.api.model.CashPoint; | ||
import org.openmrs.module.initializer.api.loaders.BaseCsvLoader; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
|
||
@OpenmrsProfile(modules = { "billing:1.1.0 - 9.*" }) | ||
public class CashPointsLoader extends BaseCsvLoader<CashPoint, CashPointsCsvParser> { | ||
|
||
@Autowired | ||
public void setParser(CashPointsCsvParser parser) { | ||
this.parser = parser; | ||
} | ||
|
||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ODORA0 @Ruhanga why not just
?
That should, normally, mean what we're intending no?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It’s quite restrictive to specify version
1.1.0
as the required version. We would prefer to set1.1.0
as the minimum version instead. Version9.*
provides a more flexible range for usage, accommodating future updates until potential incompatibility issues arise.