Skip to content

Commit

Permalink
36: Initial controllers and their interfaces for VRPs
Browse files Browse the repository at this point in the history
- There are no request parameters in v3.1.8 of the VRP swagger spec, meaning the generated code did not have any request body objects or headers. I have added the request body objects manually, but they may not e correct.
- I assume this is a mistake in the swagger spec and have created this issue: OpenBankingUK/read-write-api-specs#51
- As per other controllers in the Read/Write API, a number of annotations (e.g. @PreAuthorize and @OpenBankingAPI) need adding. I have inserted them in commented out sections, but certain things (e.g.  the scopes) may not be correct.

Issue: OpenBankingToolkit/openbanking-toolkit#36
  • Loading branch information
matt-wills committed Jun 8, 2021
1 parent c745011 commit ffb7737
Show file tree
Hide file tree
Showing 4 changed files with 363 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (4.3.1).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package com.forgerock.openbanking.aspsp.rs.api.vrp.v3_1_8;

import com.forgerock.openbanking.exceptions.OBErrorResponseException;
import io.swagger.annotations.*;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import uk.org.openbanking.datamodel.vrp.OBDomesticVRPConsentRequest;
import uk.org.openbanking.datamodel.vrp.OBDomesticVRPConsentResponse;
import uk.org.openbanking.datamodel.vrp.OBVRPFundsConfirmationRequest;

import javax.validation.Valid;

import static org.springframework.web.bind.annotation.RequestMethod.DELETE;
import static org.springframework.web.bind.annotation.RequestMethod.POST;

@javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen", date = "2021-05-27T13:44:23.551801+01:00[Europe/London]")

//@OpenBankingAPI(
// obVersion = "3.1.8",
// obGroupName = OBGroupName.VRP,
// obReference = OBReference.VARIABLE_RECURRING_PAYMENTS
//)
@Validated
@Api(value = "domestic-vrp-consents", description = "the domestic-vrp-consents API")
public interface DomesticVrpConsentsApi {

static String DOMESTIC_VRP_CONSENTS = "/domestic-vrp-consents";

/**
* POST /domestic-vrp-consents : create a domestic vrp
* create a domestic vrp
*
* @return (status code 201)
*/
@ApiOperation(
value = "create a domestic vrp",
nickname = "domesticVrpConsentsPost",
notes = "create a domestic vrp",
response = OBDomesticVRPConsentResponse.class,
// authorizations = {
// @Authorization(value = "TPPOAuth2Security", scopes = {
// @AuthorizationScope(scope = "vrps", description = "Generic VRPs scope")
// })
// },
tags = {"variable-recurring-payments",})
@ApiResponses(value = {@ApiResponse(code = 201, message = "", response = OBDomesticVRPConsentResponse.class)})
//@PreAuthorize("hasAuthority('ROLE_VRP')")
//@OpenBankingAPI(
// obReference = OBReference.CREATE_DOMESTIC_VRP_CONSENT
//)
@RequestMapping(
value = DOMESTIC_VRP_CONSENTS,
produces = {"application/json"},
method = POST)
ResponseEntity<OBDomesticVRPConsentResponse> createDomesticVrpConsent(
@ApiParam(value = "Default", required = true)
@Valid
@RequestBody OBDomesticVRPConsentRequest domesticVRPConsentRequest // added manually
// none of the headers have been generated from the open-api spec
) throws OBErrorResponseException;

/**
* GET /domestic-vrp-consents/:consentId : create a domestic vrp
* create a domestic vrp
*
* @return (status code 200)
*/
@ApiOperation(
value = "create a domestic vrp",
nickname = "domesticVrpConsentsConsentIdGet",
notes = "create a domestic vrp",
response = OBDomesticVRPConsentResponse.class,
// authorizations = {
// @Authorization(value = "TPPOAuth2Security", scopes = {
// @AuthorizationScope(scope = "vrps", description = "Generic VRPs scope")
// })
// },
tags = {"variable-recurring-payments",})
@ApiResponses(value = {@ApiResponse(code = 200, message = "", response = OBDomesticVRPConsentResponse.class)})
//@PreAuthorize("hasAuthority('ROLE_VRP')")
//@OpenBankingAPI(
// obReference = OBReference.GET_DOMESTIC_VRP_CONSENT
//)
@RequestMapping(
value = DOMESTIC_VRP_CONSENTS + "/:consentId",
produces = {"application/json"},
method = RequestMethod.GET)
ResponseEntity<OBDomesticVRPConsentResponse> getDomesticVrpConsent() throws OBErrorResponseException;

/**
* DELETE /domestic-vrp-consents/:consentId : create a domestic vrp
* create a domestic vrp
*
* @return all good (status code 204)
*/
@ApiOperation(
value = "create a domestic vrp",
nickname = "domesticVrpConsentsConsentIdDelete",
notes = "create a domestic vrp",
// authorizations = {
// @Authorization(value = "TPPOAuth2Security", scopes = {
// @AuthorizationScope(scope = "vrps", description = "Generic VRPs scope")
// })
// },
tags = {"variable-recurring-payments",})
@ApiResponses(value = {@ApiResponse(code = 204, message = "all good")})
//@PreAuthorize("hasAuthority('ROLE_VRP')")
//@OpenBankingAPI(
// obReference = OBReference.DELETE_DOMESTIC_VRP_CONSENT
//)
@RequestMapping(value = DOMESTIC_VRP_CONSENTS + "/:consentId", method = DELETE)
ResponseEntity<Void> deleteDomesticVrpConsent() throws OBErrorResponseException;

/**
* POST /domestic-vrp-consents/:consentId/funds-confirmation : create a domestic vrp
* create a domestic vrp
*
* @return (status code 200)
*/
@ApiOperation(
value = "create a domestic vrp",
nickname = "domesticVrpConsentsConsentIdFundsConfirmationPost",
notes = "create a domestic vrp",
response = Object.class,
// authorizations = {
// @Authorization(value = "TPPOAuth2Security", scopes = {
// @AuthorizationScope(scope = "vrps", description = "Generic VRPs scope")
// })
// },
tags = {"variable-recurring-payments",})
@ApiResponses(value = {@ApiResponse(code = 200, message = "", response = Object.class)})
//@PreAuthorize("hasAuthority('ROLE_VRP')")
//@OpenBankingAPI(
// obReference = OBReference.CREATE_DOMESTIC_VRP_CONSENT_FUNDS_CONFIRMATION
//)
@RequestMapping(
value = DOMESTIC_VRP_CONSENTS + "/:consentId/funds-confirmation",
produces = {"application/json"},
method = POST)
ResponseEntity<Object> createDomesticVrpConsentsConsentFundsConfirmation(
@ApiParam(value = "Default", required = true)
@Valid
@RequestBody OBVRPFundsConfirmationRequest vrpFundsConfirmationRequest) throws OBErrorResponseException;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package com.forgerock.openbanking.aspsp.rs.api.vrp.v3_1_8;

import com.forgerock.openbanking.exceptions.OBErrorResponseException;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import uk.org.openbanking.datamodel.vrp.OBDomesticVRPConsentRequest;
import uk.org.openbanking.datamodel.vrp.OBDomesticVRPConsentResponse;
import uk.org.openbanking.datamodel.vrp.OBVRPFundsConfirmationRequest;

@javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen", date = "2021-05-27T13:44:23.551801+01:00[Europe/London]")

@Controller("DomesticVrpConsentsApiControllerV3.1.8")
public class DomesticVrpConsentsApiController implements DomesticVrpConsentsApi {

@Override
public ResponseEntity<OBDomesticVRPConsentResponse> createDomesticVrpConsent(
OBDomesticVRPConsentRequest domesticVRPConsentRequest
) throws OBErrorResponseException {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}

@Override
public ResponseEntity<OBDomesticVRPConsentResponse> getDomesticVrpConsent() {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}

@Override
public ResponseEntity<Void> deleteDomesticVrpConsent() {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}


@Override
public ResponseEntity<Object> createDomesticVrpConsentsConsentFundsConfirmation(
OBVRPFundsConfirmationRequest vrpFundsConfirmationRequest
) throws OBErrorResponseException {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (4.3.1).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package com.forgerock.openbanking.aspsp.rs.store.api.openbanking.vrp.v3_1_8;

import com.forgerock.openbanking.exceptions.OBErrorResponseException;
import io.swagger.annotations.*;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import uk.org.openbanking.datamodel.vrp.OBDomesticVRPConsentRequest;
import uk.org.openbanking.datamodel.vrp.OBDomesticVRPConsentResponse;
import uk.org.openbanking.datamodel.vrp.OBVRPFundsConfirmationRequest;

import javax.validation.Valid;

import static org.springframework.web.bind.annotation.RequestMethod.DELETE;
import static org.springframework.web.bind.annotation.RequestMethod.POST;

@javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen", date = "2021-05-27T13:44:23.551801+01:00[Europe/London]")

@Api(value = "domestic-vrp-consents", description = "the domestic-vrp-consents API")
public interface DomesticVrpConsentsApi {

static String DOMESTIC_VRP_CONSENTS = "/domestic-vrp-consents";

/**
* POST /domestic-vrp-consents : create a domestic vrp
* create a domestic vrp
*
* @return (status code 201)
*/
@ApiOperation(
value = "create a domestic vrp",
nickname = "domesticVrpConsentsPost",
notes = "create a domestic vrp",
response = OBDomesticVRPConsentResponse.class,
// authorizations = {
// @Authorization(value = "TPPOAuth2Security", scopes = {
// @AuthorizationScope(scope = "vrps", description = "Generic VRPs scope")
// })
// },
tags = {"variable-recurring-payments",})
@ApiResponses(value = {@ApiResponse(code = 201, message = "", response = OBDomesticVRPConsentResponse.class)})
@RequestMapping(
value = DOMESTIC_VRP_CONSENTS,
produces = {"application/json"},
method = POST)
ResponseEntity<OBDomesticVRPConsentResponse> createDomesticVrpConsent(
@ApiParam(value = "Default", required = true)
@Valid
@RequestBody OBDomesticVRPConsentRequest domesticVRPConsentRequest // added manually
// none of the headers have been generated from the open-api spec
) throws OBErrorResponseException;

/**
* GET /domestic-vrp-consents/:consentId : create a domestic vrp
* create a domestic vrp
*
* @return (status code 200)
*/
@ApiOperation(
value = "create a domestic vrp",
nickname = "domesticVrpConsentsConsentIdGet",
notes = "create a domestic vrp",
response = OBDomesticVRPConsentResponse.class,
// authorizations = {
// @Authorization(value = "TPPOAuth2Security", scopes = {
// @AuthorizationScope(scope = "vrps", description = "Generic VRPs scope")
// })
// },
tags = {"variable-recurring-payments",})
@ApiResponses(value = {@ApiResponse(code = 200, message = "", response = OBDomesticVRPConsentResponse.class)})
@RequestMapping(
value = DOMESTIC_VRP_CONSENTS + "/:consentId",
produces = {"application/json"},
method = RequestMethod.GET)
ResponseEntity<OBDomesticVRPConsentResponse> getDomesticVrpConsent() throws OBErrorResponseException;

/**
* DELETE /domestic-vrp-consents/:consentId : create a domestic vrp
* create a domestic vrp
*
* @return all good (status code 204)
*/
@ApiOperation(
value = "create a domestic vrp",
nickname = "domesticVrpConsentsConsentIdDelete",
notes = "create a domestic vrp",
// authorizations = {
// @Authorization(value = "TPPOAuth2Security", scopes = {
// @AuthorizationScope(scope = "vrps", description = "Generic VRPs scope")
// })
// },
tags = {"variable-recurring-payments",})
@ApiResponses(value = {@ApiResponse(code = 204, message = "all good")})
@RequestMapping(value = DOMESTIC_VRP_CONSENTS + "/:consentId", method = DELETE)
ResponseEntity<Void> deleteDomesticVrpConsent() throws OBErrorResponseException;

/**
* POST /domestic-vrp-consents/:consentId/funds-confirmation : create a domestic vrp
* create a domestic vrp
*
* @return (status code 200)
*/
@ApiOperation(
value = "create a domestic vrp",
nickname = "domesticVrpConsentsConsentIdFundsConfirmationPost",
notes = "create a domestic vrp",
response = Object.class,
// authorizations = {
// @Authorization(value = "TPPOAuth2Security", scopes = {
// @AuthorizationScope(scope = "vrps", description = "Generic VRPs scope")
// })
// },
tags = {"variable-recurring-payments",})
@ApiResponses(value = {@ApiResponse(code = 200, message = "", response = Object.class)})
@RequestMapping(
value = DOMESTIC_VRP_CONSENTS + "/:consentId/funds-confirmation",
produces = {"application/json"},
method = POST)
ResponseEntity<Object> createDomesticVrpConsentsConsentFundsConfirmation(
@ApiParam(value = "Default", required = true)
@Valid
@RequestBody OBVRPFundsConfirmationRequest vrpFundsConfirmationRequest) throws OBErrorResponseException;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package com.forgerock.openbanking.aspsp.rs.store.api.openbanking.vrp.v3_1_8;

import com.forgerock.openbanking.exceptions.OBErrorResponseException;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import uk.org.openbanking.datamodel.vrp.OBDomesticVRPConsentRequest;
import uk.org.openbanking.datamodel.vrp.OBDomesticVRPConsentResponse;
import uk.org.openbanking.datamodel.vrp.OBVRPFundsConfirmationRequest;

@javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen", date = "2021-05-27T13:44:23.551801+01:00[Europe/London]")

@Controller("DomesticVrpConsentsApiControllerV3.1.8")
public class DomesticVrpConsentsApiController implements DomesticVrpConsentsApi {

@Override
public ResponseEntity<OBDomesticVRPConsentResponse> createDomesticVrpConsent(
OBDomesticVRPConsentRequest domesticVRPConsentRequest
) throws OBErrorResponseException {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}

@Override
public ResponseEntity<OBDomesticVRPConsentResponse> getDomesticVrpConsent() {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}

@Override
public ResponseEntity<Void> deleteDomesticVrpConsent() {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}


@Override
public ResponseEntity<Object> createDomesticVrpConsentsConsentFundsConfirmation(
OBVRPFundsConfirmationRequest vrpFundsConfirmationRequest
) throws OBErrorResponseException {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
}

0 comments on commit ffb7737

Please sign in to comment.