Esempio n. 1
0
  @GET
  @Path("debt")
  @Produces("application/xml")
  @Transactional
  public String debt(
      @QueryParam("offer_id") Long offerId,
      @QueryParam("aff_id") Long affId,
      @QueryParam("date_kind") @DefaultValue("CREATION") Debts.DateKind dateKind,
      @QueryParam("from") @DefaultValue("0") Long from,
      @QueryParam("to") Long to,
      @QueryParam("ordering") @DefaultValue("DEBT") Debts.Ordering ord,
      @QueryParam("direction") @DefaultValue("DESC") OrderingDirection dir,
      @QueryParam("offset") int offset,
      @QueryParam("limit") @DefaultValue("20") int limit) {
    DateTime dateFrom = new DateTime(from);
    DateTime dateTo = new DateTime(to);
    DataFilter<Debts.Ordering> filter = DataFilter.newInstance();
    filter
        .setTo(dateTo)
        .setFrom(dateFrom)
        .setOrdering(ord)
        .setDirection(dir)
        .setOffset(offset)
        .setLimit(limit);

    Pair<QueryResult, Long> result = debts.debtInfo(offerId, affId, dateKind, filter);
    return new XmlQueryResult(result.fst)
        .setElement("debt")
        .setRoot("debts")
        .addRootAttribute("count", result.snd)
        .toString();
  }
Esempio n. 2
0
 @GET
 @Path("masspayment")
 @Transactional
 @Produces("application/xml")
 public String massPayment(
     @QueryParam("from") @DefaultValue("0") Long from, @QueryParam("to") Long to) {
   DataFilter<Debts.PaymentOrdering> filter = DataFilter.newInstance();
   filter
       .setFrom(from)
       .setTo(to)
       .setOrdering(Debts.PaymentOrdering.AMOUNT)
       .setDirection(OrderingDirection.DESC);
   return massPaymentXml(debts.payments(Debts.PayMethod.AUTO, filter));
 }
Esempio n. 3
0
 @GET
 @Produces("application/xml")
 @Transactional
 public String listOrdered(
     @QueryParam("aff_id") Long affId,
     @QueryParam("offset") int offset,
     @QueryParam("limit") @DefaultValue("20") int limit) {
   DataFilter<Debts.Ordering> filter = DataFilter.newInstance();
   filter.setOffset(offset).setLimit(limit);
   Pair<QueryResult, Long> result = debts.orderedByUser(affId, filter);
   return new XmlQueryResult(result.fst)
       .setRoot("debts")
       .setElement("debt")
       .addRootAttribute("count", result.snd)
       .toString();
 }
Esempio n. 4
0
 @GET
 @Produces("application/xml")
 @Path("by_offer")
 @Transactional
 public String listOrdered(
     @QueryParam("from") @DefaultValue("0") Long from,
     @QueryParam("to") Long to,
     @QueryParam("offset") int offset,
     @QueryParam("limit") @DefaultValue("20") int limit) {
   DataFilter<Debts.Ordering> filter = DataFilter.newInstance();
   filter.setOffset(offset).setLimit(limit).setFrom(from).setTo(to);
   Pair<QueryResult, Long> result = debts.orderedByOffer(filter);
   return new XmlQueryResult(result.fst)
       .setRoot("debts")
       .setElement("debt")
       .addRootAttribute("count", result.snd)
       .toString();
 }
Esempio n. 5
0
 @GET
 @Path("payments")
 @Transactional
 @Produces("application/xml")
 public String payments(
     @QueryParam("pay_method") Debts.PayMethod payMethod,
     @QueryParam("from") @DefaultValue("0") Long from,
     @QueryParam("to") Long to,
     @QueryParam("offset") int offset,
     @QueryParam("limit") @DefaultValue("20") int limit,
     @QueryParam("ordering") @DefaultValue("AMOUNT") Debts.PaymentOrdering ordering,
     @QueryParam("direction") @DefaultValue("DESC") OrderingDirection direction) {
   DataFilter<Debts.PaymentOrdering> filter = DataFilter.newInstance();
   filter
       .setFrom(from)
       .setTo(to)
       .setOffset(offset)
       .setLimit(limit)
       .setOrdering(ordering)
       .setDirection(direction);
   return paymentsXml(debts.payments(payMethod, filter));
 }