Service - Sell Offer Standard: Difference between revisions

From Izara Wiki
Jump to navigation Jump to search
 
(13 intermediate revisions by the same user not shown)
Line 37: Line 37:
</syntaxhighlight>
</syntaxhighlight>


== LogicalResults ==
== SellOfferSettings ==


Stores results for any requests to perform logical searches on sell offer data
Handler specific settings for each SellOffer


<syntaxhighlight lang="JavaScript">
<syntaxhighlight lang="JavaScript">
{
{
resultId: xxx // eg: filterMainId for a single logical element
sellOfferId
dataId: xxx // one sellofferId
sellOfferPriceId
}
}
</syntaxhighlight>
</syntaxhighlight>


* partition key: resultId
* partition key: sellOfferId
* sort key: dataId
* sort key: (none)
 
== LogicalResultsMain ==
[[Standard LogicalResults Per Service|LogicalResultsMain]]
 
== LogicalResultsData ==
[[Standard LogicalResults Per Service|LogicalResultsData]]


= Graph database =  
= Graph database =  
Line 70: Line 76:
productId: {
productId: {
immutable: true,
immutable: true,
},
userId: {
immutable: true, // matches the sellOfferPlan's userId
},
},
sellOfferHandlerServiceNameTag: {
sellOfferHandlerServiceNameTag: {
immutable: true,
immutable: true,
},
currencyId: {
immutable: true, // matches the sellOfferPlan's currencyId
},
},
},
},
Line 107: Line 119:
}
}
</syntaxhighlight>
</syntaxhighlight>
* SellOffer relationship links the sell offer with it's parent product, the sell offer can be enabled (hasSellOffer) or disabled (disabledSellOffer)
* SellOffer relationship links the sell offer with it's parent product, the sell offer can be enabled (has_sellOffer) or disabled (disabled_sellOffer)
* when enabling/disabling we remove the old relationship and replace it with the new setting
* when enabling/disabling we remove the old relationship and replace it with the new setting
<syntaxhighlight lang="JavaScript">
{
relationshipType: "{SellOfferStandardLib.createHasSellOfferGraphRelationshipType()}", //"soldBy_user"
schema: {
elementCanBeRemoved: false,
allPropertiesImmutable: true,
restrictProperties: true,
properties: {
originTimestamp: //timestamp the request to create/change this relationship was sent
},
}
}
</syntaxhighlight>
* links a sell offer to the user selling it
<syntaxhighlight lang="JavaScript">
{
relationshipType: "{SellOfferPlanLib.createUsesSellOfferPlanGraphRelationshipType()}", // "uses_sellOfferPlan"
schema: {
elementCanBeRemoved: true,
allPropertiesImmutable: true,
restrictProperties: true,
properties: {
originTimestamp: //timestamp the request to create/change this relationship was sent
},
}
}
</syntaxhighlight>
* links a sell offer to a sell offer plan
* a sell offer has only one sell offer plan
== Basic node schemas ==
<syntaxhighlight lang="JavaScript">
{
nodeLabel: "{SellOfferStandardLib.SELL_OFFER_GRAPH_NODE_LABEL}",
schema: {
identifier: true,
restrictProperties: true,
restrictRelationships: true,
properties: {
sellOfferId: {
identifier: true,
},
sellOfferHandlerServiceNameTag: {
immutable: true,
},
},
}
}
</syntaxhighlight>
* [[Service - Orders Graph]]
= Complex Filter requests =
<syntaxhighlight lang="JavaScript">
// Not sure if moving all to sellOfferManager
{
filterType: "sellOffer" //unique id is sellOfferId
type: "group",
elements:
[
// ...
{
type: "complexFilter",
complexFilter: {
filterType: "sellOfferPlan",
// see [[Service - Sell Offer Plan|Complex Filter requests]]
}
},
{
type: "complexFilter",
complexFilter: {
filterType: "sellOfferTermLink",
// see [[Service - Sell Offer Terms|Complex Filter requests]]
}
},
...
]
}
</syntaxhighlight>
= SellOffer currency =
* When creating a sellOffer it's currency will be set to the same as the sellOfferPlan chosen
* sellOfferPrices is not linked to a set currency, this allows the pricing structure to be used across sellOffers with different currencies (eg USD equivalent currencies)
== Carts ==
* a Cart chooses one deliveryMethod, any sellOffers(actually the sellOffer's sellOfferPlan) added to the cart that are not the same currency as the selected deliveryMethod will be invalid when validating cart
== Delivery Method Links ==
* when adding a deliveryMethod to a sellOfferPlan the currencies must match
* because we expect deliveryMethods to have a rate returned, a shipping price, so expect to be able to combine that to the sellOffer's price without any conversion
* perhaps not allow changing of a deliveryMethod and sellOfferPlan's currency, if want to change need to create new
== Payment Method Links ==
* paymentMethod does not need to match the sellOfferPlan currency, seller can have sellOfferTerms to explain currency conversion when making payment
* however if the paymentMethod has a oneTimeAmount setting, that will make calculating the price invalid if it does not match the deliveryMethod/Cart's currency (maybe not store currency in paymentMethod, apply as is to whatever currency the sellOfferPlan is)
* oneTimePercentage can be set even if currencies do not match


= Working documents =
= Working documents =

Latest revision as of 10:10, 25 December 2022

Overview

Handler service for the standard sell offer type.

Repository

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

DynamoDB tables

Standard Config Table Per Service

Configuration tags

{
	configTag: "SellOfferHandlerServiceNameTag"
	configKey: "SellOfferHandlerServiceNameTag"
	configValue: xxx // this own services ServiceNameTag, eg "SellOfferStandard"
}
{
	configTag: "ProductGraphServiceName"
	configKey: "ProductGraphServiceName"
	configValue: xxx // eg: "ProductGraph"
}
{
	configTag: "SellOfferManagerServiceName"
	configKey: "SellOfferManagerServiceName"
	configValue: xxx // eg: "SellOfferManager"
}

SellOfferSettings

Handler specific settings for each SellOffer

{
	sellOfferId
	sellOfferPriceId
}
  • partition key: sellOfferId
  • sort key: (none)

LogicalResultsMain

LogicalResultsMain

LogicalResultsData

LogicalResultsData

Graph database

Service - Products Graph

Nodes

{
	nodeLabel: "{SellOfferStandardLib.SELL_OFFER_GRAPH_NODE_LABEL}",
	schema: {
		identifier: true,
		restrictProperties: true,
		restrictRelationships: true,
		properties: {
			sellOfferId: {
				identifier: true, //(random uuid)
			},
			productId: {
				immutable: true,
			},
			userId: {
				immutable: true, // matches the sellOfferPlan's userId
			},
			sellOfferHandlerServiceNameTag: {
				immutable: true,
			},
			currencyId: {
				immutable: true, // matches the sellOfferPlan's currencyId
			},
		},
	}
}

Relationships

{
	relationshipType: "{SellOfferStandardLib.createHasSellOfferGraphRelationshipType()}", //"has_sellOffer"
	schema: {
		elementCanBeRemoved: true,
		allPropertiesImmutable: true,
		restrictProperties: true,
		properties: {
			originTimestamp: //timestamp the request to create/change this relationship was sent
		},
	}
}
{
	relationshipType: "{SellOfferStandardLib.createDisabledSellOfferGraphRelationshipType()}", //"disabled_sellOffer"
	schema: {
		elementCanBeRemoved: true,
		allPropertiesImmutable: true,
		restrictProperties: true,
		properties: {
			originTimestamp: //timestamp the request to create/change this relationship was sent
		},
	}
}
  • SellOffer relationship links the sell offer with it's parent product, the sell offer can be enabled (has_sellOffer) or disabled (disabled_sellOffer)
  • when enabling/disabling we remove the old relationship and replace it with the new setting
{
	relationshipType: "{SellOfferStandardLib.createHasSellOfferGraphRelationshipType()}", //"soldBy_user"
	schema: {
		elementCanBeRemoved: false,
		allPropertiesImmutable: true,
		restrictProperties: true,
		properties: {
			originTimestamp: //timestamp the request to create/change this relationship was sent
		},
	}
}
  • links a sell offer to the user selling it
{
	relationshipType: "{SellOfferPlanLib.createUsesSellOfferPlanGraphRelationshipType()}", // "uses_sellOfferPlan"
	schema: {
		elementCanBeRemoved: true,
		allPropertiesImmutable: true,
		restrictProperties: true,
		properties: {
			originTimestamp: //timestamp the request to create/change this relationship was sent
		},
	}
}
  • links a sell offer to a sell offer plan
  • a sell offer has only one sell offer plan

Basic node schemas

{
	nodeLabel: "{SellOfferStandardLib.SELL_OFFER_GRAPH_NODE_LABEL}",
	schema: {
		identifier: true,
		restrictProperties: true,
		restrictRelationships: true,
		properties: {
			sellOfferId: {
				identifier: true,
			},
			sellOfferHandlerServiceNameTag: {
				immutable: true,
			},
		},
	}
}

Complex Filter requests

// Not sure if moving all to sellOfferManager
{
	filterType: "sellOffer" //unique id is sellOfferId
	type: "group",
	elements:
	[
		// ...
		{
			type: "complexFilter",
			complexFilter: {
				filterType: "sellOfferPlan",
				// see [[Service - Sell Offer Plan|Complex Filter requests]]
			}
		},		
		{
			type: "complexFilter",
			complexFilter: {
				filterType: "sellOfferTermLink",
				// see [[Service - Sell Offer Terms|Complex Filter requests]]
			}
		},		
		...
	]
}

SellOffer currency

  • When creating a sellOffer it's currency will be set to the same as the sellOfferPlan chosen
  • sellOfferPrices is not linked to a set currency, this allows the pricing structure to be used across sellOffers with different currencies (eg USD equivalent currencies)

Carts

  • a Cart chooses one deliveryMethod, any sellOffers(actually the sellOffer's sellOfferPlan) added to the cart that are not the same currency as the selected deliveryMethod will be invalid when validating cart

Delivery Method Links

  • when adding a deliveryMethod to a sellOfferPlan the currencies must match
  • because we expect deliveryMethods to have a rate returned, a shipping price, so expect to be able to combine that to the sellOffer's price without any conversion
  • perhaps not allow changing of a deliveryMethod and sellOfferPlan's currency, if want to change need to create new

Payment Method Links

  • paymentMethod does not need to match the sellOfferPlan currency, seller can have sellOfferTerms to explain currency conversion when making payment
  • however if the paymentMethod has a oneTimeAmount setting, that will make calculating the price invalid if it does not match the deliveryMethod/Cart's currency (maybe not store currency in paymentMethod, apply as is to whatever currency the sellOfferPlan is)
  • oneTimePercentage can be set even if currencies do not match

Working documents

Sell Offer Standard