Service - Purchase

From Izara Wiki
Jump to navigation Jump to search

Overview

Purchases from vendors including inventory, services, and expenses.

Repository

...

Object Schemas

Additional Information
Per Service Schemas

sale

{
	objectType: "purchase",
	canDelete: false,
	belongTo: {
		serviceTag: "Business",
		objectType: "business"
	},
	addOnDataStructure: [
		{
			type:"versionedData",
			versionedDataLabel: "purchaseDetail",
			storageResourceTag : "myGraph",
			fieldNames: {
				purchaseCurrencyId: {
					type: "string",
					storageResourceTags: ['myGraph']
				},
			}
        },	
	],
	storageResources: {
		myGraph: {
			storageType: "graph",
			graphServerTag: "GraphHandler"
		},
		"dynamo": {
			"storageType": "dynamoDB",
			"tableName": "purchase",
		}  
	},
	fieldNames: {
		purchaseId: {
			type: "string",
			randomOnCreate: true,
			storageResourceTags: ['myGraph']
		},
		purchaseTotal:  {
			type: "numeric",
			storageResourceTags: ['myGraph']
		},
		purchaseCommitted: { // "working"|"updateWorking"|"processing"|"committed"
			type: "string",
			storageResourceTags: ['dynamo']
		},
	},
	identifiers: [
		{
			type: "identifier",
			fieldName: "purchaseId"
		}
	]
}
  • when building a purchase it is in working stage, must click complete to become an actual purchase
  • purchaseCompleted sets to processing once compeltePurchase begins, probably needs uniqueRequestId also
  • when a change is made to a purchase (that affects accounting data) purchaseCompleted resets to updateWorking

purchaseGroup

{
	objectType: "purchaseGroup",
	canDelete: false,
	belongTo: {
		serviceTag: "Business",
		objectType: "business"
	},
	addOnDataStructure: [],
	storageResources: {
		myGraph: {
			storageType: "graph",
			graphServerTag: "GraphHandler"
		}
	},
	fieldNames: {
		purchaseGroupId: {
			type: "string",
			randomOnCreate: true,
			storageResourceTags: ['myGraph']
		},
		numberingType: {
			type: "string",
			randomOnCreate: true,
			storageResourceTags: ['myGraph']
		},
		numberingSettings: {
			type: "object",
			storageResourceTags: ['myGraph']
		},
	},
	identifiers: [
		{
			type: "identifier",
			fieldName: "purchaseGroupId"
		}
	]
}
  • groups purchases into classifications
  • purchase 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

hasPurchase

{
	hasPurchase: {
		storageResources: {
			myGraph: {
				storageType: "graph",
				graphServerTag: "GraphHandler"			
			}
		},
		links: [
			{
				storageResourceTags: ["myGraph"],
				from: {
					objType: {
						serviceTag: "Vendor",
						objectType: "vendor"
					},
					linkType: "one",
				},
				to: {
					objType: {
						serviceTag: "Purchase",
						objectType: "purchase"
					},
					linkType: "many"
				}
			},
		]
	}
}

hasPurchaseLineItem

{
	hasPurchaseLineItem: {
		canChangeToRelTypes: [
			{
				serviceTag:"PurchaseLineItemManager",
				relationshipTag: "oldPurchaseLineItem"
			},
		],
		storageResources: {
			myGraph: {
				storageType: "graph",
				graphServerTag: "GraphHandler"			
			}
		},
		links: [
			{
				storageResourceTags: ["myGraph"],
				from: {
					objType: {
						serviceTag: "Purchase",
						objectType: "purchase"
					},
					linkType: "one",
				},
				to: {
					objType: {
						serviceTag: "PurchaseLineItemManager",
						objectType: "purchaseLineItem"
					},
					linkType: "many"
				}
			},
		]
	}
}

oldPurchaseLineItem

{
	oldPurchaseLineItem: {
		canChangeToRelTypes: [
			{
				serviceTag:"PurchaseLineItemManager",
				relationshipTag: "hasPurchaseLineItem"
			},
		],
		storageResources: {
			myGraph: {
				storageType: "graph",
				graphServerTag: "GraphHandler"			
			}
		},
		links: [
			{
				storageResourceTags: ["myGraph"],
				from: {
					objType: {
						serviceTag: "Purchase",
						objectType: "purchase"
					},
					linkType: "one",
				},
				to: {
					objType: {
						serviceTag: "PurchaseLineItemManager",
						objectType: "purchaseLineItem"
					},
					linkType: "many"
				}
			},
		]
	}
}

flowSchemas

commitNewPurchase

  • uses purchaseCommitted setting to complete purchase, which sends purchaseLineItems and details to ComAcc plugin to create account entries

commitUpdatePurchase

  • after changes made uses purchaseCommitted setting to complete the purchase update, sending purchaseLineItems and details to ComAcc plugin to update account entries

updatePurchase

  • if have ComAcc plugin enabled, send request to plugin to check if purchase has been locked on Accounting

Addresses

  • use same structure as orders in Izara Market

Working documents

Purchase