An online store has the following contract: buyers can iteratively
add items to a shopping cart;
when at least one item has been added,
a buyer can proceed to the checkout.
Then, the client can either cancel the order, or pay.
In the latter case, the store can accept the payment (ok),
or decline it (no, in which case it lets the user try again),
or it can abort the transaction.

A store offers buyers two payments options:
clickPay or clickVoucher. If a buyer chooses clickPay,
the store requires it to pay;
otherwise, the store check the validity of the voucher interacting
with an online voucher distribution system (V).
If V validates the voucher (ok), the buyer can use it (voucher),
otherwise (no) it must pay the store.

singlepackageit.unica.co2.sitehonestyP/* * contracts */// between the dealer and the playercontractCp{hit?.(card!int.Cp(+)lose!(+)abort!)+stand?.(win!(+)lose!(+)abort!)}// between the dealer and the desk servicecontractCd{next!.card?int.Cd(+)abort!}/* * specification */specificationP{tellxdCd.tellxpCp.Pplay(xp,xd,0)after*->send@xdabort!}specificationPplay(xp:session,xd:session,np:int){receive{@xphit?->send@xdnext!.Pdeck(xp,xd,np)@xpstand?->Qstand(xp,xd,np,0)after*->send@xdabort!.PabortP(xp)}}specificationPdeck(xp:session,xd:session,np:int){receive{@xdcard?[n:int]->Pcard(xp,xd,np+n,n)after*->send@xpabort!.PabortD(xd)}}specificationPcard(xp:session,xd:session,np:int,n:int){ifnp<21thensend@xpcard![n].Pplay(xp,xd,np)elsesend@xplose!.PabortD(xd)}specificationQstand(xp:session,xd:session,np:int,nd:int){ifnd<21thensend@xdnext!.Qdeck(xp,xd,np,nd)elsesend@xpwin!.send@xdabort!}specificationQdeck(xp:session,xd:session,np:int,nd:int){receive{@xdcard?[n:int]->Qcard(xp,xd,np,nd)after*->send@xpabort!.PabortD(xd)}}specificationQcard(xp:session,xd:session,np:int,nd:int){ifnd<npthenQstand(xp,xd,np,nd)elsesend@xplose!.PabortD(xd)}specificationPabortP(xp:session){receive@xphit?stand?.send@xpabort!}specificationPabortD(xd:session){send@xdabort!|receive@xdcard?[n:int].send@xdabort!}

singlepackageit.unica.co2.sitehonestyP/* * contracts */// between the travel agency and the customercontractCu{tripDets?string.budget?int.(quote!int.pay?.(commit!(+)abort!)(+)abort!)}// between the travel agency and the flying companycontractCf{flightDets!string.D}// between the travel agency and the hotel reservation servicecontractCh{hotelDets!string.D}contractD{quote?int.(pay!.(confirm?.(commit!(+)abort!))(+)abort!)}/* * specification */specificationP{tellxuCu.receive@xutripDets?[yt:string].receive@xubudget?[bud:int].P1(xu,yt,bud)}specificationP1(xu:session,yt:string,bud:int){tellAndReturnxfCf.tellAndReturnxhCh.(send@xfflightDets![yt]|send@xhhotelDets![yt]|Pquote(xu,xf,xh,bud))}specificationPquote(xu:session,xf:session,xh:session,bud:int){receive{@xfquote?[n:int]->Pquote1(xu,xf,xh,n,bud)@xhquote?[n:int]->Pquote1(xu,xh,xf,n,bud)after*->Pabort(xu,xh,xf)}}specificationPquote1(x:session,x1:session,x2:session,quote:int,budget:int){ifquote<budgetthenPquote2(x,x1,x2,quote,budget)elsePabort(x,x1,x2)}specificationPquote2(x:session,x1:session,x2:session,quote:int,budget:int){receive{@x2quote?[quote2:int]->ifquote+quote2<budgetthenPpay(x,x1,x2,quote+quote2)elsePabort(x,x1,x2)after*->Pabort(x,x1,x2)}}specificationPabort(x:session,x1:session,x2:session){send@xabort!|send@x1abort!|send@x2abort!|receive@xpay?|receive@x1quote?[n:int]|receive@x2quote?[n:int]|receive@x1confirm?|receive@x2confirm?}specificationPpay(x:session,x1:session,x2:session,amount:int){send@xquote![amount].(receive{@xpay?->Pconfirm1(x,x1,x2)after*->Pabort(x,x1,x2)})}specificationPconfirm1(x:session,x1:session,x2:session){send@x1pay!.send@x2pay!.(receive{@x1confirm?->Pconfirm2(x,x1,x2)after*->Pabort(x,x1,x2)})}specificationPconfirm2(x:session,x1:session,x2:session){receive{@x2confirm?->Pcommit(x,x1,x2)after*->Pabort(x,x1,x2)}}specificationPcommit(x:session,x1:session,x2:session){send@xcommit!.send@x1commit!.send@x2commit!}