Service - Delivery Method Standard
Revision as of 11:47, 31 October 2021 by Sven the Barbarian (talk | contribs)
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,
},
currencyId: {
immutable: true, // cannot change after creating
},
defaultValueType: {},
defaultValueId: {},
},
}
}
{
nodeLabel: "{DeliveryMethodStandardLib.DELIVERYMETHOD_GRAPH_NODE_LABEL}PropertyLabel",
}
{
nodeLabel: "{DeliveryMethodStandardLib.DELIVERYMETHOD_GRAPH_NODE_LABEL}Property",
}
- see DataSchemaLib
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",
}
- see DataSchemaLib
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
- deliveryMethodPropertyLabel
- 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