/** * Most of the code in the Qalingo project is copyrighted Hoteia and licensed * under the Apache License Version 2.0 (release version 0.8.0) * http://www.apache.org/licenses/LICENSE-2.0 * * Copyright (c) Hoteia, 2012-2014 * http://www.hoteia.com - http://twitter.com/hoteia - contact@hoteia.com * */ package org.hoteia.qalingo.core.domain; import java.math.BigDecimal; import java.util.Date; import java.util.HashSet; import java.util.Set; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.OneToMany; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; import org.hoteia.qalingo.core.domain.impl.DomainEntity; @Entity @Table(name="TECO_ORDER_PAYMENT") public class OrderPayment extends AbstractExtendEntity<OrderPayment, OrderPaymentAttribute> implements DomainEntity { /** * Generated UID */ private static final long serialVersionUID = 1602080387919993090L; @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name="ID", nullable=false) private Long id; @Column(name="AMOUNT") private BigDecimal amount; @Column(name="IP_ADDRESS") private String ipAddress; @Column(name="REQUEST_TOKEN") private String requestToken; @Column(name="PAYMENT_TYPE") private String paymentType; @Column(name="TRANSACTION_TYPE") private String transactionType; @Column(name="CARD_TYPE") private String cardType; @Column(name="STATUS") private String status; @Column(name="CARDHOLDER_NAME") private String cardHolderName; @Column(name="EXPIRATION_MONTH") private String expirationMonth; @Column(name="EXPIRATION_YEAR") private String expirationYear; @Column(name="CVV2_CODE") private String cvv2Code; @Column(name="AUTHORIZATION_CODE") private String authorizationCode; @Column(name="NAME") private String currencyCode; @OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL, targetEntity = org.hoteia.qalingo.core.domain.OrderPaymentAttribute.class) @JoinColumn(name = "ORDER_PAYMENT_ID") private Set<OrderPaymentAttribute> attributes = new HashSet<OrderPaymentAttribute>(); @Temporal(TemporalType.TIMESTAMP) @Column(name="DATE_CREATE") private Date dateCreate; @Temporal(TemporalType.TIMESTAMP) @Column(name="DATE_UPDATE") private Date dateUpdate; public OrderPayment(){ this.dateCreate = new Date(); this.dateUpdate = new Date(); } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public BigDecimal getAmount() { return amount; } public void setAmount(BigDecimal amount) { this.amount = amount; } public String getIpAddress() { return ipAddress; } public void setIpAddress(String ipAddress) { this.ipAddress = ipAddress; } public String getRequestToken() { return requestToken; } public void setRequestToken(String requestToken) { this.requestToken = requestToken; } public String getPaymentType() { return paymentType; } public void setPaymentType(String paymentType) { this.paymentType = paymentType; } public String getTransactionType() { return transactionType; } public void setTransactionType(String transactionType) { this.transactionType = transactionType; } public String getCardType() { return cardType; } public void setCardType(String cardType) { this.cardType = cardType; } public String getStatus() { return status; } public void setStatus(String status) { this.status = status; } public String getCardHolderName() { return cardHolderName; } public void setCardHolderName(String cardHolderName) { this.cardHolderName = cardHolderName; } public String getExpirationMonth() { return expirationMonth; } public void setExpirationMonth(String expirationMonth) { this.expirationMonth = expirationMonth; } public String getExpirationYear() { return expirationYear; } public void setExpirationYear(String expirationYear) { this.expirationYear = expirationYear; } public String getCvv2Code() { return cvv2Code; } public void setCvv2Code(String cvv2Code) { this.cvv2Code = cvv2Code; } public String getAuthorizationCode() { return authorizationCode; } public void setAuthorizationCode(String authorizationCode) { this.authorizationCode = authorizationCode; } public String getCurrencyCode() { return currencyCode; } public void setCurrencyCode(String currencyCode) { this.currencyCode = currencyCode; } public Set<OrderPaymentAttribute> getAttributes() { return attributes; } public void setAttributes(Set<OrderPaymentAttribute> attributes) { this.attributes = attributes; } public Date getDateCreate() { return dateCreate; } public void setDateCreate(Date dateCreate) { this.dateCreate = dateCreate; } public Date getDateUpdate() { return dateUpdate; } public void setDateUpdate(Date dateUpdate) { this.dateUpdate = dateUpdate; } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((dateCreate == null) ? 0 : dateCreate.hashCode()); result = prime * result + ((id == null) ? 0 : id.hashCode()); result = prime * result + ((requestToken == null) ? 0 : requestToken.hashCode()); return result; } @Override public boolean equals(Object sourceObj) { Object obj = deproxy(sourceObj); if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; OrderPayment other = (OrderPayment) obj; if (dateCreate == null) { if (other.dateCreate != null) return false; } else if (!dateCreate.equals(other.dateCreate)) return false; if (id == null) { if (other.id != null) return false; } else if (!id.equals(other.id)) return false; if (requestToken == null) { if (other.requestToken != null) return false; } else if (!requestToken.equals(other.requestToken)) return false; return true; } @Override public String toString() { return "OrderPayment [id=" + id + ", amount=" + amount + ", ipAddress=" + ipAddress + ", requestToken=" + requestToken + ", cardType=" + cardType + ", status=" + status + ", cardHolderName=" + cardHolderName + ", expirationMonth=" + expirationMonth + ", expirationYear=" + expirationYear + ", cvv2Code=" + cvv2Code + ", authorizationCode=" + authorizationCode + ", currencyCode=" + currencyCode + ", dateCreate=" + dateCreate + ", dateUpdate=" + dateUpdate + "]"; } }