A payment service, because nothing in life is really free...
The Payment service is part of the ACME Fitness Serverless Shop. The goal of this specific service is to validate credit card payments. Currently the only validation performed is whether the card is acceptable.
- Go (at least Go 1.12)
- An AWS account
- A Pulumi account
- A Sentry.io account if you want to enable tracing and error reporting
With Pulumi (using SQS for eventing)
To deploy the Payment Service you'll need a Pulumi account. Once you have your Pulumi account and configured the Pulumi CLI, you can initialize a new stack using the Pulumi templates in the pulumi folder.
cd pulumi pulumi stack init <your pulumi org>/acmeserverless-payment/dev
Pulumi is configured using a file called
Pulumi.dev.yaml. A sample configuration is available in the Pulumi directory. You can rename
Pulumi.dev.yaml and update the variables accordingly. Alternatively, you can change variables directly in the main.go file in the pulumi directory. The configuration contains:
config: aws:region: us-west-2 ## The region you want to deploy to awsconfig:generic: sentrydsn: ## The DSN to connect to Sentry accountid: ## Your AWS Account ID wavefronturl: ## The URL of your Wavefront instance wavefronttoken: ## Your Wavefront API token awsconfig:tags: author: retgits ## The author, you... feature: acmeserverless team: vcs ## The team you're on version: 0.2.0 ## The version
To create the Pulumi stack, and create the Payment service, run
If you want to keep track of the resources in Pulumi, you can add tags to your stack as well.
pulumi stack tag set app:name acmeserverless pulumi stack tag set app:feature acmeserverless-payment pulumi stack tag set app:domain payment
With CloudFormation (using EventBridge for eventing)
Clone this repository
git clone https://github.com/retgits/acme-serverless-payment cd acme-serverless-payment
Get the Go Module dependencies
go get ./...
Change directories to the cloudformation folder
If your event bus is not called acmeserverless, update the name of the
feature parameter in the
template.yaml file. Now you can build and deploy the Lambda function:
make build make deploy
To test, you can use the SQS or EventBridge test apps in the acme-serverless repo.
Please make sure to update tests as appropriate.
See the LICENSE file in the repository