sample-ordering-story Pub Share

An amazon use case: order a new product.

First, a seller can define the new product, via either a B2B API

send::  msg catalog.addProduct  (name="prod1", sku="prod1")

expect::  (productId is defined)


send::  msg cart.create  (customer="John", metadata :JSON)

add book1 view cart

add book1 view cart

send::  msg catalog.addProduct  (name="Book1", sku="book1", quantity:Number=3)

expect::  (productId is number)

A customer will now order it and checkout

send::  msg cust.addToCart  (customer="John", sku="book1", quantity:Number=2)

expect::  ( ((cart as String) contains "book1"))

send::  msg cust.addToCart  (customer="John", sku="book2", quantity:Number=2)

expect::  ( ((cart as String) contains "book2"))

send::  msg cart.checkout  (customer="John", shipAddr="123", billing="bil123")

/$expect inv.low (sku=="book1") /$expect shipping.send

send::  msg diesel.memdb.clear 


Was this useful?    

By: Razie | 2017-04-06 .. 2022-06-21 | Tags: story , dsl , amazon , check


Viewed 961 times ( | History | Print ) this page.

You need to log in to post a comment!

© Copyright DieselApps, 2012-2024, all rights reserved.