Subversion Repositories SmartDukaan

Rev

Rev 28241 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
28241 amit.gupta 1
package com.spice.profitmandi.dao.entity.fofo;
2
 
3
import java.time.LocalDateTime;
4
 
5
import javax.persistence.Column;
6
import javax.persistence.Entity;
7
import javax.persistence.EnumType;
8
import javax.persistence.Enumerated;
9
import javax.persistence.GeneratedValue;
10
import javax.persistence.GenerationType;
11
import javax.persistence.Id;
12
import javax.persistence.Table;
13
 
14
import com.spice.profitmandi.dao.enumuration.fofo.Gateway;
29497 amit.gupta 15
import com.spice.profitmandi.dao.enumuration.fofo.PaymentStatus;
28241 amit.gupta 16
 
17
@Entity
29497 amit.gupta 18
@Table(name = "fofo.payment", schema = "fofo")
19
public class FofoPayment {
28241 amit.gupta 20
 
21
	private static final long serialVersionUID = 1L;
22
	@Id
23
	@Column(name = "id")
24
	@GeneratedValue(strategy = GenerationType.IDENTITY)
25
	private int id;
26
 
27
	@Column(name="fofo_id")
28
	private int fofoId;
29497 amit.gupta 29
	@Column(name="amount")
30
	private double amount;
28241 amit.gupta 31
 
29497 amit.gupta 32
	@Column(name="gateway")
33
	@Enumerated(EnumType.STRING)
34
	private Gateway gateway;
35
 
36
	@Column(name="payment_method")
37
	private String paymentMethod;
38
 
28241 amit.gupta 39
	@Column(name="gateway_fee")
40
	private double gatewayFee;
41
 
29497 amit.gupta 42
	@Column(name="gateway_reference")
43
	private String gatewayReference;
44
 
28241 amit.gupta 45
	@Column(name="status")
46
	@Enumerated(EnumType.STRING)
29497 amit.gupta 47
	private PaymentStatus status=PaymentStatus.INIT;
28241 amit.gupta 48
 
49
	@Column(name="create_timestamp")
50
	private LocalDateTime createTimestamp;
51
 
52
 
29497 amit.gupta 53
	@Column(name="update_timestamp")
54
	private LocalDateTime updateTimestamp;
28241 amit.gupta 55
 
56
 
29497 amit.gupta 57
 
28241 amit.gupta 58
	public double getTotalAmount() {
29497 amit.gupta 59
		return amount + gatewayFee;
28241 amit.gupta 60
	}
29497 amit.gupta 61
 
62
	@Override
63
	public String toString() {
64
		return "FofoPayment [id=" + id + ", fofoId=" + fofoId + ", amount=" + amount + ", gateway=" + gateway
65
				+ ", gatewayFee=" + gatewayFee + ", gatewayReference=" + gatewayReference + ", status=" + status
66
				+ ", createTimestamp=" + createTimestamp + ", updateTimestamp=" + updateTimestamp + ", paymentMethod="
67
				+ paymentMethod + "]";
68
	}
69
 
28241 amit.gupta 70
	public int getId() {
71
		return id;
72
	}
29497 amit.gupta 73
 
28241 amit.gupta 74
	public void setId(int id) {
75
		this.id = id;
76
	}
29497 amit.gupta 77
 
28241 amit.gupta 78
	public int getFofoId() {
79
		return fofoId;
80
	}
29497 amit.gupta 81
 
28241 amit.gupta 82
	public void setFofoId(int fofoId) {
83
		this.fofoId = fofoId;
84
	}
85
 
29497 amit.gupta 86
	public double getAmount() {
87
		return amount;
28241 amit.gupta 88
	}
89
 
29497 amit.gupta 90
	public void setAmount(double amount) {
91
		this.amount = amount;
28241 amit.gupta 92
	}
93
 
29497 amit.gupta 94
	public Gateway getGateway() {
95
		return gateway;
96
	}
97
 
98
	public void setGateway(Gateway gateway) {
99
		this.gateway = gateway;
100
	}
101
 
28241 amit.gupta 102
	public double getGatewayFee() {
103
		return gatewayFee;
104
	}
29497 amit.gupta 105
 
28241 amit.gupta 106
	public void setGatewayFee(double gatewayFee) {
107
		this.gatewayFee = gatewayFee;
108
	}
29497 amit.gupta 109
 
110
	public String getGatewayReference() {
111
		return gatewayReference;
112
	}
113
 
114
	public void setGatewayReference(String gatewayReference) {
115
		this.gatewayReference = gatewayReference;
116
	}
117
 
118
	public PaymentStatus getStatus() {
119
		return status;
120
	}
121
 
122
	public void setStatus(PaymentStatus status) {
123
		this.status = status;
124
	}
125
 
126
	public LocalDateTime getCreateTimestamp() {
127
		return createTimestamp;
128
	}
129
 
130
	public void setCreateTimestamp(LocalDateTime createTimestamp) {
131
		this.createTimestamp = createTimestamp;
132
	}
133
 
134
	public LocalDateTime getUpdateTimestamp() {
135
		return updateTimestamp;
136
	}
137
 
138
	public void setUpdateTimestamp(LocalDateTime updateTimestamp) {
139
		this.updateTimestamp = updateTimestamp;
140
	}
141
 
28241 amit.gupta 142
	public String getPaymentMethod() {
143
		return paymentMethod;
144
	}
29497 amit.gupta 145
 
28241 amit.gupta 146
	public void setPaymentMethod(String paymentMethod) {
147
		this.paymentMethod = paymentMethod;
148
	}
29497 amit.gupta 149
 
28241 amit.gupta 150
	@Override
151
	public int hashCode() {
152
		final int prime = 31;
153
		int result = 1;
154
		long temp;
29497 amit.gupta 155
		temp = Double.doubleToLongBits(amount);
28241 amit.gupta 156
		result = prime * result + (int) (temp ^ (temp >>> 32));
29497 amit.gupta 157
		result = prime * result + ((createTimestamp == null) ? 0 : createTimestamp.hashCode());
28241 amit.gupta 158
		result = prime * result + fofoId;
159
		result = prime * result + ((gateway == null) ? 0 : gateway.hashCode());
160
		temp = Double.doubleToLongBits(gatewayFee);
161
		result = prime * result + (int) (temp ^ (temp >>> 32));
29497 amit.gupta 162
		result = prime * result + ((gatewayReference == null) ? 0 : gatewayReference.hashCode());
28241 amit.gupta 163
		result = prime * result + id;
164
		result = prime * result + ((paymentMethod == null) ? 0 : paymentMethod.hashCode());
29497 amit.gupta 165
		result = prime * result + ((status == null) ? 0 : status.hashCode());
166
		result = prime * result + ((updateTimestamp == null) ? 0 : updateTimestamp.hashCode());
28241 amit.gupta 167
		return result;
168
	}
169
 
170
	@Override
171
	public boolean equals(Object obj) {
172
		if (this == obj)
173
			return true;
174
		if (obj == null)
175
			return false;
176
		if (getClass() != obj.getClass())
177
			return false;
29497 amit.gupta 178
		FofoPayment other = (FofoPayment) obj;
179
		if (Double.doubleToLongBits(amount) != Double.doubleToLongBits(other.amount))
180
			return false;
28241 amit.gupta 181
		if (createTimestamp == null) {
182
			if (other.createTimestamp != null)
183
				return false;
184
		} else if (!createTimestamp.equals(other.createTimestamp))
185
			return false;
186
		if (fofoId != other.fofoId)
187
			return false;
188
		if (gateway != other.gateway)
189
			return false;
190
		if (Double.doubleToLongBits(gatewayFee) != Double.doubleToLongBits(other.gatewayFee))
191
			return false;
29497 amit.gupta 192
		if (gatewayReference == null) {
193
			if (other.gatewayReference != null)
194
				return false;
195
		} else if (!gatewayReference.equals(other.gatewayReference))
196
			return false;
28241 amit.gupta 197
		if (id != other.id)
198
			return false;
199
		if (paymentMethod == null) {
200
			if (other.paymentMethod != null)
201
				return false;
202
		} else if (!paymentMethod.equals(other.paymentMethod))
203
			return false;
29497 amit.gupta 204
		if (status != other.status)
205
			return false;
206
		if (updateTimestamp == null) {
207
			if (other.updateTimestamp != null)
208
				return false;
209
		} else if (!updateTimestamp.equals(other.updateTimestamp))
210
			return false;
28241 amit.gupta 211
		return true;
212
	}
213
 
214
 
215
}
216