petshop-10-services.spp
petshop/membership/petshop-10-services.spp
Download original file · Petstore source contents
1domain petshop;23atomic check checkCustomerProfile(Buyer) {4require(buyer.name != BLANK, RejectionCode.NAME_REQUIRED);5require(buyer.email != BLANK, RejectionCode.EMAIL_REQUIRED);6require(buyer.address != BLANK, RejectionCode.ADDRESS_REQUIRED);7require(8buyer.tier == MemberTier.NORMAL || buyer.tier == MemberTier.VIP,9RejectionCode.INVALID_MEMBER_TIER10);11}1213atomic calculate registerCustomer(Buyer, Cart) {14cart.buyer = buyer;15cart.lines = new CartLine[] {16};17}1819atomic calculate updateProfile(ProfileAgreement, Buyer) {20buyer.name = profileAgreement.newName;21buyer.email = profileAgreement.newEmail;22buyer.address = profileAgreement.newAddress;23buyer.tier = profileAgreement.newTier;24}2526atomic check checkNewCustomer(Buyer) {27require(!buyer, RejectionCode.CUSTOMER_EXISTS);28}2930atomic check checkBuyerCredential(Buyer) {31require(buyer.membershipNumber != BLANK, RejectionCode.MEMBERSHIP_NUMBER_REQUIRED);32}3334atomic calculate locateBuyerCart(Buyer, Cart) {35cart.buyer = buyer;36}