Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Put some records in own modules to avoid name clashes
- Loading branch information
Showing
4 changed files
with
80 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
module PricedOrder where | ||
|
||
import SharedTypes | ||
import PricedOrderLine | ||
import Data.List.NonEmpty | ||
|
||
data PricedOrder = PricedOrder { | ||
orderId :: OrderId, | ||
customerInfo :: CustomerInfo, | ||
shippingAddress :: ShippingAddress, | ||
billingAddress :: BillingAddress, | ||
orderLines :: NonEmpty PricedOrderLine, | ||
amountToBill :: BillingAmount | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
module PricedOrderLine where | ||
|
||
import SharedTypes | ||
|
||
data PricedOrderLine = PricedOrderLine { | ||
orderLineId :: OrderLineId, | ||
orderId :: OrderId, | ||
productId :: ProductId, | ||
orderQuantity :: Int, | ||
price :: Price | ||
} deriving (Show) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
module SharedTypes where | ||
|
||
newtype OrderId = OrderId String deriving (Eq, Show) | ||
newtype OrderLineId = OrderLineId String deriving (Eq, Show) | ||
newtype ProductId = ProductId String deriving (Eq, Show) | ||
newtype CustomerId = CustomerId Int deriving (Show) | ||
newtype InvoiceId = InvoiceId Int deriving (Show) | ||
newtype ContactId = ContactId Int deriving (Show, Eq) | ||
newtype EmailAddress = EmailAddress String deriving (Show) | ||
newtype VerifiedEmailAddress = VerifiedEmailAddress String deriving (Show) | ||
newtype PhoneNumber = PhoneNumber String deriving (Show) | ||
newtype BillingAmount = BillingAmount Double deriving (Show) | ||
newtype Price = Price Double deriving (Show) | ||
newtype UnvalidatedAddress = UnvalidatedAddress String deriving Show | ||
newtype ValidatedAddress = ValidatedAddress String deriving Show | ||
-- newtype ValidatedShippingAddress = ValidatedShippingAddress String deriving Show | ||
-- newtype ValidatedBillingAddress = ValidatedBillingAddress String deriving Show | ||
-- newtype ValidatedOrderLine = ValidatedOrderLine String deriving Show | ||
|
||
-- TODO | ||
newtype AcknowledgmentSent = AcknowledgmentSent String | ||
newtype OrderPlaced = OrderPlaced String | ||
newtype BillableOrderPlaced = BillableOrderPlaced String | ||
newtype EmailContactInfo = EmailContactInfo String deriving Show | ||
newtype PostalContactInfo = PostalContactInfo String deriving Show | ||
newtype CustomerInfo = CustomerInfo String deriving Show | ||
|
||
data ProductCode = WidgetCode String | GizmoCode String deriving (Show) | ||
data CardType = Visa | Master deriving (Show) | ||
|
||
data CustomerEmail = Unverfied EmailAddress | Verified VerifiedEmailAddress deriving Show | ||
|
||
data ShippingAddress = ShippingAddress { | ||
} | ||
|
||
data BillingAddress = BillingAddress { | ||
} |