// Path: web/javamoney-payment-cdi-event/src/main/java/org/javamoney/examples/cdi/payment/events/PaymentEvent.java
// public class PaymentEvent {
// 	private PaymentType type;  //credit or debit
// 	private Date datetime;
// 	private MonetaryAmount money;
// 	
// 	public PaymentType getType() {
// 		return type;
// 	}
// 	public void setType(PaymentType type) {
// 		this.type = type;
// 	}
// 
// 	public Date getDatetime() {
// 		return datetime;
// 	}
// 	public void setDatetime(Date datetime) {
// 		this.datetime = datetime;
// 	}
// 
// 	public String toString(){
//         return String.format("EVT: %s:%s:%s", getDatetime(), getMoney(), getType());
// 	}
// 	public MonetaryAmount getMoney() {
// 		return money;
// 	}
// 	public void setMoney(MonetaryAmount money) {
// 		this.money = money;
// 	}
// }
// 
// Path: web/javamoney-payment-cdi-event/src/main/java/org/javamoney/examples/cdi/payment/events/PaymentType.java
// public enum PaymentType {
// 
// 	CREDIT("1"), DEBIT("2");
// 
// 	private final String value;
// 
// 	static final Map<String, PaymentType> map = new HashMap<String, PaymentType>();
// 
// 	static {
// 		for (PaymentType paymentType : PaymentType.values()) {
// 			map.put(paymentType.getValue(), paymentType);
// 		}
// 	}
// 
// 	private PaymentType(String value) {
// 		this.value = value;
// 	}
// 
// 	public String getValue() {
// 		return value;
// 	}
// 
// 	public static PaymentType of(String value) {
// 		return map.get(value);
// 	}
// }


import javax.money.Monetary;
import org.javamoney.examples.cdi.payment.events.PaymentEvent;
import org.javamoney.examples.cdi.payment.events.PaymentType;
import org.javamoney.examples.cdi.payment.qualifiers.Amount;
import org.javamoney.examples.cdi.payment.qualifiers.Credit;
import org.javamoney.examples.cdi.payment.qualifiers.Debit;
import org.javamoney.moneta.Money;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.logging.Logger;
import javax.enterprise.context.SessionScoped;
import javax.enterprise.event.Event;
import javax.inject.Inject;
import javax.inject.Named;
import javax.money.CurrencyUnit;
import javax.money.MonetaryAmount;
/*
 * JavaMoney Examples
 * Copyright 2012 Red Hat, Inc. and/or its affiliates,
 * and individual contributors by the @author tags. See the copyright.txt in the
 * distribution for a full listing of individual contributors
 *
 * Copyright 2012-2019, Werner Keil
 * and individual contributors by the @author tags.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * http://www.apache.org/licenses/LICENSE-2.0
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,  
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.javamoney.examples.cdi.payment.beans;




//import org.javamoney.annotation.Amount;

@Named
@SessionScoped
public class PaymentBean implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 6634420857401223541L;

	@Inject
	private Logger log;

	// Events producers
	@Inject
	@Credit
	Event<PaymentEvent> creditEventProducer;

	@Inject
	@Debit
	Event<PaymentEvent> debitEventProducer;

	private static final CurrencyUnit CURRENCY = Monetary
			.getCurrency("EUR");

	@Amount
	private BigDecimal amount = new BigDecimal(10.0);

	@Amount
	private MonetaryAmount money = Money.of(amount, CURRENCY);

	public MonetaryAmount getMoney() {
		return money;
	}

	public void setMoney(MonetaryAmount money) {
		this.money = money;
	}

	private String paymentOption = PaymentType.DEBIT.toString();

	// Pay Action
	public String pay() {
// Path: web/javamoney-payment-cdi-event/src/main/java/org/javamoney/examples/cdi/payment/events/PaymentEvent.java
// public class PaymentEvent {
// 	private PaymentType type;  //credit or debit
// 	private Date datetime;
// 	private MonetaryAmount money;
// 	
// 	public PaymentType getType() {
// 		return type;
// 	}
// 	public void setType(PaymentType type) {
// 		this.type = type;
// 	}
// 
// 	public Date getDatetime() {
// 		return datetime;
// 	}
// 	public void setDatetime(Date datetime) {
// 		this.datetime = datetime;
// 	}
// 
// 	public String toString(){
//         return String.format("EVT: %s:%s:%s", getDatetime(), getMoney(), getType());
// 	}
// 	public MonetaryAmount getMoney() {
// 		return money;
// 	}
// 	public void setMoney(MonetaryAmount money) {
// 		this.money = money;
// 	}
// }
// 
// Path: web/javamoney-payment-cdi-event/src/main/java/org/javamoney/examples/cdi/payment/events/PaymentType.java
// public enum PaymentType {
// 
// 	CREDIT("1"), DEBIT("2");
// 
// 	private final String value;
// 
// 	static final Map<String, PaymentType> map = new HashMap<String, PaymentType>();
// 
// 	static {
// 		for (PaymentType paymentType : PaymentType.values()) {
// 			map.put(paymentType.getValue(), paymentType);
// 		}
// 	}
// 
// 	private PaymentType(String value) {
// 		this.value = value;
// 	}
// 
// 	public String getValue() {
// 		return value;
// 	}
// 
// 	public static PaymentType of(String value) {
// 		return map.get(value);
// 	}
// }


// Path: web/javamoney-payment-cdi-event/src/main/java/org/javamoney/examples/cdi/payment/beans/PaymentBean.java
import javax.money.Monetary;
import org.javamoney.examples.cdi.payment.events.PaymentEvent;
import org.javamoney.examples.cdi.payment.events.PaymentType;
import org.javamoney.examples.cdi.payment.qualifiers.Amount;
import org.javamoney.examples.cdi.payment.qualifiers.Credit;
import org.javamoney.examples.cdi.payment.qualifiers.Debit;
import org.javamoney.moneta.Money;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.logging.Logger;
import javax.enterprise.context.SessionScoped;
import javax.enterprise.event.Event;
import javax.inject.Inject;
import javax.inject.Named;
import javax.money.CurrencyUnit;
import javax.money.MonetaryAmount;

/*
 * JavaMoney Examples
 * Copyright 2012 Red Hat, Inc. and/or its affiliates,
 * and individual contributors by the @author tags. See the copyright.txt in the
 * distribution for a full listing of individual contributors
 *
 * Copyright 2012-2019, Werner Keil
 * and individual contributors by the @author tags.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * http://www.apache.org/licenses/LICENSE-2.0
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,  
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.javamoney.examples.cdi.payment.beans;




//import org.javamoney.annotation.Amount;

@Named
@SessionScoped
public class PaymentBean implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 6634420857401223541L;

	@Inject
	private Logger log;

	// Events producers
	@Inject
	@Credit
	Event<PaymentEvent> creditEventProducer;

	@Inject
	@Debit
	Event<PaymentEvent> debitEventProducer;

	private static final CurrencyUnit CURRENCY = Monetary
			.getCurrency("EUR");

	@Amount
	private BigDecimal amount = new BigDecimal(10.0);

	@Amount
	private MonetaryAmount money = Money.of(amount, CURRENCY);

	public MonetaryAmount getMoney() {
		return money;
	}

	public void setMoney(MonetaryAmount money) {
		this.money = money;
	}

	private String paymentOption = PaymentType.DEBIT.toString();

	// Pay Action
	public String pay() {
		PaymentEvent currentEvtPayload = new PaymentEvent();