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

Commit

Permalink
adding subtotal, fee, and total fields to the spec and the schema (#337)
Browse files Browse the repository at this point in the history
* adding subtotal, fee, and total fields to the spec and the schema

* Update Quote example with required fields (#340)

* Fill out quote example with required fields

* Tweak the link

* Drop reference to Cash App

---------

Co-authored-by: Tom Daffurn <[email protected]>
  • Loading branch information
Jiyoon Koo and tomdaffurn authored Jul 4, 2024
1 parent e62b69d commit 3c2f3b4
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 8 deletions.
12 changes: 8 additions & 4 deletions hosted/json-schemas/quote.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,23 @@
"type": "string",
"description": "ISO 4217 currency code string"
},
"amount": {
"subtotal": {
"$ref": "definitions.json#/definitions/decimalString",
"description": "The amount of currency expressed in the smallest respective unit"
"description": "The amount of currency paid for the exchange, excluding fees"
},
"fee": {
"$ref": "definitions.json#/definitions/decimalString",
"description": "The amount paid in fees"
"description": "The amount of currency paid in fees"
},
"total": {
"$ref": "definitions.json#/definitions/decimalString",
"description": "The total amount of currency to be paid in or paid out. It is always a sum of subtotal and fee"
},
"paymentInstruction": {
"$ref": "#/definitions/PaymentInstruction"
}
},
"required": ["currencyCode", "amount"]
"required": ["currencyCode", "subtotal", "total"]
},
"PaymentInstruction": {
"type": "object",
Expand Down
20 changes: 16 additions & 4 deletions specs/protocol/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -554,8 +554,9 @@ A `Close` can be sent by Alice _or_ the PFI at any point during the exchange, bu
| field | data type | required | description |
| -------------------- | ------------------------------------------- | -------- | --------------------------------------------------------------------------------------------------------- |
| `currencyCode` | string | Y | ISO 4217 currency code string |
| `amount` | [`DecimalString`](#decimalstring) | Y | The amount of currency paid to the PFI or by the PFI excluding fees |
| `fee` | [`DecimalString`](#decimalstring) | N | The amount paid in fees |
| `subtotal` | [`DecimalString`](#decimalstring) | Y | The amount of currency paid for the exchange, **excluding** fees |
| `fee` | [`DecimalString`](#decimalstring) | N | The amount of currency paid in fees |
| `total` | [`DecimalString`](#decimalstring) | Y | The total amount of currency to be paid in or paid out. It is always a sum of `subtotal` and `fee` |
| `paymentInstruction` | [`PaymentInstruction`](#paymentinstruction) | N | Object that describes how to pay the PFI, and how to get paid by the PFI (e.g. BTC address, payment link) |

#### `PaymentInstruction`
Expand All @@ -580,10 +581,21 @@ A `Close` can be sent by Alice _or_ the PFI at any point during the exchange, bu
"expiresAt": "2023-09-13T23:11:17.315Z",
"payoutUnitsPerPayinUnit": "16.654345",
"payin": {
"link": "http://cash.app/pfi?currency=usd&amount=50"
"currencyCode": "USD",
"subtotal": "200.00",
"fee": "0.20",
"total": "200.20",
"paymentInstruction": {
"link": "https://example-pfi.com/payin?currency=usd&amount=200.20"
}
},
"payout": {
"instruction": "BTC will be paid to the provided BTC address",
"currencyCode": "BTC",
"subtotal": "0.000016",
"total": "0.000016",
"paymentInstruction": {
"instruction": "BTC will be paid to the provided BTC address"
}
}
},
"signature": "eyJhbGciOiJFZERTQSIsImtpZCI6ImRpZDprZXk6ejZNa29yZUMxVVJNUUVWS204d3h6aFZGbnRMenZQWFlidEg4Q0VGTktVY1NrTFdUI3o2TWtvcmVDMVVSTVFFVkttOHd4emhWRm50THp2UFhZYnRIOENFRk5LVWNTa0xXVCJ9..R_BBKJoWifPFh10GJ1ij2gCCxND1CdzKbiOgPCIha__0GvRy0rHYCi18-TY7jNARaQ94RHXHYIsCRm2MuOPACw"
Expand Down

0 comments on commit 3c2f3b4

Please sign in to comment.