Subversion Repositories SmartDukaan

Rev

Rev 6057 | Rev 6100 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
6050 anupam.sin 1
package in.shop2020.serving.controllers;
2
 
6066 amit.gupta 3
import in.shop2020.model.v1.order.RechargeType;
4
import in.shop2020.thrift.clients.TransactionClient;
5
 
6050 anupam.sin 6
import java.util.Map;
6057 anupam.sin 7
import java.util.Set;
6050 anupam.sin 8
 
9
import org.apache.log4j.Logger;
10
 
11
public class RechargeController extends BaseController {
12
 
13
    /**
14
     * 
15
     */
6057 anupam.sin 16
    private String serviceType = "1";
6050 anupam.sin 17
    private String form = "";
6057 anupam.sin 18
    private Set<Long> providerKeys;
19
    private Map<Long, String> providers;
6050 anupam.sin 20
 
21
    private static final long serialVersionUID = 2079308723099307749L;
22
 
23
    private static Logger log = Logger.getLogger(Class.class);
24
 
6057 anupam.sin 25
 
26
/*    static{
27
        TransactionClient tc;
28
        try {
29
            tc = new TransactionClient();
30
            providers = tc.getClient().getServiceProviders(RechargeType.valueOf(serviceType));
31
        } catch (Exception e) {
32
            log.error("Cannot get providers");
33
        }
34
        setProviderKeys(providers.keySet());
35
    }*/
36
 
6050 anupam.sin 37
    public String index() {
6057 anupam.sin 38
        System.out.println("1");
6050 anupam.sin 39
        return "index";
40
    }
41
 
42
    public String create() {
43
        if(form.equals("serviceSelect")) {
44
            return index();
45
        }
46
        return "hello";
47
    }
6057 anupam.sin 48
 
49
    public Map<Long, String> getProviderMap() {
50
        System.out.println("2");
51
        TransactionClient tc;
52
        try {
53
            tc = new TransactionClient();
54
            System.out.println("3");
55
            providers = tc.getClient().getServiceProviders(RechargeType.findByValue(Integer.parseInt(serviceType)));
56
            System.out.println("4");
57
            setProviderKeys(providers.keySet());
58
            System.out.println("5");
59
        } catch (Exception e) {
60
            log.error("Cannot get providers", e);
61
        }
62
        return providers;
63
    }
6050 anupam.sin 64
 
6057 anupam.sin 65
    private void setProviderKeys(Set<Long> keySet) {
66
        this.providerKeys = keySet;
6050 anupam.sin 67
    }
6057 anupam.sin 68
 
69
    public Set<Long> getProviderKeys() {
70
        System.out.println("6");
71
        return providerKeys;
72
    }
6050 anupam.sin 73
 
6057 anupam.sin 74
    public void setServiceType(String incomingServiceType) {
75
        serviceType = incomingServiceType;
76
    }
77
 
6050 anupam.sin 78
    public String getServiceType() {
79
        return serviceType;
80
    }
81
 
82
    public String getForm() {
83
        return form;
84
    }
85
 
86
    public void setForm(String form) {
87
        this.form = form;
88
    }
89
}