Skip to content

Commit

Permalink
Add env variables for buyer-finder fee and type
Browse files Browse the repository at this point in the history
  • Loading branch information
adityapatil123 committed Oct 24, 2024
1 parent 567c909 commit 6174ee8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 22 deletions.
2 changes: 2 additions & 0 deletions webserver/main/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ class Config:
CITY_LIST = [c.strip() for c in os.getenv("CITY_LIST", all_cities_str).split(",")]
NO_DASHBOARD_ENDPOINT = os.getenv("NO_DASHBOARD_ENDPOINT", "https://analytics-api-pre-prod.aws.ondc.org")
NO_DASHBOARD_BEARER_TOKEN = os.getenv("NO_DASHBOARD_BEARER_TOKEN", "token")
BAP_FINDER_FEE_TYPE = os.getenv("BAP_FINDER_FEE_TYPE", "percent")
BAP_FINDER_FEE_AMOUNT = os.getenv("BAP_FINDER_FEE_AMOUNT", "3")


class DevelopmentConfig(Config):
Expand Down
36 changes: 14 additions & 22 deletions webserver/main/cron/search_by_city.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ def make_http_requests_for_search_by_city(search_type: SearchType, domains=None,
domain_list = get_config_by_name("DOMAIN_LIST") if domains is None else domains
end_time = datetime.utcnow().strftime('%Y-%m-%dT%H:%M:%S.%f')[:-3] + 'Z'
start_time = (datetime.utcnow() - timedelta(days=1)).strftime('%Y-%m-%dT%H:%M:%S.%f')[:-3] + 'Z'
payment_object = {
"@ondc/org/buyer_app_finder_fee_type": get_config_by_name("BAP_FINDER_FEE_TYPE"),
"@ondc/org/buyer_app_finder_fee_amount": get_config_by_name("BAP_FINDER_FEE_AMOUNT")
}
if search_type == SearchType.FULL:
city_list = get_config_by_name("CITY_LIST") if cities is None else cities
message = {
Expand All @@ -25,11 +29,7 @@ def make_http_requests_for_search_by_city(search_type: SearchType, domains=None,
{
"type": "Delivery"
},
"payment":
{
"@ondc/org/buyer_app_finder_fee_type": "percent",
"@ondc/org/buyer_app_finder_fee_amount": "3"
}
"payment": payment_object
}
}
else:
Expand All @@ -38,24 +38,20 @@ def make_http_requests_for_search_by_city(search_type: SearchType, domains=None,
message = {
"intent":
{
"payment":
{
"@ondc/org/buyer_app_finder_fee_type":"percent",
"@ondc/org/buyer_app_finder_fee_amount":"3"
},
"payment": payment_object,
"tags":
[
{
"code":"catalog_inc",
"code": "catalog_inc",
"list":
[
{
"code":"start_time",
"value":start_time
"code": "start_time",
"value": start_time
},
{
"code":"end_time",
"value":end_time
"code": "end_time",
"value": end_time
}
]
}
Expand All @@ -65,20 +61,16 @@ def make_http_requests_for_search_by_city(search_type: SearchType, domains=None,
else:
message = {
"intent": {
"payment":
{
"@ondc/org/buyer_app_finder_fee_type":"percent",
"@ondc/org/buyer_app_finder_fee_amount":"3"
},
"payment": payment_object,
"tags":
[
{
"code":"catalog_inc",
"list":
[
{
"code":"mode",
"value":mode
"code": "mode",
"value": mode
}
]
}
Expand Down

0 comments on commit 6174ee8

Please sign in to comment.