https://github.com/mirantis/k8srnd-sockshop-payment
https://github.com/mirantis/k8srnd-sockshop-payment
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/mirantis/k8srnd-sockshop-payment
- Owner: Mirantis
- License: apache-2.0
- Created: 2019-09-11T07:16:41.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2020-02-26T12:36:53.000Z (over 6 years ago)
- Last Synced: 2025-01-20T17:50:47.623Z (over 1 year ago)
- Language: Go
- Size: 79.1 KB
- Stars: 1
- Watchers: 4
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Contributing: .github/CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# Payment
[](https://travis-ci.org/microservices-demo/payment)
[](https://coveralls.io/github/microservices-demo/payment?branch=master)
[](https://goreportcard.com/report/github.com/microservices-demo/user)
[](http://microbadger.com/images/weaveworksdemos/payment "Get your own image badge on microbadger.com")
A microservices-demo service that provides payment services.
This build is built, tested and released by travis.
## Bugs, Feature Requests and Contributing
We'd love to see community contributions. We like to keep it simple and use Github issues to track bugs and feature requests and pull requests to manage contributions.
## API Spec
Checkout the API Spec [here](http://microservices-demo.github.io/api/index?url=https://raw.githubusercontent.com/microservices-demo/payment/master/api-spec/payment.json)
## Build
#### Dependencies
```
cd $GOPATH/src/github.com/microservices-demo/payment/
go get -u github.com/FiloSottile/gvt
gvt restore
```
#### Using native Go tools
In order to build the project locally you need to make sure that the repository directory is located in the correct
$GOPATH directory: $GOPATH/src/github.com/microservices-demo/payment/. Once that is in place you can build by running:
```
cd $GOPATH/src/github.com/microservices-demo/payment/paymentsvc/
go build -o payment
```
The result is a binary named `payment`, in the current directory.
#### Using Docker Compose
`docker-compose build`
## Test
`COMMIT=test make test`
## Run
#### Using Go native
If you followed to Go build instructions, you should have a "payment" binary in $GOPATH/src/github.com/microservices-demo/payment/cmd/paymentsvc/.
To run it use:
```
./payment
ts=2016-12-14T11:48:58Z caller=main.go:29 transport=HTTP port=8080
```
#### Using Docker Compose
If you used Docker Compose to build the payment project, the result should be a Docker image called `weaveworksdemos/payment`.
To run it use:
```
docker-compose up
```
You can now access the service via http://localhost:8082
## Check
You can check the health of the service by doing a GET request to the health endpoint:
```
curl http://localhost:8082/health
{"health":[{"service":"payment","status":"OK","time":"2016-12-14 12:22:04.716316395 +0000 UTC"}]}
```
## Use
You can authorise a payment by POSTing to the paymentAuth endpoint:
```
curl -H "Content-Type: application/json" -X POST -d'{"Amount":40}' http://localhost:8082/paymentAuth
{"authorised":true}
```
## Push
`GROUP=weaveworksdemos COMMIT=test ./scripts/push.sh`