Skip to content
This repository has been archived by the owner on Dec 12, 2024. It is now read-only.

Commit

Permalink
list of orderstatuses (#351)
Browse files Browse the repository at this point in the history
* adding orderstatuses

* order status test vector update

* adding payin expired enum
  • Loading branch information
Jiyoon Koo authored Jul 13, 2024
1 parent f7260d8 commit 621f54f
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 17 deletions.
26 changes: 21 additions & 5 deletions hosted/json-schemas/orderstatus.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,29 @@
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://tbdex.dev/orderstatus.schema.json",
"type": "object",
"required": [
"orderStatus"
],
"additionalProperties": false,
"properties": {
"orderStatus": {
"status": {
"type":"string",
"enum": [
"PAYIN_PENDING",
"PAYIN_INITIATED",
"PAYIN_SETTLED",
"PAYIN_FAILED",
"PAYIN_EXPIRED",
"PAYOUT_PENDING",
"PAYOUT_INITIATED",
"PAYOUT_SETTLED",
"PAYOUT_FAILED",
"REFUND_PENDING",
"REFUND_INITIATED",
"REFUND_SETTLED",
"REFUND_FAILED"
]
},
"details": {
"type":"string"
}
}
},
"required": ["status"]
}
19 changes: 10 additions & 9 deletions hosted/test-vectors/protocol/vectors/parse-orderstatus.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
{
"description": "Order Status parses from string",
"input": "{\"metadata\":{\"from\":\"did:dht:3whftgpbdjihx9ze9tdn575zqzm4qwccetnf1ybiibuzad7rrmyy\",\"to\":\"did:dht:qyac4pru9ykcxbrutpaaxkmususxh4wtc4ctt19813zrie8uyy5y\",\"exchangeId\":\"rfq_01hw25hn39ermsmftw3a3rb1ph\",\"protocol\":\"1.0\",\"kind\":\"orderstatus\",\"id\":\"orderstatus_01hw25hn39ermsmftw3d1efc2f\",\"createdAt\":\"2024-04-22T05:48:01.513Z\"},\"data\":{\"orderStatus\":\"wee\"},\"signature\":\"eyJhbGciOiJFZERTQSIsImtpZCI6ImRpZDpkaHQ6M3doZnRncGJkamloeDl6ZTl0ZG41NzV6cXptNHF3Y2NldG5mMXliaWlidXphZDdycm15eSMwIn0..alR9hfgjKSbSEmuXi1fpA7Puh5JNp22uDqk2b5zGcbvbgUsDCkChBQ47SWjAV5BchmfZ0yaDLPQPTxiH918jBQ\"}",
"input": "{\"metadata\":{\"from\":\"did:jwk:eyJrdHkiOiJPS1AiLCJjcnYiOiJFZDI1NTE5IiwieCI6IlhOOVB3T3R2MUEwV1VxcFp6YTFHeHFQM1VoRUxDZWhsdXBPcnp3dEl6NGMifQ\",\"to\":\"did:jwk:eyJrdHkiOiJPS1AiLCJjcnYiOiJFZDI1NTE5IiwieCI6ImFHdVlsbmxiRHVZVmZMSVRJeDJkdWxPajhMVkFGaF83QzlEN2VQaU4xRnMifQ\",\"kind\":\"orderstatus\",\"id\":\"orderstatus_01j2hk4kt5f8jrsnmt24fnty86\",\"exchangeId\":\"rfq_01j2hk4kt5f8jbb105b3kaj0jp\",\"createdAt\":\"2024-07-11T19:08:21Z\",\"protocol\":\"1.0\"},\"data\":{\"status\":\"PAYIN_INITIATED\",\"details\":\"CC Payment Initiated\"},\"signature\":\"eyJhbGciOiJFZERTQSIsImtpZCI6ImRpZDpqd2s6ZXlKcmRIa2lPaUpQUzFBaUxDSmpjbllpT2lKRlpESTFOVEU1SWl3aWVDSTZJbGhPT1ZCM1QzUjJNVUV3VjFWeGNGcDZZVEZIZUhGUU0xVm9SVXhEWldoc2RYQlBjbnAzZEVsNk5HTWlmUSMwIn0..9ieXFwyxUq13OXGFQuhNjZK7rznTghkhH4McnwJ7GqBtWiQBxwvbpMEE8ZWezMhKsbLuBbLi3UBfcrdU-3VyCA\"}",
"output": {
"metadata": {
"from": "did:dht:3whftgpbdjihx9ze9tdn575zqzm4qwccetnf1ybiibuzad7rrmyy",
"to": "did:dht:qyac4pru9ykcxbrutpaaxkmususxh4wtc4ctt19813zrie8uyy5y",
"exchangeId": "rfq_01hw25hn39ermsmftw3a3rb1ph",
"protocol": "1.0",
"from": "did:jwk:eyJrdHkiOiJPS1AiLCJjcnYiOiJFZDI1NTE5IiwieCI6IlhOOVB3T3R2MUEwV1VxcFp6YTFHeHFQM1VoRUxDZWhsdXBPcnp3dEl6NGMifQ",
"to": "did:jwk:eyJrdHkiOiJPS1AiLCJjcnYiOiJFZDI1NTE5IiwieCI6ImFHdVlsbmxiRHVZVmZMSVRJeDJkdWxPajhMVkFGaF83QzlEN2VQaU4xRnMifQ",
"kind": "orderstatus",
"id": "orderstatus_01hw25hn39ermsmftw3d1efc2f",
"createdAt": "2024-04-22T05:48:01.513Z"
"id": "orderstatus_01j2hk4kt5f8jrsnmt24fnty86",
"exchangeId": "rfq_01j2hk4kt5f8jbb105b3kaj0jp",
"createdAt": "2024-07-11T19:08:21Z",
"protocol": "1.0"
},
"data": {
"orderStatus": "wee"
"status": "PAYIN_INITIATED",
"details": "CC Payment Initiated"
},
"signature": "eyJhbGciOiJFZERTQSIsImtpZCI6ImRpZDpkaHQ6M3doZnRncGJkamloeDl6ZTl0ZG41NzV6cXptNHF3Y2NldG5mMXliaWlidXphZDdycm15eSMwIn0..alR9hfgjKSbSEmuXi1fpA7Puh5JNp22uDqk2b5zGcbvbgUsDCkChBQ47SWjAV5BchmfZ0yaDLPQPTxiH918jBQ"
"signature": "eyJhbGciOiJFZERTQSIsImtpZCI6ImRpZDpqd2s6ZXlKcmRIa2lPaUpQUzFBaUxDSmpjbllpT2lKRlpESTFOVEU1SWl3aWVDSTZJbGhPT1ZCM1QzUjJNVUV3VjFWeGNGcDZZVEZIZUhGUU0xVm9SVXhEWldoc2RYQlBjbnAzZEVsNk5HTWlmUSMwIn0..9ieXFwyxUq13OXGFQuhNjZK7rznTghkhH4McnwJ7GqBtWiQBxwvbpMEE8ZWezMhKsbLuBbLi3UBfcrdU-3VyCA"
},
"error": false
}
25 changes: 22 additions & 3 deletions specs/protocol/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ Version: Draft
- [`Order`](#order)
- [Example Order](#example-order)
- [`OrderStatus`](#orderstatus)
- [`Status`](#status)
- [`Close`](#close)
- [Example Close](#example-close)
- [`Cancel`](#cancel)
Expand Down Expand Up @@ -613,9 +614,27 @@ This table enumerates the structure of `PrivateData`
> **Note**
> There can be many `OrderStatus` messages in a tbdex exchange. 1 for every status change that a PFI wants to inform Alice of.
| field | data type | required | description |
| ------------- | --------- | -------- | --------------------------------------------- |
| `orderStatus` | string | Y | Current status of Order that's being executed |
| field | data type | required | description |
| --------- | --------- | -------- | --------------------------------------------- |
| `status` | `Status` | Y | Current status of Order that's being executed |
| `details` | string | N | Additional details about the status |

#### `Status`
| `Status` value | description |
| ---------------- | ----------------------------------------------------------------------------- |
| PAYIN_PENDING | PFI is awaiting payment from Alice. |
| PAYIN_INITIATED | Payment from Alice has been initiated. |
| PAYIN_SETTLED | Payment from Alice has been settled into PFI's account. |
| PAYIN_FAILED | Payment from Alice failed. |
| PAYIN_EXPIRED | Payment from Alice has not been received before Quote's `expiresAt` datetime. |
| PAYOUT_PENDING | Payment to Alice is pending further processing. |
| PAYOUT_INITIATED | Payment to Alice has been initiated. |
| PAYOUT_SETTLED | Payment to Alice has been settled out of PFI's account. |
| PAYOUT_FAILED | Payment to Alice failed. |
| REFUND_PENDING | Refund of Alice's payin is pending further processing. |
| REFUND_INITIATED | Refund of Alice's payin has been initiated. |
| REFUND_FAILED | Refund of Alice's payin failed. |
| REFUND_SETTLED | Refund of Alice's payin has settled out of PFI's account. |


```json
Expand Down

0 comments on commit 621f54f

Please sign in to comment.