Subversion Repositories SmartDukaan

Rev

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

Rev 6234 Rev 6239
Line 21... Line 21...
21
    private String errorMsg = "";
21
    private String errorMsg = "";
22
    public final static String ADDRESS = "address";
22
    public final static String ADDRESS = "address";
23
    public final static String PHONE = "phone";
23
    public final static String PHONE = "phone";
24
    public final static String NOTHING = "nothing";
24
    public final static String NOTHING = "nothing";
25
    private Long amount = null;
25
    private Long amount = null;
-
 
26
    private String phone = "";
26
    
27
    
27
    private static final long serialVersionUID = 2079308723099307749L;
28
    private static final long serialVersionUID = 2079308723099307749L;
28
 
29
 
29
    private static Logger log = Logger.getLogger(Class.class);
30
    private static Logger log = Logger.getLogger(Class.class);
30
    
31
    
Line 72... Line 73...
72
                if (addressId != 0) {
73
                if (addressId != 0) {
73
                    address = ucl.getClient().getAddressById(addressId);
74
                    address = ucl.getClient().getAddressById(addressId);
74
                }
75
                }
75
            } catch (Exception e) {
76
            } catch (Exception e) {
76
                log.error("Unable to connect to user service", e);
77
                log.error("Unable to connect to user service", e);
77
                //We don't know if we need customer's address or phone. Let us ask anyway.
78
                //We don't know if we need customer's address or phone. Let us ask.
78
                if (amount > 1000)
79
                if (amount > 1000)
79
                    return ADDRESS;
80
                    return ADDRESS;
80
                else
81
                else
81
                    return PHONE;
82
                    return PHONE;
82
            }
83
            }
83
            
84
 
84
            if (amount > 1000) {
85
            if (amount > 1000) {
85
                if (address == null) {
86
                if (address == null) {
86
                    return ADDRESS;
87
                    return ADDRESS;
-
 
88
                } else {
-
 
89
                    return NOTHING;
87
                }
90
                }
88
            } else {
91
            } else {
89
                if (address == null || address.getPhone() == null || address.getPhone().isEmpty()) {
92
                if (address == null || address.getPhone() == null || address.getPhone().isEmpty()) {
90
                    return PHONE;
93
                    return PHONE;
-
 
94
                } else {
-
 
95
                    setPhone(address.getPhone());//We have his phone number.
-
 
96
                    return PHONE;
91
                }
97
                }
92
            }
98
            }
-
 
99
            
-
 
100
            
-
 
101
        //For Mobile Recharges
-
 
102
        } else {
-
 
103
            setPhone(rechargeOrder.getDeviceNumber());//We have his phone number.
-
 
104
            return PHONE;
93
        }
105
        }
94
        
-
 
95
        return NOTHING; 
-
 
96
    }
106
    }
97
 
107
 
98
    public void setRechargeOrder(RechargeOrder rechargeOrder) {
108
    public void setRechargeOrder(RechargeOrder rechargeOrder) {
99
        this.rechargeOrder = rechargeOrder;
109
        this.rechargeOrder = rechargeOrder;
100
    }
110
    }
Line 112... Line 122...
112
    }
122
    }
113
 
123
 
114
    public String getErrorMsg() {
124
    public String getErrorMsg() {
115
        return errorMsg;
125
        return errorMsg;
116
    }
126
    }
-
 
127
 
-
 
128
    public String getPhone() {
-
 
129
        return phone;
-
 
130
    }
-
 
131
 
-
 
132
    public void setPhone(String phone) {
-
 
133
        this.phone = phone;
-
 
134
    }
117
}
135
}
118
136