Rev 6091 | Rev 6228 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
package in.shop2020.serving.controllers;import java.util.HashMap;import java.util.List;import java.util.Map;import java.util.ResourceBundle;import org.apache.log4j.Logger;import org.apache.struts2.convention.annotation.Result;import org.apache.struts2.convention.annotation.Results;import org.apache.thrift.TException;import org.apache.thrift.transport.TTransportException;import in.shop2020.model.v1.order.RechargeOrder;import in.shop2020.model.v1.user.Address;import in.shop2020.thrift.clients.HelperClient;import in.shop2020.thrift.clients.UserClient;import in.shop2020.utils.HelperServiceException;import in.shop2020.utils.QuickLink;public class RechargePayOptionsController extends BaseController {/****///private static final ResourceBundle resource = ResourceBundle.getBundle(ProceedToPayController.class.getName());//private static final boolean SHOW_EBS_TEST_GATEWAY = Boolean.parseBoolean(resource.getString("show_ebs_test_gateway"));private RechargeOrder rechargeOrder = null;private String rechargeOrderId = "";private String amount = "";private String errorMsg = "";private String userId = null;private String rechargeType = "";private static final long serialVersionUID = 2079308723099307749L;private static Logger log = Logger.getLogger(Class.class);public String index() {return "index";}public String create() {return index();}/*public boolean shouldShowEbsTestGateway() {//return SHOW_EBS_TEST_GATEWAY;return true;}*//*Please dont delete this. It will be reused.public boolean isAddressRequired() {UserClient ucl;long addressId = 0;try {ucl = new UserClient();addressId = ucl.getClient().getDefaultAddressId(Long.parseLong(userId));} catch (Exception e) {log.error("Unable to connect to user service", e);}if (addressId <= 0) {return true;} else {return false;}}*/public boolean isPhoneNumberRequired() {Address address;UserClient ucl;if (rechargeType.equals("2")) { //2 is DTH rechargelong addressId = 0;try {ucl = new UserClient();addressId = ucl.getClient().getDefaultAddressId(Long.parseLong(userId));address = ucl.getClient().getAddressById(addressId);if (address == null || address.getPhone().isEmpty() || address.getPhone() == null) {//Phone number will be be required in cases when//rechargeType is DTH and the user does not have a default address//or if it does not contain a phone number. For all other cases//it will be not be required to be filled in by the user.return true;}} catch (Exception e) {log.error("Unable to connect to user service", e);//We dont know if we need his number. Let us ask anyway.return true;}}return false;}public void setRechargeOrder(RechargeOrder rechargeOrder) {this.rechargeOrder = rechargeOrder;}public RechargeOrder getRechargeOrder() {return rechargeOrder;}public void setRechargeOrderId(String rechargeOrderId) {this.rechargeOrderId = rechargeOrderId;}public String getRechargeOrderId() {return rechargeOrderId;}public void setAmount(String amount) {this.amount = amount;}public String getAmount() {return amount;}public String getErrorMsg() {return errorMsg;}public String getUserId() {return userId;}public void setUserId(String userId) {this.userId = userId;}public void setRechargeType(String rechargeType) {this.rechargeType = rechargeType;}public String getRechargeType() {return rechargeType;}}