-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBaseController.java
More file actions
23 lines (17 loc) · 866 Bytes
/
BaseController.java
File metadata and controls
23 lines (17 loc) · 866 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package cl.transbank.webpay.example.controllers;
import com.google.gson.GsonBuilder;
import java.util.Random;
public abstract class BaseController {
protected static final String VIEW_ERROR = "error/error_page";
protected static final String VIEW_ABORTED_ERROR = "error/webpay/aborted";
protected static final String VIEW_FORM_ERROR = "error/webpay/form_error";
protected static final String VIEW_TIMEOUT_ERROR = "error/webpay/timeout";
protected static final String VIEW_RECOVER_ERROR = "error/oneclick/recover";
protected static final String VIEW_REJECTED_ERROR = "error/oneclick/rejected";
public String toJson(Object obj) {
return (new GsonBuilder().setPrettyPrinting().create()).toJson(obj);
}
protected String getRandomNumber() {
return String.valueOf(new Random().nextInt(Integer.MAX_VALUE));
}
}