Service - Sell Offer Manager: Difference between revisions

From Izara Wiki
Jump to navigation Jump to search
No edit summary
 
(21 intermediate revisions by the same user not shown)
Line 9: Line 9:
https://bitbucket.org/izara-market-products/izara-market-products-sell-offer-manager/src/master/
https://bitbucket.org/izara-market-products/izara-market-products-sell-offer-manager/src/master/


= DynamoDB tables =
= Object Schemas =
; Additional Information: [[Per Service Schemas]]


== [[Standard Config Table Per Service]] ==
== objType ==


=== Configuration tags ===
=== sellOffer ===


<syntaxhighlight lang="JavaScript">
<syntaxhighlight lang="JavaScript">
{
{
configKey: "ProductsGraphServiceName"
objectType: "sellOffer",
configTag: "ProductsGraphServiceName"
canDelete: false,
configValue: xxx // eg: "ProductsGraph"
belongTo: {
serviceTag: "user",
objectType: "user"
},
addOnDataStructure: [ // optional, add for additional setting to objectType
{
  type: "attributeTree",   
  attributeTreeTag: "sellOfferTerms"
},
],
storageResources: {
myGraph: {
storageType: "graph",
graphServerTag: "GraphHandler"
}
    },
    fieldNames: {
sellOfferId: {
type: "string",
randomOnCreate: true,
storageResourceTags: ['myGraph']
},
    },
    identifiers: [
{
type: "identifier",
fieldName: "sellOfferId"
}
    ]
}
}
</syntaxhighlight>
</syntaxhighlight>
== Object Relationships ==
=== hasSellOffer ===


<syntaxhighlight lang="JavaScript">
<syntaxhighlight lang="JavaScript">
{
{
configKey: "SellOfferHandlerService"
hasSellOffer: {
configTag: xxx // sellOfferHandlerServiceNameTag, eg: "SellOfferStandard", this is what is saved in each catalog record
canChangeToRelTypes: [
configValue: {
{
serviceName: xxx // eg: "SellOfferStandard", this is the actual deployed service name}
serviceTag:"sellOfferManager",
relationshipTag: "disabledSellOffer"
},
],
storageResources: {
myGraph: {
storageType: "graph",
graphServerTag: "GraphHandler"
}
},
links: [
{
storageResourceTags: ["myGraph"],
from: {
objType: {
serviceTag: "ProductManager",
objectType: "product"
},
linkType: "one",
},
to: {
objType: {
serviceTag: "sellOfferManager",
objectType: "sellOffer"
},
linkType: "many"
}
}
]
}
}
}
}
</syntaxhighlight>
</syntaxhighlight>
=== disabledSellOffer ===


<syntaxhighlight lang="JavaScript">
<syntaxhighlight lang="JavaScript">
{
{
configKey: "TranslateIdsType"
disabledSellOffer: {
configTag: xxx // eg SellOffer > Product would be sellOffer_product
canChangeToRelTypes: [
configValue: {
{
ttl: 64000 // number of seconds TranslateIdsCache records live for
serviceTag:"sellOfferManager",
relationshipTag: "hasSellOffer"
},
],
storageResources: {
myGraph: {
storageType: "graph",
graphServerTag: "GraphHandler"
}
},
links: [
{
storageResourceTags: ["myGraph"],
from: {
objType: {
serviceTag: "ProductManager",
objectType: "product"
},
linkType: "one",
},
to: {
objType: {
serviceTag: "sellOfferManager",
objectType: "sellOffer"
},
linkType: "many"
}
}
]
}
}
}
}
</syntaxhighlight>
</syntaxhighlight>


== SellOffers ==
=== soldByUser ===
 
Records which Handler manages each sell offer


<syntaxhighlight lang="JavaScript">
<syntaxhighlight lang="JavaScript">
{
{
sellOfferId
soldByUser: {
sellOfferHandlerServiceNameTag
storageResources: {
myGraph: {
storageType: "graph",
graphServerTag: "GraphHandler"
}
},
links: [
{
storageResourceTags: ["myGraph"],
from: {
objType: {
serviceTag: "sellOfferManager",
objectType: "sellOffer"
},
linkType: "many",
},
to: {
objType: {
serviceTag: "user",
objectType: "user"
},
linkType: "one"
}
}
]
}
}
}
</syntaxhighlight>
</syntaxhighlight>


* partition key: sellOfferId
=== usesSellOfferPlan ===
* sort key: (none)
 
== LogicalResults ==
 
Stores results for any requests to perform logical searches on product data


<syntaxhighlight lang="JavaScript">
<syntaxhighlight lang="JavaScript">
{
{
resultId: xxx // eg: filterMainId for a single logical element
usesSellOfferPlan: {
dataId: xxx // one productId
storageResources: {
myGraph: {
storageType: "graph",
graphServerTag: "GraphHandler"
}
},
links: [
{
storageResourceTags: ["myGraph"],
from: {
objType: {
serviceTag: "sellOfferManager",
objectType: "sellOffer"
},
linkType: "many",
},
to: {
objType: {
serviceTag: "sellOfferPlan",
objectType: "sellOfferPlan"
},
linkType: "one"
}
}
]
}
}
}
</syntaxhighlight>
</syntaxhighlight>


* partition key: resultId
== OrderPrice ==
* sort key: dataId


== TranslateIdsCache ==
Cache of one total calculation for list of sellOffer quantities, and one combination of deliverToLocationId, / sellOfferPlanUserPaymentMethodLinkId / sellOfferPlanDeliveryMethodLinkId. Price includes Payment and Delivery method costs.
 
Stores a record for any unique translateId process


<syntaxhighlight lang="JavaScript">
<syntaxhighlight lang="JavaScript">
{
{
cacheId // fromType + "_" + fromPartitionKeyId + "_" + toType
orderPriceId: "xx",
toDataId
sellOfferQuantities: {},
expireTime
deliverToLocationId: "xx",
//price: "xx", //removing and using findDataMain process
//expiryTime: "xx", //removing and using findDataMain process
// status: "xx", // "recalculating"|"complete"|"error", not really needed, added as a reference
// errorsFound: [], // stringSet, when recalculating, will reset to empty, once finished if any errorsFound then status will be "error"
// uniqueRequestId: "xx", (I think no longer used) used for idempotence when first process request called, in case that invocation fails and restarts, can be removed when set to complete/error
orderSubtotal: "xx",
orderQuantity: "xx",
sellOfferPrices: {}
deliveryPrice: "xx",
sellOfferPlanDeliveryMethodLinkId: "xx",
paymentPrice: "xx",
sellOfferPlanUserPaymentMethodLinkId: "xx",
}
}
</syntaxhighlight>
</syntaxhighlight>


* partition key: cacheId
* partition key: orderPriceId
* sort key: toDataId
* sort key: (none)
* expireTime is set as an automatic DynamoDB TTL attibute
* orderPriceId is {hash of sellOfferQuantities / orderQuantity / deliverToLocationId / sellOfferPlanDeliveryMethodLinkId / sellOfferPlanUserPaymentMethodLinkId
* sellOfferPlanQuantities works out the combined total for multiple sellOfferPlans, all sellOfferPlans must offer the given payment and delivery Ids, if not will be status error
* values found during re-calc are stored here, and can be used to present detailed cart pricing
* total price is stored in FindData table, and price is recalculated whenever FindData expires. This will mean should always request price via FindData, cannot request directly from orderPrice table


= Working documents =
= Working documents =

Latest revision as of 23:24, 16 August 2025

Overview

Each sell offer is handled by a Service - Sell Offer (handlers) service.

The Sell Offer Manager service handles shared orchestration of the Sell Offer Handler services.

Repository

https://bitbucket.org/izara-market-products/izara-market-products-sell-offer-manager/src/master/

Object Schemas

Additional Information
Per Service Schemas

objType

sellOffer

{
	objectType: "sellOffer",
	canDelete: false,
	belongTo: { 
		serviceTag: "user",
		objectType: "user"
	},
	addOnDataStructure: [ // optional, add for additional setting to objectType
		{
		  type: "attributeTree",    
		  attributeTreeTag: "sellOfferTerms"
		},
	],
	storageResources: {
		myGraph: {
			storageType: "graph",
			graphServerTag: "GraphHandler"
		}
    },
    fieldNames: {
		sellOfferId: {
			type: "string",
			randomOnCreate: true,
			storageResourceTags: ['myGraph']
		},
    },
    identifiers: [
		{
			type: "identifier",
			fieldName: "sellOfferId"
		}
    ]
}

Object Relationships

hasSellOffer

{
	hasSellOffer: {
		canChangeToRelTypes: [
			{
				serviceTag:"sellOfferManager",
				relationshipTag: "disabledSellOffer"
			},
		],
		storageResources: {
			myGraph: {
				storageType: "graph",
				graphServerTag: "GraphHandler"			
			}
		},
		links: [
			{
				storageResourceTags: ["myGraph"],
				from: {
					objType: {
						serviceTag: "ProductManager",
						objectType: "product"
					},
					linkType: "one",
				},
				to: {
					objType: {
						serviceTag: "sellOfferManager",
						objectType: "sellOffer"
					},
					linkType: "many"
				}
			}
		]
	}
}

disabledSellOffer

{
	disabledSellOffer: {
		canChangeToRelTypes: [
			{
				serviceTag:"sellOfferManager",
				relationshipTag: "hasSellOffer"
			},
		],
		storageResources: {
			myGraph: {
				storageType: "graph",
				graphServerTag: "GraphHandler"			
			}
		},
		links: [
			{
				storageResourceTags: ["myGraph"],
				from: {
					objType: {
						serviceTag: "ProductManager",
						objectType: "product"
					},
					linkType: "one",
				},
				to: {
					objType: {
						serviceTag: "sellOfferManager",
						objectType: "sellOffer"
					},
					linkType: "many"
				}
			}
		]
	}
}

soldByUser

{
	soldByUser: {
		storageResources: {
			myGraph: {
				storageType: "graph",
				graphServerTag: "GraphHandler"			
			}
		},
		links: [
			{
				storageResourceTags: ["myGraph"],
				from: {
					objType: {
						serviceTag: "sellOfferManager",
						objectType: "sellOffer"
					},
					linkType: "many",
				},
				to: {
					objType: {
						serviceTag: "user",
						objectType: "user"
					},
					linkType: "one"
				}
			}
		]
	}
}

usesSellOfferPlan

{
	usesSellOfferPlan: {
		storageResources: {
			myGraph: {
				storageType: "graph",
				graphServerTag: "GraphHandler"			
			}
		},
		links: [
			{
				storageResourceTags: ["myGraph"],
				from: {
					objType: {
						serviceTag: "sellOfferManager",
						objectType: "sellOffer"
					},
					linkType: "many",
				},
				to: {
					objType: {
						serviceTag: "sellOfferPlan",
						objectType: "sellOfferPlan"
					},
					linkType: "one"
				}
			}
		]
	}
}

OrderPrice

Cache of one total calculation for list of sellOffer quantities, and one combination of deliverToLocationId, / sellOfferPlanUserPaymentMethodLinkId / sellOfferPlanDeliveryMethodLinkId. Price includes Payment and Delivery method costs.

{
	orderPriceId: "xx",
	sellOfferQuantities: {},
	deliverToLocationId: "xx",
	//price: "xx", //removing and using findDataMain process
	//expiryTime: "xx", //removing and using findDataMain process
	// status: "xx", // "recalculating"|"complete"|"error", not really needed, added as a reference
	// errorsFound: [], // stringSet, when recalculating, will reset to empty, once finished if any errorsFound then status will be "error"
	// uniqueRequestId: "xx", (I think no longer used) used for idempotence when first process request called, in case that invocation fails and restarts, can be removed when set to complete/error
	orderSubtotal: "xx",
	orderQuantity: "xx",
	sellOfferPrices: {}
	deliveryPrice: "xx",
	sellOfferPlanDeliveryMethodLinkId: "xx",
	paymentPrice: "xx",
	sellOfferPlanUserPaymentMethodLinkId: "xx",
}
  • partition key: orderPriceId
  • sort key: (none)
  • orderPriceId is {hash of sellOfferQuantities / orderQuantity / deliverToLocationId / sellOfferPlanDeliveryMethodLinkId / sellOfferPlanUserPaymentMethodLinkId
  • sellOfferPlanQuantities works out the combined total for multiple sellOfferPlans, all sellOfferPlans must offer the given payment and delivery Ids, if not will be status error
  • values found during re-calc are stored here, and can be used to present detailed cart pricing
  • total price is stored in FindData table, and price is recalculated whenever FindData expires. This will mean should always request price via FindData, cannot request directly from orderPrice table

Working documents

Sell Offer Manager