Add sample receipt object
This commit is contained in:
parent
43e2f41855
commit
098e7f7f21
106
docs/Receipt.md
106
docs/Receipt.md
@ -1,5 +1,111 @@
|
|||||||
# Receipt Objects
|
# Receipt Objects
|
||||||
|
|
||||||
|
## Sample receipt object
|
||||||
|
|
||||||
|
This is an example of the data `global.apis.pos.onReceiptChange`
|
||||||
|
and `global.apis.pos.onTransactionFinished` send to plugins.
|
||||||
|
All data for a PostalPoint transaction is available in its receipt object.
|
||||||
|
|
||||||
|
The money-related properties near the bottom of this sample are generated by PostalPoint
|
||||||
|
from the items and payments.
|
||||||
|
|
||||||
|
### Notes:
|
||||||
|
|
||||||
|
* The `due` property will be a negative number if change is owed to the customer.
|
||||||
|
* `pendingEmailTo` is set to a suggested email address for the email receipt, and if the receipt
|
||||||
|
should actually be emailed, it will be set in `emailTo`.
|
||||||
|
* `uuid` is a unique 16-character alphanumeric receipt ID number, which is shown and used in several places.
|
||||||
|
The `uuid` is generated using `global.apis.util.uuid.short()`.
|
||||||
|
* `customerAccountId` is the UUID for the customer's account, or null if there isn't a customer attached.
|
||||||
|
* This example happens to be the object used when test printing a receipt from the PostalPoint
|
||||||
|
settings menu, so press that button to see what this is rendered into.
|
||||||
|
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
{
|
||||||
|
"items": [
|
||||||
|
ReceiptItem.fromJSON({
|
||||||
|
"id": "9100123456789012345678",
|
||||||
|
"label": "Test Package",
|
||||||
|
"text": "Package Details\nTracking # 9100 1234 5678 9012 3456 78\nTo:\nTEST PERSON\nORGANIZATION INC\n123 TEST ROAD\nTESTTOWN TE 99999-0001",
|
||||||
|
"priceEach": 8,
|
||||||
|
"qty": 1,
|
||||||
|
"cost": 0,
|
||||||
|
"retail": 8,
|
||||||
|
"taxRate": 0,
|
||||||
|
"free": false,
|
||||||
|
"barcode": "9100123456789012345678",
|
||||||
|
"certifiedInfo": false,
|
||||||
|
"isMerch": false,
|
||||||
|
"surcharge": false,
|
||||||
|
"toAddress": {
|
||||||
|
"name": "TEST PERSON",
|
||||||
|
"company": "ORGANIZATION INC",
|
||||||
|
"street1": "123 TEST ROAD",
|
||||||
|
"street2": null,
|
||||||
|
"city": "TESTTOWN",
|
||||||
|
"state": "TE",
|
||||||
|
"zip": "99999-0001",
|
||||||
|
"email": null,
|
||||||
|
"phone": null,
|
||||||
|
"country": "US"
|
||||||
|
},
|
||||||
|
"fromAddress": {
|
||||||
|
"name": "TEST PERSON",
|
||||||
|
"company": "ORGANIZATION INC",
|
||||||
|
"street1": "123 TEST ROAD",
|
||||||
|
"street2": null,
|
||||||
|
"city": "TESTTOWN",
|
||||||
|
"state": "TE",
|
||||||
|
"zip": "99999-0001",
|
||||||
|
"email": null,
|
||||||
|
"phone": null,
|
||||||
|
"country": "US"
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
ReceiptItem.fromJSON({
|
||||||
|
"id": "testitem",
|
||||||
|
"label": "Test Item",
|
||||||
|
"text": "",
|
||||||
|
"priceEach": 2,
|
||||||
|
"qty": 1,
|
||||||
|
"cost": 0,
|
||||||
|
"retail": 2,
|
||||||
|
"taxRate": 0.1,
|
||||||
|
"free": false,
|
||||||
|
"barcode": "",
|
||||||
|
"certifiedInfo": false,
|
||||||
|
"isMerch": true,
|
||||||
|
"surcharge": false
|
||||||
|
})
|
||||||
|
],
|
||||||
|
"payments": [
|
||||||
|
ReceiptPayment.fromJSON({
|
||||||
|
"amount": 10,
|
||||||
|
"type": "cash",
|
||||||
|
"text": "",
|
||||||
|
"id": "testcash"
|
||||||
|
})
|
||||||
|
],
|
||||||
|
"subtotal": 10,
|
||||||
|
"subtotalFormatted": "$10.00",
|
||||||
|
"tax": 0.2,
|
||||||
|
"taxFormatted": "$0.20",
|
||||||
|
"grandTotal": 10.2,
|
||||||
|
"grandTotalFormatted": "$10.20",
|
||||||
|
"paid": 10.2,
|
||||||
|
"paidFormatted": "$10.20",
|
||||||
|
"due": 0,
|
||||||
|
"dueFormatted": "$0.00",
|
||||||
|
"emailTo": null,
|
||||||
|
"pendingEmailTo": null,
|
||||||
|
"uuid": "1234567890abcdef",
|
||||||
|
"customerAccountId": null,
|
||||||
|
"topTextHTML": "",
|
||||||
|
"bottomTextHTML": ""
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
## global.apis.pos.ReceiptItem
|
## global.apis.pos.ReceiptItem
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user