basket-modifier.sh Script Documentation
This document describes the functionality and usage of the basket-modifier.sh script found in the cruiseappy/scripts folder.
Purpose
This script modifies the basket items for a given search ID in a cruise booking system.
Usage
./basket-modifier.sh <search_id>
Arguments
search_id: The ID of the search for which to modify basket items.
Description
The script performs the following steps:
1. Sets the script path and sources the functions.sh file.
2. Retrieves the search ID and session key from the database.
3. Checks if the search ID and session key are provided, exits if not.
4. Removes all 'pricemodifier' items from the basket by:
- Generating an XML request to remove the item from the basket.
- Sending the request to the endpoint using curl.
- Deleting the item from the database.
5. Re-adds all modifiers to the basket by:
- Retrieving the modifier details from the database.
- Generating an XML request to add the modifier to the basket.
- Sending the request to the endpoint using curl.
- Checking for errors in the response and updating the database if any errors occur.
6. Deletes all 'cruise' items from the basket.
7. Calls the get_basket_cruise function with the search ID.
Environment Variables
ca_db_name: The name of the database to use.ca_tt_username: The username for authentication.ca_tt_password: The password for authentication.ca_tt_endpoint: The endpoint URL for API requests.
Dependencies
functions.sh: A script containing utility functions.mysql: A command-line client for MySQL.curl: A command-line tool for transferring data with URLs.
For further details, refer to the comments in the script or contact the development team.