func (p *Payment) Code() string {
	return p.CVV
}
Code returns the CVV.
package dawg
import (
	"errors"
	"fmt"
	"regexp"
	"strconv"
	"strings"
	"time"
)
type Card interface {
	Num() string
	ExpiresOn() time.Time
	Code() string
}
func NewCard(number, expiration string, cvv int) Card {
	if len(expiration) < 4 || len(expiration) > 5 {
		return nil  
	}
	return &Payment{
		Number:     number,
		Expiration: expiration,
		CVV:        strconv.Itoa(cvv),
	}
}
func ToPayment(c Card) *Payment {
	return &Payment{
		Number:     c.Num(),
		Expiration: formatDate(c.ExpiresOn()),
		CVV:        c.Code(),
	}
}
type Payment struct {
	Number string `json:"Number"`
	Expiration string `json:"Expiration"`
	CardType   string `json:"Type"`
	CVV        string `json:"SecurityCode"`
}
func (p *Payment) Num() string {
	return p.Number
}
var BadExpiration = time.Date(0, 0, 0, 0, 0, 0, 0, time.UTC)
func (p *Payment) ExpiresOn() time.Time {
	if len(p.Expiration) == 0 {
		return BadExpiration
	}
	m, y := parseDate(p.Expiration)
	if m <= 0 || m > 12 || y < 0 {
		return BadExpiration
	}
	return time.Date(int(y), time.Month(m), 1, 0, 0, 0, 0, time.Local)
}