@@ -710,9 +710,11 @@ async def create_euler_offer(params: FunctionCallParams):
710710 "validTo" : end_date ,
711711 "minAmount" : min_order_amount ,
712712 "sponsoredBy" : sponsored_by ,
713- "paymentMethods" : payment_instruments
714- if payment_instruments
715- else "All payment methods" ,
713+ "paymentMethods" : (
714+ payment_instruments
715+ if payment_instruments
716+ else "All payment methods"
717+ ),
716718 },
717719 }
718720 await params .result_callback ({"data" : json .dumps (success_result )})
@@ -1268,22 +1270,32 @@ async def update_euler_offer(params: FunctionCallParams):
12681270 "offer_code" : offer_code ,
12691271 "batch_id" : existing_offer .get ("batch_id" , "" ),
12701272 "offer_description" : {
1271- "title" : offer_title
1272- if offer_title is not None
1273- else existing_offer .get ("offer_description" , {}).get ("title" , "" ),
1274- "description" : offer_description
1275- if offer_description is not None
1276- else existing_offer .get ("offer_description" , {}).get ("description" , "" ),
1273+ "title" : (
1274+ offer_title
1275+ if offer_title is not None
1276+ else existing_offer .get ("offer_description" , {}).get ("title" , "" )
1277+ ),
1278+ "description" : (
1279+ offer_description
1280+ if offer_description is not None
1281+ else existing_offer .get ("offer_description" , {}).get (
1282+ "description" , ""
1283+ )
1284+ ),
12771285 "tnc" : existing_offer .get ("offer_description" , {}).get ("tnc" , "" ),
1278- "sponsored_by" : sponsored_by
1279- if sponsored_by is not None
1280- else existing_offer .get ("offer_description" , {}).get (
1281- "sponsored_by" , "BREEZE"
1286+ "sponsored_by" : (
1287+ sponsored_by
1288+ if sponsored_by is not None
1289+ else existing_offer .get ("offer_description" , {}).get (
1290+ "sponsored_by" , "BREEZE"
1291+ )
12821292 ),
1283- "display_title" : offer_title
1284- if offer_title is not None
1285- else existing_offer .get ("offer_description" , {}).get (
1286- "display_title" , ""
1293+ "display_title" : (
1294+ offer_title
1295+ if offer_title is not None
1296+ else existing_offer .get ("offer_description" , {}).get (
1297+ "display_title" , ""
1298+ )
12871299 ),
12881300 },
12891301 "ui_configs" : existing_offer .get (
@@ -1307,11 +1319,13 @@ async def update_euler_offer(params: FunctionCallParams):
13071319 "max_order_amount" : existing_offer .get ("rule_dsl" , {})
13081320 .get ("order" , {})
13091321 .get ("max_order_amount" ),
1310- "min_order_amount" : str (min_order_amount )
1311- if min_order_amount is not None
1312- else existing_offer .get ("rule_dsl" , {})
1313- .get ("order" , {})
1314- .get ("min_order_amount" , "1" ),
1322+ "min_order_amount" : (
1323+ str (min_order_amount )
1324+ if min_order_amount is not None
1325+ else existing_offer .get ("rule_dsl" , {})
1326+ .get ("order" , {})
1327+ .get ("min_order_amount" , "1" )
1328+ ),
13151329 "currency" : existing_offer .get ("rule_dsl" , {})
13161330 .get ("order" , {})
13171331 .get ("currency" , "INR" ),
@@ -1322,9 +1336,13 @@ async def update_euler_offer(params: FunctionCallParams):
13221336 "additional_payment_filters" : existing_offer .get ("rule_dsl" , {}).get (
13231337 "additional_payment_filters"
13241338 ),
1325- "payment_instrument" : payment_instruments_payload
1326- if payment_instruments_payload is not None
1327- else existing_offer .get ("rule_dsl" , {}).get ("payment_instrument" , []),
1339+ "payment_instrument" : (
1340+ payment_instruments_payload
1341+ if payment_instruments_payload is not None
1342+ else existing_offer .get ("rule_dsl" , {}).get (
1343+ "payment_instrument" , []
1344+ )
1345+ ),
13281346 "counters" : existing_offer .get ("rule_dsl" , {}).get ("counters" , []),
13291347 "txn_type" : existing_offer .get ("rule_dsl" , {}).get (
13301348 "txn_type" , ["ORDER" ]
@@ -1334,29 +1352,37 @@ async def update_euler_offer(params: FunctionCallParams):
13341352 ),
13351353 "benefits" : [
13361354 {
1337- "type" : offer_type
1338- if offer_type is not None
1339- else existing_offer .get ("rule_dsl" , {})
1340- .get ("benefits" , [{}])[0 ]
1341- .get ("type" , "DISCOUNT" ),
1342- "calculation_rule" : calculation_type
1343- if calculation_type is not None
1344- else existing_offer .get ("rule_dsl" , {})
1345- .get ("benefits" , [{}])[0 ]
1346- .get ("calculation_rule" , "ABSOLUTE" ),
1347- "value" : discount_value
1348- if discount_value is not None
1349- else existing_offer .get ("rule_dsl" , {})
1350- .get ("benefits" , [{}])[0 ]
1351- .get ("value" , 0 ),
1355+ "type" : (
1356+ offer_type
1357+ if offer_type is not None
1358+ else existing_offer .get ("rule_dsl" , {})
1359+ .get ("benefits" , [{}])[0 ]
1360+ .get ("type" , "DISCOUNT" )
1361+ ),
1362+ "calculation_rule" : (
1363+ calculation_type
1364+ if calculation_type is not None
1365+ else existing_offer .get ("rule_dsl" , {})
1366+ .get ("benefits" , [{}])[0 ]
1367+ .get ("calculation_rule" , "ABSOLUTE" )
1368+ ),
1369+ "value" : (
1370+ discount_value
1371+ if discount_value is not None
1372+ else existing_offer .get ("rule_dsl" , {})
1373+ .get ("benefits" , [{}])[0 ]
1374+ .get ("value" , 0 )
1375+ ),
13521376 "amount_info" : existing_offer .get ("rule_dsl" , {})
13531377 .get ("benefits" , [{}])[0 ]
13541378 .get ("amount_info" , []),
1355- "max_amount" : max_discount_amount
1356- if max_discount_amount is not None
1357- else existing_offer .get ("rule_dsl" , {})
1358- .get ("benefits" , [{}])[0 ]
1359- .get ("max_amount" ),
1379+ "max_amount" : (
1380+ max_discount_amount
1381+ if max_discount_amount is not None
1382+ else existing_offer .get ("rule_dsl" , {})
1383+ .get ("benefits" , [{}])[0 ]
1384+ .get ("max_amount" )
1385+ ),
13601386 "global_max_amount" : existing_offer .get ("rule_dsl" , {})
13611387 .get ("benefits" , [{}])[0 ]
13621388 .get ("global_max_amount" ),
@@ -1366,15 +1392,19 @@ async def update_euler_offer(params: FunctionCallParams):
13661392 "filters" , {"blacklist" : [], "whitelist" : []}
13671393 ),
13681394 },
1369- "status" : status
1370- if status is not None
1371- else existing_offer .get ("status" , "ACTIVE" ),
1372- "start_time" : start_date_iso
1373- if start_date_iso is not None
1374- else existing_offer .get ("start_time" ),
1375- "end_time" : end_date_iso
1376- if end_date_iso is not None
1377- else existing_offer .get ("end_time" ),
1395+ "status" : (
1396+ status if status is not None else existing_offer .get ("status" , "ACTIVE" )
1397+ ),
1398+ "start_time" : (
1399+ start_date_iso
1400+ if start_date_iso is not None
1401+ else existing_offer .get ("start_time" )
1402+ ),
1403+ "end_time" : (
1404+ end_date_iso
1405+ if end_date_iso is not None
1406+ else existing_offer .get ("end_time" )
1407+ ),
13781408 "metadata" : {
13791409 "analytics_offer_code" : offer_code ,
13801410 "customerResetPeriodType" : existing_offer .get ("metadata" , {}).get (
@@ -1395,12 +1425,16 @@ async def update_euler_offer(params: FunctionCallParams):
13951425 "productUpiResetPeriodType" : existing_offer .get ("metadata" , {}).get (
13961426 "productUpiResetPeriodType" , "offerPeriod"
13971427 ),
1398- "start_date" : start_date_iso
1399- if start_date_iso is not None
1400- else existing_offer .get ("metadata" , {}).get ("start_date" ),
1401- "end_date" : end_date_iso
1402- if end_date_iso is not None
1403- else existing_offer .get ("metadata" , {}).get ("end_date" ),
1428+ "start_date" : (
1429+ start_date_iso
1430+ if start_date_iso is not None
1431+ else existing_offer .get ("metadata" , {}).get ("start_date" )
1432+ ),
1433+ "end_date" : (
1434+ end_date_iso
1435+ if end_date_iso is not None
1436+ else existing_offer .get ("metadata" , {}).get ("end_date" )
1437+ ),
14041438 },
14051439 "udf1" : existing_offer .get ("udf1" ),
14061440 "udf2" : existing_offer .get ("udf2" ),
0 commit comments