ucloud-pay/README.md

56 lines
1.5 KiB
Markdown
Raw Normal View History

2019-09-13 05:02:23 +00:00
# ucloud-pay
The pay module for the ucloud
2019-09-19 10:26:39 +00:00
- uses [etcd3](https://coreos.com/blog/etcd3-a-new-etcd.html) for storage
- uses [Stripe](https://stripe.com/docs/api) as the payment gateway
2019-09-13 05:02:23 +00:00
2019-09-13 06:37:53 +00:00
## Getting started
2019-09-19 10:26:39 +00:00
```
git clone git@code.ungleich.ch:ucloud/ucloud-pay.git
cd uclou-pay
cp env.sample .env
```
Now, modify the params in .env file as per your setup and run.
2019-09-13 06:37:53 +00:00
```
pipenv shell
pipenv install
2019-09-19 10:28:01 +00:00
python ucloud_pay.py
2019-09-13 06:37:53 +00:00
```
2019-09-13 05:02:23 +00:00
Currently handles very basic features, such as:
2019-09-19 10:26:39 +00:00
#### 1. Adding of products
2019-09-13 05:02:23 +00:00
```
2019-09-19 10:26:39 +00:00
curl http://ucloud-pay-server:5000/product/add -XPOST --data '-name mravi --realm test --seed testseed --product-name "IPV6 VPN" --product-description="YEARLY IPV6 subscription" --product-type=recurring --product-recurring-period=year --product-price=12000 --product-minimum-subscription-period=year'
2019-09-13 05:02:23 +00:00
```
2019-09-19 10:26:39 +00:00
#### 2. Listing of products
2019-09-13 05:02:23 +00:00
```
curl http://ucloud-pay-server:5000/product/list
```
2019-09-19 10:26:39 +00:00
#### 3. Ordering products
```
curl http://ucloud-pay-server:5000/product/order -XPOST --data '-name username --realm user_realm --seed user_seed --product-id 343sdf3e2423
```
#### 4. Listing users orders
```
curl http://ucloud-pay-server:5000/order/list -XPOST --data '-name username --realm user_realm --seed user_seed
```
#### 5. Registering user's payment method (credit card for now using Stripe)
```
curl http://ucloud-pay-server:5000/user/register_payment -XPOST --data '-name username --realm user_realm --seed user_seed --card_number 4111111111111111 --cvc 123 --expiry_year 2020 --expiry_month 8 --card_holder_name "The test user"
```