Class AccountSellerUsersController

java.lang.Object
com.skava.accounts.web.AccountSellerUsersController

@RestController @RequestMapping public class AccountSellerUsersController extends Object
The Class AccoountSellerUsersController-
The controller class has service end points to process account seller entity.
Author:
Infosys Equinox
  • Constructor Details

    • AccountSellerUsersController

      public AccountSellerUsersController()
  • Method Details

    • createSeller

      @PostMapping("/accounts/{accountId}/sellers") @PreAuthorize("hasRoleForServiceAndCollection(\'ROLE_ACCOUNT_ADMIN\', \'account\', #collectionId) or hasPrivilegeForServiceAndCollectionAndAccount(\'account/create/accountseller\', \'account\', #collectionId, #accountId)") @ResponseStatus(CREATED) @Audit(action="CreateSeller") public org.springframework.http.ResponseEntity<Seller> createSeller(@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="AccountSeller") Seller request)
      Creates the seller.
      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 store
      version - Refers to the version
      request - It refers to the seller request object which consists of the details using which a new seller will be created
      Returns:
      the response entity Seller
    • findAllSellers

      @GetMapping("/accounts/{accountId}/sellers") @PreAuthorize("hasRoleForServiceAndCollection(\'ROLE_ACCOUNT_ADMIN\', \'account\', #collectionId) or hasRoleForServiceAndCollectionAndAccount(\'ROLE_ACCOUNT_BUYER_ADMIN\', \'account\', #collectionId, #accountId) or hasPrivilegeForServiceAndCollectionAndAccount(\'account/viewall/accountseller\', \'account\', #collectionId, #accountId)") @ResponseStatus(ACCEPTED) @Audit(action="GetAllAccountSellers") public org.springframework.http.ResponseEntity<AccountSellersAPIResponse> findAllSellers(@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="sort",required=false) @AuditField(field="SORT") String sort)
      Find all sellers.
      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 store
      version - Refers to the version
      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.
      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.
      Returns:
      the response entity Seller
    • getSellerById

      @GetMapping("/accounts/{accountId}/sellers/{sellerId}") @PreAuthorize("hasRoleForServiceAndCollection(\'ROLE_ACCOUNT_ADMIN\', \'account\', #collectionId) or hasRoleForServiceAndCollectionAndAccount(\'ROLE_ACCOUNT_BUYER_ADMIN\', \'account\', #collectionId, #accountId) or hasPrivilegeForServiceAndCollectionAndAccount(\'account/view/accountseller\', \'account\', #collectionId, #accountId)") @ResponseStatus(ACCEPTED) @Audit(action="GetAccountSeller") public org.springframework.http.ResponseEntity<Seller> getSellerById(@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="sellerId",required=true) @AuditField(field="ID") long id)
      Gets the seller 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 store
      version - Refers to the version
      id - It refers to the unique identifier of the seller which is to be retrieved which is an auto generated when a seller is created. A valid seller should be present for the given id.
      Returns:
      the seller Seller
    • deleteSeller

      @DeleteMapping("/accounts/{accountId}/sellers/{sellerId}") @PreAuthorize("hasRoleForServiceAndCollection(\'ROLE_ACCOUNT_ADMIN\', \'account\', #collectionId) or hasPrivilegeForServiceAndCollectionAndAccount(\'account/delete/accountseller\', \'account\', #collectionId, #accountId)") @ResponseStatus(ACCEPTED) @Audit(action="DeleteAccountSeller") public org.springframework.http.ResponseEntity<Object> deleteSeller(@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="sellerId",required=true) @AuditField(field="ID") long id)
      Delete seller.
      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 store
      version - Refers to the version
      id - It refers to the unique identifier of the seller which is to be retrieved which is an autogenerated when a seller is created. A valid seller should be present for the given id.
      Returns:
      the response entity
    • updateSeller

      @PatchMapping("/accounts/{accountId}/sellers/{sellerId}") @PreAuthorize("hasRoleForServiceAndCollection(\'ROLE_ACCOUNT_ADMIN\', \'account\', #collectionId) or hasPrivilegeForServiceAndCollectionAndAccount(\'account/update/accountseller\', \'account\', #collectionId, #accountId)") @ResponseStatus(ACCEPTED) @Audit(action="UpdtaeAccountSeller") public org.springframework.http.ResponseEntity<Seller> updateSeller(@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="sellerId",required=true) @AuditField(field="ID") long id, @RequestBody(required=true) @AuditField(field="AccountSeller") Seller request)
      To update a Seller User
      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 store
      version - Refers to the version
      id - It refers to the unique identifier of the seller which is to be retrieved which is an autogenerated when a seller is created. A valid seller should be present for the given id.
      request - It refers to the seller request object which consists of the details to be updated for a seller which is already been created.
      Returns:
      the response entity Seller
    • getAccountForSeller

      @GetMapping("/sellers/{sellerId}/accounts") @PreAuthorize("hasRoleForServiceAndCollection(\'ROLE_ACCOUNT_ADMIN\', \'account\', #collectionId) or hasPrivilegeForServiceAndCollection(\'account/viewall/accountseller\', \'account\', #collectionId)") @ResponseStatus(ACCEPTED) @Audit(action="GetAccountForSeller") public org.springframework.http.ResponseEntity<List<Accounts>> getAccountForSeller(@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="sellerId",required=true) String sellerId, @RequestParam(value="filter",required=false,defaultValue="") @AuditField(field="FILTER") @DeIdentify String filter)
      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 store
      version - Refers to the version
      sellerId - It refers to the userId/seller of the sellers. Account details are retrived using the given userId/sellerId.
      Returns:
      response entity List of Accounts