This repo is a solution for technical interview challenge by Valpay
. It uses serverless architecture lambda
, api gateway
and dynamodb
.
Below Makefile command is an abstraction for a guided deployment
make deploy
Stack Name [valpay]:
AWS Region [eu-west-1]:
Parameter Environment [dev]:
#Shows you resources changes to be deployed and require a 'Y' to initiate deploy
Confirm changes before deploy [y/N]: N
#SAM needs permission to be able to create roles to connect to the resources in your template
Allow SAM CLI IAM role creation [Y/n]: Y
#Preserves the state of previously provisioned resources when an operation fails
Disable rollback [y/N]: N
TransactionNotificationFun has no authentication. Is this okay? [y/N]: y
PayoutNotificationFun has no authentication. Is this okay? [y/N]: y
Save arguments to configuration file [Y/n]: n
I've used NoSQL key/value pair DynamoDB Table with HASH
key merchantId
and RANGE
key transactionId
. Also with secondary local index which is used to generate reports and for query
operation with RANGE
key transactionDate
.
The Table Structure is as follows:
- merchantId (HASH), type String
- transactionId (RANGE), type String
- transactionDate (RANGE), type Number
- type, type String valid values
auth
,refund
ordispute
- paymentTarget, type string valid values
valpay
ormerchant
- payouts, type Array
On PayoutNotification the payouts array is appended onto the pay value provided from the POST
payload of the PayoutNotification
webhook
The application folows method factory pattern which create objects of type or paymentTarget which are constructed using strategy pattern
The Architecture is depicted by the below diagram:
- AuthZ/AuthN not implemented possible solution AWS Cognito service
- SNS Notification on third party collection service failure not implemented, although stubs are there.