Class PriceRuleController

java.lang.Object
com.skava.price.web.PriceRuleController

@RestController @RequestMapping("/pricerules") public class PriceRuleController extends Object
The Class PriceRuleController. This controller class contains service end-points that are used to perform actions as follows, Create PriceRule,Get All PriceRule,Get PriceRule By id, Update PriceRule and Delete PriceRule.
Since:
8.0
Author:
Infosys Equinox
  • Constructor Details

    • PriceRuleController

      public PriceRuleController()
  • Method Details

    • createPriceRule

      @ResponseStatus(CREATED) @PreAuthorize("hasPrivilegeForServiceAndCollection(\'price/create/pricerule\',\'price\', #collectionId)") @PostMapping public org.springframework.http.ResponseEntity<PriceRule> createPriceRule(@RequestHeader(value="x-collection-id",required=true) long collectionId, @RequestHeader(value="x-version",required=false,defaultValue="8.19.7") String versionId, @RequestParam(value="locale",required=false) @IgnoreAudit String locale, @RequestHeader(value="x-auth-token",required=true) String authToken, @RequestBody(required=true) PriceRuleRequest request)
      This method is used to create PriceRule based on given PriceRuleRequest.
      Parameters:
      collectionId - This field holds a valid collection identifier of this microservice and requested operation will be performed on this collection identifier.
      locale - Response would be rendered in the mentioned locale.
      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.
      versionId - This field holds a API version information.
      request - It contains the attributes required for the creation of PriceRule.
      Returns:
      It returns the PriceRuleAPIResponse.
      Throws:
      com.skava.core.ECommerceException - It will throw Ecommerce exception if it process get failed.
    • findAllPriceRule

      @ResponseStatus(OK) @PreAuthorize("hasPrivilegeForServiceAndCollection(\'price/view/pricerule\',\'price\', #collectionId)") @GetMapping public org.springframework.http.ResponseEntity<PriceRulesAPIResponse> findAllPriceRule(@RequestHeader(value="x-collection-id",required=true) long collectionId, @RequestHeader(value="x-version",required=false,defaultValue="8.19.7") String versionId, @RequestParam(value="locale",required=false) String locale, @RequestHeader(value="x-auth-token",required=true) String authToken, @RequestParam(value="sort",required=false) com.skava.core.qdsl.sort.EcomSorts sort, @RequestParam(value="filters",required=false) String filters, @RequestParam(value="page",required=false,defaultValue="1") int page, @RequestParam(value="size",required=false,defaultValue="10") int size)
      This method is used to find all PriceRules and the number of SKUs in the rule based on given PriceRuleRequest.
      Parameters:
      collectionId - This field holds a valid collection identifier of this microservice and requested operation will be performed on this collection identifier.
      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.
      versionId - This field holds a API version information.
      locale - Response would be rendered in the mentioned locale.
      sort - It contains the parameters for sorting. Example Format : {"sort":[{"field":"status","direction":"ASC"}, {"field":"status","direction":"DESC"}]}
      filters - This field holds the simple query criteria (can be multiple) based on the available fields to limit returned results
      page - This parameter will be available for all the services that supports pagination. This parameter is used to mention the starting index of the items which going to responded by the API.
      size - This parameter will be available for all the services that supports pagination. This parameter is used to mention the number of maximum items that needs to be responded for the request.
      Returns:
      It returns the PriceRuleAPIResponse.
    • getPriceRuleById

      @ResponseStatus(OK) @PreAuthorize("hasPrivilegeForServiceAndCollection(\'price/view/pricerule\',\'price\', #collectionId) or hasPrivilegeForServiceAndCollection(\'price/read/pricelist\',\'price\', #collectionId)") @GetMapping("/{priceRuleId}") public org.springframework.http.ResponseEntity<PriceRule> getPriceRuleById(@RequestHeader(value="x-collection-id",required=true) long collectionId, @RequestHeader(value="x-version",required=false,defaultValue="8.19.7") String versionId, @RequestParam(value="locale",required=false) String locale, @RequestHeader(value="x-auth-token",required=true) String authToken, @PathVariable(value="priceRuleId",required=true) long id)
      This method is used to load single PriceRule and the SKUs in the rule based on given PriceRuleRequest.
      Parameters:
      collectionId - This field holds a valid collection identifier of this microservice and requested operation will be performed on this collection identifier.
      locale - Response would be rendered in the mentioned locale.
      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.
      versionId - This field holds a API version information.
      id - It contains identifier of PriceRule.
      Returns:
      It returns the PriceRuleAPIResponse.
    • deletePriceRule

      @PreAuthorize("hasPrivilegeForServiceAndCollection(\'price/delete/pricerule\',\'price\', #collectionId)") @DeleteMapping("/{priceRuleId}") @Audit public org.springframework.http.ResponseEntity<org.springframework.http.HttpStatus> deletePriceRule(@RequestHeader(value="x-collection-id",required=true) @AuditField(field="collectionId") long collectionId, @RequestHeader(value="x-version",required=false,defaultValue="8.19.7") @AuditField(field="versionId") String versionId, @RequestParam(value="locale",required=false) @IgnoreAudit String locale, @RequestHeader(value="x-auth-token",required=true) @AuditField(field="authToken") String authToken, @PathVariable(value="priceRuleId",required=true) @AuditField(field="priceFacetId") long id)
      This method is used to delete PriceRule based on given PriceRuleRequest.
      Parameters:
      collectionId - This field holds a valid collection identifier of this microservice and requested operation will be performed on this collection identifier.
      locale - Response would be rendered in the mentioned locale.
      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.
      versionId - This field holds a API version information.
      id - It contains identifier of PriceRule.
      Returns:
      It returns the PriceRuleAPIResponse.
    • patchUpdatePriceRule

      @ResponseStatus(OK) @PreAuthorize("hasPrivilegeForServiceAndCollection(\'price/update/pricerule\',\'price\', #collectionId)") @PatchMapping("/{priceRuleId}") public org.springframework.http.ResponseEntity<PriceRule> patchUpdatePriceRule(@RequestHeader(value="x-collection-id",required=true) long collectionId, @RequestHeader(value="x-version",required=false,defaultValue="8.19.7") String versionId, @RequestParam(value="locale",required=false) @IgnoreAudit String locale, @RequestHeader(value="x-auth-token",required=true) String authToken, @PathVariable(value="priceRuleId",required=true) long id, @RequestBody(required=true) PriceRuleRequest request)
      This method is used to update required field in PriceRule based on given PriceRulePatchUpdateRequest.
      Parameters:
      collectionId - This field holds a valid collection identifier of this microservice and requested operation will be performed on this collection identifier.
      locale - Response would be rendered in the mentioned locale.
      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.
      versionId - This field holds a API version information.
      id - It contains identifier of PriceRule.
      request - It contains the attributes required for the update required field in PriceRule.
      Returns:
      It returns the PriceRuleAPIResponse.
    • applyRules

      @ResponseStatus(ACCEPTED) @PreAuthorize("hasPrivilegeForServiceAndCollection(\'price/apply/pricerule\',\'price\', #collectionId) or hasPrivilegeForServiceAndCollection(\'price/read/pricelist\',\'price\', #collectionId)") @PostMapping("/{priceRuleId}/applyrules") public org.springframework.http.ResponseEntity<ApplyPriceRulesAPIResponse> applyRules(@RequestHeader(value="x-collection-id",required=true) long collectionId, @RequestHeader(value="x-version",required=false,defaultValue="8.19.7") String versionId, @RequestParam(value="locale",required=false) @IgnoreAudit String locale, @RequestHeader(value="x-auth-token",required=true) String authToken, @PathVariable(value="priceRuleId",required=true) long id, @RequestBody(required=true) ApplyPriceRuleRequest requests)
      This method is used to create PriceRule based on given PriceRuleRequest.
      Parameters:
      collectionId - This field holds a valid collection identifier of this microservice and requested operation will be performed on this collection identifier.
      versionId - This field holds a API version information.
      locale - Response would be rendered in the mentioned locale.
      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.
      id - It contains identifier of PriceRule.
      requests - It contains the attributes required for the creation of PriceRule.
      Returns:
      It returns the PriceRuleAPIResponse.
      Throws:
      com.skava.core.ECommerceException - It will throw Ecommerce exception if it process get failed.
    • validatePriceRule

      @ResponseStatus(OK) @PreAuthorize("hasPrivilegeForServiceAndCollection(\'price/create/pricerule\',\'price\', #collectionId)") @PostMapping("/validatePriceRule") public org.springframework.http.ResponseEntity<ValidatePriceRulesAPIResponse> validatePriceRule(@RequestHeader(value="x-collection-id",required=true) long collectionId, @RequestHeader(value="x-version",required=false,defaultValue="8.19.7") String versionId, @RequestParam(value="locale",required=false) @IgnoreAudit String locale, @RequestHeader(value="x-auth-token",required=true) String authToken, @RequestBody(required=true) ValidatePriceRuleRequest request)
      This method is used to validate PriceRule based on given PriceRuleRequest.
      Parameters:
      collectionId - This field holds a valid collection identifier of this microservice and requested operation will be performed on this collection identifier.
      locale - Response would be rendered in the mentioned locale.
      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.
      versionId - This field holds a API version information.
      request - It contains the price rule for validation.
      Returns:
      It returns the PriceRuleAPIResponse.
      Throws:
      com.skava.core.ECommerceException - It will throw Ecommerce exception if it process get failed.
    • initBinder

      @InitBinder public void initBinder(org.springframework.web.bind.WebDataBinder binder)
      Parameters:
      binder - binds data