Form view
Stores the card data such as number, name, etc.
This CardData can be embeded into your application's Model in various ways.
Here's 2 example of embedding this data into your model:
Example 1:
-- Use CardData in your model directly
type alias Model =
{ cardData : CreditCard.CardData {}
...
}
-- Initial the model
init =
{ cardData = CardData.emptyCardData
...
}Example 2:
-- Extends the CardData in your Model
type alias Model =
{ number : Maybe String
, name : Maybe String
, month : Maybe String
, year : Maybe String
, ccv : Maybe String
, state : CreditCard.State
, shippingAddress : Maybe String
...
}
-- Initial the model
init =
let
emptyCardData =
CardData.emptyCardData
in
{ emptyCardData |
shippingAddress = Nothing
...
}Empty card data
Internal State of the card view
Initial state of the card view
Card view