abadi199/elm-creditcard/6.0.0

NOTE: this package is not compatible with Elm 0.19.1

CreditCard

View

card : Config {} -> CardData model -> Html msg

Card view

form : FormConfig model msg -> CardData model -> Html msg

Form view

Data

type alias CardData model =
{ model
| number : Maybe String
, name : Maybe String
, month : Maybe String
, year : Maybe String
, ccv : Maybe String
, state : State
}

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
        ...
        }
emptyCardData : CardData {}

Empty card data

Internal State

type alias State =
State

Internal State of the card view

initialState : State

Initial state of the card view