예제 #1
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);
  }
예제 #2
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);
  }
예제 #3
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);
  }
예제 #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();
 }