Service - Sale: Difference between revisions

From Izara Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 14: Line 14:
<syntaxhighlight lang="JavaScript">
<syntaxhighlight lang="JavaScript">
{
{
objectType: "customer",
objectType: "sale",
canDelete: false,
canDelete: false,
belongTo: {
belongTo: {
Line 20: Line 20:
objectType: "business"
objectType: "business"
},
},
addOnDataStructure: [],
addOnDataStructure: [
{
type:"versionedData",
versionedDataLabel: "saleDetail",
storageResourceTag : "myGraph",
fieldNames: {
saleCurrencyId: {
type: "string",
randomOnCreate: true,
storageResourceTags: ['myGraph']
},
}
        },
],
storageResources: {
storageResources: {
myGraph: {
myGraph: {
storageType: "graph",
storageType: "graph",
graphServerTag: "GraphHandler"
graphServerTag: "GraphHandler"
}
},
"dynamo": {
"storageType": "dynamoDB",
"tableName": "sale",
},
},
fieldNames: {
fieldNames: {
Line 37: Line 54:
storageResourceTags: ['myGraph']
storageResourceTags: ['myGraph']
},
},
saleCurrencyId: {
saleCommitted: { // "working"|"updateWorking"|"processing"|"committed"
type: "string",
type: "string",
randomOnCreate: true,
storageResourceTags: ['dynamo']
storageResourceTags: ['myGraph']
},
},
},
},
Line 51: Line 67:
}
}
</syntaxhighlight>
</syntaxhighlight>
* 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 ==
== invoiceGroup ==
Line 139: Line 159:
{
{
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"
}
},
]
}
}
</syntaxhighlight>
=== oldSaleLineItem ===
<syntaxhighlight lang="JavaScript">
{
oldSaleLineItem: {
canChangeToRelTypes: [
{
serviceTag:"SaleLineItemManager",
relationshipTag: "hasSaleLineItem"
},
],
storageResources: {
storageResources: {
myGraph: {
myGraph: {
Line 167: Line 233:
}
}
</syntaxhighlight>
</syntaxhighlight>
= 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 =
= Addresses =

Revision as of 13:58, 12 January 2026

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

Working documents

Sale