Service - Sale
Revision as of 13:58, 12 January 2026 by Sven the Barbarian (talk | contribs)
Overview
Sales of inventory to customers.
Repository
...
Object Schemas
- Additional Information
- Per Service Schemas
sale
{
objectType: "sale",
canDelete: false,
belongTo: {
serviceTag: "Business",
objectType: "business"
},
addOnDataStructure: [
{
type:"versionedData",
versionedDataLabel: "saleDetail",
storageResourceTag : "myGraph",
fieldNames: {
saleCurrencyId: {
type: "string",
randomOnCreate: true,
storageResourceTags: ['myGraph']
},
}
},
],
storageResources: {
myGraph: {
storageType: "graph",
graphServerTag: "GraphHandler"
},
"dynamo": {
"storageType": "dynamoDB",
"tableName": "sale",
}
},
fieldNames: {
saleId: {
type: "string",
randomOnCreate: true,
storageResourceTags: ['myGraph']
},
saleTotal: {
type: "numeric",
storageResourceTags: ['myGraph']
},
saleCommitted: { // "working"|"updateWorking"|"processing"|"committed"
type: "string",
storageResourceTags: ['dynamo']
},
},
identifiers: [
{
type: "identifier",
fieldName: "saleId"
}
]
}
- when building a sale it is in working stage, must click complete to become an actual sale
- saleCompleted sets to processing once compelteSale begins, probably needs uniqueRequestId also
- when a change is made to a sale (that affects accounting data) saleCompleted resets to updateWorking
invoiceGroup
{
objectType: "invoiceGroup",
canDelete: false,
belongTo: {
serviceTag: "Business",
objectType: "business"
},
addOnDataStructure: [],
storageResources: {
myGraph: {
storageType: "graph",
graphServerTag: "GraphHandler"
}
},
fieldNames: {
invoiceGroupId: {
type: "string",
randomOnCreate: true,
storageResourceTags: ['myGraph']
},
numberingType: {
type: "string",
randomOnCreate: true,
storageResourceTags: ['myGraph']
},
numberingSettings: {
type: "object",
storageResourceTags: ['myGraph']
},
},
identifiers: [
{
type: "identifier",
fieldName: "invoiceGroupId"
}
]
}
- groups sales into classifications
- invoice numbers can be separated by groups, eg separate sequencial numbering
- numberingSettings saves details such as prefix, suffix, method of sequencial ordering, period when numbering resets
Relationships
hasSale
{
hasSale: {
storageResources: {
myGraph: {
storageType: "graph",
graphServerTag: "GraphHandler"
}
},
links: [
{
storageResourceTags: ["myGraph"],
from: {
objType: {
serviceTag: "customer",
objectType: "customer"
},
linkType: "one",
},
to: {
objType: {
serviceTag: "sale",
objectType: "sale"
},
linkType: "many"
}
},
]
}
}
hasSaleLineItem
{
hasSaleLineItem: {
canChangeToRelTypes: [
{
serviceTag:"SaleLineItemManager",
relationshipTag: "oldSaleLineItem"
},
],
storageResources: {
myGraph: {
storageType: "graph",
graphServerTag: "GraphHandler"
}
},
links: [
{
storageResourceTags: ["myGraph"],
from: {
objType: {
serviceTag: "sale",
objectType: "sale"
},
linkType: "one",
},
to: {
objType: {
serviceTag: "saleLineItemManager",
objectType: "saleLineItem"
},
linkType: "many"
}
},
]
}
}
oldSaleLineItem
{
oldSaleLineItem: {
canChangeToRelTypes: [
{
serviceTag:"SaleLineItemManager",
relationshipTag: "hasSaleLineItem"
},
],
storageResources: {
myGraph: {
storageType: "graph",
graphServerTag: "GraphHandler"
}
},
links: [
{
storageResourceTags: ["myGraph"],
from: {
objType: {
serviceTag: "sale",
objectType: "sale"
},
linkType: "one",
},
to: {
objType: {
serviceTag: "saleLineItemManager",
objectType: "saleLineItem"
},
linkType: "many"
}
},
]
}
}
flowSchemas
commitNewSale
- uses saleCommitted setting to complete sale, which sends saleLineItems and details to ComAcc plugin to create account entries
commitUpdateSale
- after changes made uses saleCommitted setting to complete the sale update, sending saleLineItems and details to ComAcc plugin to update account entries
updateSale
- if have ComAcc plugin enabled, send request to plugin to check if sale has been locked on Accounting
Addresses
- use same structure as orders in Izara Market