Service - Delivery Method Standard

From Izara Wiki
Jump to navigation Jump to search

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: "{DeliveryMethodStandardLib.DELIVERYMETHOD_GRAPH_NODE_LABEL}", // "deliveryMethod"
	schema: {
		identifier: true,
		restrictProperties: true,
		restrictRelationships: true,
		properties: {
			deliveryMethodId: {
				identifier: true, // create unique id from translation
			},
			deliveryMethodHandlerServiceNameTag: {
				immutable: true,
			},
			defaultValueType: {},
			defaultValueId: {},
		},
	}
}
{
	nodeLabel: "{DeliveryMethodStandardLib.DELIVERYMETHOD_GRAPH_NODE_LABEL}PropertyLabel",
}
{
	nodeLabel: "{DeliveryMethodStandardLib.DELIVERYMETHOD_GRAPH_NODE_LABEL}Property",
}

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",
}

Basic node schemas

{
	nodeLabel: "{DeliveryMethodStandardLib.DELIVERYMETHOD_GRAPH_NODE_LABEL}"
	schema: {
		identifier: true,
		restrictProperties: true,
		restrictRelationships: true,
		properties: {
			deliveryMethodId: {
				identifier: true,
			},
			deliveryMethodHandlerServiceNameTag: {
				immutable: true,
			},
		},
	}
}

Schema comes from BasicNodeSchemaLib

  1. deliveryMethodPropertyLabel
  2. deliveryMethodProperty

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
  • 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

Delivery Method Standard