Subversion Repositories SmartDukaan

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2747 chandransh 1
package in.shop2020.payment.domain;
2
 
3
import in.shop2020.payments.Attribute;
4
 
5
import java.io.Serializable;
6
import java.util.ArrayList;
7
import java.util.Date;
8
import java.util.List;
9
 
10
@SuppressWarnings("serial")
11
public class Refund implements Serializable {
12
	private long id;
13
	private long paymentId;
14
    private long gatewayId;
15
    private long orderId;
16
 
17
    private double amount;
18
    private String gatewayTxnId;
19
    private int attempts;
20
 
21
    private Date createdAt;
22
    private Date processedAt;
23
 
24
    private List<RefundAttribute> attributes;
25
 
26
    public in.shop2020.payments.Refund getThriftPayment(){
27
        in.shop2020.payments.Refund refund = new in.shop2020.payments.Refund();
28
        refund.setId(id);
29
        refund.setPaymentId(paymentId);
30
        refund.setGatewayId(gatewayId);
31
        refund.setOrderId(orderId);
32
        refund.setAmount(amount);
33
        refund.setAttempts(attempts);
34
        refund.setCreatedAt(createdAt.getTime());
35
        if(processedAt != null)
36
            refund.setProcessedAt(processedAt.getTime());
37
        if(gatewayTxnId != null)
38
            refund.setGatewayTxnId(gatewayTxnId);
39
 
40
        if(attributes == null || attributes.isEmpty())
41
            refund.setAttributes(new ArrayList<Attribute>());
42
        else {
43
            for(RefundAttribute attr : attributes){
44
                refund.addToAttributes(new Attribute(attr.getName(), attr.getValue()));
45
            }
46
        }
47
 
48
        return refund;
49
    }
50
 
51
	public long getId() {
52
		return id;
53
	}
54
 
55
	public void setId(long id) {
56
		this.id = id;
57
	}
58
 
59
	public long getPaymentId() {
60
		return paymentId;
61
	}
62
 
63
	public void setPaymentId(long paymentId) {
64
		this.paymentId = paymentId;
65
	}
66
 
67
	public long getGatewayId() {
68
		return gatewayId;
69
	}
70
 
71
	public void setGatewayId(long gatewayId) {
72
		this.gatewayId = gatewayId;
73
	}
74
 
75
	public long getOrderId() {
76
		return orderId;
77
	}
78
 
79
	public void setOrderId(long orderId) {
80
		this.orderId = orderId;
81
	}
82
 
83
	public double getAmount() {
84
		return amount;
85
	}
86
 
87
	public void setAmount(double amount) {
88
		this.amount = amount;
89
	}
90
 
91
	public String getGatewayTxnId() {
92
		return gatewayTxnId;
93
	}
94
 
95
	public void setGatewayTxnId(String gatewayTxnId) {
96
		this.gatewayTxnId = gatewayTxnId;
97
	}
98
 
99
	public int getAttempts() {
100
		return attempts;
101
	}
102
 
103
	public void setAttempts(int attempts) {
104
		this.attempts = attempts;
105
	}
106
 
107
	public Date getCreatedAt() {
108
		return createdAt;
109
	}
110
 
111
	public void setCreatedAt(Date createdAt) {
112
		this.createdAt = createdAt;
113
	}
114
 
115
	public Date getProcessedAt() {
116
		return processedAt;
117
	}
118
 
119
	public void setProcessedAt(Date processedAt) {
120
		this.processedAt = processedAt;
121
	}
122
 
123
	public List<RefundAttribute> getAttributes() {
124
		return attributes;
125
	}
126
 
127
	public void setAttributes(List<RefundAttribute> attributes) {
128
		this.attributes = attributes;
129
	}
130
}