Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
297 views
in Technique[技术] by (71.8m points)

architecture - DDD - Modeling "Team" Purchases In E-Commerce Apps

I'm trying to model social purchasing in an ecommerce style application. It's fairly early in the process so I don't have code to show yet.

Some user cases

  • At checkout time, a buyer can invite others (who may or not be users of the app) to purchase the same product. If the invitees purchase the product within a time period, the app grants an "App Bonus" to both the inviter and invitee. This "App Bonus" is at the "team purchase level" i.e. it is a single amount all purchases related to the original invitation and is not granted to each buyer individually. The App Bonus increases as more invited purchases are made.

  • Pre checkout (even preorder), a buyer can set up a Match Order where they use some of their "App Points" to match / subsidize any purchases for a specific product. They set up the Match Order with a specific product and limits around how much they'll match (e.g. 1 point for every $10 spent up to 1000 points). They then invite/share others to that Match Order. If the invitees buy the product, the points are automatically deducted. The Match Order purchases also qualify for the "App Bonus" above.

I am struggling with how to model this. What i am thinking of already...

  • Buyer (AR)
  • Order (AR)
    • Order details. Match Order Id (if exists), App Bonus Id (if exists)
  • MatchOrder (AR)
    • How much to match, what to match on, limits etc.
  • AppBonus (AR)
    • Amount of App Bonus for the group of orders.

Questions...

  • What's the best way to accumulate the App Bonus as the invitee orders are made? Is this just an OrderSubmittedDomainEvent that is handled (eventually) by the AppBonus AR?
  • At checkout time, i want to be able to show the invitee what impact their purchase will have on the App Bonus (essentially precalculate it based on their cart). This feels like both domain logic and query logic so i'm not sure where to put it. I have CQRS style query handlers that don't use the domain model but this feels like it should be in the App Bonus AR.
  • Should the App Bonus AR include an explicit list of orders related to it? Or is it fine for the Orders to have the Ids of the AppBonus

Thanks!


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...