mirror of
https://codeberg.org/timelimit/timelimit-server.git
synced 2025-10-03 01:39:31 +02:00
Add new purchase API
This commit is contained in:
parent
35acd05d08
commit
58a6359a3e
18 changed files with 534 additions and 22 deletions
|
@ -89,3 +89,41 @@ If there was nothing found for the mail address: HTTP status code 409 Conflict
|
|||
### see
|
||||
|
||||
- [premium concept](../concept/premium.md)
|
||||
|
||||
## POST /admin/unlock-premium-v2
|
||||
|
||||
Use this to unlock all features for one user for a specified duration.
|
||||
|
||||
### request
|
||||
|
||||
request properties: ``purchaseToken`` and ``purchaseId``
|
||||
|
||||
- ``purchasetoken`` is a string which the client shows at the purchase screen
|
||||
- ``purchaseId`` is the ID that is used at the bill
|
||||
|
||||
### response
|
||||
|
||||
The response contains the following properties:
|
||||
|
||||
- ``ok`` (boolean)
|
||||
- ``error``
|
||||
- string
|
||||
- set if and only if ``ok`` is false
|
||||
- possible values
|
||||
- ``token invalid``
|
||||
- ``illegal state``
|
||||
- ``purchase id already used``
|
||||
- ``detail``
|
||||
- optional string
|
||||
- should be shown to the support
|
||||
- ``lastPurchase``
|
||||
- optional object
|
||||
- should be shown to the support
|
||||
- ``wasAlreadyExecuted`` (boolean, set if and only if ``ok`` is true)
|
||||
|
||||
If the request was malformed: HTTP status code 400 Bad Request
|
||||
|
||||
Using the same ``purchaseId`` twice results in:
|
||||
|
||||
- ``wasAlreadyExecuted`` if the familyId is unchanged
|
||||
- ``error`` = ``purchase id already used`` otherwise
|
||||
|
|
35
docs/schema/IdentityTokenPayload.schema.json
Normal file
35
docs/schema/IdentityTokenPayload.schema.json
Normal file
|
@ -0,0 +1,35 @@
|
|||
{
|
||||
"additionalProperties": false,
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"purpose": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"purchase"
|
||||
]
|
||||
},
|
||||
"familyId": {
|
||||
"type": "string"
|
||||
},
|
||||
"userId": {
|
||||
"type": "string"
|
||||
},
|
||||
"mail": {
|
||||
"type": "string"
|
||||
},
|
||||
"exp": {
|
||||
"type": "number"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"exp",
|
||||
"familyId",
|
||||
"mail",
|
||||
"purpose",
|
||||
"userId"
|
||||
],
|
||||
"definitions": {},
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"title": "IdentityTokenPayload",
|
||||
"$id": "https://timelimit.io/IdentityTokenPayload"
|
||||
}
|
|
@ -16,6 +16,8 @@
|
|||
|
||||
* [FinishPurchaseByGooglePlayRequest](./finishpurchasebygoogleplayrequest.md) – `https://timelimit.io/FinishPurchaseByGooglePlayRequest`
|
||||
|
||||
* [IdentityTokenPayload](./identitytokenpayload.md) – `https://timelimit.io/IdentityTokenPayload`
|
||||
|
||||
* [LinkParentMailAddressRequest](./linkparentmailaddressrequest.md) – `https://timelimit.io/LinkParentMailAddressRequest`
|
||||
|
||||
* [MailAuthTokenRequestBody](./mailauthtokenrequestbody.md) – `https://timelimit.io/MailAuthTokenRequestBody`
|
||||
|
|
15
docs/schema/identitytokenpayload-definitions.md
Normal file
15
docs/schema/identitytokenpayload-definitions.md
Normal file
|
@ -0,0 +1,15 @@
|
|||
# Untitled undefined type in IdentityTokenPayload Schema
|
||||
|
||||
```txt
|
||||
https://timelimit.io/IdentityTokenPayload#/definitions
|
||||
```
|
||||
|
||||
|
||||
|
||||
| Abstract | Extensible | Status | Identifiable | Custom Properties | Additional Properties | Access Restrictions | Defined In |
|
||||
| :------------------ | :--------- | :------------- | :---------------------- | :---------------- | :-------------------- | :------------------ | :-------------------------------------------------------------------------------------------- |
|
||||
| Can be instantiated | No | Unknown status | Unknown identifiability | Forbidden | Allowed | none | [IdentityTokenPayload.schema.json\*](IdentityTokenPayload.schema.json "open original schema") |
|
||||
|
||||
## definitions Type
|
||||
|
||||
unknown
|
15
docs/schema/identitytokenpayload-properties-exp.md
Normal file
15
docs/schema/identitytokenpayload-properties-exp.md
Normal file
|
@ -0,0 +1,15 @@
|
|||
# Untitled number in IdentityTokenPayload Schema
|
||||
|
||||
```txt
|
||||
https://timelimit.io/IdentityTokenPayload#/properties/exp
|
||||
```
|
||||
|
||||
|
||||
|
||||
| Abstract | Extensible | Status | Identifiable | Custom Properties | Additional Properties | Access Restrictions | Defined In |
|
||||
| :------------------ | :--------- | :------------- | :---------------------- | :---------------- | :-------------------- | :------------------ | :-------------------------------------------------------------------------------------------- |
|
||||
| Can be instantiated | No | Unknown status | Unknown identifiability | Forbidden | Allowed | none | [IdentityTokenPayload.schema.json\*](IdentityTokenPayload.schema.json "open original schema") |
|
||||
|
||||
## exp Type
|
||||
|
||||
`number`
|
15
docs/schema/identitytokenpayload-properties-familyid.md
Normal file
15
docs/schema/identitytokenpayload-properties-familyid.md
Normal file
|
@ -0,0 +1,15 @@
|
|||
# Untitled string in IdentityTokenPayload Schema
|
||||
|
||||
```txt
|
||||
https://timelimit.io/IdentityTokenPayload#/properties/familyId
|
||||
```
|
||||
|
||||
|
||||
|
||||
| Abstract | Extensible | Status | Identifiable | Custom Properties | Additional Properties | Access Restrictions | Defined In |
|
||||
| :------------------ | :--------- | :------------- | :---------------------- | :---------------- | :-------------------- | :------------------ | :-------------------------------------------------------------------------------------------- |
|
||||
| Can be instantiated | No | Unknown status | Unknown identifiability | Forbidden | Allowed | none | [IdentityTokenPayload.schema.json\*](IdentityTokenPayload.schema.json "open original schema") |
|
||||
|
||||
## familyId Type
|
||||
|
||||
`string`
|
15
docs/schema/identitytokenpayload-properties-mail.md
Normal file
15
docs/schema/identitytokenpayload-properties-mail.md
Normal file
|
@ -0,0 +1,15 @@
|
|||
# Untitled string in IdentityTokenPayload Schema
|
||||
|
||||
```txt
|
||||
https://timelimit.io/IdentityTokenPayload#/properties/mail
|
||||
```
|
||||
|
||||
|
||||
|
||||
| Abstract | Extensible | Status | Identifiable | Custom Properties | Additional Properties | Access Restrictions | Defined In |
|
||||
| :------------------ | :--------- | :------------- | :---------------------- | :---------------- | :-------------------- | :------------------ | :-------------------------------------------------------------------------------------------- |
|
||||
| Can be instantiated | No | Unknown status | Unknown identifiability | Forbidden | Allowed | none | [IdentityTokenPayload.schema.json\*](IdentityTokenPayload.schema.json "open original schema") |
|
||||
|
||||
## mail Type
|
||||
|
||||
`string`
|
23
docs/schema/identitytokenpayload-properties-purpose.md
Normal file
23
docs/schema/identitytokenpayload-properties-purpose.md
Normal file
|
@ -0,0 +1,23 @@
|
|||
# Untitled string in IdentityTokenPayload Schema
|
||||
|
||||
```txt
|
||||
https://timelimit.io/IdentityTokenPayload#/properties/purpose
|
||||
```
|
||||
|
||||
|
||||
|
||||
| Abstract | Extensible | Status | Identifiable | Custom Properties | Additional Properties | Access Restrictions | Defined In |
|
||||
| :------------------ | :--------- | :------------- | :---------------------- | :---------------- | :-------------------- | :------------------ | :-------------------------------------------------------------------------------------------- |
|
||||
| Can be instantiated | No | Unknown status | Unknown identifiability | Forbidden | Allowed | none | [IdentityTokenPayload.schema.json\*](IdentityTokenPayload.schema.json "open original schema") |
|
||||
|
||||
## purpose Type
|
||||
|
||||
`string`
|
||||
|
||||
## purpose Constraints
|
||||
|
||||
**enum**: the value of this property must be equal to one of the following values:
|
||||
|
||||
| Value | Explanation |
|
||||
| :----------- | :---------- |
|
||||
| `"purchase"` | |
|
15
docs/schema/identitytokenpayload-properties-userid.md
Normal file
15
docs/schema/identitytokenpayload-properties-userid.md
Normal file
|
@ -0,0 +1,15 @@
|
|||
# Untitled string in IdentityTokenPayload Schema
|
||||
|
||||
```txt
|
||||
https://timelimit.io/IdentityTokenPayload#/properties/userId
|
||||
```
|
||||
|
||||
|
||||
|
||||
| Abstract | Extensible | Status | Identifiable | Custom Properties | Additional Properties | Access Restrictions | Defined In |
|
||||
| :------------------ | :--------- | :------------- | :---------------------- | :---------------- | :-------------------- | :------------------ | :-------------------------------------------------------------------------------------------- |
|
||||
| Can be instantiated | No | Unknown status | Unknown identifiability | Forbidden | Allowed | none | [IdentityTokenPayload.schema.json\*](IdentityTokenPayload.schema.json "open original schema") |
|
||||
|
||||
## userId Type
|
||||
|
||||
`string`
|
125
docs/schema/identitytokenpayload.md
Normal file
125
docs/schema/identitytokenpayload.md
Normal file
|
@ -0,0 +1,125 @@
|
|||
# IdentityTokenPayload Schema
|
||||
|
||||
```txt
|
||||
https://timelimit.io/IdentityTokenPayload
|
||||
```
|
||||
|
||||
|
||||
|
||||
| Abstract | Extensible | Status | Identifiable | Custom Properties | Additional Properties | Access Restrictions | Defined In |
|
||||
| :------------------ | :--------- | :------------- | :----------- | :---------------- | :-------------------- | :------------------ | :------------------------------------------------------------------------------------------ |
|
||||
| Can be instantiated | Yes | Unknown status | No | Forbidden | Forbidden | none | [IdentityTokenPayload.schema.json](IdentityTokenPayload.schema.json "open original schema") |
|
||||
|
||||
## IdentityTokenPayload Type
|
||||
|
||||
`object` ([IdentityTokenPayload](identitytokenpayload.md))
|
||||
|
||||
# IdentityTokenPayload Properties
|
||||
|
||||
| Property | Type | Required | Nullable | Defined by |
|
||||
| :-------------------- | :------- | :------- | :------------- | :----------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| [purpose](#purpose) | `string` | Required | cannot be null | [IdentityTokenPayload](identitytokenpayload-properties-purpose.md "https://timelimit.io/IdentityTokenPayload#/properties/purpose") |
|
||||
| [familyId](#familyid) | `string` | Required | cannot be null | [IdentityTokenPayload](identitytokenpayload-properties-familyid.md "https://timelimit.io/IdentityTokenPayload#/properties/familyId") |
|
||||
| [userId](#userid) | `string` | Required | cannot be null | [IdentityTokenPayload](identitytokenpayload-properties-userid.md "https://timelimit.io/IdentityTokenPayload#/properties/userId") |
|
||||
| [mail](#mail) | `string` | Required | cannot be null | [IdentityTokenPayload](identitytokenpayload-properties-mail.md "https://timelimit.io/IdentityTokenPayload#/properties/mail") |
|
||||
| [exp](#exp) | `number` | Required | cannot be null | [IdentityTokenPayload](identitytokenpayload-properties-exp.md "https://timelimit.io/IdentityTokenPayload#/properties/exp") |
|
||||
|
||||
## purpose
|
||||
|
||||
|
||||
|
||||
`purpose`
|
||||
|
||||
* is required
|
||||
|
||||
* Type: `string`
|
||||
|
||||
* cannot be null
|
||||
|
||||
* defined in: [IdentityTokenPayload](identitytokenpayload-properties-purpose.md "https://timelimit.io/IdentityTokenPayload#/properties/purpose")
|
||||
|
||||
### purpose Type
|
||||
|
||||
`string`
|
||||
|
||||
### purpose Constraints
|
||||
|
||||
**enum**: the value of this property must be equal to one of the following values:
|
||||
|
||||
| Value | Explanation |
|
||||
| :----------- | :---------- |
|
||||
| `"purchase"` | |
|
||||
|
||||
## familyId
|
||||
|
||||
|
||||
|
||||
`familyId`
|
||||
|
||||
* is required
|
||||
|
||||
* Type: `string`
|
||||
|
||||
* cannot be null
|
||||
|
||||
* defined in: [IdentityTokenPayload](identitytokenpayload-properties-familyid.md "https://timelimit.io/IdentityTokenPayload#/properties/familyId")
|
||||
|
||||
### familyId Type
|
||||
|
||||
`string`
|
||||
|
||||
## userId
|
||||
|
||||
|
||||
|
||||
`userId`
|
||||
|
||||
* is required
|
||||
|
||||
* Type: `string`
|
||||
|
||||
* cannot be null
|
||||
|
||||
* defined in: [IdentityTokenPayload](identitytokenpayload-properties-userid.md "https://timelimit.io/IdentityTokenPayload#/properties/userId")
|
||||
|
||||
### userId Type
|
||||
|
||||
`string`
|
||||
|
||||
## mail
|
||||
|
||||
|
||||
|
||||
`mail`
|
||||
|
||||
* is required
|
||||
|
||||
* Type: `string`
|
||||
|
||||
* cannot be null
|
||||
|
||||
* defined in: [IdentityTokenPayload](identitytokenpayload-properties-mail.md "https://timelimit.io/IdentityTokenPayload#/properties/mail")
|
||||
|
||||
### mail Type
|
||||
|
||||
`string`
|
||||
|
||||
## exp
|
||||
|
||||
|
||||
|
||||
`exp`
|
||||
|
||||
* is required
|
||||
|
||||
* Type: `number`
|
||||
|
||||
* cannot be null
|
||||
|
||||
* defined in: [IdentityTokenPayload](identitytokenpayload-properties-exp.md "https://timelimit.io/IdentityTokenPayload#/properties/exp")
|
||||
|
||||
### exp Type
|
||||
|
||||
`number`
|
||||
|
||||
# IdentityTokenPayload Definitions
|
Loading…
Add table
Add a link
Reference in a new issue