From f39874f2d30413e0f91a45843b5a6a098e6353d4 Mon Sep 17 00:00:00 2001 From: Vadym <30234255+vadkor@users.noreply.github.com> Date: Mon, 20 Nov 2023 12:17:40 +1100 Subject: [PATCH 1/4] Updated Telco to CDS spec 1.28.0 --- .../consumerdatastandards/holder/api/telco/TelcoApi.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/data-holder/src/main/java/au/org/consumerdatastandards/holder/api/telco/TelcoApi.java b/data-holder/src/main/java/au/org/consumerdatastandards/holder/api/telco/TelcoApi.java index b0abbbed..bfc4b313 100644 --- a/data-holder/src/main/java/au/org/consumerdatastandards/holder/api/telco/TelcoApi.java +++ b/data-holder/src/main/java/au/org/consumerdatastandards/holder/api/telco/TelcoApi.java @@ -50,7 +50,7 @@ public interface TelcoApi { /** * GET /telco/accounts/{accountId} : Get Telco Account Detail - * Obtain detailed information for a specific telco account Other Versions: [v1](includes/obsolete/get-telco-account-detail-v1.html) + * Obtain detailed information for a specific telco account * * @param accountId ID of a specific account to obtain data for. This is a tokenised ID previously obtained from the Account List end point. In accordance with [CDR ID permanence](#id-permanence) requirements (required) * @param xV Version of the API end point requested by the client. Must be set to a positive integer. The data holder should respond with the highest supported version between [x-min-v](#request-headers) and [x-v](#request-headers). If the value of [x-min-v](#request-headers) is equal to or higher than the value of [x-v](#request-headers) then the [x-min-v](#request-headers) header should be treated as absent. If all versions requested are not supported then the data holder must respond with a 406 Not Acceptable. See [HTTP Headers](#request-headers) (required) @@ -66,7 +66,7 @@ public interface TelcoApi { */ @ApiOperation(value = "Get Telco Account Detail", nickname = "getAccount", - notes = "Obtain detailed information for a specific telco account Other Versions: [v1](includes/obsolete/get-telco-account-detail-v1.html)", + notes = "Obtain detailed information for a specific telco account", response = TelcoAccountDetailResponse.class, tags = {"Telco", "Accounts",}) @ApiResponses(value = { @@ -700,7 +700,7 @@ ResponseEntity getUsageForService( /** * GET /telco/accounts : Get Telco Accounts - * Obtain the list of telco accounts available under the authorised consent Other Versions: [v1](includes/obsolete/get-telco-accounts-v1.html) + * Obtain the list of telco accounts available under the authorised consent * * @param xV Version of the API end point requested by the client. Must be set to a positive integer. The data holder should respond with the highest supported version between [x-min-v](#request-headers) and [x-v](#request-headers). If the value of [x-min-v](#request-headers) is equal to or higher than the value of [x-v](#request-headers) then the [x-min-v](#request-headers) header should be treated as absent. If all versions requested are not supported then the data holder must respond with a 406 Not Acceptable. See [HTTP Headers](#request-headers) (required) * @param openStatus Used to filter results according to open/closed status. Values can be OPEN, CLOSED or ALL. If absent then ALL is assumed (optional, default to ALL) @@ -719,7 +719,7 @@ ResponseEntity getUsageForService( */ @ApiOperation(value = "Get Telco Accounts", nickname = "listAccounts", - notes = "Obtain the list of telco accounts available under the authorised consent Other Versions: [v1](includes/obsolete/get-telco-accounts-v1.html)", + notes = "Obtain the list of telco accounts available under the authorised consent", response = TelcoAccountListResponse.class, tags = {"Telco", "Accounts",}) @ApiResponses(value = { From ed1b86145b075e1f6d9a0e1398e56fa9a8cd0519 Mon Sep 17 00:00:00 2001 From: Vadym <30234255+vadkor@users.noreply.github.com> Date: Thu, 23 Nov 2023 10:46:35 +1100 Subject: [PATCH 2/4] Updated Energy to CDS spec 1.28.0, added date/time validation --- .../holder/api/ApiControllerBase.java | 42 +++++++++++++++++++ .../banking/BankingAccountsApiController.java | 1 + .../banking/BankingProductsApiController.java | 1 + .../holder/api/energy/EnergyApi.java | 18 ++++---- .../api/energy/EnergyApiController.java | 9 ++++ .../energy/EnergyInvoiceGasUsageCharges.java | 12 +++--- 6 files changed, 68 insertions(+), 15 deletions(-) diff --git a/data-holder/src/main/java/au/org/consumerdatastandards/holder/api/ApiControllerBase.java b/data-holder/src/main/java/au/org/consumerdatastandards/holder/api/ApiControllerBase.java index d6f9c37c..63ae2437 100644 --- a/data-holder/src/main/java/au/org/consumerdatastandards/holder/api/ApiControllerBase.java +++ b/data-holder/src/main/java/au/org/consumerdatastandards/holder/api/ApiControllerBase.java @@ -15,6 +15,8 @@ import org.springframework.util.StringUtils; import org.springframework.web.context.request.NativeWebRequest; +import java.time.LocalDate; +import java.time.OffsetDateTime; import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -57,6 +59,46 @@ protected void validatePageSize(Integer pageSize, UUID interactionId) { } } + protected void validateUpdatedSince(OffsetDateTime updatedSince, UUID interactionId) { + if (updatedSince != null && !updatedSince.isBefore(OffsetDateTime.now())) { + throwInvalidDate("updated-since is not in the past", interactionId); + } + } + + protected void validateOldestNewestOffsetDateTime(OffsetDateTime oldestTime, OffsetDateTime newestTime, UUID interactionId) { + if (newestTime != null && !newestTime.isBefore(OffsetDateTime.now())) { + throwInvalidDate("newest-time is not in the past", interactionId); + } + if (oldestTime != null) { + if (!oldestTime.isBefore(OffsetDateTime.now())) { + throwInvalidDate("oldest-time is not in the past", interactionId); + } + if (newestTime != null && newestTime.isBefore(oldestTime)) { + throwInvalidDate("newest-time is before oldest-time", interactionId); + } + } + } + + protected void validateOldestNewestLocalDate(LocalDate oldestDate, LocalDate newestDate, UUID interactionId) { + if (newestDate != null && !newestDate.isBefore(LocalDate.now())) { + throwInvalidDate("newest-date is not in the past", interactionId); + } + if (oldestDate != null) { + if (!oldestDate.isBefore(LocalDate.now())) { + throwInvalidDate("oldest-date is not in the past", interactionId); + } + if (newestDate != null && newestDate.isBefore(oldestDate)) { + throwInvalidDate("newest-date is before oldest-date", interactionId); + } + } + } + + protected void throwInvalidDate(String message, UUID interactionId) { + throwCDSErrors(interactionId, Collections.singletonList( + new Error("Invalid Page Size", "urn:au-cds:error:cds-all:Field/InvalidDateTime", message)), + HttpStatus.BAD_REQUEST); + } + protected boolean hasSupportedVersion(Integer xMinV, Integer xV, int maxSupportedVersion) { if (xMinV == null || xMinV > xV) { return (maxSupportedVersion >= xV); diff --git a/data-holder/src/main/java/au/org/consumerdatastandards/holder/api/banking/BankingAccountsApiController.java b/data-holder/src/main/java/au/org/consumerdatastandards/holder/api/banking/BankingAccountsApiController.java index ef8689eb..4699e704 100644 --- a/data-holder/src/main/java/au/org/consumerdatastandards/holder/api/banking/BankingAccountsApiController.java +++ b/data-holder/src/main/java/au/org/consumerdatastandards/holder/api/banking/BankingAccountsApiController.java @@ -133,6 +133,7 @@ public ResponseEntity getTransactions(String acc Integer xV) { int supportedVersion = validateHeaders(xCdsClientHeaders, xFapiCustomerIpAddress, xFapiInteractionId, xMinV, xV, 1); validatePageSize(pageSize, xFapiInteractionId); + validateOldestNewestOffsetDateTime(oldestTime, newestTime, xFapiInteractionId); HttpHeaders headers = generateResponseHeaders(xFapiInteractionId, supportedVersion); Integer actualPage = getPagingValue(page, 1); Integer actualPageSize = getPagingValue(pageSize, 25); diff --git a/data-holder/src/main/java/au/org/consumerdatastandards/holder/api/banking/BankingProductsApiController.java b/data-holder/src/main/java/au/org/consumerdatastandards/holder/api/banking/BankingProductsApiController.java index 765135d6..c3075ed7 100644 --- a/data-holder/src/main/java/au/org/consumerdatastandards/holder/api/banking/BankingProductsApiController.java +++ b/data-holder/src/main/java/au/org/consumerdatastandards/holder/api/banking/BankingProductsApiController.java @@ -83,6 +83,7 @@ public ResponseEntity listProducts(ParamEffective ef effective, updatedSince, brand, productCategory, page, pageSize); int supportedVersion = validateSupportedVersion(xMinV, xV, WebUtil.NO_INTERACTION_ID, 3); validatePageSize(pageSize, WebUtil.NO_INTERACTION_ID); + validateUpdatedSince(updatedSince, WebUtil.NO_INTERACTION_ID); HttpHeaders headers = generateResponseHeaders(null, supportedVersion); BankingProduct bankingProduct = new BankingProductV2(); bankingProduct.setLastUpdated(updatedSince); diff --git a/data-holder/src/main/java/au/org/consumerdatastandards/holder/api/energy/EnergyApi.java b/data-holder/src/main/java/au/org/consumerdatastandards/holder/api/energy/EnergyApi.java index f2b68528..c1ba6c26 100644 --- a/data-holder/src/main/java/au/org/consumerdatastandards/holder/api/energy/EnergyApi.java +++ b/data-holder/src/main/java/au/org/consumerdatastandards/holder/api/energy/EnergyApi.java @@ -251,7 +251,7 @@ ResponseEntity getBalanceForAccount( response = EnergyBillingListResponse.class), @ApiResponse(code = 400, responseHeaders = @ResponseHeader(name = "x-fapi-interaction-id", response = UUID.class, description = "An **[[RFC4122]](#nref-RFC4122)** UUID used as a correlation id. If provided, the data holder must play back this value in the x-fapi-interaction-id response header. If not provided a **[[RFC4122]](#nref-RFC4122)** UUID value is required to be provided in the response header to track the interaction."), - message = "Invalid Version / Missing Field / Invalid Field / Invalid Page Size", + message = "Invalid Version / Missing Field / Invalid Field / Invalid Page Size / Invalid Date", response = ErrorListResponse.class), @ApiResponse(code = 406, responseHeaders = @ResponseHeader(name = "x-fapi-interaction-id", response = UUID.class, description = "An **[[RFC4122]](#nref-RFC4122)** UUID used as a correlation id. If provided, the data holder must play back this value in the x-fapi-interaction-id response header. If not provided a **[[RFC4122]](#nref-RFC4122)** UUID value is required to be provided in the response header to track the interaction."), @@ -534,7 +534,7 @@ ResponseEntity getDERForServicePoint( response = EnergyInvoiceListResponse.class), @ApiResponse(code = 400, responseHeaders = @ResponseHeader(name = "x-fapi-interaction-id", response = UUID.class, description = "An **[[RFC4122]](#nref-RFC4122)** UUID used as a correlation id. If provided, the data holder must play back this value in the x-fapi-interaction-id response header. If not provided a **[[RFC4122]](#nref-RFC4122)** UUID value is required to be provided in the response header to track the interaction."), - message = "Invalid Version / Missing Field / Invalid Field / Invalid Page Size", + message = "Invalid Version / Missing Field / Invalid Field / Invalid Page Size / Invalid Date", response = ErrorListResponse.class), @ApiResponse(code = 406, responseHeaders = @ResponseHeader(name = "x-fapi-interaction-id", response = UUID.class, description = "An **[[RFC4122]](#nref-RFC4122)** UUID used as a correlation id. If provided, the data holder must play back this value in the x-fapi-interaction-id response header. If not provided a **[[RFC4122]](#nref-RFC4122)** UUID value is required to be provided in the response header to track the interaction."), @@ -1287,7 +1287,7 @@ ResponseEntity listBalancesForAccounts( response = EnergyBillingListResponse.class), @ApiResponse(code = 400, responseHeaders = @ResponseHeader(name = "x-fapi-interaction-id", response = UUID.class, description = "An **[[RFC4122]](#nref-RFC4122)** UUID used as a correlation id. If provided, the data holder must play back this value in the x-fapi-interaction-id response header. If not provided a **[[RFC4122]](#nref-RFC4122)** UUID value is required to be provided in the response header to track the interaction."), - message = "Invalid Version / Missing Field / Invalid Field / Invalid Page Size", + message = "Invalid Version / Missing Field / Invalid Field / Invalid Page Size / Invalid Date", response = ErrorListResponse.class), @ApiResponse(code = 406, responseHeaders = @ResponseHeader(name = "x-fapi-interaction-id", response = UUID.class, description = "An **[[RFC4122]](#nref-RFC4122)** UUID used as a correlation id. If provided, the data holder must play back this value in the x-fapi-interaction-id response header. If not provided a **[[RFC4122]](#nref-RFC4122)** UUID value is required to be provided in the response header to track the interaction."), @@ -1395,7 +1395,7 @@ ResponseEntity listBillingBulk( response = EnergyBillingListResponse.class), @ApiResponse(code = 400, responseHeaders = @ResponseHeader(name = "x-fapi-interaction-id", response = UUID.class, description = "An **[[RFC4122]](#nref-RFC4122)** UUID used as a correlation id. If provided, the data holder must play back this value in the x-fapi-interaction-id response header. If not provided a **[[RFC4122]](#nref-RFC4122)** UUID value is required to be provided in the response header to track the interaction."), - message = "Invalid Version / Missing Field / Invalid Field / Invalid Page Size", + message = "Invalid Version / Missing Field / Invalid Field / Invalid Page Size / Invalid Date", response = ErrorListResponse.class), @ApiResponse(code = 406, responseHeaders = @ResponseHeader(name = "x-fapi-interaction-id", response = UUID.class, description = "An **[[RFC4122]](#nref-RFC4122)** UUID used as a correlation id. If provided, the data holder must play back this value in the x-fapi-interaction-id response header. If not provided a **[[RFC4122]](#nref-RFC4122)** UUID value is required to be provided in the response header to track the interaction."), @@ -1707,7 +1707,7 @@ ResponseEntity listDERForServicePoints( response = EnergyInvoiceListResponse.class), @ApiResponse(code = 400, responseHeaders = @ResponseHeader(name = "x-fapi-interaction-id", response = UUID.class, description = "An **[[RFC4122]](#nref-RFC4122)** UUID used as a correlation id. If provided, the data holder must play back this value in the x-fapi-interaction-id response header. If not provided a **[[RFC4122]](#nref-RFC4122)** UUID value is required to be provided in the response header to track the interaction."), - message = "Invalid Version / Missing Field / Invalid Field / Invalid Page Size", + message = "Invalid Version / Missing Field / Invalid Field / Invalid Page Size / Invalid Date", response = ErrorListResponse.class), @ApiResponse(code = 406, responseHeaders = @ResponseHeader(name = "x-fapi-interaction-id", response = UUID.class, description = "An **[[RFC4122]](#nref-RFC4122)** UUID used as a correlation id. If provided, the data holder must play back this value in the x-fapi-interaction-id response header. If not provided a **[[RFC4122]](#nref-RFC4122)** UUID value is required to be provided in the response header to track the interaction."), @@ -1814,7 +1814,7 @@ ResponseEntity listInvoicesBulk( response = EnergyInvoiceListResponse.class), @ApiResponse(code = 400, responseHeaders = @ResponseHeader(name = "x-fapi-interaction-id", response = UUID.class, description = "An **[[RFC4122]](#nref-RFC4122)** UUID used as a correlation id. If provided, the data holder must play back this value in the x-fapi-interaction-id response header. If not provided a **[[RFC4122]](#nref-RFC4122)** UUID value is required to be provided in the response header to track the interaction."), - message = "Invalid Version / Missing Field / Invalid Field / Invalid Page Size", + message = "Invalid Version / Missing Field / Invalid Field / Invalid Page Size / Invalid Date", response = ErrorListResponse.class), @ApiResponse(code = 406, responseHeaders = @ResponseHeader(name = "x-fapi-interaction-id", response = UUID.class, description = "An **[[RFC4122]](#nref-RFC4122)** UUID used as a correlation id. If provided, the data holder must play back this value in the x-fapi-interaction-id response header. If not provided a **[[RFC4122]](#nref-RFC4122)** UUID value is required to be provided in the response header to track the interaction."), @@ -1923,7 +1923,7 @@ ResponseEntity listInvoicesForAccounts( message = "Successful response", response = EnergyPlanListResponse.class), @ApiResponse(code = 400, - message = "Invalid Version / Missing Field / Invalid Field / Invalid Page Size", + message = "Invalid Version / Missing Field / Invalid Field / Invalid Page Size / Invalid Date", response = ErrorListResponse.class), @ApiResponse(code = 406, message = "Unsupported Version", @@ -2127,7 +2127,7 @@ ResponseEntity listServicePoints( response = EnergyUsageListResponse.class), @ApiResponse(code = 400, responseHeaders = @ResponseHeader(name = "x-fapi-interaction-id", response = UUID.class, description = "An **[[RFC4122]](#nref-RFC4122)** UUID used as a correlation id. If provided, the data holder must play back this value in the x-fapi-interaction-id response header. If not provided a **[[RFC4122]](#nref-RFC4122)** UUID value is required to be provided in the response header to track the interaction."), - message = "Invalid Version / Missing Field / Invalid Field / Invalid Page Size", + message = "Invalid Version / Missing Field / Invalid Field / Invalid Page Size / Invalid Date", response = ErrorListResponse.class), @ApiResponse(code = 406, responseHeaders = @ResponseHeader(name = "x-fapi-interaction-id", response = UUID.class, description = "An **[[RFC4122]](#nref-RFC4122)** UUID used as a correlation id. If provided, the data holder must play back this value in the x-fapi-interaction-id response header. If not provided a **[[RFC4122]](#nref-RFC4122)** UUID value is required to be provided in the response header to track the interaction."), @@ -2241,7 +2241,7 @@ ResponseEntity listUsageBulk( response = EnergyUsageListResponse.class), @ApiResponse(code = 400, responseHeaders = @ResponseHeader(name = "x-fapi-interaction-id", response = UUID.class, description = "An **[[RFC4122]](#nref-RFC4122)** UUID used as a correlation id. If provided, the data holder must play back this value in the x-fapi-interaction-id response header. If not provided a **[[RFC4122]](#nref-RFC4122)** UUID value is required to be provided in the response header to track the interaction."), - message = "Invalid Version / Invalid Page Size / Missing Field / Invalid Field", + message = "Invalid Version / Invalid Page Size / Missing Field / Invalid Field / Invalid Date", response = ErrorListResponse.class), @ApiResponse(code = 406, responseHeaders = @ResponseHeader(name = "x-fapi-interaction-id", response = UUID.class, description = "An **[[RFC4122]](#nref-RFC4122)** UUID used as a correlation id. If provided, the data holder must play back this value in the x-fapi-interaction-id response header. If not provided a **[[RFC4122]](#nref-RFC4122)** UUID value is required to be provided in the response header to track the interaction."), diff --git a/data-holder/src/main/java/au/org/consumerdatastandards/holder/api/energy/EnergyApiController.java b/data-holder/src/main/java/au/org/consumerdatastandards/holder/api/energy/EnergyApiController.java index 211bc66a..768b6eee 100644 --- a/data-holder/src/main/java/au/org/consumerdatastandards/holder/api/energy/EnergyApiController.java +++ b/data-holder/src/main/java/au/org/consumerdatastandards/holder/api/energy/EnergyApiController.java @@ -131,6 +131,7 @@ public ResponseEntity getBillingForAccount(String acc OffsetDateTime newestTime, OffsetDateTime oldestTime, Integer page, Integer pageSize, UUID xFapiInteractionId, Date xFapiAuthDate, String xFapiCustomerIpAddress, String xCdsClientHeaders) { int supportedVersion = validateSupportedVersion(xMinV, xV, xFapiInteractionId, 2); + validateOldestNewestOffsetDateTime(oldestTime, newestTime, xFapiInteractionId); validatePageSize(pageSize, xFapiInteractionId); if (!service.checkAccountExistence(accountId)) { throwInvalidAccount(accountId, xFapiInteractionId); @@ -199,6 +200,7 @@ public ResponseEntity getInvoicesForAccount(String ac LocalDate newestDate, LocalDate oldestDate, Integer page, Integer pageSize, UUID xFapiInteractionId, Date xFapiAuthDate, String xFapiCustomerIpAddress, String xCdsClientHeaders) { int supportedVersion = validateSupportedVersion(xMinV, xV, xFapiInteractionId, 1); + validateOldestNewestLocalDate(oldestDate, newestDate, xFapiInteractionId); validatePageSize(pageSize, xFapiInteractionId); if (!service.checkAccountExistence(accountId)) { throwInvalidAccount(accountId, xFapiInteractionId); @@ -387,6 +389,7 @@ public ResponseEntity listBillingBulk(Integer xV, Int OffsetDateTime oldestTime, Integer page, Integer pageSize, UUID xFapiInteractionId, Date xFapiAuthDate, String xFapiCustomerIpAddress, String xCdsClientHeaders) { int supportedVersion = validateSupportedVersion(xMinV, xV, xFapiInteractionId, 2); + validateOldestNewestOffsetDateTime(oldestTime, newestTime, xFapiInteractionId); HttpHeaders headers = generateResponseHeaders(xFapiInteractionId, supportedVersion); Integer actualPage = getPagingValue(page, 1); Integer actualPageSize = getPagingValue(pageSize, 25); @@ -413,6 +416,7 @@ public ResponseEntity listBillingForAccounts(Integer UUID xFapiInteractionId, Date xFapiAuthDate, String xFapiCustomerIpAddress, String xCdsClientHeaders, ParamIntervalReadsEnum intervalReads) { int supportedVersion = validateSupportedVersion(xMinV, xV, xFapiInteractionId, 2); + validateOldestNewestOffsetDateTime(oldestTime, newestTime, xFapiInteractionId); validatePageSize(pageSize, xFapiInteractionId); List accountIds = accountIdList.getData().getAccountIds(); validateAccountIds(accountIds, xFapiInteractionId); @@ -497,6 +501,7 @@ public ResponseEntity listInvoicesBulk(Integer xV, In String xFapiCustomerIpAddress, String xCdsClientHeaders) { int supportedVersion = validateSupportedVersion(xMinV, xV, xFapiInteractionId, 1); + validateOldestNewestLocalDate(oldestDate, newestDate, xFapiInteractionId); validatePageSize(pageSize, xFapiInteractionId); HttpHeaders headers = generateResponseHeaders(xFapiInteractionId, supportedVersion); Integer actualPage = getPagingValue(page, 1); @@ -524,6 +529,7 @@ public ResponseEntity listInvoicesForAccounts(Integer UUID xFapiInteractionId, Date xFapiAuthDate, String xFapiCustomerIpAddress, String xCdsClientHeaders) { int supportedVersion = validateSupportedVersion(xMinV, xV, xFapiInteractionId, 1); + validateOldestNewestLocalDate(oldestDate, newestDate, xFapiInteractionId); validatePageSize(pageSize, xFapiInteractionId); List accountIds = accountIdList.getData().getAccountIds(); validateAccountIds(accountIds, xFapiInteractionId); @@ -565,6 +571,7 @@ public ResponseEntity listPlans(Integer xV, Integer xMin Integer page, Integer pageSize) { int supportedVersion = validateSupportedVersion(xMinV, xV, WebUtil.NO_INTERACTION_ID, 1); + validateUpdatedSince(updatedSince, WebUtil.NO_INTERACTION_ID); validatePageSize(pageSize, WebUtil.NO_INTERACTION_ID); HttpHeaders headers = generateResponseHeaders(null, supportedVersion); EnergyPlanListResponse response = new EnergyPlanListResponse(); @@ -623,6 +630,7 @@ public ResponseEntity listUsageBulk(Integer xV, Integer String xFapiCustomerIpAddress, String xCdsClientHeaders, ParamIntervalReadsEnum intervalReads) { int supportedVersion = validateSupportedVersion(xMinV, xV, xFapiInteractionId, 1); + validateOldestNewestLocalDate(oldestDate, newestDate, xFapiInteractionId); validatePageSize(pageSize, xFapiInteractionId); HttpHeaders headers = generateResponseHeaders(xFapiInteractionId, supportedVersion); Integer actualPage = getPagingValue(page, 1); @@ -652,6 +660,7 @@ public ResponseEntity listUsageForServicePoints(Integer String xCdsClientHeaders, ParamIntervalReadsEnum intervalReads) { int supportedVersion = validateSupportedVersion(xMinV, xV, xFapiInteractionId, 1); + validateOldestNewestLocalDate(oldestDate, newestDate, xFapiInteractionId); validatePageSize(pageSize, xFapiInteractionId); List servicePointIds = servicePointIdList.getData().getServicePointIds(); validateServicePointIds(servicePointIds, xFapiInteractionId); diff --git a/data-holder/src/main/java/au/org/consumerdatastandards/holder/model/energy/EnergyInvoiceGasUsageCharges.java b/data-holder/src/main/java/au/org/consumerdatastandards/holder/model/energy/EnergyInvoiceGasUsageCharges.java index 752e8bec..456ea84f 100644 --- a/data-holder/src/main/java/au/org/consumerdatastandards/holder/model/energy/EnergyInvoiceGasUsageCharges.java +++ b/data-holder/src/main/java/au/org/consumerdatastandards/holder/model/energy/EnergyInvoiceGasUsageCharges.java @@ -96,12 +96,12 @@ public EnergyInvoiceGasUsageCharges totalOnceOffCharges(String totalOnceOffCharg } /** - * The aggregate total of any once off charges arising from electricity usage for the period covered by the invoice (exclusive of GST) + * The aggregate total of any once off charges arising from gas usage for the period covered by the invoice (exclusive of GST) * * @return totalOnceOffCharges */ @ApiModelProperty(required = true, - value = "The aggregate total of any once off charges arising from electricity usage for the period covered by the invoice (exclusive of GST)") + value = "The aggregate total of any once off charges arising from gas usage for the period covered by the invoice (exclusive of GST)") @NotNull public String getTotalOnceOffCharges() { return totalOnceOffCharges; @@ -117,12 +117,12 @@ public EnergyInvoiceGasUsageCharges totalOnceOffDiscounts(String totalOnceOffDis } /** - * The aggregate total of any once off discounts or credits arising from electricity usage for the period covered by the invoice (exclusive of GST) + * The aggregate total of any once off discounts or credits arising from gas usage for the period covered by the invoice (exclusive of GST) * * @return totalOnceOffDiscounts */ @ApiModelProperty(required = true, - value = "The aggregate total of any once off discounts or credits arising from electricity usage for the period covered by the invoice (exclusive of GST)") + value = "The aggregate total of any once off discounts or credits arising from gas usage for the period covered by the invoice (exclusive of GST)") @NotNull public String getTotalOnceOffDiscounts() { return totalOnceOffDiscounts; @@ -166,11 +166,11 @@ public EnergyInvoiceGasUsageCharges totalGst(String totalGst) { } /** - * The total GST for all electricity usage charges. If absent then zero is assumed + * The total GST for all gas usage charges. If absent then zero is assumed * * @return totalGst */ - @ApiModelProperty(value = "The total GST for all electricity usage charges. If absent then zero is assumed") + @ApiModelProperty(value = "The total GST for all gas usage charges. If absent then zero is assumed") public String getTotalGst() { return totalGst; } From 2253c3fb6df12d024a2471586a047b3449fe86a6 Mon Sep 17 00:00:00 2001 From: Vadym <30234255+vadkor@users.noreply.github.com> Date: Sat, 25 Nov 2023 15:29:27 +1100 Subject: [PATCH 3/4] Updated Banking to CDS spec 1.28.0 --- .../holder/api/banking/BankingAccountsApi.java | 4 ++-- .../holder/api/banking/BankingAccountsApiController.java | 2 +- .../holder/api/banking/BankingPayeesApi.java | 4 ++-- .../holder/api/banking/BankingProductsApi.java | 2 +- .../holder/api/banking/BankingScheduledPaymentsApi.java | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/data-holder/src/main/java/au/org/consumerdatastandards/holder/api/banking/BankingAccountsApi.java b/data-holder/src/main/java/au/org/consumerdatastandards/holder/api/banking/BankingAccountsApi.java index 16d90f6b..114cd1dc 100644 --- a/data-holder/src/main/java/au/org/consumerdatastandards/holder/api/banking/BankingAccountsApi.java +++ b/data-holder/src/main/java/au/org/consumerdatastandards/holder/api/banking/BankingAccountsApi.java @@ -205,7 +205,7 @@ ResponseEntity getTransactionDetail( ), @ApiResponse( code = 400, - message = "Invalid Version / Invalid Field / Missing Field / Invalid Date / Invalid Page Size", + message = "Invalid Field / Missing Field / Invalid Date / Invalid Page Size", responseHeaders = @ResponseHeader(name = "x-fapi-interaction-id", response = UUID.class, description = "An **[[RFC4122]](#nref-RFC4122)** UUID used as a correlation id. If provided, the data holder must play back this value in the x-fapi-interaction-id response header. If not provided a **[[RFC4122]](#nref-RFC4122)** UUID value is required to be provided in the response header to track the interaction."), response = ErrorListResponse.class ), @@ -304,7 +304,7 @@ ResponseEntity getTransactions( ), @ApiResponse( code = 400, - message = "Invalid Version / Invalid Page Size / Invalid Field / Missing Field", + message = "Invalid Page Size / Invalid Field / Missing Field", responseHeaders = @ResponseHeader(name = "x-fapi-interaction-id", response = UUID.class, description = "An **[[RFC4122]](#nref-RFC4122)** UUID used as a correlation id. If provided, the data holder must play back this value in the x-fapi-interaction-id response header. If not provided a **[[RFC4122]](#nref-RFC4122)** UUID value is required to be provided in the response header to track the interaction."), response = ErrorListResponse.class ), diff --git a/data-holder/src/main/java/au/org/consumerdatastandards/holder/api/banking/BankingAccountsApiController.java b/data-holder/src/main/java/au/org/consumerdatastandards/holder/api/banking/BankingAccountsApiController.java index 4699e704..f3edef7b 100644 --- a/data-holder/src/main/java/au/org/consumerdatastandards/holder/api/banking/BankingAccountsApiController.java +++ b/data-holder/src/main/java/au/org/consumerdatastandards/holder/api/banking/BankingAccountsApiController.java @@ -147,7 +147,7 @@ public ResponseEntity getTransactions(String acc ResponseBankingTransactionList responseBankingTransactionList = new ResponseBankingTransactionList(); responseBankingTransactionList.setData(listData); responseBankingTransactionList.setLinks(getLinkData(request, transactionPage, actualPage, actualPageSize)); - responseBankingTransactionList.setMeta(getMetaData(transactionPage)); + responseBankingTransactionList.setMeta(getTxMetaData(transactionPage, false)); return new ResponseEntity<>(responseBankingTransactionList, headers, HttpStatus.OK); } diff --git a/data-holder/src/main/java/au/org/consumerdatastandards/holder/api/banking/BankingPayeesApi.java b/data-holder/src/main/java/au/org/consumerdatastandards/holder/api/banking/BankingPayeesApi.java index 1a0686b5..60be6085 100644 --- a/data-holder/src/main/java/au/org/consumerdatastandards/holder/api/banking/BankingPayeesApi.java +++ b/data-holder/src/main/java/au/org/consumerdatastandards/holder/api/banking/BankingPayeesApi.java @@ -58,7 +58,7 @@ default Optional getRequest() { ), @ApiResponse( code = 400, - message = "Invalid Version / Invalid Page Size / Invalid Field / Missing Field", + message = "Invalid Page Size / Invalid Field / Missing Field", responseHeaders = @ResponseHeader(name = "x-fapi-interaction-id", response = UUID.class, description = "An **[[RFC4122]](#nref-RFC4122)** UUID used as a correlation id. If provided, the data holder must play back this value in the x-fapi-interaction-id response header. If not provided a **[[RFC4122]](#nref-RFC4122)** UUID value is required to be provided in the response header to track the interaction."), response = ErrorListResponse.class ), @@ -134,7 +134,7 @@ ResponseEntity getPayeeDetail( ), @ApiResponse( code = 400, - message = "Invalid Version / Invalid Page Size / Invalid Field / Missing Field", + message = "Invalid Page Size / Invalid Field / Missing Field", responseHeaders = @ResponseHeader(name = "x-fapi-interaction-id", response = UUID.class, description = "An **[[RFC4122]](#nref-RFC4122)** UUID used as a correlation id. If provided, the data holder must play back this value in the x-fapi-interaction-id response header. If not provided a **[[RFC4122]](#nref-RFC4122)** UUID value is required to be provided in the response header to track the interaction."), response = ErrorListResponse.class ), diff --git a/data-holder/src/main/java/au/org/consumerdatastandards/holder/api/banking/BankingProductsApi.java b/data-holder/src/main/java/au/org/consumerdatastandards/holder/api/banking/BankingProductsApi.java index 548198a3..4fe53128 100644 --- a/data-holder/src/main/java/au/org/consumerdatastandards/holder/api/banking/BankingProductsApi.java +++ b/data-holder/src/main/java/au/org/consumerdatastandards/holder/api/banking/BankingProductsApi.java @@ -99,7 +99,7 @@ ResponseEntity getProductDetail( ), @ApiResponse( code = 400, - message = "Invalid Version / Invalid Page Size / Invalid Field / Missing Field / Invalid Date", + message = "Invalid Page Size / Invalid Field / Missing Field / Invalid Date", response = ErrorListResponse.class ), @ApiResponse( diff --git a/data-holder/src/main/java/au/org/consumerdatastandards/holder/api/banking/BankingScheduledPaymentsApi.java b/data-holder/src/main/java/au/org/consumerdatastandards/holder/api/banking/BankingScheduledPaymentsApi.java index 37bafc71..32b74421 100644 --- a/data-holder/src/main/java/au/org/consumerdatastandards/holder/api/banking/BankingScheduledPaymentsApi.java +++ b/data-holder/src/main/java/au/org/consumerdatastandards/holder/api/banking/BankingScheduledPaymentsApi.java @@ -137,7 +137,7 @@ ResponseEntity listScheduledPayments( ), @ApiResponse( code = 400, - message = "Invalid Version / Invalid Page Size / Invalid Field / Missing Field", + message = "Invalid Page Size / Invalid Field / Missing Field", responseHeaders = @ResponseHeader(name = "x-fapi-interaction-id", response = UUID.class, description = "An **[[RFC4122]](#nref-RFC4122)** UUID used as a correlation id. If provided, the data holder must play back this value in the x-fapi-interaction-id response header. If not provided a **[[RFC4122]](#nref-RFC4122)** UUID value is required to be provided in the response header to track the interaction."), response = ErrorListResponse.class ), @@ -222,7 +222,7 @@ ResponseEntity listScheduledPaymentsBulk( ), @ApiResponse( code = 400, - message = "Invalid Version / Invalid Page Size / Invalid Field / Missing Field", + message = "Invalid Page Size / Invalid Field / Missing Field", responseHeaders = @ResponseHeader(name = "x-fapi-interaction-id", response = UUID.class, description = "An **[[RFC4122]](#nref-RFC4122)** UUID used as a correlation id. If provided, the data holder must play back this value in the x-fapi-interaction-id response header. If not provided a **[[RFC4122]](#nref-RFC4122)** UUID value is required to be provided in the response header to track the interaction."), response = ErrorListResponse.class ), From ca7abf1c081b6a51b01e97b95aa7e1bc29e98418 Mon Sep 17 00:00:00 2001 From: Vadym <30234255+vadkor@users.noreply.github.com> Date: Sat, 25 Nov 2023 16:32:26 +1100 Subject: [PATCH 4/4] Updated version to 2.3.0 --- client-cli/README.md | 8 ++++---- .../au/org/consumerdatastandards/client/ApiClient.java | 2 +- data-holder/README.md | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/client-cli/README.md b/client-cli/README.md index 8394266a..834cc7c2 100644 --- a/client-cli/README.md +++ b/client-cli/README.md @@ -29,11 +29,11 @@ or, if you want to point to your own keystore: docker run -p 8686:8686 -it -v /your/local/path/to/java-artefacts/client-cli/keystore:/keystore consumerdatastandardsaustralia/client-cli:x.x.x -Where `x.x.x` is the version, say, `2.2.0` +Where `x.x.x` is the version, say, `2.3.0` Run locally-built image: - docker run -p 8383:8383 consumerdatastandardsaustralia/data-holder:2.2.1-SNAPSHOT + docker run -p 8383:8383 consumerdatastandardsaustralia/data-holder:2.3.1-SNAPSHOT ### Command Reference @@ -183,8 +183,8 @@ or in the application.properties file before launching the application with `mvn Example: - java -Dserver=http://localhost:8383/cds-au/v1 -jar target/client-cli-2.2.0.jar + java -Dserver=http://localhost:8383/cds-au/v1 -jar target/client-cli-2.3.0.jar or - java -Dserver=http://localhost:8383/cds-au/v1 -jar target/client-cli-2.2.1-SNAPSHOT.jar \ No newline at end of file + java -Dserver=http://localhost:8383/cds-au/v1 -jar target/client-cli-2.3.1-SNAPSHOT.jar \ No newline at end of file diff --git a/client/src/main/java/au/org/consumerdatastandards/client/ApiClient.java b/client/src/main/java/au/org/consumerdatastandards/client/ApiClient.java index e6b7bc2a..1439ca1c 100644 --- a/client/src/main/java/au/org/consumerdatastandards/client/ApiClient.java +++ b/client/src/main/java/au/org/consumerdatastandards/client/ApiClient.java @@ -65,7 +65,7 @@ public ApiClient(boolean validating) { json = new JSON(validating); // Set default User-Agent. - setUserAgent("CDS Client/2.2.0/java"); + setUserAgent("CDS Client/2.3.0/java"); addDefaultHeader("Accept", "application/json"); addDefaultHeader("Content-Type", "application/json"); diff --git a/data-holder/README.md b/data-holder/README.md index abbb52a1..fff4be06 100644 --- a/data-holder/README.md +++ b/data-holder/README.md @@ -20,7 +20,7 @@ If you want to pass a [test data file](https://github.com/ConsumerDataStandardsA java -jar target/data-holder-x.x.x.jar /your/local/path/to/testdata-cli/samples/output/u1-output.json -Where `x.x.x` is the version, say, `2.2.0` +Where `x.x.x` is the version, say, `2.3.0` ## Docker @@ -36,8 +36,8 @@ If you want to pass a [test data file](https://github.com/ConsumerDataStandardsA docker run -p 8383:8383 -v /your/local/path/to/testdata-cli/samples/output/u1-output.json:/testdata/u1-output.json consumerdatastandardsaustralia/data-holder:x.x.x /testdata/u1-output.json -Where `x.x.x` is the version, say, `2.2.0` +Where `x.x.x` is the version, say, `2.3.0` Run locally-built image: - docker run -p 8383:8383 consumerdatastandardsaustralia/data-holder:2.2.1-SNAPSHOT + docker run -p 8383:8383 consumerdatastandardsaustralia/data-holder:2.3.1-SNAPSHOT