package app.actions;

import app.model.Model;

import com.opensymphony.xwork2.ActionSupport;

public class Buy extends ActionSupport {

	private static final long serialVersionUID = 1L;

	private String cardNum = null;

	public String getCardNum() {
		return cardNum;
	}

	public void setCardNum(String cardNum) {
		this.cardNum = cardNum;
	}

	public String execute() throws Exception {

		if (Model.buyWithCard(cardNum)) {
			return SUCCESS;
		} else {
			addActionError("Provide another card");
			return ERROR;
		}
	}

}