Ejemplo n.º 1
0
  @GET
  @Path("/registerCoupons/{id}&{couponcode}&{allocated}&{used}/")
  @Produces(MediaType.APPLICATION_JSON)
  public JSONObject registerCoupons(
      @PathParam("id") String id,
      @PathParam("couponcode") String couponcode,
      @PathParam("allocated") String allocated,
      @PathParam("used") String used) {
    JSONObject res = new JSONObject();
    System.out.println("Inside registerCoupons ");

    Registration registration = new Registration();
    int response = registration.registerCoupons(id, couponcode, allocated, used);
    try {
      if (response == 0) {
        res.append("result", "200");
        res.append("response", "Successfully Registered");
      } else {
        res.append("result", "400");
        res.append("response", "Not Registered");
      }
    } catch (JSONException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
    return res;
  }
Ejemplo n.º 2
0
  /**
   * ****************************************************************
   *
   * <p>REGISTRATION URL FOR VARIOUS USERS 1. Kandy Details 2. Rewards
   *
   * <p>****************************************************************
   */
  @GET
  @Path("/registerKandy/{id}&{username}&{password}&{key}&{provider}&{uid}/")
  @Produces(MediaType.APPLICATION_JSON)
  public JSONObject registerEndUser(
      @PathParam("id") String id,
      @PathParam("username") String username,
      @PathParam("password") String password,
      @PathParam("key") String key,
      @PathParam("provider") String provider,
      @PathParam("uid") String uid) {
    JSONObject res = new JSONObject();
    System.out.println("Inside registerKandy Helper");

    Registration registration = new Registration();
    int response = registration.registerKandy(id, username, password, key, provider, uid);
    try {
      if (response == 0) {
        res.append("result", "200");
        res.append("response", "Successfully Registered");
      } else {
        res.append("result", "400");
        res.append("response", "Not Registered");
      }
    } catch (JSONException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
    return res;
  }