Service - Delivery Method Standard: Difference between revisions

From Izara Wiki
Jump to navigation Jump to search
No edit summary
 
(14 intermediate revisions by the same user not shown)
Line 61: Line 61:
<syntaxhighlight lang="JavaScript">
<syntaxhighlight lang="JavaScript">
{
{
nodeLabel: "{DeliveryMethodStandardLib.DELIVERYMETHOD_GRAPH_NODE_LABEL}", // "deliveryMethod"
nodeLabel: "{deliveryMethodSharedLib.consts.DELIVERYMETHOD_GRAPH_NODE_LABEL}",
schema: {
identifier: true,
restrictProperties: true,
restrictRelationships: true,
properties: {
deliveryMethodId: {
identifier: true, // create unique id from translation
},
deliveryMethodHandlerServiceNameTag: {
immutable: true,
},
defaultValueType: {},
defaultValueId: {},
},
}
}
}
</syntaxhighlight>
</syntaxhighlight>
Line 89: Line 74:
</syntaxhighlight>
</syntaxhighlight>
* see [[NPM module - Izara Core - Property Node|DataSchemaLib]]
* see [[NPM module - Izara Core - Property Node|DataSchemaLib]]
=== Versioned data ===
==== deliveryMethodSettings ====
<syntaxhighlight lang="JavaScript">
{
properties: {
defaultValueType: {}, // orderQuantity|orderSubtotal|productAttributeId|sellOfferTermId
defaultValueId: {}, // used for productAttributeId|sellOfferTermId
defaultValueLanguageId: {}, // used for productAttributeId|sellOfferTermId, when finding attribute value need to set language to find
defaultAccumulateValue: true // default: true, if set to false will find the largest value out of all sellOffers in the order
},
}
</syntaxhighlight>


=== Relationships ===
=== Relationships ===
Line 161: Line 161:
* see [[NPM module - Izara Core - Property Node|DataSchemaLib]]
* see [[NPM module - Izara Core - Property Node|DataSchemaLib]]


== Basic node schemas ==
= Complex Filter requests =


<syntaxhighlight lang="JavaScript">
<syntaxhighlight lang="JavaScript">
{
{
nodeLabel: "{DeliveryMethodStandardLib.DELIVERYMETHOD_GRAPH_NODE_LABEL}"
filterType: "handlerDeliveryMethod" //unique id is deliveryMethodId
schema: {
type: "group",
identifier: true,
elements:
restrictProperties: true,
[
restrictRelationships: true,
{
properties: {
type: "logical",
deliveryMethodId: {
logicalTag: "currencyId",
identifier: true,
comparison: "equals",
},
value: "xx"
deliveryMethodHandlerServiceNameTag: {
},
immutable: true,
{
},
type: "logical",
logicalTag: "fromLocationNodeId",
comparison: "equals",
value: "xx"
},
{
type: "complexFilter",
complexFilter: {
filterType: "deliveryMethodRateTable",
// see [[Service - Delivery Method Rate Table|Complex Filter requests]]
}
},
{
type: "complexFilter",
complexFilter: {
filterType: "deliveryMethodProperty",
// see [[NPM module - Izara Core - Property Node|Complex Filter requests]]
}
},
},
}
{
type: "complexFilter",
complexFilter: {
filterType: "deliveryMethodNameTranslation" //unique id is deliveryMethodId
type: "group",
elements:
[
{
// see [[Service - Translations|Complex Filter requests]]
type: "logical",
logicalTag: "textTag_languageId_text",
resultType: "deliveryMethod",
textTag: "deliveryMethodName",
languageId: "en",
text: "Is a great term",
subjectIdentifierPropertyName: "deliveryMethodId",
caseSensitive: true
},
]
}
},
...
]
}
}
</syntaxhighlight>
</syntaxhighlight>
* [[Service - Translations Graph]]
* [[Service - Orders Graph]]


=== Schema comes from [[NPM module - Izara Core - Property Node|BasicNodeSchemaLib]] ===
== Translate Ids - deliveryMethodRateTable to deliveryMethod ==


# deliveryMethodPropertyLabel
* only find deliveryMethodIds that are enabled
#* [[Service - Translations Graph]]
# deliveryMethodProperty
#* [[Service - Translations Graph]]


= Data structure notes =
= Data structure notes =
Line 196: Line 230:
* deliveryMethods have RBAC structure, default to creator having admin permissions, but admin can add other roles etc..
* deliveryMethods have RBAC structure, default to creator having admin permissions, but admin can add other roles etc..
* Any user can attach any deliveryMethod to a SellOfferPlan
* Any user can attach any deliveryMethod to a SellOfferPlan
* deliveryMethods do not set a currency, that will come from the paymentMethod chosen in a sellOffer plan, deliveryMethods just return a value that is added into a pricing total, assumed to be the currency of the paymentMethod however we could get more complicated in sellOfferPlanDeliveryMethodLinks to do conversions etc


= Working documents =
= Working documents =

Latest revision as of 03:15, 13 April 2023

Overview

Handler service for basic delivery methods that use Service - Delivery Method Rate Table for pricing.

Repository

https://bitbucket.org/izara-market-products/izara-market-products-delivery-method-standard

DynamoDB tables

Standard Config Table Per Service

Configuration tags

{
	configTag: "DeliveryMethodHandlerServiceNameTag"
	configKey: "DeliveryMethodHandlerServiceNameTag"
	configValue: xxx // this own services ServiceNameTag, eg "DeliveryMethodStandard"
}
{
	configTag: "ProductGraphServiceName"
	configKey: "ProductGraphServiceName"
	configValue: xxx // eg: "ProductGraph"
}
{
	configTag: "DeliveryMethodManagerServiceName"
	configKey: "DeliveryMethodManagerServiceName"
	configValue: xxx // eg: "DeliveryMethodManager"
}
{
	configTag: "DeliveryMethodRateTableServiceName"
	configKey: "DeliveryMethodRateTableServiceName"
	configValue: xxx // eg: "DeliveryMethodRateTable"
}
{
	configTag: "DeliveryMethodRbacServiceName"
	configKey: "DeliveryMethodRbacServiceName"
	configValue: xxx // eg: "Rbac"
}

Graph database

Service - Products Graph

Nodes

{
	nodeLabel: "{deliveryMethodSharedLib.consts.DELIVERYMETHOD_GRAPH_NODE_LABEL}",
}
{
	nodeLabel: "{DeliveryMethodStandardLib.DELIVERYMETHOD_GRAPH_NODE_LABEL}PropertyLabel",
}
{
	nodeLabel: "{DeliveryMethodStandardLib.DELIVERYMETHOD_GRAPH_NODE_LABEL}Property",
}

Versioned data

deliveryMethodSettings

{
	properties: {
		defaultValueType: {}, // orderQuantity|orderSubtotal|productAttributeId|sellOfferTermId
		defaultValueId: {}, // used for productAttributeId|sellOfferTermId
		defaultValueLanguageId: {}, // used for productAttributeId|sellOfferTermId, when finding attribute value need to set language to find
		defaultAccumulateValue: true // default: true, if set to false will find the largest value out of all sellOffers in the order
	},
}

Relationships

{
	relationshipType: "{DeliveryMethodStandardLib.createfromLocationNodeRelationshipType()}", // "from_LocationNode"
	schema: {
		elementCanBeRemoved: false,
		allPropertiesImmutable: true,
		restrictProperties: true,
		properties: {
			originTimestamp: //timestamp the request to create/change this relationship was sent
		},
	}
}
  • currently this is set when creating the deliveryMethod and cannot be changed, if in future we allow to be changed, will need to validate all sellOffers that link to this deliveryMethod and ensure sellOffer's stock location still slots into the deliveryMethods new from_LocationNode
{
	relationshipType: "{DeliveryMethodStandardLib.createHasDeliveryMethodRateTableGraphRelationshipType()}", // "has_deliveryMethodRateTable"
	schema: {
		elementCanBeRemoved: true,
		allPropertiesImmutable: true,
		restrictProperties: true,
		properties: {
			originTimestamp: //timestamp the request to create/change this relationship was sent
		},
	}
}
{
	relationshipType: "{DeliveryMethodStandardLib.createDisabledDeliveryMethodRateTableGraphRelationshipType()}", // "disabled_deliveryMethodRateTable"
	schema: {
		elementCanBeRemoved: true,
		allPropertiesImmutable: true,
		restrictProperties: true,
		properties: {
			originTimestamp: //timestamp the request to create/change this relationship was sent
		},
	}
}
{
	relationshipType: "{DeliveryMethodStandardLib.createHasDeliveryMethodRateTableGraphRelationshipType()}", // "owns_deliveryMethodRateTable"
	schema: {
		elementCanBeRemoved: true,
		allPropertiesImmutable: true,
		restrictProperties: true,
		properties: {
			originTimestamp: //timestamp the request to create/change this relationship was sent
		},
	}
}
  • controls ownership of a rateTable, many deliveryMethods can point to one rateTable but only one deliveryMethod controls it (RBAC for that deliveryMethods allows control over the rateTable)
{
	relationshipType: "has_{DeliveryMethodStandardLib.DELIVERYMETHOD_GRAPH_NODE_LABEL}Property",
}
{
	relationshipType: "disabled_{DeliveryMethodStandardLib.DELIVERYMETHOD_GRAPH_NODE_LABEL}Property",
}
{
	relationshipType: "is_{DeliveryMethodStandardLib.DELIVERYMETHOD_GRAPH_NODE_LABEL}PropertyLabel",
}

Complex Filter requests

{
	filterType: "handlerDeliveryMethod" //unique id is deliveryMethodId
	type: "group",
	elements:
	[
		{
			type: "logical",
			logicalTag: "currencyId",
			comparison: "equals",
			value: "xx"
		},
		{
			type: "logical",
			logicalTag: "fromLocationNodeId",
			comparison: "equals",
			value: "xx"
		},
		{
			type: "complexFilter",
			complexFilter: {
				filterType: "deliveryMethodRateTable",
				// see [[Service - Delivery Method Rate Table|Complex Filter requests]]
			}
		},
		{
			type: "complexFilter",
			complexFilter: {
				filterType: "deliveryMethodProperty",
				// see [[NPM module - Izara Core - Property Node|Complex Filter requests]]
			}
		},
		{
			type: "complexFilter",
			complexFilter: {
				filterType: "deliveryMethodNameTranslation" //unique id is deliveryMethodId
				type: "group",
				elements: 
				[
					{
						// see [[Service - Translations|Complex Filter requests]]
						type: "logical",
						logicalTag: "textTag_languageId_text",
						resultType: "deliveryMethod",
						textTag: "deliveryMethodName",
						languageId: "en",
						text: "Is a great term",
						subjectIdentifierPropertyName: "deliveryMethodId",
						caseSensitive: true
					},
				]
			}
		},		
		...
	]
}

Translate Ids - deliveryMethodRateTable to deliveryMethod

  • only find deliveryMethodIds that are enabled

Data structure notes

  • Users can create new deliveryMethods which are uniquely identified by their translation
  • deliveryMethods have RBAC structure, default to creator having admin permissions, but admin can add other roles etc..
  • Any user can attach any deliveryMethod to a SellOfferPlan

Working documents

Delivery Method Standard