A rudimentary implementation of a bank transferring system, built using lambda functions and the serverless framework.
Java == 8
Scala == 1.12
AWS credentials for an IAM user that can create lambdas and dynamodb tables.
cd serverless-bank-transfer
sbt assembly
serverless deploy
Then POST a request to the endpoint output by serverless, like:
curl -X POST https://REPLACE-ME.execute-api.us-east-1.amazonaws.com/dev/transfer/schedule --header 'content-type: application/json' --data @examples/no_scheduled_time_request.json
TODO: Implement the following integration test cases:
Set-up for each of the following scenarios:
Balances table: Alice $100 Bob $50
#1: $100 Alice -> Bob now (success)
#2: $1 Alice -> Bob now (failure -- insufficient balance)
#1: $100 Alice -> Bob in 1 hour (success)
#2: $1 Alice -> Bob now (failure -- insufficient balance)
#1: $50 Bob -> Alice in 1 minute (success)
#2: $1 Bob -> Alice now (failure -- insufficient balance)
cancel transfer #1 (success)
#3: $50 Bob -> Alice now (success)
#1: $1 Alice -> Bob now (success)
cancel transfer #1 (fails -- already executed)
#1: $1 Alice -> Bob now (success)
#2: Resend transfer #1 (failure -- transfer schedule request already processed)