Subversion Repositories SmartDukaan

Rev

Go to most recent revision | Details | 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;
15
import com.spice.profitmandi.dao.enumuration.fofo.LoanPaymentStatus;
16
 
17
@Entity
18
@Table(name = "fofo.loan_payment_request", schema = "fofo")
19
public class LoanPaymentRequest {
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;
29
	@Column(name="credit_amount")
30
	private double creditAmount;
31
 
32
	@Column(name="gateway_fee")
33
	private double gatewayFee;
34
 
35
	@Column(name="status")
36
	@Enumerated(EnumType.STRING)
37
	private LoanPaymentStatus loanPaymentStatus=LoanPaymentStatus.INIT;
38
 
39
	@Column(name="create_timestamp")
40
	private LocalDateTime createTimestamp;
41
 
42
	@Column(name="gateway_identifier")
43
	@Enumerated(EnumType.STRING)
44
	private Gateway gateway;
45
 
46
 
47
	@Column(name="payment_method")
48
	private String paymentMethod;
49
 
50
	public double getTotalAmount() {
51
		return creditAmount + gatewayFee;
52
	}
53
 
54
	public int getId() {
55
		return id;
56
	}
57
	public void setId(int id) {
58
		this.id = id;
59
	}
60
	public LoanPaymentStatus getLoanPaymentStatus() {
61
		return loanPaymentStatus;
62
	}
63
	public void setLoanPaymentStatus(LoanPaymentStatus loanPaymentStatus) {
64
		this.loanPaymentStatus = loanPaymentStatus;
65
	}
66
	public LocalDateTime getCreateTimestamp() {
67
		return createTimestamp;
68
	}
69
	public void setCreateTimestamp(LocalDateTime createTimestamp) {
70
		this.createTimestamp = createTimestamp;
71
	}
72
	public int getFofoId() {
73
		return fofoId;
74
	}
75
	public void setFofoId(int fofoId) {
76
		this.fofoId = fofoId;
77
	}
78
 
79
 
80
	public double getCreditAmount() {
81
		return creditAmount;
82
	}
83
 
84
	public void setCreditAmount(double creditAmount) {
85
		this.creditAmount = creditAmount;
86
	}
87
 
88
	public double getGatewayFee() {
89
		return gatewayFee;
90
	}
91
	public void setGatewayFee(double gatewayFee) {
92
		this.gatewayFee = gatewayFee;
93
	}
94
	public String getPaymentMethod() {
95
		return paymentMethod;
96
	}
97
	public void setPaymentMethod(String paymentMethod) {
98
		this.paymentMethod = paymentMethod;
99
	}
100
	@Override
101
	public int hashCode() {
102
		final int prime = 31;
103
		int result = 1;
104
		result = prime * result + ((createTimestamp == null) ? 0 : createTimestamp.hashCode());
105
		long temp;
106
		temp = Double.doubleToLongBits(creditAmount);
107
		result = prime * result + (int) (temp ^ (temp >>> 32));
108
		result = prime * result + fofoId;
109
		result = prime * result + ((gateway == null) ? 0 : gateway.hashCode());
110
		temp = Double.doubleToLongBits(gatewayFee);
111
		result = prime * result + (int) (temp ^ (temp >>> 32));
112
		result = prime * result + id;
113
		result = prime * result + ((loanPaymentStatus == null) ? 0 : loanPaymentStatus.hashCode());
114
		result = prime * result + ((paymentMethod == null) ? 0 : paymentMethod.hashCode());
115
		return result;
116
	}
117
 
118
	@Override
119
	public boolean equals(Object obj) {
120
		if (this == obj)
121
			return true;
122
		if (obj == null)
123
			return false;
124
		if (getClass() != obj.getClass())
125
			return false;
126
		LoanPaymentRequest other = (LoanPaymentRequest) obj;
127
		if (createTimestamp == null) {
128
			if (other.createTimestamp != null)
129
				return false;
130
		} else if (!createTimestamp.equals(other.createTimestamp))
131
			return false;
132
		if (Double.doubleToLongBits(creditAmount) != Double.doubleToLongBits(other.creditAmount))
133
			return false;
134
		if (fofoId != other.fofoId)
135
			return false;
136
		if (gateway != other.gateway)
137
			return false;
138
		if (Double.doubleToLongBits(gatewayFee) != Double.doubleToLongBits(other.gatewayFee))
139
			return false;
140
		if (id != other.id)
141
			return false;
142
		if (loanPaymentStatus != other.loanPaymentStatus)
143
			return false;
144
		if (paymentMethod == null) {
145
			if (other.paymentMethod != null)
146
				return false;
147
		} else if (!paymentMethod.equals(other.paymentMethod))
148
			return false;
149
		return true;
150
	}
151
 
152
	public Gateway getGateway() {
153
		return gateway;
154
	}
155
 
156
	public void setGateway(Gateway gateway) {
157
		this.gateway = gateway;
158
	}
159
 
160
	@Override
161
	public String toString() {
162
		return "LoanPaymentRequest [id=" + id + ", fofoId=" + fofoId + ", creditAmount=" + creditAmount
163
				+ ", gatewayFee=" + gatewayFee + ", loanPaymentStatus=" + loanPaymentStatus + ", createTimestamp="
164
				+ createTimestamp + ", gateway=" + gateway + ", paymentMethod=" + paymentMethod + "]";
165
	}
166
 
167
 
168
}
169