Skip to content

Commit 80d2634

Browse files
authored
O3-5343: Support Billing v2 in the Initializer module (#311)
1 parent 961d2fb commit 80d2634

25 files changed

+165
-106
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,9 @@ See the [documentation on Initializer's logging properties](readme/rtprops.md#lo
215215
----
216216

217217
## Releases notes
218+
#### Version 2.11.0
219+
* Support for 'billing' (billableservices, paymentmodes, cashpoints) for Billing V2
220+
* Removed support for Billing V1 (1.x) versions
218221

219222
#### Version 2.10.0
220223
* Support enhanced methods for loading htmlforms when running htmlformentry 5.5.0+

api-2.7/pom.xml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
<properties>
1818
<openmrsPlatformVersion>${openmrsVersion2.7}</openmrsPlatformVersion>
1919
<fhir2Version2.2>2.2.0</fhir2Version2.2>
20+
<billing2Version>2.0.0-SNAPSHOT</billing2Version>
2021
</properties>
2122

2223
<dependencies>
@@ -79,6 +80,19 @@
7980
<scope>provided</scope>
8081
</dependency>
8182

83+
<dependency>
84+
<groupId>org.openmrs.module</groupId>
85+
<artifactId>billing-api</artifactId>
86+
<version>${billing2Version}</version>
87+
<scope>provided</scope>
88+
</dependency>
89+
90+
<dependency>
91+
<groupId>org.openmrs.module</groupId>
92+
<artifactId>stockmanagement-api</artifactId>
93+
<version>${stockmanagementVersion}</version>
94+
<scope>provided</scope>
95+
</dependency>
8296
</dependencies>
8397

8498
</project>

api-2.4/src/main/java/org/openmrs/module/initializer/api/billing/BillableServicesCsvParser.java renamed to api-2.7/src/main/java/org/openmrs/module/initializer/api/billing/BillableServicesCsvParser.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import org.apache.commons.lang3.StringUtils;
44
import org.openmrs.annotation.OpenmrsProfile;
5-
import org.openmrs.module.billing.api.IBillableItemsService;
5+
import org.openmrs.module.billing.api.BillableServiceService;
66
import org.openmrs.module.billing.api.model.BillableService;
77
import org.openmrs.module.initializer.Domain;
88
import org.openmrs.module.initializer.api.BaseLineProcessor;
@@ -11,18 +11,18 @@
1111
import org.springframework.beans.factory.annotation.Autowired;
1212
import org.springframework.beans.factory.annotation.Qualifier;
1313

14-
@OpenmrsProfile(modules = { "billing:1.1.0 - 9.*" })
14+
@OpenmrsProfile(modules = { "billing:2.0.0 - 9.*" })
1515
public class BillableServicesCsvParser extends CsvParser<BillableService, BaseLineProcessor<BillableService>> {
1616

17-
private final IBillableItemsService billableItemsService;
17+
private final BillableServiceService billableServiceService;
1818

1919
private final BillableServicesLineProcessor billableServicesLineProcessor;
2020

2121
@Autowired
22-
public BillableServicesCsvParser(@Qualifier("billableItemsService") IBillableItemsService billableItemsService,
22+
public BillableServicesCsvParser(@Qualifier("billableServiceService") BillableServiceService billableServiceService,
2323
BillableServicesLineProcessor billableServicesLineProcessor) {
2424
super(billableServicesLineProcessor);
25-
this.billableItemsService = billableItemsService;
25+
this.billableServiceService = billableServiceService;
2626
this.billableServicesLineProcessor = billableServicesLineProcessor;
2727
}
2828

@@ -35,7 +35,7 @@ public Domain getDomain() {
3535
public BillableService bootstrap(CsvLine line) throws IllegalArgumentException {
3636
String uuid = line.getUuid();
3737

38-
BillableService billableService = billableItemsService.getByUuid(uuid);
38+
BillableService billableService = billableServiceService.getBillableServiceByUuid(uuid);
3939

4040
if (billableService == null) {
4141
billableService = new BillableService();
@@ -49,7 +49,7 @@ public BillableService bootstrap(CsvLine line) throws IllegalArgumentException {
4949

5050
@Override
5151
public BillableService save(BillableService instance) {
52-
return billableItemsService.save(instance);
52+
return billableServiceService.saveBillableService(instance);
5353
}
5454

5555
@Override

api-2.4/src/main/java/org/openmrs/module/initializer/api/billing/BillableServicesLineProcessor.java renamed to api-2.7/src/main/java/org/openmrs/module/initializer/api/billing/BillableServicesLineProcessor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
/**
1515
* This is the first level line processor for Billable Services
1616
*/
17-
@OpenmrsProfile(modules = { "billing:1.1.0 - 9.*" })
17+
@OpenmrsProfile(modules = { "billing:2.0.0 - 9.*" })
1818
public class BillableServicesLineProcessor extends BaseLineProcessor<BillableService> {
1919

2020
protected static final String HEADER_NAME = "service name";

api-2.4/src/main/java/org/openmrs/module/initializer/api/billing/BillableServicesLoader.java renamed to api-2.7/src/main/java/org/openmrs/module/initializer/api/billing/BillableServicesLoader.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import org.openmrs.module.initializer.api.loaders.BaseCsvLoader;
66
import org.springframework.beans.factory.annotation.Autowired;
77

8-
@OpenmrsProfile(modules = { "billing:1.1.0 - 9.*" })
8+
@OpenmrsProfile(modules = { "billing:2.0.0 - 9.*" })
99
public class BillableServicesLoader extends BaseCsvLoader<BillableService, BillableServicesCsvParser> {
1010

1111
@Autowired

api-2.4/src/main/java/org/openmrs/module/initializer/api/billing/CashPointsCsvParser.java renamed to api-2.7/src/main/java/org/openmrs/module/initializer/api/billing/CashPointsCsvParser.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import org.apache.commons.lang3.StringUtils;
44
import org.openmrs.annotation.OpenmrsProfile;
5-
import org.openmrs.module.billing.api.ICashPointService;
5+
import org.openmrs.module.billing.api.CashPointService;
66
import org.openmrs.module.billing.api.model.CashPoint;
77
import org.openmrs.module.initializer.Domain;
88
import org.openmrs.module.initializer.api.BaseLineProcessor;
@@ -11,16 +11,16 @@
1111
import org.springframework.beans.factory.annotation.Autowired;
1212
import org.springframework.beans.factory.annotation.Qualifier;
1313

14-
@OpenmrsProfile(modules = { "billing:1.1.0 - 9.*" })
14+
@OpenmrsProfile(modules = { "billing:2.0.0 - 9.*" })
1515
public class CashPointsCsvParser extends CsvParser<CashPoint, BaseLineProcessor<CashPoint>> {
1616

17-
private final ICashPointService iCashPointService;
17+
private final CashPointService cashPointService;
1818

1919
@Autowired
20-
public CashPointsCsvParser(@Qualifier("cashierCashPointService") ICashPointService iCashPointService,
20+
public CashPointsCsvParser(@Qualifier("cashPointService") CashPointService cashPointService,
2121
CashPointsLineProcessor processor) {
2222
super(processor);
23-
this.iCashPointService = iCashPointService;
23+
this.cashPointService = cashPointService;
2424
}
2525

2626
@Override
@@ -33,7 +33,7 @@ public CashPoint bootstrap(CsvLine line) throws IllegalArgumentException {
3333
String uuid = line.getUuid();
3434
CashPoint cashPoint = null;
3535
if (StringUtils.isNotBlank(uuid)) {
36-
cashPoint = iCashPointService.getByUuid(uuid);
36+
cashPoint = cashPointService.getCashPointByUuid(uuid);
3737
}
3838
if (cashPoint == null) {
3939
cashPoint = new CashPoint();
@@ -46,6 +46,6 @@ public CashPoint bootstrap(CsvLine line) throws IllegalArgumentException {
4646

4747
@Override
4848
public CashPoint save(CashPoint instance) {
49-
return iCashPointService.save(instance);
49+
return cashPointService.saveCashPoint(instance);
5050
}
5151
}

api-2.4/src/main/java/org/openmrs/module/initializer/api/billing/CashPointsLineProcessor.java renamed to api-2.7/src/main/java/org/openmrs/module/initializer/api/billing/CashPointsLineProcessor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import org.springframework.beans.factory.annotation.Autowired;
1010
import org.springframework.beans.factory.annotation.Qualifier;
1111

12-
@OpenmrsProfile(modules = { "billing:1.1.0 - 9.*" })
12+
@OpenmrsProfile(modules = { "billing:2.0.0 - 9.*" })
1313
public class CashPointsLineProcessor extends BaseLineProcessor<CashPoint> {
1414

1515
protected static final String HEADER_DESCRIPTION = "description";

api-2.4/src/main/java/org/openmrs/module/initializer/api/billing/CashPointsLoader.java renamed to api-2.7/src/main/java/org/openmrs/module/initializer/api/billing/CashPointsLoader.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import org.openmrs.module.initializer.api.loaders.BaseCsvLoader;
66
import org.springframework.beans.factory.annotation.Autowired;
77

8-
@OpenmrsProfile(modules = { "billing:1.1.0 - 9.*" })
8+
@OpenmrsProfile(modules = { "billing:2.0.0 - 9.*" })
99
public class CashPointsLoader extends BaseCsvLoader<CashPoint, CashPointsCsvParser> {
1010

1111
@Autowired

api-2.4/src/main/java/org/openmrs/module/initializer/api/billing/PaymentModesCsvParser.java renamed to api-2.7/src/main/java/org/openmrs/module/initializer/api/billing/PaymentModesCsvParser.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import org.apache.commons.lang3.StringUtils;
44
import org.openmrs.annotation.OpenmrsProfile;
5-
import org.openmrs.module.billing.api.IPaymentModeService;
5+
import org.openmrs.module.billing.api.PaymentModeService;
66
import org.openmrs.module.billing.api.model.PaymentMode;
77
import org.openmrs.module.initializer.Domain;
88
import org.openmrs.module.initializer.api.BaseLineProcessor;
@@ -11,13 +11,13 @@
1111
import org.springframework.beans.factory.annotation.Autowired;
1212
import org.springframework.beans.factory.annotation.Qualifier;
1313

14-
@OpenmrsProfile(modules = { "billing:1.1.0 - 9.*" })
14+
@OpenmrsProfile(modules = { "billing:2.0.0 - 9.*" })
1515
public class PaymentModesCsvParser extends CsvParser<PaymentMode, BaseLineProcessor<PaymentMode>> {
1616

17-
private final IPaymentModeService paymentModeService;
17+
private final PaymentModeService paymentModeService;
1818

1919
@Autowired
20-
public PaymentModesCsvParser(@Qualifier("cashierPaymentModeService") IPaymentModeService paymentModeService,
20+
public PaymentModesCsvParser(@Qualifier("paymentModeService") PaymentModeService paymentModeService,
2121
PaymentModesLineProcessor processor) {
2222
super(processor);
2323
this.paymentModeService = paymentModeService;
@@ -31,7 +31,7 @@ public Domain getDomain() {
3131
@Override
3232
public PaymentMode bootstrap(CsvLine line) throws IllegalArgumentException {
3333
String uuid = line.getUuid();
34-
PaymentMode paymentMode = paymentModeService.getByUuid(uuid);
34+
PaymentMode paymentMode = paymentModeService.getPaymentModeByUuid(uuid);
3535
if (paymentMode == null) {
3636
paymentMode = new PaymentMode();
3737
if (StringUtils.isNotBlank(uuid)) {
@@ -43,6 +43,6 @@ public PaymentMode bootstrap(CsvLine line) throws IllegalArgumentException {
4343

4444
@Override
4545
public PaymentMode save(PaymentMode instance) {
46-
return paymentModeService.save(instance);
46+
return paymentModeService.savePaymentMode(instance);
4747
}
4848
}

api-2.4/src/main/java/org/openmrs/module/initializer/api/billing/PaymentModesLineProcessor.java renamed to api-2.7/src/main/java/org/openmrs/module/initializer/api/billing/PaymentModesLineProcessor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import org.openmrs.module.initializer.api.BaseLineProcessor;
77
import org.openmrs.module.initializer.api.CsvLine;
88

9-
@OpenmrsProfile(modules = { "billing:1.1.0 - 9.*" })
9+
@OpenmrsProfile(modules = { "billing:2.0.0 - 9.*" })
1010
public class PaymentModesLineProcessor extends BaseLineProcessor<PaymentMode> {
1111

1212
protected static final String HEADER_ATTRIBUTES = "attributes";

0 commit comments

Comments
 (0)