2020-01-20 07:30:12 +00:00
|
|
|
# uncloud-pay
|
|
|
|
|
|
|
|
The pay module for the uncloud
|
|
|
|
|
|
|
|
- uses [etcd3](https://coreos.com/blog/etcd3-a-new-etcd.html) for storage.
|
|
|
|
- uses [Stripe](https://stripe.com/docs/api) as the payment gateway.
|
|
|
|
- uses [ldap3](https://github.com/cannatag/ldap3) for ldap authentication.
|
|
|
|
|
2020-02-19 08:12:07 +00:00
|
|
|
## Installation
|
2020-01-20 07:30:12 +00:00
|
|
|
|
2020-02-19 08:12:07 +00:00
|
|
|
```shell script
|
|
|
|
pip3 install -r requirements.txt
|
|
|
|
```
|
|
|
|
|
|
|
|
## Getting Started
|
|
|
|
|
|
|
|
```shell script
|
|
|
|
python ucloud_pay.py
|
|
|
|
```
|
2020-01-20 07:30:12 +00:00
|
|
|
|
|
|
|
## Usage
|
|
|
|
|
|
|
|
#### 1. Adding of products
|
|
|
|
```shell script
|
2020-02-19 06:59:54 +00:00
|
|
|
http --json http://[::]:5000/product/add username=your_username_here password=your_password_here specs:=@ipv6-only-vm.json
|
2020-01-20 07:30:12 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
#### 2. Listing of products
|
|
|
|
```shell script
|
|
|
|
http --json http://[::]:5000/product/list
|
|
|
|
```
|
|
|
|
|
2020-02-19 06:59:54 +00:00
|
|
|
#### 3. Registering user's payment method (credit card for now using Stripe)
|
|
|
|
|
2020-01-20 07:30:12 +00:00
|
|
|
```shell script
|
2020-02-19 06:59:54 +00:00
|
|
|
http --json http://[::]:5000/user/register_payment card_number=4111111111111111 cvc=123 expiry_year=2020 expiry_month=8 card_holder_name="The test user" username=your_username_here password=your_password_here line1="your_billing_address" city="your_city" country="your_country"
|
2020-01-20 07:30:12 +00:00
|
|
|
```
|
|
|
|
|
2020-02-19 06:59:54 +00:00
|
|
|
#### 4. Ordering products
|
|
|
|
|
|
|
|
First of all, user have to buy the membership first.
|
2020-01-20 07:30:12 +00:00
|
|
|
|
|
|
|
```shell script
|
2020-02-19 06:59:54 +00:00
|
|
|
http --json http://[::]:5000/product/order username=your_username_here password=your_password_here product_id=membership pay=True
|
2020-01-20 07:30:12 +00:00
|
|
|
```
|
|
|
|
|
2020-02-19 06:59:54 +00:00
|
|
|
```shell script
|
|
|
|
http --json http://[::]:5000/product/order username=your_username_here password=your_password_here product_id=ipv6-only-vm cpu=1 ram=1 os-disk-space=10 os=alpine pay=True
|
|
|
|
```
|
2020-01-20 07:30:12 +00:00
|
|
|
|
2020-02-19 06:59:54 +00:00
|
|
|
#### 5. Listing users orders
|
2020-01-20 07:30:12 +00:00
|
|
|
|
|
|
|
```shell script
|
2020-02-19 06:59:54 +00:00
|
|
|
http --json POST http://[::]:5000/order/list username=your_username_here password=your_password_here
|
|
|
|
```
|