Skip to content

Commit 21a97af

Browse files
Deploying to main from @ saicone/PixelBuy@1de7962 🚀
1 parent 70960e3 commit 21a97af

File tree

2 files changed

+159
-5
lines changed

2 files changed

+159
-5
lines changed

docs/pixelbuy/developers/schema.md

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
---
2+
sidebar_position: 2
3+
title: Schema
4+
description: PixelBuy web API schema.
5+
---
6+
7+
To allow people make its own website and connect it with PixelBuy, a format to get website data is provided.
8+
9+
## REST API
10+
11+
Make your site serve data with the typical `GET` and `POST` process.
12+
13+
Json content is used to explain the format.
14+
15+
### Authentication
16+
17+
Every website must provide a "secret", an API key to allow the user to get information from the website API.
18+
19+
PixelBuy is compatible with a variety of authentication formats:
20+
21+
* Query parameters, by providing the secret as a query parameter in the same URL.
22+
* Header property, by providing the secret as a http header in every connection.
23+
* Basic authentication, by passing the secret in a Basic authentication header in every connection.
24+
25+
### Version 1
26+
27+
**error:** The response to communicate an error.
28+
29+
```json5
30+
{
31+
"error": "error_message_code",
32+
"message": "An error has occur",
33+
"status": 404,
34+
}
35+
```
36+
37+
**(GET) order:** A store order, the player can be provided by only its name if you don't want to provide the UUID.
38+
39+
```json5
40+
{
41+
"id": 1234, // Order numeric ID / transaction number
42+
"date": "1970-01-25", // ISO-8601 formatted
43+
"player": "7ca003dc-175f-4f1f-b490-5651045311ad:Rubenicos", // [<uuid>:]<name>
44+
"execution": "BUY", // Optional, the value must be BUY, RECOVER or REFUND
45+
// The items can be empty if execution is RECOVER or REFUND
46+
"items": [
47+
{
48+
"product": 55, // Optional, it's the product identifier, can be any type of object
49+
"id": "super-pickaxe", // The item identifier configured on PixelBuy items
50+
"amount": 1, // The amount of items of this type, must be an integer number
51+
"price": 2.49, // The real amount of money spend on this item(s)
52+
},
53+
{
54+
"product": 94,
55+
"id": "eco-bundle",
56+
"amount": 6,
57+
"price": 5.04,
58+
}
59+
]
60+
}
61+
```
62+
63+
**(GET) server:** A server information.
64+
65+
```json5
66+
{
67+
// Orders that should be processed by PixelBuy
68+
"pending_orders": [
69+
{
70+
// Order object...
71+
},
72+
{
73+
// Order object...
74+
}
75+
],
76+
"next_check": 60, // Optional, the amount of seconds to wait until make the next check
77+
}
78+
```
79+
80+
**(POST) update:** Communicate to store a server update.
81+
82+
```json5
83+
{
84+
"processed_orders": [ 1234, 6727, 1897 ], // Order IDs that must be removed from server pending orders
85+
}
86+
```

docs/pixelbuy/store/web-supervisor.md

Lines changed: 73 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,17 @@ title: Web supervisor
44
description: How to setup PixelBuy web supervisors.
55
---
66

7+
```mdx-code-block
8+
import DocCard from '@theme/DocCard';
9+
```
10+
711
The web supervisor interface is a type of system that retrieves data from a web store to apply any necessary delivery inside Minecraft server.
812

913
## Types
1014

1115
PixelBuy currently aims to support some delivery concepts:
1216

17+
* `PIXELBUY` - Website compatible with PixelBuy web API format.
1318
* `WOOMINECRAFT` - Self-hosted WordPress using **WooMinecraft** plugin.
1419
* `TEBEX` - BuyCraft-like delivery from **Tebex** store.
1520

@@ -18,10 +23,68 @@ PixelBuy currently aims to support some delivery concepts:
1823
Any web supervisor has common configuration paths.
1924

2025
```yaml
26+
Type: PIXELBUY
2127
Group: 'servername'
28+
URL: 'https://shop.mysite.com'
2229
```
2330
31+
* `type` - The type of web supervisor.
2432
* `group` - Is the server associated with the name that the supervisor is looking for orders.
33+
* `url` - Is the store url.
34+
35+
### Secret declaration
36+
37+
In any part of the configuration where a "secret", "key" or any value that is supposed to be private, can be declared in the following ways:
38+
39+
* `<value>` - The simple one, where `<value>` is just the value.
40+
* `file:<path>` - To get the value from a file content, where `<path>` is the file path.
41+
* `property:<key>` - To get the value from a system property, where `<key>` is the system property key.
42+
43+
## PixelBuy
44+
45+
The PixelBuy web supervisor retrieves information from a site compatible with PixelBuy web API schema:
46+
47+
```mdx-code-block
48+
<DocCard item={{
49+
type: "link",
50+
href: "/pixelbuy/developers/schema/",
51+
label: "Schema",
52+
description: "PixelBuy web API schema"
53+
}}
54+
/>
55+
```
56+
57+
This supervisor also came with its own configuration.
58+
59+
```yaml
60+
Version: 1
61+
Format:
62+
Server: '{url}/api/server/{key}'
63+
Order: '{url}/api/order/{key}'
64+
Rest:
65+
Check-Interval: 30
66+
Auth: PARAMS
67+
Property: 'secret'
68+
Secret: ''
69+
```
70+
71+
* `version` - The version of PixelBuy schema.
72+
* `format.server` - The URL format to get server information (`{key}` will be replaced with server group).
73+
* `format.order` - The URL format to get order information (`{key}` will be replaced with order ID).
74+
* `rest.check-interval` - The interval in seconds to check new orders, set to `DETECT` to use a provided one by REST API.
75+
* `rest.auth` - The authentication type to connect with REST API.
76+
* `rest.property` - The property name, this both apply to `PARAMS` and `HEADER` authentication.
77+
* `rest.secret` - The secret key that is used to get information.
78+
79+
### Format version
80+
81+
* **Version 1:** Initial PixelBuy web API version, no changes.
82+
83+
### Auth types
84+
85+
* `PARAMS` - Use query parameters to provide the secret.
86+
* `HEADER` - Use header property to provide the secret.
87+
* `BASIC` - Use HTTP Basic authorization.
2588

2689
## WooMinecraft
2790

@@ -30,14 +93,12 @@ The WooMinecraft supervisor type makes delayed checks to get what order commands
3093
The store plugin setup is the same as [WooMinecraft wiki](https://github.com/WooMinecraft/WooMinecraft/wiki/Step-2:-Setting-up-the-wordpress-side) and also [the commands](https://github.com/WooMinecraft/WooMinecraft/wiki/Step-3:-Creating-A-Package).
3194

3295
```yaml
33-
Check-Interval: 7
34-
URL: 'http://shop.mysite.com'
96+
Check-Interval: 600
3597
Key: 'asdUniqueKeyForServer'
3698
```
3799

38-
* `Check-Interval` - Is the interval in seconds to check WooMinecraft rest api from store url.
39-
* `URL` - Is the store url.
40-
* `Key` - Is the server key from [WooMinecraft configuration](https://github.com/WooMinecraft/WooMinecraft/wiki/Step-2:-Setting-up-the-wordpress-side).
100+
* `check-interval` - Is the interval in seconds to check WooMinecraft rest api from store url.
101+
* `key` - Is the server key from [WooMinecraft configuration](https://github.com/WooMinecraft/WooMinecraft/wiki/Step-2:-Setting-up-the-wordpress-side).
41102

42103
### WooCommerce integration
43104

@@ -62,8 +123,15 @@ Next you only need to set the generated key and secret into web supervisor confi
62123

63124
```yaml
64125
WooCommerce:
126+
Version: 3
127+
Auth: PARAMS
65128
ConsumerKey: 'ck_theGeneratedConsumerKey'
66129
ConsumerSecret: 'cs_theGeneratedConsumerSecret'
67130
```
68131

132+
* `version` - WooCommerce API version, currently only version 3 is supported.
133+
* `auth` - The [authentication type](https://woocommerce.github.io/woocommerce-rest-api-docs/#authentication-over-https) to connect with WooCommerce API (`PARAMS` or `BASIC`).
134+
* `consumerkey` - The generated key.
135+
* `consumersecret` - The generated secret.
136+
69137
Take in count that every consumer key starts with `ck_` and every consumer secret starts with `cs_`.

0 commit comments

Comments
 (0)