It’s hard to look at a range full of beautiful, natural and botanical skincare and not think⦠I need all this on my face immediately! Or maybe you are new to skincare and your thoughts are⦠Wow, where do I begin? (We get it, sometimes skincare can be overwhelming!)
In the midst of incredible serums and amazing treatments, one thing that’s often overlooked is the building blocks of your skincare routine. The truth is if you do not have good basics, you aren’t giving your skin the best chance at becoming its healthiest self.
Three things that you MUST have in your skincare routine is a natural cleanser, 95% Aloe Hydrating Gel and a botanical moisturiser that suits your skin type. These three products are the base of your routine. They should never be swapped, taken out or forgotten. Here’s whyâ¦
Your skin needs consistency
Healthy skin doesn't happen overnight. Regular use of basics makes all the difference. Once you have chosen your building blocks, stick to it. Use them every morning and evening. Cleanse, hydrate, moisturise, repeat!
Your treatment products will work better
Our products are designed and formulated to work together in synergy. Once you get your basic three right, the treatment products you choose (like a serum, scrub or mask) will bring you the best result. For example, don't skip the cleanser and go straight to a serum. Build your routine around the building blocks for best results. We advise only using treatment products if you are using your basic three.
Our recommendation for the building blocks? The Everyday Go-To Set
Step 1: Aloe Foaming Cleanser
This bio-active formula effectively breaks down excess oils and impurities. It is gentle, yet powerful enough to remove all makeup without leaving any residue.
Step 2: 95% Aloe Hydrating Gel
This essential step instantly hydrates and locks in moisture, rebalances the skin, boosts hydration and treats blemishes
Step 3: Infiniti C Moisturiser
This lightweight daily moisturiser is packed with the most effective antioxidant power to provide lasting nourishment and prevent future lines and wrinkles from forming.
from flask import (Blueprint, Response, current_app,
json, jsonify, request, make_response)
import os
import requests
import pdb
import time
import pprint
from datetime import datetime
import pytz
from operator import itemgetter
import logging
bp = Blueprint(‘abandoned_cart’, name, url_prefix=’/abandoned_cart’)
USERNAME = current_app.config[‘USERNAME’]
PASSWORD = current_app.config[‘PASSWORD’]
CONSUMER_KEY = current_app.config[‘CONSUMER_KEY’]
CONSUMER_SECRET = current_app.config[‘CONSUMER_SECRET’]
path = os.path.dirname(file)
access_token = None
instance_url = None
params = {
“grant_type”: “password”,
“client_id”: CONSUMER_KEY, # Consumer Key
“client_secret”: CONSUMER_SECRET, # Consumer Secret
“username”: USERNAME, # The email you use to login
“password”: PASSWORD # Concat your password and your security token
}
def log_in():
res = requests.post(
“https://login.salesforce.com/services/oauth2/token”, params=params)
# if you connect to a Sandbox, use test.salesforce.com instead
global access_token
global instance_url
if res.status_code == 200:
access_token = res.json().get("access_token")
instance_url = res.json().get("instance_url")
# pdb.set_trace()
else:
current_app.logger.info('Login failed {}'.format(res.status_code))
@bp.before_request
def before_request():
log_in()
def get_local_date():
# Example date in local timezone
local_date = datetime.now() # datetime.datetime(2024, 7, 25, 12, 28, 15, 690673)
# Convert to UTC
# datetime.datetime(2024, 7, 25, 2, 28, 52, 241692, tzinfo=)
utc_date = local_date.astimezone(pytz.utc)
# Format to ISO 8601
formatted_date = utc_date.strftime(
'%Y-%m-%dT%H:%M:%SZ') # '2024-07-25T02:25:25Z'
return formatted_date
def sf_api_call(action, parameters={}, method=’get’, data={}):
“””
Helper function to make calls to Salesforce REST API.
Parameters:
- action (str): The URL endpoint for the API action (e.g., '/services/data/v40.0/sobjects/Account/0015g00000Xxxxx')
- parameters (dict): URL parameters (optional, used for GET requests or query parameters)
- method (str): HTTP method ('get', 'post', 'patch', 'delete')
- data (dict): Data payload for POST/PATCH requests (optional)
Returns:
- The response of the API call (either JSON for GET/POST/PATCH, or None for DELETE).
"""
print(access_token) # Debugging line, ensure access token is correct
headers = {
'Content-type': 'application/json',
'Accept-Encoding': 'gzip',
'Authorization': 'Bearer %s' % access_token
}
# Handle the different HTTP methods
if method == 'get':
r = requests.request(method, instance_url + action,
headers=headers, params=parameters, timeout=30)
elif method in ['post', 'patch']:
r = requests.request(method, instance_url + action,
headers=headers, json=data, params=parameters, timeout=10)
elif method == 'delete':
r = requests.delete(instance_url + action, headers=headers, timeout=10)
else:
# Raise an error if an unsupported HTTP method is used
raise ValueError('Method should be get, post, patch, or delete.')
# Log and print the request URL for debugging
print('Debug: API %s call: %s' % (method, r.url))
current_app.logger.info('Debug: API %s call: %s' % (method, r.url))
# Handle the response status
if r.status_code < 300:
if method == 'delete':
return None # For DELETE, we return None as there's no content to return
elif method == 'patch':
return None # PATCH may not return anything useful, so return None
else:
return r.json() # Return the JSON response for GET/POST requests
else:
current_app.logger.error(
'API error when calling %s : %s' % (r.url, r.content))
raise Exception('API error when calling %s : %s' % (r.url, r.content))
def sf_get_single_cart_activity_data(id):
query = ‘SELECT Id, Name, P_Session_Id__c, P_Email__c, P_Mobile_c__c, P_Last_User_Activity__c, P_Store__c, P_Checkout_Step__c FROM P_Cart_Activity__c WHERE Id = '’+’‘+id+’' ‘
def sf_get_cart_activity_get_single_product(product_id, activity_id):
# pdb.set_trace()
# query = f”SELECT Id FROM P_Cart_Activity_Product__c WHERE P_Cart_Activity_Product_Id__c = ‘{product_id}’”
query = f"SELECT Id FROM P_Cart_Activity_Product__c WHERE P_Cart_Activity_Product_Id__c = '{product_id}' AND P_Cart_Activity_Id__c = '{activity_id}'"
print("-----------------------------------------------------")
print(
f"sf_get_cart_activity_get_single_product: {product_id, activity_id}")
print(f"query: {query}")
print("-----------------------------------------------------")
return json.dumps(sf_api_call('/services/data/v39.0/query/', {'q': query}), indent=2)
def update_cart_product(product_id, quantity):
“””
Updates the quantity of a specific cart activity product.
Args:
product_id (str): The ID of the cart activity product to update.
quantity (int): The new quantity to set.
Returns:
Response: A Flask response object with the result of the operation.
"""
action_endpoint = f'/services/data/v40.0/sobjects/P_Cart_Activity_Product__c/Id/{product_id}'
cart_activity_product_data = {
'P_Cart_Activity_Product_Quantity__c': quantity
}
try:
# Perform the API call to update the cart activity product
sf_api_call(action_endpoint, method='patch',
data=cart_activity_product_data)
current_app.logger.info(
f"Cart activity product updated successfully. ID: {product_id}")
# Return a success response
print("-----------------------------------------------------")
print(f"Cart activity product updated successfully. ID: {product_id}")
print("-----------------------------------------------------")
response = {
"data": "",
"message": "Cart activity product successfully updated.",
"error": False
}
return make_response(jsonify(response), 200)
except Exception as error:
# Log the error and return an error response
error_message = f"Failed to update cart activity product {product_id}: {str(error)}"
print("-----------------------------------------------------")
print(error_message)
print("-----------------------------------------------------")
current_app.logger.error(error_message)
response = {
"data": "",
"message": error_message,
"error": True
}
return make_response(jsonify(response), 500)
def create_salesforce_record(object_name, data):
“””
Helper function to create a record in Salesforce using the REST API.
Parameters:
- object_name: The Salesforce object name (e.g., 'P_Cart_Activity__c')
- data: The data to send in the request body
Returns:
- The response from Salesforce (parsed JSON)
"""
try:
# Make the API call to Salesforce to create the record
response = sf_api_call(
f"/services/data/v40.0/sobjects/{object_name}",
method='post',
data=data
)
# Return the response from Salesforce
print("-----------------------------------------------------")
print("inserting new product=====", response)
print("-----------------------------------------------------")
return response
except Exception as e:
print("-----------------------------------------------------")
print("inserting new product ======fail", str(e))
print("-----------------------------------------------------")
current_app.logger.error(
f"Error creating Salesforce record for {object_name}: {str(e)}")
return {"success": False, "message": str(e)}
@bp.route(‘/delete_cart_activity/', methods=['POST', 'GET'])
def delete_cart_activity(activity_id):
"""
Delete Cart Activity and all its associated products.
"""
try:
# Step 1: Query and delete all associated CartActivityProduct records
associated_products_query = f"SELECT Id FROM P_Cart_Activity_Product__c WHERE P_Cart_Activity_Id__c = '{activity_id}'"
# Fetch associated CartActivityProduct records
associated_products = sf_api_call(
'/services/data/v40.0/query',
{'q': associated_products_query}
)
# Loop through and delete each associated CartActivityProduct record
for product in associated_products['records']:
product_id = product['Id']
sf_api_call(
f'/services/data/v40.0/sobjects/P_Cart_Activity_Product__c/{product_id}', method='delete')
# Step 2: Delete the CartActivity parent record
action = f'/services/data/v40.0/sobjects/P_Cart_Activity__c/{activity_id}'
# No need to check result.status_code here
sf_api_call(action, method='delete')
# Return success response
return make_response(
jsonify({
"data": "",
"message": f"Record with ID {activity_id} and its associated products were successfully deleted.",
"error": False
}),
200
)
except Exception as e:
# Log and return error response
current_app.logger.error('Error in delete_cart_activity: %s' % str(e))
return make_response(
jsonify({
"data": "",
"message": f"Failed to delete the Cart Activity record: {str(e)}",
"error": True
}),
500
)
@bp.route(‘/create_cart_activity_product/', methods=['POST'])
def create_cart_activity_product(activity_id):
"""
Create or update a cart activity product in Salesforce.
Args:
activity_id (str): The ID of the cart activity to associate the product with.
Returns:
Response: A Flask response object indicating the result of the operation.
"""
if not activity_id:
return make_response(
jsonify(
{"data": "", "message": "Activity ID is required.", "error": True}),
400
)
if request.method == "POST":
data = request.json
if not data:
return make_response(
jsonify(
{"data": "", "message": "Request payload is missing.", "error": True}),
400
)
product_id = data.get("product_id")
product_quantity = data.get("product_quantity")
if not product_id or not product_quantity:
return make_response(
jsonify(
{"data": "", "message": "Product ID and quantity are required.", "error": True}),
400
)
# Check if the product already exists in Salesforce
# pdb.set_trace()
print("-----------------------------------------------------")
print(f"create_cart_activity_product: {product_id, activity_id}")
print("-----------------------------------------------------")
response_data = sf_get_cart_activity_get_single_product(
product_id, activity_id)
records = json.loads(response_data).get('records', [])
product_exists = len(records) > 0
if product_exists:
product_sf_id = records[0]['Id']
current_app.logger.info(
f"Updating existing product with ID: {product_sf_id}")
print("-----------------------------------------------------")
print(f"Updating existing product with ID: {product_sf_id}")
print("-----------------------------------------------------")
update_cart_product(product_sf_id, product_quantity)
message = "Cart activity product successfully updated."
else:
print("-----------------------------------------------------")
print("inserting new product")
print("-----------------------------------------------------")
current_app.logger.info("Inserting new cart activity product")
# Create related Cart Activity Product in Salesforce
cart_activity_product_data = {
'P_Cart_Activity_Id__c': activity_id,
'P_Cart_Activity_Product_Id__c': product_id,
'P_Cart_Activity_Product_Quantity__c': product_quantity
}
cart_activity_product_response = create_salesforce_record(
object_name="P_Cart_Activity_Product__c",
data=cart_activity_product_data
)
if not cart_activity_product_response.get("success"):
current_app.logger.error(
f"Failed to create cart activity product for activity ID: {activity_id}")
return make_response(
jsonify(
{"data": "", "message": "Failed to create cart activity product.", "error": True}),
500
)
current_app.logger.info(
f"Cart activity product created successfully with ID: {cart_activity_product_response.get('id')}"
)
message = "Cart activity product successfully created."
# Return success response
return make_response(
jsonify({"data": "", "message": message, "error": False}),
200
)
return make_response(
jsonify(
{"data": "", "message": "Invalid request method. Only POST is allowed.", "error": True}),
405
)
@bp.route(‘/delete_cart_activity_product/', methods=['POST'])
def delete_cart_activity_product(activity_id):
"""
Delete Cart Activity Product with the specified ID if it exists.
Args:
activity_id (str): The ID of the activity associated with the product.
Returns:
Response: Flask response indicating success or failure of the operation.
"""
if request.method == "POST":
data = request.json
if not data:
return make_response(
jsonify(
{"data": "", "message": "Request payload is missing.", "error": True}),
400
)
product_id = data.get("product_id")
if not product_id:
return make_response(
jsonify(
{"data": "", "message": "Product ID is required.", "error": True}),
400
)
try:
# Step 1: Query for the Cart Activity Product to confirm existence
product_query = sf_get_cart_activity_get_single_product(
product_id, activity_id)
records = json.loads(product_query).get('records', [])
product_exists = len(records) > 0
if not product_exists:
print("-----------------------------------------------------")
print(f"No Cart Activity Product found with ID {product_id}")
print("-----------------------------------------------------")
current_app.logger.info(
f"No Cart Activity Product found with ID {product_id}")
return make_response(
jsonify(
{"data": "", "message": f"No Cart Activity Product found with ID {product_id}.", "error": True}),
404
)
# Step 2: Delete the Cart Activity Product
product_sf_id = records[0]['Id']
sf_api_call(
f'/services/data/v40.0/sobjects/P_Cart_Activity_Product__c/{product_sf_id}', method='delete'
)
print("-----------------------------------------------------")
print(
f"Cart Activity Product with ID {product_sf_id} successfully deleted.")
print("-----------------------------------------------------")
current_app.logger.info(
f"Cart Activity Product with ID {product_sf_id} successfully deleted.")
return make_response(
jsonify(
{"data": "", "message": f"Cart Activity Product with ID {product_sf_id} successfully deleted.", "error": False}),
200
)
except Exception as e:
current_app.logger.error(
f"Error in delete_cart_activity_product: {str(e)}")
return make_response(
jsonify(
{"data": "", "message": f"Failed to delete the Cart Activity Product: {str(e)}", "error": True}),
500
)
return make_response(
jsonify(
{"data": "", "message": "Invalid request method. Only POST is allowed.", "error": True}),
405
)
@bp.route(‘/delete_all_cart_activity_products/', methods=['POST'])
def delete_all_cart_activity_products(activity_id):
"""
Delete all specified carat activity associated products.
"""
try:
# Query and delete all CartActivityProduct records
associated_products_query = f"SELECT Id FROM P_Cart_Activity_Product__c WHERE P_Cart_Activity_Id__c = '{activity_id}'"
# Fetch associated CartActivityProduct records
associated_products = sf_api_call(
'/services/data/v40.0/query',
{'q': associated_products_query}
)
# Loop through and delete each associated CartActivityProduct record
for product in associated_products['records']:
product_id = product['Id']
sf_api_call(
f'/services/data/v40.0/sobjects/P_Cart_Activity_Product__c/{product_id}', method='delete')
# Return success response
return make_response(
jsonify({
"data": "",
"message": f"Record with this ID {activity_id} :successfully deleted all associated products.",
"error": False
}),
200
)
except Exception as e:
# Log and return error response
current_app.logger.error(
'Error in delete_cart_activity associated products: %s' % str(e))
return make_response(
jsonify({
"data": "",
"message": f"Failed to delete the Cart Activity associated products: {str(e)}",
"error": True
}),
500
)
Simply place a Grace
order during the Black Friday Sale and automatically go in the draw
to win a full refund of your order. Make sure you are subscribed to
find out if you are
a winner!
By clicking submit, you consent to receive marketing
communications and can unsubscribe at any time. See competition T&C's.
Your Rewards
Christmas gifts for everyone on your list! Explore our Grace Gift Guide today.