Subversion Repositories SmartDukaan

Rev

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

Rev 21101 Rev 21363
Line 46... Line 46...
46
	private String email;
46
	private String email;
47
	private User user;
47
	private User user;
48
	private String amount;
48
	private String amount;
49
	private String url;
49
	private String url;
50
	private String result;
50
	private String result;
-
 
51
	private String cashback;
-
 
52
 
-
 
53
	public String getCashback() {
-
 
54
		return cashback;
-
 
55
	}
-
 
56
 
-
 
57
	public void setCashback(String cashback) {
-
 
58
		this.cashback = cashback;
-
 
59
	}
51
 
60
 
52
	public String getResult() {
61
	public String getResult() {
53
		return result;
62
		return result;
54
	}
63
	}
55
 
64
 
Line 133... Line 142...
133
		return "user-wallet-credit-edit";
142
		return "user-wallet-credit-edit";
134
	}
143
	}
135
 
144
 
136
	public String creditWallet(){
145
	public String creditWallet(){
137
		long credit_amount;
146
		long credit_amount;
-
 
147
		double cash_back; 
138
		try{
148
		try{
139
			credit_amount = Long.valueOf(amount);
149
			credit_amount = Long.valueOf(amount);
140
			if (credit_amount <=0){
150
			if (credit_amount <=0){
141
				setResult("Amount cant be negative");
151
				setResult("Amount cant be negative");
142
				return "pmsa-result";
152
				return "pmsa-result";
Line 144... Line 154...
144
		}
154
		}
145
		catch(Exception e){
155
		catch(Exception e){
146
			setResult("Invalid amount");
156
			setResult("Invalid amount");
147
			return "pmsa-result";
157
			return "pmsa-result";
148
		}
158
		}
-
 
159
		
-
 
160
		try{
-
 
161
			cash_back = Double.valueOf(cashback);
-
 
162
		}
-
 
163
		catch(Exception e){
-
 
164
			setResult("Invalid cashback");
-
 
165
			e.printStackTrace();
-
 
166
			return "pmsa-result";
-
 
167
		}
149
		try{
168
		try{
150
			Client uc = new UserClient().getClient();
169
			Client uc = new UserClient().getClient();
151
			user = uc.getUserByEmail(email);
170
			user = uc.getUserByEmail(email);
152
		}
171
		}
153
		catch(Exception e){
172
		catch(Exception e){
Line 159... Line 178...
159
			setResult("User email not valid");
178
			setResult("User email not valid");
160
			return "pmsa-result";
179
			return "pmsa-result";
161
		}
180
		}
162
		try {
181
		try {
163
			in.shop2020.model.v1.order.TransactionService.Client tc = new TransactionClient().getClient();
182
			in.shop2020.model.v1.order.TransactionService.Client tc = new TransactionClient().getClient();
164
			tc.creditUserWallet(user.getUserId(), credit_amount);
183
			tc.creditUserWallet(user.getUserId(), credit_amount, cash_back);
165
		} catch (Exception e) {
184
		} catch (Exception e) {
166
			e.printStackTrace();
185
			e.printStackTrace();
167
			setResult("Service error");
186
			setResult("Service error");
168
			return "pmsa-result";
187
			return "pmsa-result";
169
		}
188
		}