Skip to content

Commit a61d8dc

Browse files
committed
Fixed error starting cesop application demo
1 parent ffd7896 commit a61d8dc

File tree

8 files changed

+30
-51
lines changed

8 files changed

+30
-51
lines changed

bzst-dip-java-client-demo/src/main/java/software/xdev/ApplicationWithCesop.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
import software.xdev.bzst.dip.client.exception.HttpStatusCodeNotExceptedException;
1818
import software.xdev.bzst.dip.client.model.configuration.BzstDipConfiguration;
1919
import software.xdev.bzst.dip.client.model.configuration.BzstDipConfigurationBuilder;
20-
import software.xdev.bzst.dip.client.model.configuration.BzstDipDpiMessageType;
2120
import software.xdev.bzst.dip.client.model.configuration.BzstDipOecdDocType;
2221
import software.xdev.bzst.dip.client.model.message.cesop.BzstCesopAccountIdentifier;
2322
import software.xdev.bzst.dip.client.model.message.cesop.BzstCesopAccountIdentifierTypeEnum;
@@ -81,7 +80,7 @@ public static BzstDipConfiguration createConfiguration()
8180
.getResourceAsStream("DemoKeystore.jks"))
8281
.setCertificateKeystorePassword("test123")
8382
.setRealmEnvironmentBaseUrl(BzstDipConfiguration.ENDPOINT_URL_TEST)
84-
.setMessageTypeIndic(BzstDipDpiMessageType.DPI_401)
83+
.setMessageTypeIndicCesop(BzstCesopMessageTypeIndicEnum.CESOP_101)
8584
.setReportingPeriod(LocalDate.now())
8685
.setDocTypeIndic(BzstDipOecdDocType.OECD_1)
8786
.setPlatformOperatorOrganizationName("TestOrg")
@@ -92,7 +91,6 @@ public static BzstDipConfiguration createConfiguration()
9291
.setReportingPeriodCesopQuarter(2)
9392
.setReportingPeriodCesopYear("2024")
9493
.setMessageRefId(UUID.randomUUID().toString())
95-
.setMessageTypeIndicCesop(BzstCesopMessageTypeIndicEnum.CESOP_100)
9694
.setTimestamp(ZonedDateTime.parse("2024-05-08T14:02:53Z", DateTimeFormatter.ISO_ZONED_DATE_TIME))
9795
.buildAndValidate();
9896
}

bzst-dip-java-client-demo/src/main/resources/app.properties

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,9 @@ platform.operator.address.street=
2727
platform.operator.address.building=
2828
platform.operator.address.suite=
2929
platform.operator.address.floor=
30-
transmittingCountry=
31-
messageType=
32-
messageRefId=
33-
reportingPeriodCesop.quarter=
34-
reportingPeriodCesop.year=
30+
transmitting.country=
31+
message.ref.id=
32+
reporting.period.cesop.quarter=
33+
reporting.period.cesop.year=
3534
timestamp=
36-
message.type.indic.cesop=
35+
message.type.indic=

bzst-dip-java-client/src/main/java/software/xdev/bzst/dip/client/model/configuration/BzstDipConfigurationBuilder.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@ public BzstDipConfiguration buildAndValidate()
469469
),
470470
this.getSetPropertyOrReadFromFileMessageTypeIndicCesop(
471471
this.messageTypeIndicCesop,
472-
PropertiesSupplier.PROPERTY_NAME_MESSAGE_TYPE_INDIC_CESOP,
472+
PropertiesSupplier.PROPERTY_NAME_MESSAGE_TYPE_INDIC,
473473
BzstCesopMessageTypeIndicEnum.CESOP_100
474474
),
475475
this.getSetPropertyOrReadFromFileApplicationCode(
@@ -689,9 +689,15 @@ private BzstDipDpiMessageType getSetPropertyOrReadFromFileDpiMessageType(
689689
{
690690
return builderProperty;
691691
}
692-
return BzstDipDpiMessageType.valueOf(this.getSetPropertyOrReadFromFile(
692+
final String propertyValue = this.getSetPropertyOrReadFromFile(
693693
null,
694-
propertyNameInFile));
694+
propertyNameInFile,
695+
null);
696+
if(propertyValue != null)
697+
{
698+
return BzstDipDpiMessageType.valueOf(propertyValue);
699+
}
700+
return null;
695701
}
696702

697703
private String getSetPropertyOrReadFromFile(final String builderProperty, final String propertyNameInFile)

bzst-dip-java-client/src/main/java/software/xdev/bzst/dip/client/model/configuration/BzstDipConfigurationValidator.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ public static void validateConfiguration(final BzstDipConfiguration configuratio
4545
checkForNullOrBlank(
4646
PropertiesSupplier.PROPERTY_NAME_REALM_ENVIRONMENT_BASE_URL, configuration.getRealmEnvironmentBaseUrl());
4747
checkForNull(PropertiesSupplier.PROPERTY_NAME_ENVIRONMENT, configuration.getEnvironment());
48-
checkForNull(PropertiesSupplier.PROPERTY_NAME_MESSAGE_TYPE_INDIC, configuration.getMessageTypeIndic());
4948
checkForNull(PropertiesSupplier.PROPERTY_NAME_DOC_TYPE_INDIC, configuration.getDocType());
5049
checkForNull("certificate keystore input", configuration.getCertificateKeystoreInputStream());
5150
checkForNullOrBlank(

bzst-dip-java-client/src/main/java/software/xdev/bzst/dip/client/model/configuration/PropertiesSupplier.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public class PropertiesSupplier
3838
public static final String PROPERTY_NAME_TAX_NUMBER = "tax.number";
3939
public static final String PROPERTY_NAME_REALM_ENVIRONMENT_BASE_URL = "base.url";
4040
public static final String PROPERTY_NAME_ENVIRONMENT = "environment";
41-
public static final String PROPERTY_NAME_MESSAGE_TYPE_INDIC = "message.type";
41+
public static final String PROPERTY_NAME_MESSAGE_TYPE_INDIC = "message.type.indic";
4242
public static final String PROPERTY_NAME_REPORTING_PERIOD = "reporting.period";
4343
public static final String PROPERTY_NAME_DOC_TYPE_INDIC = "doc.type";
4444
public static final String PROPERTY_NAME_PLATFORM_OPERATOR_DOC_REF_ID = "platform.operator.doc.ref.id";
@@ -64,13 +64,12 @@ public class PropertiesSupplier
6464
"platform.operator.address.post.code";
6565
public static final String PROPERTY_NAME_PLATFORM_OPERATOR_ADDRESS_CITY = "platform.operator.address.city";
6666
public static final String PROPERTY_NAME_APPLICATION_CODE = "application.code";
67-
public static final String PROPERTY_NAME_TRANSMITTING_COUNTRY = "transmittingCountry";
68-
public static final String PROPERTY_NAME_MESSAGE_TYPE = "messageType";
69-
public static final String PROPERTY_NAME_MESSAGE_REF_ID = "messageRefId";
70-
public static final String PROPERTY_NAME_REPORTING_PERIOD_CESOP_YEAR = "reportingPeriodCesop.year";
71-
public static final String PROPERTY_NAME_REPORTING_PERIOD_CESOP_QUARTER = "reportingPeriodCesop.quarter";
67+
public static final String PROPERTY_NAME_TRANSMITTING_COUNTRY = "transmitting.country";
68+
public static final String PROPERTY_NAME_MESSAGE_TYPE = "message.type";
69+
public static final String PROPERTY_NAME_MESSAGE_REF_ID = "message.ref.id";
70+
public static final String PROPERTY_NAME_REPORTING_PERIOD_CESOP_YEAR = "reporting.period.cesop.year";
71+
public static final String PROPERTY_NAME_REPORTING_PERIOD_CESOP_QUARTER = "reporting.period.cesop.quarter";
7272
public static final String PROPERTY_NAME_TIMESTAMP = "timestamp";
73-
public static final String PROPERTY_NAME_MESSAGE_TYPE_INDIC_CESOP = "message.type.indic.cesop";
7473

7574
private final Properties properties;
7675

bzst-dip-java-client/src/main/java/software/xdev/bzst/dip/client/model/message/cesop/BzstCesopPaymentDataBody.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -118,19 +118,19 @@ private List<ReportedPayeeType> convertToReportedPayeesType() throws DatatypeCon
118118
reportedTransactionType.setAmount(amountType);
119119
reportedTransactionType.setTransactionIdentifier(reportedPayee.reportedTransaction()
120120
.transactionIdentifier());
121-
paymentMethodType.setPaymentMethodType(PaymentMethodTypeType.valueOf(reportedPayee.reportedTransaction()
121+
paymentMethodType.setPaymentMethodType(PaymentMethodTypeType.fromValue(reportedPayee.reportedTransaction()
122122
.paymentMethod()
123123
.paymentMethodEnum()
124124
.value()));
125-
payerMSType.setPayerMSSource(AccountIdentifierTypeType.valueOf(reportedPayee.reportedTransaction()
125+
payerMSType.setPayerMSSource(AccountIdentifierTypeType.fromValue(reportedPayee.reportedTransaction()
126126
.payerMS()
127127
.accountIdentifierType()
128128
.value()));
129-
payerMSType.setValue(MSCountryCodeType.valueOf(reportedPayee.reportedTransaction()
129+
payerMSType.setValue(MSCountryCodeType.fromValue(reportedPayee.reportedTransaction()
130130
.payerMS()
131131
.msCountryCodeType()
132132
.value()));
133-
pspRoleType.setPSPRoleType(PSPRoleTypeType.valueOf(reportedPayee.reportedTransaction()
133+
pspRoleType.setPSPRoleType(PSPRoleTypeType.fromValue(reportedPayee.reportedTransaction()
134134
.pspRole()
135135
.pspRoleType()
136136
.value()));
@@ -148,7 +148,7 @@ private List<ReportedPayeeType> convertToReportedPayeesType() throws DatatypeCon
148148

149149
transactionDateType.setValue(xmlGregorianCalendar);
150150
transactionDateType.setTransactionDateType(
151-
TransactionDateTypeType.valueOf(reportedPayee.reportedTransaction()
151+
TransactionDateTypeType.fromValue(reportedPayee.reportedTransaction()
152152
.transactionDateType()
153153
.transactionDateTypeEnum()
154154
.value()));

bzst-dip-java-client/src/main/java/software/xdev/bzst/dip/client/xmldocument/XMLDocumentBodyCreator.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ private Object createData(
115115

116116
final DataType dataType = new DataType();
117117

118-
if(this.configuration.getApplicationCode().equals(BzstDipConfiguration.SupportedApplicationCode.DAC7))
118+
if(this.configuration.getApplicationCode().equals(BzstDipConfiguration.SupportedApplicationCode.DAC7.name()))
119119
{
120120
final DPIOECD dpioecd = new DPIOECD();
121121
dpioecd.setMessageSpec(this.createMessageSpecDac7());
@@ -140,7 +140,7 @@ private Object createData(
140140

141141
final DataType dataType = new DataType();
142142

143-
if(this.configuration.getApplicationCode().equals(BzstDipConfiguration.SupportedApplicationCode.CESOP))
143+
if(this.configuration.getApplicationCode().equals(BzstDipConfiguration.SupportedApplicationCode.CESOP.name()))
144144
{
145145
final CESOP cesop = new CESOP();
146146
cesop.setMessageSpec(this.createMessageSpecCesop());
@@ -268,8 +268,8 @@ private software.xdev.bzst.dip.client.xmldocument.model.cesop.MessageSpecType cr
268268
messageSpecType.setTransmittingCountry(MSCountryCodeType.fromValue(this.configuration.getTransmittingCountry()
269269
.name()));
270270
messageSpecType.setMessageType(MessageTypeType.fromValue(this.configuration.getMessageType().value()));
271-
messageSpecType.setMessageTypeIndic(MessageTypeIndicType.fromValue(this.configuration.getMessageTypeIndic()
272-
.name()));
271+
messageSpecType.setMessageTypeIndic(MessageTypeIndicType.fromValue(this.configuration.getMessageTypeIndicEnum()
272+
.value()));
273273
messageSpecType.setMessageRefId(this.configuration.getMessageRefId());
274274

275275
final ReportingPeriodType reportingPeriodType = new ReportingPeriodType();

bzst-dip-java-client/src/test/java/software/xdev/bzst/dip/client/model/configuration/BzstDipConfigurationBuilderTest.java

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -213,28 +213,6 @@ void buildAndValidate_cesop()
213213
);
214214
}
215215

216-
@Test
217-
void buildAndValidate_missingMessageTypeIndic()
218-
{
219-
Assertions.assertThrows(
220-
ConfigurationException.class,
221-
() -> new BzstDipConfigurationBuilder()
222-
.setClientId("abcd1234-ab12-ab12-ab12-abcdef123456")
223-
.setTaxID("86095742719")
224-
.setTaxNumber("123")
225-
.setCertificateKeystoreInputStream(() -> ClassLoader.getSystemClassLoader()
226-
.getResourceAsStream("DemoKeystore.jks"))
227-
.setCertificateKeystorePassword("test123")
228-
.setRealmEnvironmentBaseUrl(BzstDipConfiguration.ENDPOINT_URL_TEST)
229-
.setReportingPeriod(LocalDate.now())
230-
.setDocTypeIndic(BzstDipOecdDocType.OECD_1)
231-
.setPlatformOperatorOrganizationName("TestOrg")
232-
.setPlatformOperatorPlatformName("TestApp")
233-
.setPlatformOperatorAddress(new BzstDipAddressFix("TestCity"))
234-
.buildAndValidate()
235-
);
236-
}
237-
238216
@Test
239217
void buildAndValidate_wrongReportingPeriod()
240218
{

0 commit comments

Comments
 (0)