Exemplo n.º 1
0
  public PaymentNotification[] getNotifications(String userId) {
    WebTarget notificationTarget = appTarget.path("notification/user/" + userId);
    Invocation.Builder setupBuilder = notificationTarget.request(MediaType.APPLICATION_JSON);
    Response response = setupBuilder.get();

    Gson gson = new GsonBuilder().setDateFormat("yyyy-MM-dd HH:mm:ss.SSS").create();
    String json = response.readEntity(String.class);
    return gson.fromJson(json, PaymentNotification[].class);
  }
Exemplo n.º 2
0
  public Response sendMoney(MoneySend moneySend) {
    Gson gson = new Gson();
    String payload = gson.toJson(moneySend);

    WebTarget moneyTarget = appTarget.path("money");
    WebTarget sendMoneyTarget = moneyTarget.path("send");
    return sendMoneyTarget
        .request()
        .accept(MediaType.APPLICATION_JSON)
        .post(Entity.entity(payload, MediaType.APPLICATION_JSON), Response.class);
  }
Exemplo n.º 3
0
  public Response collectMoney(MoneyCollect moneyCollect) {
    Gson gson = new Gson();
    String payload = gson.toJson(moneyCollect);

    WebTarget moneyTarget = appTarget.path("money");
    WebTarget collectMoneyTarget = moneyTarget.path("collect");
    return collectMoneyTarget
        .request()
        .accept(MediaType.APPLICATION_JSON)
        .post(Entity.entity(payload, MediaType.APPLICATION_JSON), Response.class);
  }
Exemplo n.º 4
0
 public Response backdoorTeardown() {
   WebTarget backdoorTarget = appTarget.path("backdoor");
   WebTarget setupTarget = backdoorTarget.path("teardown");
   Invocation.Builder setupBuilder = setupTarget.request(MediaType.TEXT_PLAIN_TYPE);
   return setupBuilder.get();
 }