Class OtherChargesController

java.lang.Object
com.skava.cart.web.OtherChargesController

@RestController @RequestMapping("/carts") public class OtherChargesController extends Object

The Class OtherChargesController.

This class controls the controls the request for the CRUD operations on the OtherCharges Entity.
  • Field Details

  • Constructor Details

    • OtherChargesController

      public OtherChargesController()
  • Method Details

    • createOtherCharges

      @ResponseStatus(CREATED) @PreAuthorize("hasRoleForServiceAndCollection(\'ROLE_GUEST\',\'cart\', #collectionId) or hasRoleForServiceAndCollection(\'ROLE_REG_USER\',\'cart\', #collectionId) or hasPrivilegeForServiceAndCollection( \'cart/manage/cart\',\'cart\', #collectionId) or hasPrivilegeForServiceAndCollection( \'cart/create/cart\',\'cart\', #collectionId) or hasPrivilegeForServiceAndCollection( \'cart/manage/alluserscarts\',\'cart\', #collectionId)") @PostMapping("/{cartId}/otherCharges") @Audit(action="createCartOtherCharges") public org.springframework.http.ResponseEntity<OtherChargesResponse> createOtherCharges(@RequestHeader(value="x-collection-id",required=true) @AuditField(field="collectionId") long collectionId, @RequestHeader(value="x-auth-token",required=true) @AuditField(field="authToken") String authToken, @RequestHeader(value="x-version-id",required=false) @AuditField(field="versionId") String versionId, @RequestHeader(value="x-store-id",required=false,defaultValue="0") @AuditField(field="STORE_ID") long storeId, @PathVariable(value="cartId",required=true) @AuditField(field="cartId") long cartId, @RequestParam(value="locale",required=false,defaultValue="en_US") @AuditField(field="locale") String locale, @Valid @RequestBody @Valid List<OtherCharges> otherCharges, @RequestParam(value="userInfo",required=false) @AuditField(field="USER_INFO") String userInfo)
      This method is used to create otherCharges based on given OtherChargesRequest.
      Parameters:
      collectionId - It contains the collectionId associated with list. Holds a valid collection identifier of this microservice. The requested operation will be performed on this collection identifier. A collection is the topmost entity of a microservice under which all the other entities/resources reside. Each collection represents an instance of the microservice with the configured properties. These properties can be modified to bring in a different behavior per collection of the same microservice. The Store association is the process of associating a microservice collection to a store along with its respective sub-entity. This way, the storefront can fetch/store the required information from that respective association.
      authToken - It contains the authentication token required to calculate cart. Holds a valid authorization token generated using the Authorization microservice for a user. The Auth Token (JWT format) represents claims containing the roles and privileges of the user accessing this API. The 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 beforehand 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 the HTML and HTTP environments while being more compact when compared to XML-based standards such as SAML. Thus, the 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
      versionId - It hold the value of version number of API. Using this parameter we can access the different version of the API. Holds the value of an API version number. Using this parameter, you can access different versions of the API. The version format is major.minor.patch. For example, 8.0.0.
      cartId - Indicates a unique ID of the cart. The minimum value is 1. There is no maximum value.
      locale - API Response and error messages will be responded in the mentioned locale. Indicates the locale in which the API response and the error messages will be responded. The locale should be mentioned in the Java standard locale format.
      storeId - It contains the storeId associated with list. Indicates the store id associated with the item.
      otherCharges - It contains the attributes required for the creation of otherCharges.
      userInfo - Indicates the ID of the user to be searched. It can be used only if the admin wants to filter by user ID.
      Returns:
      the instance of ResponseEntity of OtherChargesResponse object.
    • patchOtherCharges

      @ResponseStatus(OK) @PreAuthorize("hasRoleForServiceAndCollection(\'ROLE_GUEST\',\'cart\', #collectionId) or hasRoleForServiceAndCollection(\'ROLE_REG_USER\',\'cart\', #collectionId) or hasPrivilegeForServiceAndCollection( \'cart/manage/cart\',\'cart\', #collectionId) or hasPrivilegeForServiceAndCollection( \'cart/update/cart\',\'cart\', #collectionId) or hasPrivilegeForServiceAndCollection( \'cart/manage/alluserscarts\',\'cart\', #collectionId)") @PatchMapping("/{cartId}/otherCharges/{otherChargesId}") @Audit(action="patchUpdateCartOtherCharges") public org.springframework.http.ResponseEntity<OtherChargesResponse> patchOtherCharges(@RequestHeader(value="x-version-id",required=false) String versionId, @RequestHeader(value="x-collection-id",required=true) Long collectionId, @PathVariable(value="cartId",required=true) @AuditField(field="cartId") long cartId, @RequestHeader(value="x-auth-token",required=false) String authToken, @PathVariable(value="otherChargesId",required=true) long otherChargesId, @RequestParam(value="locale",required=false,defaultValue="en_US") String locale, @Valid @RequestBody @AuditField(field="othercharges") @Valid List<OtherCharges> otherCharges, @RequestHeader(value="x-store-id",required=false,defaultValue="0") @AuditField(field="STORE_ID") long storeId, @RequestParam(value="userInfo",required=false) @AuditField(field="USER_INFO") String userInfo)
      This method used to update otherCharges in a cart level Patch update cart other charges.
      Parameters:
      cartId - Indicates a unique ID of the cart. The minimum value is 1. There is no maximum value.
      versionId - It hold the value of version number of API. Using this parameter we can access the different version of the API. Holds the value of an API version number. Using this parameter, you can access different versions of the API. The version format is major.minor.patch. For example, 8.0.0.
      collectionId - It contains the collectionId associated with list. Holds a valid collection identifier of this microservice. The requested operation will be performed on this collection identifier. A collection is the topmost entity of a microservice under which all the other entities/resources reside. Each collection represents an instance of the microservice with the configured properties. These properties can be modified to bring in a different behavior per collection of the same microservice. The Store association is the process of associating a microservice collection to a store along with its respective sub-entity. This way, the storefront can fetch/store the required information from that respective association.
      authToken - It contains the authentication token required to calculate cart. Holds a valid authorization token generated using the Authorization microservice for a user. The Auth Token (JWT format) represents claims containing the roles and privileges of the user accessing this API. The 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 beforehand 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 the HTML and HTTP environments while being more compact when compared to XML-based standards such as SAML. Thus, the 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
      locale - API Response and error messages will be responded in the mentioned locale. Indicates the locale in which the API response and the error messages will be responded. The locale should be mentioned in the Java standard locale format.
      storeId - It contains the storeId associated with list. Indicates the store id associated with the item.
      otherCharges - the otherCharges
      otherChargesId - Unique identifier of otherCharges
      userInfo - Indicates the ID of the user to be searched. It can be used only if the admin wants to filter by user ID.
      Returns:
      the instance of ResponseEntity of PaymentResponse object.
    • deleteOtherChanges

      @ResponseStatus(ACCEPTED) @PreAuthorize("hasRoleForServiceAndCollection(\'ROLE_GUEST\',\'cart\', #collectionId) or hasRoleForServiceAndCollection(\'ROLE_REG_USER\',\'cart\', #collectionId) or hasPrivilegeForServiceAndCollection( \'cart/manage/cart\',\'cart\', #collectionId) or hasPrivilegeForServiceAndCollection( \'cart/manage/alluserscarts\',\'cart\', #collectionId) or hasPrivilegeForServiceAndCollection( \'cart/delete/cart\',\'cart\', #collectionId)") @DeleteMapping("/{cartId}/otherCharges/{otherChargesId}") @Audit public org.springframework.http.ResponseEntity<com.skava.core.ResponseModel> deleteOtherChanges(@RequestHeader(value="x-version-id",required=false) String versionId, @RequestHeader(value="x-collection-id",required=true) Long collectionId, @PathVariable(value="cartId",required=true) @AuditField(field="cartId") long cartId, @RequestHeader(value="x-auth-token",required=false) String authToken, @RequestParam(value="locale",required=false,defaultValue="en_US") String locale, @PathVariable(value="otherChargesId",required=true) long otherChargesId, @RequestHeader(value="x-store-id",required=false,defaultValue="0") @AuditField(field="STORE_ID") long storeId, @RequestParam(value="userInfo",required=false) @AuditField(field="USER_INFO") String userInfo)
      This method used to delete otherCharges in a cart level Delete cart otherCharges.
      Parameters:
      cartId - Indicates a unique ID of the cart. The minimum value is 1. There is no maximum value.
      versionId - It hold the value of version number of API. Using this parameter we can access the different version of the API. Holds the value of an API version number. Using this parameter, you can access different versions of the API. The version format is major.minor.patch. For example, 8.0.0.
      collectionId - It contains the collectionId associated with list. Holds a valid collection identifier of this microservice. The requested operation will be performed on this collection identifier. A collection is the topmost entity of a microservice under which all the other entities/resources reside. Each collection represents an instance of the microservice with the configured properties. These properties can be modified to bring in a different behavior per collection of the same microservice. The Store association is the process of associating a microservice collection to a store along with its respective sub-entity. This way, the storefront can fetch/store the required information from that respective association.
      authToken - It contains the authentication token required to calculate cart. Holds a valid authorization token generated using the Authorization microservice for a user. The Auth Token (JWT format) represents claims containing the roles and privileges of the user accessing this API. The 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 beforehand 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 the HTML and HTTP environments while being more compact when compared to XML-based standards such as SAML. Thus, the 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 - It contains the storeId associated with list. Indicates the store id associated with the item.
      locale - API Response and error messages will be responded in the mentioned locale. Indicates the locale in which the API response and the error messages will be responded. The locale should be mentioned in the Java standard locale format.
      userInfo - Indicates the ID of the user to be searched.
      otherChargesId - Unique identifier of otherCharges It can be used only if the admin wants to filter by user ID.
      Returns:
      It returns the PaymentAPIResponse entity.
    • onCompleteResponse

      public void onCompleteResponse(@AuditField(field="OTHERCHARGESCONTROLLER_RESPONSE") OtherChargesResponse response)
      On complete response.
      Parameters:
      response - the response