-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathhandler.py
38 lines (28 loc) · 898 Bytes
/
handler.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import json
from random import random
import boto3
SFN = boto3.client('stepfunctions')
SQS = boto3.client('sqs')
def creditCheck(event, context):
print(event)
#Simulate processing of cretid Check
return event
def wallet(event, context):
print(f'# event={json.dumps(event)}')
body = json.loads(event['Records'][0]['body'])
print(f'# {body}')
change = random()
if change < 0.7 :
SFN.send_task_success(
taskToken=body['taskToken'],
output=json.dumps({
'msg': 'this goes to the next state',
'credit_status': True
}))
else:
SFN.send_task_success(
taskToken=body['taskToken'],
output=json.dumps({
'msg': 'this goes to the next state',
'credit_status': False
}))