Subversion Repositories SmartDukaan

Rev

Rev 6091 | Rev 6228 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 6091 Rev 6215
Line 10... Line 10...
10
import org.apache.struts2.convention.annotation.Results;
10
import org.apache.struts2.convention.annotation.Results;
11
import org.apache.thrift.TException;
11
import org.apache.thrift.TException;
12
import org.apache.thrift.transport.TTransportException;
12
import org.apache.thrift.transport.TTransportException;
13
 
13
 
14
import in.shop2020.model.v1.order.RechargeOrder;
14
import in.shop2020.model.v1.order.RechargeOrder;
-
 
15
import in.shop2020.model.v1.user.Address;
15
import in.shop2020.thrift.clients.HelperClient;
16
import in.shop2020.thrift.clients.HelperClient;
16
import in.shop2020.thrift.clients.UserClient;
17
import in.shop2020.thrift.clients.UserClient;
17
import in.shop2020.utils.HelperServiceException;
18
import in.shop2020.utils.HelperServiceException;
18
import in.shop2020.utils.QuickLink;
19
import in.shop2020.utils.QuickLink;
19
 
20
 
Line 28... Line 29...
28
    private RechargeOrder rechargeOrder = null;
29
    private RechargeOrder rechargeOrder = null;
29
    private String rechargeOrderId = "";
30
    private String rechargeOrderId = "";
30
    private String amount = "";
31
    private String amount = "";
31
    private String errorMsg = "";
32
    private String errorMsg = "";
32
    private String userId = null;
33
    private String userId = null;
-
 
34
    private String rechargeType = "";
33
    
35
    
34
    private static final long serialVersionUID = 2079308723099307749L;
36
    private static final long serialVersionUID = 2079308723099307749L;
35
 
37
 
36
    private static Logger log = Logger.getLogger(Class.class);
38
    private static Logger log = Logger.getLogger(Class.class);
37
    
39
    
Line 41... Line 43...
41
    
43
    
42
    public String create() {
44
    public String create() {
43
        return index();
45
        return index();
44
    }
46
    }
45
    
47
    
46
    public boolean shouldShowEbsTestGateway() {
48
    /*public boolean shouldShowEbsTestGateway() {
47
        //return SHOW_EBS_TEST_GATEWAY;
49
        //return SHOW_EBS_TEST_GATEWAY;
48
        return true;
50
        return true;
49
    }
51
    }*/
50
    
52
    
-
 
53
    /*Please dont delete this. It will be reused.
51
    public boolean isAddressRequired() {
54
    public boolean isAddressRequired() {
52
        UserClient ucl;
55
        UserClient ucl;
53
        long addressId = 0;
56
        long addressId = 0;
54
        try {
57
        try {
55
            ucl = new UserClient();
58
            ucl = new UserClient();
Line 61... Line 64...
61
            return true;
64
            return true;
62
        } else {
65
        } else {
63
            return false;
66
            return false;
64
        }
67
        }
65
    }
68
    }
-
 
69
    */
-
 
70
    public boolean isPhoneNumberRequired() {
-
 
71
        Address address;
-
 
72
        UserClient ucl;
-
 
73
        if (rechargeType.equals("2")) {                         //2 is DTH recharge
-
 
74
            long addressId = 0;
-
 
75
            try {
-
 
76
                ucl = new UserClient();
-
 
77
                addressId = ucl.getClient().getDefaultAddressId(Long.parseLong(userId));
-
 
78
                address = ucl.getClient().getAddressById(addressId);
-
 
79
                if (address == null || address.getPhone().isEmpty() || address.getPhone() == null) {
-
 
80
                    //Phone number will be be required in cases when 
-
 
81
                    //rechargeType is DTH and the user does not have a default address
-
 
82
                    //or if it does not contain a phone number. For all other cases
-
 
83
                    //it will be not be required to be filled in by the user.
-
 
84
                    return true;
-
 
85
                }
-
 
86
            } catch (Exception e) {
-
 
87
                log.error("Unable to connect to user service", e);
-
 
88
                //We dont know if we need his number. Let us ask anyway.
-
 
89
                return true;
-
 
90
            }
-
 
91
        }
-
 
92
        return false;
-
 
93
    }
66
 
94
 
67
    public void setRechargeOrder(RechargeOrder rechargeOrder) {
95
    public void setRechargeOrder(RechargeOrder rechargeOrder) {
68
        this.rechargeOrder = rechargeOrder;
96
        this.rechargeOrder = rechargeOrder;
69
    }
97
    }
70
 
98
 
Line 97... Line 125...
97
    }
125
    }
98
 
126
 
99
    public void setUserId(String userId) {
127
    public void setUserId(String userId) {
100
        this.userId = userId;
128
        this.userId = userId;
101
    }
129
    }
-
 
130
 
-
 
131
    public void setRechargeType(String rechargeType) {
-
 
132
        this.rechargeType = rechargeType;
-
 
133
    }
-
 
134
 
-
 
135
    public String getRechargeType() {
-
 
136
        return rechargeType;
-
 
137
    }
102
}
138
}
103
139