Package com.skava.accounts.web
Class AccountBuyerUsersController
java.lang.Object
com.skava.accounts.web.AccountBuyerUsersController
The Class AccountController -
The controller class has service end points to process account buyer entity.
The controller class has service end points to process account buyer entity.
- Author:
- Infosys Equinox
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.http.ResponseEntity<AccountBuyer>
createAccountBuyer
(long accountId, String locale, String version, long storeId, long collectionId, String authToken, AccountBuyer request) Creates the account buyer.org.springframework.http.ResponseEntity<Object>
deleteAccountBuyer
(long accountId, long collectionId, String locale, String version, long storeId, String authToken, long id) Delete account buyer.org.springframework.http.ResponseEntity<AccountBuyersAPIResponse>
findAllAccountBuyers
(long accountId, String authToken, long collectionId, String locale, String version, long storeId, int page, int size, String filter, String sort) Find all account buyers.org.springframework.http.ResponseEntity<AccountBuyer>
getAccountBuyerById
(long accountId, long collectionId, String locale, String version, long storeId, String authToken, long id) Gets the account buyer by id.org.springframework.http.ResponseEntity<Accounts>
getAccountForBuyer
(long collectionId, String locale, String version, long storeId, String authToken, String buyerId) org.springframework.http.ResponseEntity<AccountBuyer>
updateAccountBuyer
(long accountId, long collectionId, String locale, String version, long storeId, String authToken, long id, AccountBuyer request) Update account buyer.
-
Constructor Details
-
AccountBuyerUsersController
public AccountBuyerUsersController()
-
-
Method Details
-
createAccountBuyer
@PostMapping("/accounts/{accountId}/buyers") @PreAuthorize("hasRoleForServiceAndCollection(\'ROLE_ACCOUNT_ADMIN\', \'account\', #collectionId) or hasRoleForServiceAndCollectionAndAccount(\'ROLE_ACCOUNT_REP\', \'account\', #collectionId, #accountId) or hasRoleForServiceAndCollectionAndAccount(\'ROLE_ACCOUNT_BUYER_ADMIN\', \'account\', #collectionId, #accountId) or hasPrivilegeForServiceAndCollectionAndAccount(\'account/create/accountbuyer\', \'account\', #collectionId, #accountId)") @ResponseStatus(ACCEPTED) @Audit(action="CreateAccountBuyer") public org.springframework.http.ResponseEntity<AccountBuyer> createAccountBuyer(@PathVariable("accountId") @AuditField(field="ACCOUNTID") long accountId, @RequestHeader(value="locale",required=false,defaultValue="en_US") @AuditField(field="LOCALE") String locale, @RequestHeader(value="x-version",required=false,defaultValue="8.19.7") @AuditField(field="VERSION") String version, @RequestHeader(value="x-store-id",required=false,defaultValue="0") @AuditField(field="STOREID") long storeId, @RequestHeader(value="x-collection-id",required=true) @AuditField(field="COLLECTIONID") long collectionId, @RequestHeader(value="x-auth-token",required=true) @AuditField(field="AUTHTOKEN") String authToken, @RequestBody(required=true) @AuditField(field="AccountBuyer") AccountBuyer request) Creates the account buyer.- Parameters:
accountId
- It refers to the id of the account which is a unique identifier. An account should exists for the given account id, and also the account should be associated with the given collection id.locale
- API Response and error messages will be responded in the locale mentioned in this parameter.collectionId
- This field holds a valid collection identifier of this microservice and requested operation will be performed on this collection identifier. Collection is the top most entity of a microservice under which all the other entities/resources reside. Each collection represents an instance of the microservice with configured properties and these properties can be modified to bring in a different behavior per collection of the same microservice. Store association is the process of associating a microservice collection to a store along with its respective sub-entity. This way storefront can fetch/store the required information from that respective association.authToken
- This field holds a valid authorization token generated using the Authorization microservice for an user. Auth token (JWT format) represents claims containing roles and privileges of the user accessing this API. JSON Web Token (JWT) is an open standard (RFC 7519) that defines a compact and self-contained way for securely transmitting information between parties as a JSON object. Since the token is a required field for this API it has to be generated before hand by invoking the /auth/sessions API provided by Authorization microservice. The output is three Base64 strings separated by dots that can be easily passed in HTML and HTTP environments, while being more compact when compared to XML-based standards such as SAML. Thus generated token has to be passed to this service and the request will be processed only if the following conditions are met:- Token validation against the secret key
- Expiry time should be in the future
- Necessary privileges are available for the user to perform the action on the subjected resource
storeId
- Refers to the unique id of the storeversion
- Refers to the versionrequest
- Instance ofAccountBuyer
It refers to the buyer request object which consists of the details using which a new account buyer will be created- Returns:
- the response entity
AccountBuyer
-
findAllAccountBuyers
@GetMapping("/accounts/{accountId}/buyers") @PreAuthorize("hasRoleForServiceAndCollection(\'ROLE_ACCOUNT_ADMIN\', \'account\', #collectionId) or hasRoleForServiceAndCollection(\'ROLE_ACCOUNT_REP\', \'account\', #collectionId) or hasRoleForServiceAndCollectionAndAccount(\'ROLE_ACCOUNT_BUYER_ADMIN\', \'account\', #collectionId, #accountId) or hasPrivilegeForServiceAndCollectionAndAccount(\'account/viewall/accountbuyer\', \'account\', #collectionId, #accountId)") @ResponseStatus(ACCEPTED) @Audit(action="FindAllAccountBuyer") public org.springframework.http.ResponseEntity<AccountBuyersAPIResponse> findAllAccountBuyers(@PathVariable("accountId") @AuditField(field="ACCOUNTID") long accountId, @RequestHeader(value="x-auth-token",required=true) @AuditField(field="AUTHTOKEN") String authToken, @RequestHeader(value="x-collection-id",required=true) @AuditField(field="COLLECTIONID") long collectionId, @RequestHeader(value="locale",required=false,defaultValue="en_US") @AuditField(field="LOCALE") String locale, @RequestHeader(value="x-version",required=false,defaultValue="8.19.7") @AuditField(field="VERSION") String version, @RequestHeader(value="x-store-id",required=false,defaultValue="0") @AuditField(field="STOREID") long storeId, @RequestParam(value="page",required=false,defaultValue="1") @AuditField(field="PAGE") int page, @RequestParam(value="size",required=false,defaultValue="10") @AuditField(field="SIZE") int size, @RequestParam(value="filter",required=false,defaultValue="") @AuditField(field="FILTER") String filter, @RequestParam(value="sort",required=false) @AuditField(field="SORT") String sort) Find all account buyers.- Parameters:
accountId
- It refers to the id of the account which is a unique identifier. An account should exists for the given account id, and also the account should be associated with the given collection id.authToken
- This field holds a valid authorization token generated using the Authorization microservice for an user. Auth token (JWT format) represents claims containing roles and privileges of the user accessing this API. JSON Web Token (JWT) is an open standard (RFC 7519) that defines a compact and self-contained way for securely transmitting information between parties as a JSON object. Since the token is a required field for this API it has to be generated before hand by invoking the /auth/sessions API provided by Authorization microservice. The output is three Base64 strings separated by dots that can be easily passed in HTML and HTTP environments, while being more compact when compared to XML-based standards such as SAML. Thus generated token has to be passed to this service and the request will be processed only if the following conditions are met:- Token validation against the secret key
- Expiry time should be in the future
- Necessary privileges are available for the user to perform the action on the subjected resource
storeId
- Refers to the unique id of the storeversion
- Refers to the versioncollectionId
- This field holds a valid collection identifier of this microservice and requested operation will be performed on this collection identifier. Collection is the top most entity of a microservice under which all the other entities/resources reside. Each collection represents an instance of the microservice with configured properties and these properties can be modified to bring in a different behavior per collection of the same microservice. Store association is the process of associating a microservice collection to a store along with its respective sub-entity. This way storefront can fetch/store the required information from that respective association.locale
- API Response and error messages will be responded in the locale mentioned in this parameter.page
- The page number to be retrieved where the size of the page must be specified by the size/offset/pageSize parameter. First page starts with value \"0\"size
- The number of documents being retrieved on the corresponding page specified by page parameter.sort
- the sort.filter
- the filter param using which the account buyers will be filtered and displayed.- Returns:
- the response entity List of
AccountBuyer
-
getAccountBuyerById
@GetMapping("/accounts/{accountId}/buyers/{buyerId}") @PreAuthorize("hasRoleForServiceAndCollection(\'ROLE_ACCOUNT_ADMIN\', \'account\', #collectionId) or hasRoleForServiceAndCollectionAndAccount(\'ROLE_ACCOUNT_REP\', \'account\', #collectionId, #accountId) or hasRoleForServiceAndCollectionAndAccount(\'ROLE_ACCOUNT_BUYER_ADMIN\', \'account\', #collectionId, #accountId) or hasRoleForServiceAndCollectionAndAccount(\'ROLE_ACCOUNT_BUYER\', \'account\', #collectionId, #accountId) or hasPrivilegeForServiceAndCollectionAndAccount(\'account/view/accountbuyer\', \'account\', #collectionId, #accountId)") @ResponseStatus(ACCEPTED) @Audit(action="FindAccountBuyer") public org.springframework.http.ResponseEntity<AccountBuyer> getAccountBuyerById(@PathVariable("accountId") @AuditField(field="ACCOUNTID") long accountId, @RequestHeader(value="x-collection-id",required=true) @AuditField(field="COLLECTIONID") long collectionId, @RequestHeader(value="locale",required=false,defaultValue="en_US") @AuditField(field="LOCALE") String locale, @RequestHeader(value="x-version",required=false,defaultValue="8.19.7") @AuditField(field="VERSION") String version, @RequestHeader(value="x-store-id",required=false,defaultValue="0") @AuditField(field="STOREID") long storeId, @RequestHeader(value="x-auth-token",required=true) @AuditField(field="AUTHTOKEN") String authToken, @PathVariable(value="buyerId",required=true) @AuditField(field="ID") long id) Gets the account buyer by id.- Parameters:
accountId
- It refers to the id of the account which is a unique identifier. An account should exists for the given account id, and also the account should be associated with the given collection id.collectionId
- This field holds a valid collection identifier of this microservice and requested operation will be performed on this collection identifier. Collection is the top most entity of a microservice under which all the other entities/resources reside. Each collection represents an instance of the microservice with configured properties and these properties can be modified to bring in a different behavior per collection of the same microservice. Store association is the process of associating a microservice collection to a store along with its respective sub-entity. This way storefront can fetch/store the required information from that respective association.locale
- API Response and error messages will be responded in the locale mentioned in this parameter.authToken
- This field holds a valid authorization token generated using the Authorization microservice for an user. Auth token (JWT format) represents claims containing roles and privileges of the user accessing this API. JSON Web Token (JWT) is an open standard (RFC 7519) that defines a compact and self-contained way for securely transmitting information between parties as a JSON object. Since the token is a required field for this API it has to be generated before hand by invoking the /auth/sessions API provided by Authorization microservice. The output is three Base64 strings separated by dots that can be easily passed in HTML and HTTP environments, while being more compact when compared to XML-based standards such as SAML. Thus generated token has to be passed to this service and the request will be processed only if the following conditions are met:- Token validation against the secret key
- Expiry time should be in the future
- Necessary privileges are available for the user to perform the action on the subjected resource
storeId
- Refers to the unique id of the storeversion
- Refers to the versionid
- It refers to the unique identifier of the buyer which is to be retrieved which is an autogenerated when a buyer is created. A valid buyer should be present for the given id.- Returns:
- the account buyer
AccountBuyer
-
deleteAccountBuyer
@DeleteMapping("/accounts/{accountId}/buyers/{buyerId}") @PreAuthorize("hasRoleForServiceAndCollection(\'ROLE_ACCOUNT_ADMIN\', \'account\', #collectionId) or hasRoleForServiceAndCollectionAndAccount(\'ROLE_ACCOUNT_REP\', \'account\', #collectionId, #accountId) or hasRoleForServiceAndCollectionAndAccount(\'ROLE_ACCOUNT_BUYER_ADMIN\', \'account\', #collectionId, #accountId) or hasPrivilegeForServiceAndCollectionAndAccount(\'account/delete/accountbuyer\', \'account\', #collectionId, #accountId)") @ResponseStatus(ACCEPTED) @Audit(action="DeleteAccountBuyer") public org.springframework.http.ResponseEntity<Object> deleteAccountBuyer(@PathVariable("accountId") @AuditField(field="ACCOUNTID") long accountId, @RequestHeader(value="x-collection-id",required=true) @AuditField(field="COLLECTIONID") long collectionId, @RequestHeader(value="locale",required=false,defaultValue="en_US") @AuditField(field="LOCALE") String locale, @RequestHeader(value="x-version",required=false,defaultValue="8.19.7") @AuditField(field="VERSION") String version, @RequestHeader(value="x-store-id",required=false,defaultValue="0") @AuditField(field="STOREID") long storeId, @RequestHeader(value="x-auth-token",required=true) @AuditField(field="AUTHTOKEN") String authToken, @PathVariable(value="buyerId",required=true) @AuditField(field="ID") long id) Delete account buyer.- Parameters:
accountId
- It refers to the id of the account which is a unique identifier. An account should exists for the given account id, and also the account should be associated with the given collection id.collectionId
- This field holds a valid collection identifier of this microservice and requested operation will be performed on this collection identifier. Collection is the top most entity of a microservice under which all the other entities/resources reside. Each collection represents an instance of the microservice with configured properties and these properties can be modified to bring in a different behavior per collection of the same microservice. Store association is the process of associating a microservice collection to a store along with its respective sub-entity. This way storefront can fetch/store the required information from that respective association.locale
- API Response and error messages will be responded in the locale mentioned in this parameter.authToken
- This field holds a valid authorization token generated using the Authorization microservice for an user. Auth token (JWT format) represents claims containing roles and privileges of the user accessing this API. JSON Web Token (JWT) is an open standard (RFC 7519) that defines a compact and self-contained way for securely transmitting information between parties as a JSON object. Since the token is a required field for this API it has to be generated before hand by invoking the /auth/sessions API provided by Authorization microservice. The output is three Base64 strings separated by dots that can be easily passed in HTML and HTTP environments, while being more compact when compared to XML-based standards such as SAML. Thus generated token has to be passed to this service and the request will be processed only if the following conditions are met:- Token validation against the secret key
- Expiry time should be in the future
- Necessary privileges are available for the user to perform the action on the subjected resource
storeId
- Refers to the unique id of the storeversion
- Refers to the versionid
- It refers to the unique identifier of the buyer which is to be deleted which is an autogenerated when a buyer is created. A valid buyer should be present for the given id.- Returns:
- the response entity
-
updateAccountBuyer
@PatchMapping("/accounts/{accountId}/buyers/{buyerId}") @PreAuthorize("hasRoleForServiceAndCollection(\'ROLE_ACCOUNT_ADMIN\', \'account\', #collectionId) or hasRoleForServiceAndCollectionAndAccount(\'ROLE_ACCOUNT_REP\', \'account\', #collectionId, #accountId) or hasRoleForServiceAndCollectionAndAccount(\'ROLE_ACCOUNT_BUYER_ADMIN\', \'account\', #collectionId, #accountId) or hasPrivilegeForServiceAndCollectionAndAccount(\'account/update/accountbuyer\', \'account\', #collectionId, #accountId)") @ResponseStatus(ACCEPTED) @Audit(action="UpdateAccountBuyer") public org.springframework.http.ResponseEntity<AccountBuyer> updateAccountBuyer(@PathVariable("accountId") @AuditField(field="ACCOUNTID") long accountId, @RequestHeader(value="x-collection-id",required=true) @AuditField(field="COLLECTIONID") long collectionId, @RequestHeader(value="locale",required=false,defaultValue="en_US") @AuditField(field="LOCALE") String locale, @RequestHeader(value="x-version",required=false,defaultValue="8.19.7") @AuditField(field="VERSION") String version, @RequestHeader(value="x-store-id",required=false,defaultValue="0") @AuditField(field="STOREID") long storeId, @RequestHeader(value="x-auth-token",required=true) @AuditField(field="AUTHTOKEN") String authToken, @PathVariable(value="buyerId",required=true) @AuditField(field="ID") long id, @RequestBody(required=true) @AuditField(field="AccountBuyer") AccountBuyer request) Update account buyer.- Parameters:
accountId
- It refers to the id of the account which is a unique identifier. An account should exists for the given account id, and also the account should be associated with the given collection id.collectionId
- This field holds a valid collection identifier of this microservice and requested operation will be performed on this collection identifier. Collection is the top most entity of a microservice under which all the other entities/resources reside. Each collection represents an instance of the microservice with configured properties and these properties can be modified to bring in a different behavior per collection of the same microservice. Store association is the process of associating a microservice collection to a store along with its respective sub-entity. This way storefront can fetch/store the required information from that respective association.locale
- API Response and error messages will be responded in the locale mentioned in this parameter.authToken
- This field holds a valid authorization token generated using the Authorization microservice for an user. Auth token (JWT format) represents claims containing roles and privileges of the user accessing this API. JSON Web Token (JWT) is an open standard (RFC 7519) that defines a compact and self-contained way for securely transmitting information between parties as a JSON object. Since the token is a required field for this API it has to be generated before hand by invoking the /auth/sessions API provided by Authorization microservice. The output is three Base64 strings separated by dots that can be easily passed in HTML and HTTP environments, while being more compact when compared to XML-based standards such as SAML. Thus generated token has to be passed to this service and the request will be processed only if the following conditions are met:- Token validation against the secret key
- Expiry time should be in the future
- Necessary privileges are available for the user to perform the action on the subjected resource
storeId
- Refers to the unique id of the storeversion
- Refers to the versionid
- It refers to the unique identifier of the buyer which is to be updated which is an autogenerated when a buyer is created. A valid buyer should be present for the given id.request
- It refers to the buyer request object which consists of the details to be updated for a buyer which is already been created.- Returns:
- the response entity of
AccountBuyer
-
getAccountForBuyer
@GetMapping("buyers/{buyerId}/accounts") @PreAuthorize("hasRoleForServiceAndCollection(\'ROLE_ACCOUNT_ADMIN\', \'account\', #collectionId) or hasRoleForServiceAndCollection(\'ROLE_ACCOUNT_REP\', \'account\', #collectionId) or hasRoleForServiceAndCollection(\'ROLE_ACCOUNT_BUYER_ADMIN\', \'account\', #collectionId) or hasRoleForServiceAndCollection(\'ROLE_ACCOUNT_BUYER\', \'account\', #collectionId) or hasPrivilegeForServiceAndCollection(\'account/view/buyeraccount\', \'account\', #collectionId)") @ResponseStatus(ACCEPTED) @Audit(action="GetAccountForBuyer") public org.springframework.http.ResponseEntity<Accounts> getAccountForBuyer(@RequestHeader(value="x-collection-id",required=true) @AuditField(field="COLLECTIONID") long collectionId, @RequestHeader(value="locale",required=false,defaultValue="en_US") @AuditField(field="LOCALE") String locale, @RequestHeader(value="x-version",required=false,defaultValue="8.19.7") @AuditField(field="VERSION") String version, @RequestHeader(value="x-store-id",required=false,defaultValue="0") @AuditField(field="STOREID") long storeId, @RequestHeader(value="x-auth-token",required=true) @AuditField(field="AUTHTOKEN") String authToken, @PathVariable(value="buyerId",required=true) String buyerId) - Parameters:
collectionId
- This field holds a valid collection identifier of this microservice and requested operation will be performed on this collection identifier. Collection is the top most entity of a microservice under which all the other entities/resources reside. Each collection represents an instance of the microservice with configured properties and these properties can be modified to bring in a different behavior per collection of the same microservice. Store association is the process of associating a microservice collection to a store along with its respective sub-entity. This way storefront can fetch/store the required information from that respective association.locale
- API Response and error messages will be responded in the locale mentioned in this parameter.authToken
- This field holds a valid authorization token generated using the Authorization microservice for an user. Auth token (JWT format) represents claims containing roles and privileges of the user accessing this API. JSON Web Token (JWT) is an open standard (RFC 7519) that defines a compact and self-contained way for securely transmitting information between parties as a JSON object. Since the token is a required field for this API it has to be generated before hand by invoking the /auth/sessions API provided by Authorization microservice. The output is three Base64 strings separated by dots that can be easily passed in HTML and HTTP environments, while being more compact when compared to XML-based standards such as SAML. Thus generated token has to be passed to this service and the request will be processed only if the following conditions are met:- Token validation against the secret key
- Expiry time should be in the future
- Necessary privileges are available for the user to perform the action on the subjected resource
storeId
- Refers to the unique id of the storeversion
- Refers to the versionbuyerId
- It refers to the userId/buyerId of the buyers. Account details are retrieved using the given userId/buyerId.- Returns:
- the response entity
Accounts
-