/***
 * Excerpted from "Domain-Driven Design Using Naked Objects",
 * published by The Pragmatic Bookshelf.
 * Copyrights apply to this code. It may not be used to create training material, 
 * courses, books, articles, and the like. Contact us if you are in doubt.
 * We make no guarantees that this code is fit for any purpose. 
 * Visit http://www.pragmaticprogrammer.com/titles/dhnako for more book information.
***/
package com.pragprog.dhnako.carserv.dom.customer;

import org.nakedobjects.applib.annotation.MemberOrder;
import org.nakedobjects.applib.annotation.RegEx;

import com.pragprog.dhnako.carserv.dom.payment.PaymentMethod;

public class CreditCard extends PaymentMethod {


	// {{ CardNumber
	private String cardNumber;

	@MemberOrder(sequence = "3.1")
	public String getCardNumber() {
		return cardNumber;
	}

	public void setCardNumber(final String cardNumber) {
		this.cardNumber = cardNumber;
	}
	// }}

	// {{ ExpiryDate
	private String expiryDate;

	@RegEx(validation="[0-9]{2}/[0-9]{4}")
	@MemberOrder(sequence = "3.2")
	public String getExpiryDate() {
		return expiryDate;
	}

	public void setExpiryDate(final String expiryDate) {
		this.expiryDate = expiryDate;
	}
	// }}


	// {{ pay
	@Override
	public boolean pay(Integer amount) {
		// stub implementation, would probably delegate to
		// a CreditCardService.
		warnUser("NOT YET IMPLEMENTED - ignoring");
		return false;
	}
	@Override
	public String validatePay(Integer amount) {
		return null;
	}
	// }}


}
