Service - Sell Offer Manager: Difference between revisions

From Izara Wiki
Jump to navigation Jump to search
No edit summary
 
(31 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">
{
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"
}
}
]
}
}
</syntaxhighlight>
=== disabledSellOffer ===
<syntaxhighlight lang="JavaScript">
{
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"
}
}
]
}
}
</syntaxhighlight>
=== soldByUser ===
<syntaxhighlight lang="JavaScript">
{
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"
}
}
]
}
}
</syntaxhighlight>
=== usesSellOfferPlan ===


<syntaxhighlight lang="JavaScript">
<syntaxhighlight lang="JavaScript">
{
{
configKey: "SellOfferService"
usesSellOfferPlan: {
configTag: xxx // sellOfferServiceNameTag, eg: "SellOfferStandard", this is what is saved in each catalog record
storageResources: {
configValue: {
myGraph: {
serviceName: xxx // eg: "SellOfferStandard", this is the actual deployed service name}
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>


== TranslateIdsRequest ==
== OrderPrice ==


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


<syntaxhighlight lang="JavaScript">
<syntaxhighlight lang="JavaScript">
{
{
translateIdsRequestId: xxx // fromType + '_' + fromResultId + '_' + toType
orderPriceId: "xx",
fromType
sellOfferQuantities: {},
fromResultId
deliverToLocationId: "xx",
fromResultTable
//price: "xx", //removing and using findDataMain process
toType
//expiryTime: "xx", //removing and using findDataMain process
status: // "processing"|"complete"
// status: "xx", // "recalculating"|"complete"|"error", not really needed, added as a reference
request_hashes: [..] // string set of hashes of each request object, used for idempotence
// errorsFound: [], // stringSet, when recalculating, will reset to empty, once finished if any errorsFound then status will be "error"
requests: [..] // array of request objects waiting a reply when this request is complete
// 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: translateIdsRequestId
* partition key: orderPriceId
* sort key: {none}
* 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 =
= 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