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 32... Line 32...
32
 
32
 
33
 
33
 
34
@Results({
34
@Results({
35
    @Result(name="recharge-redirect", type="redirectAction", params = {"actionName" , "recharge"}),
35
    @Result(name="recharge-redirect", type="redirectAction", params = {"actionName" , "recharge"}),
36
    @Result(name="recharge-pay-options-redirect", type="redirectAction", params = {"actionName" , "recharge-pay-options", "rechargeOrderId", "${rechargeOrderId}"}),
36
    @Result(name="recharge-pay-options-redirect", type="redirectAction", params = {"actionName" , "recharge-pay-options", "rechargeOrderId", "${rechargeOrderId}"}),
37
    @Result(name="ebs-pay-redirect", type="redirect", location="/ebs-pay/${paymentId}/edit"),
37
    @Result(name="ebs-pay-redirect", type="redirect", location="/ebs-pay/${paymentId}/edit", params = {"phone", "${phone}"}),
38
    @Result(name="cod-redirect", type="redirect", location="/pay-success?paymentId=${paymentId}")
38
    @Result(name="cod-redirect", type="redirect", location="/pay-success?paymentId=${paymentId}")
39
})
39
})
40
 
40
 
41
 
41
 
42
public class RechargePaymentController extends BaseController {
42
public class RechargePaymentController extends BaseController {
43
    
43
    
44
    /**
44
    /**
45
     * 
45
     * 
46
     */
46
     */
47
    private String rechargeOrderId = "";
47
    private String rechargeOrderId = "";
48
    private String name = "";
-
 
49
    private String line1 = "";
-
 
50
    private String line2 = "";
-
 
51
    private String city = "";
-
 
52
    private String state = "";
-
 
53
    private String pincode = "";
-
 
54
    private String phone = "";
48
    private String phone = "";
55
    
49
    
56
    
50
    
57
    private static final long serialVersionUID = 2079308723099307749L;
51
    private static final long serialVersionUID = 2079308723099307749L;
58
 
52
 
Line 93... Line 87...
93
    public String create(){
87
    public String create(){
94
        
88
        
95
        if(rechargeOrderId == null){
89
        if(rechargeOrderId == null){
96
            return "recharge-redirect";
90
            return "recharge-redirect";
97
        }
91
        }
-
 
92
        
-
 
93
        /* Dont delete this code fragment. It will be reused.
98
        UserClient uc;
94
        UserClient uc;
99
        try {
95
        try {
100
            uc = new UserClient();
96
            uc = new UserClient();
101
            TransactionClient tc = new TransactionClient();
97
            TransactionClient tc = new TransactionClient();
102
            rechargeOrder = tc.getClient().getRechargeOrder(Long.parseLong(rechargeOrderId));
98
            rechargeOrder = tc.getClient().getRechargeOrder(Long.parseLong(rechargeOrderId));
Line 128... Line 124...
128
            e.printStackTrace();
124
            e.printStackTrace();
129
        } catch (UserContextException e) {
125
        } catch (UserContextException e) {
130
            // TODO Auto-generated catch block
126
            // TODO Auto-generated catch block
131
            e.printStackTrace();
127
            e.printStackTrace();
132
        }
128
        }
133
 
129
        */
134
 
130
 
135
        String paymentOption = request.getParameter("payment_option");
131
        String paymentOption = request.getParameter("payment_option");
136
        log.info("Payment Option Selected: " + paymentOption);
132
        log.info("Payment Option Selected: " + paymentOption);
137
        if(paymentOption == null || paymentOption.equals("")){
133
        if(paymentOption == null || paymentOption.equals("")){
138
            addActionError("Please select a payment method to continue.");
134
            addActionError("Please select a payment method to continue.");
Line 164... Line 160...
164
        EbsPaymentService ebsPaymentService = new EbsPaymentService();
160
        EbsPaymentService ebsPaymentService = new EbsPaymentService();
165
        paymentId = ebsPaymentService.createPayment(rechargeOrder, paymentOption);
161
        paymentId = ebsPaymentService.createPayment(rechargeOrder, paymentOption);
166
        if(paymentId == IPaymentService.PAYMENT_NOT_CREATED){
162
        if(paymentId == IPaymentService.PAYMENT_NOT_CREATED){
167
            addActionError("We are experiencing some problems. Please try later.");
163
            addActionError("We are experiencing some problems. Please try later.");
168
            log.error("Unable to process payment through EBS.");
164
            log.error("Unable to process payment through EBS.");
169
            return "proceed-to-pay-redirect";
165
            return "recharge-redirect";
170
        } else {
166
        } else {
171
            log.info("Successfully created payment for EBS to process. Redirecting to /ebs-pay/" + paymentId);
167
            log.info("Successfully created payment for EBS to process. Redirecting to /ebs-pay/" + paymentId);
172
            return "ebs-pay-redirect";
168
            return "ebs-pay-redirect";
173
        }           
169
        }           
174
    }
170
    }
Line 195... Line 191...
195
 
191
 
196
    public String getRechargeOrderId() {
192
    public String getRechargeOrderId() {
197
        return rechargeOrderId;
193
        return rechargeOrderId;
198
    }
194
    }
199
 
195
 
200
    public String getName() {
-
 
201
        return name;
-
 
202
    }
-
 
203
 
-
 
204
    public void setName(String name) {
-
 
205
        this.name = name;
-
 
206
    }
-
 
207
 
-
 
208
    public String getLine1() {
-
 
209
        return line1;
-
 
210
    }
-
 
211
 
-
 
212
    public void setLine1(String line1) {
-
 
213
        this.line1 = line1;
-
 
214
    }
-
 
215
 
-
 
216
    public String getLine2() {
-
 
217
        return line2;
-
 
218
    }
-
 
219
 
-
 
220
    public void setLine2(String line2) {
-
 
221
        this.line2 = line2;
-
 
222
    }
-
 
223
 
-
 
224
    public String getCity() {
-
 
225
        return city;
-
 
226
    }
-
 
227
 
-
 
228
    public void setCity(String city) {
-
 
229
        this.city = city;
-
 
230
    }
-
 
231
 
-
 
232
    public String getPincode() {
-
 
233
        return pincode;
-
 
234
    }
-
 
235
 
-
 
236
    public void setPincode(String pincode) {
-
 
237
        this.pincode = pincode;
-
 
238
    }
-
 
239
 
-
 
240
    public String getPhone() {
196
    public String getPhone() {
241
        return phone;
197
        return phone;
242
    }
198
    }
243
 
199
 
244
    public void setPhone(String phone) {
200
    public void setPhone(String phone) {
245
        this.phone = phone;
201
        this.phone = phone;
246
    }
202
    }
247
 
-
 
248
    public void setState(String state) {
-
 
249
        this.state = state;
-
 
250
    }
-
 
251
 
-
 
252
    public String getState() {
-
 
253
        return state;
-
 
254
    }
-
 
255
}
203
}
256
204