Tabnine Logo
PaymentJson
Code IndexAdd Tabnine to your IDE (free)

How to use
PaymentJson
in
com.ning.billing.jaxrs.json

Best Java code snippets using com.ning.billing.jaxrs.json.PaymentJson (Showing top 10 results out of 315)

origin: com.ning.billing/killbill-jaxrs

@GET
@Path("/{accountId:" + UUID_PATTERN + "}/" + PAYMENTS)
@Produces(APPLICATION_JSON)
public Response getPayments(@PathParam("accountId") final String accountId,
              @javax.ws.rs.core.Context final HttpServletRequest request) throws PaymentApiException {
  final List<Payment> payments = paymentApi.getAccountPayments(UUID.fromString(accountId), context.createContext(request));
  final List<PaymentJson> result = new ArrayList<PaymentJson>(payments.size());
  for (final Payment payment : payments) {
    result.add(new PaymentJson(payment, null));
  }
  return Response.status(Status.OK).entity(result).build();
}
origin: com.ning.billing/killbill-jaxrs

@POST
@Produces(APPLICATION_JSON)
@Consumes(APPLICATION_JSON)
@Path("/{invoiceId:" + UUID_PATTERN + "}/" + PAYMENTS)
public Response createInstantPayment(final PaymentJson payment,
                   @QueryParam(QUERY_PAYMENT_EXTERNAL) @DefaultValue("false") final Boolean externalPayment,
                   @HeaderParam(HDR_CREATED_BY) final String createdBy,
                   @HeaderParam(HDR_REASON) final String reason,
                   @HeaderParam(HDR_COMMENT) final String comment,
                   @javax.ws.rs.core.Context final HttpServletRequest request,
                   @javax.ws.rs.core.Context final UriInfo uriInfo) throws AccountApiException, PaymentApiException {
  final CallContext callContext = context.createContext(createdBy, reason, comment, request);
  final Account account = accountUserApi.getAccountById(UUID.fromString(payment.getAccountId()), callContext);
  final UUID invoiceId = UUID.fromString(payment.getInvoiceId());
  if (externalPayment) {
    paymentApi.createExternalPayment(account, invoiceId, payment.getAmount(), callContext);
  } else {
    paymentApi.createPayment(account, invoiceId, payment.getAmount(), callContext);
  }
  return uriBuilder.buildResponse(uriInfo, InvoiceResource.class, "getPayments", payment.getInvoiceId());
}
origin: com.ning.billing/killbill-jaxrs

public PaymentJson(final Payment payment, final String bundleExternalKey,
          final List<RefundJson> refunds, final List<ChargebackJson> chargebacks,
          @Nullable final List<AuditLog> auditLogs) {
  this(payment.getAmount(), payment.getPaidAmount(), payment.getAccountId().toString(),
     payment.getInvoiceId().toString(), payment.getId().toString(),
     payment.getPaymentNumber().toString(),
     payment.getPaymentMethodId().toString(),
     payment.getEffectiveDate(), payment.getEffectiveDate(),
     payment.getAttempts().size(), payment.getCurrency().toString(), payment.getPaymentStatus().toString(),
     payment.getAttempts().get(payment.getAttempts().size() - 1).getGatewayErrorCode(),
     payment.getAttempts().get(payment.getAttempts().size() - 1).getGatewayErrorMsg(),
     bundleExternalKey, refunds, chargebacks, toAuditLogJson(auditLogs));
}
origin: com.ning.billing/killbill-jaxrs

@PUT
@Path("/{paymentId:" + UUID_PATTERN + "}")
@Consumes(APPLICATION_JSON)
@Produces(APPLICATION_JSON)
public Response retryFailedPayment(@PathParam(ID_PARAM_NAME) final String paymentIdString,
                  @HeaderParam(HDR_CREATED_BY) final String createdBy,
                  @HeaderParam(HDR_REASON) final String reason,
                  @HeaderParam(HDR_COMMENT) final String comment,
                  @javax.ws.rs.core.Context final HttpServletRequest request) throws AccountApiException, PaymentApiException {
  final CallContext callContext = context.createContext(createdBy, reason, comment, request);
  final UUID paymentId = UUID.fromString(paymentIdString);
  final Payment payment = paymentApi.getPayment(paymentId, false, callContext);
  final Account account = accountUserApi.getAccountById(payment.getAccountId(), callContext);
  final Payment newPayment = paymentApi.retryPayment(account, paymentId, callContext);
  return Response.status(Status.OK).entity(new PaymentJson(newPayment, null)).build();
}
origin: com.ning.billing/killbill-jaxrs

@GET
@Path("/{invoiceId:" + UUID_PATTERN + "}/" + PAYMENTS)
@Produces(APPLICATION_JSON)
public Response getPayments(@PathParam("invoiceId") final String invoiceId,
              @QueryParam(QUERY_AUDIT) @DefaultValue("NONE") final AuditMode auditMode,
              @javax.ws.rs.core.Context final HttpServletRequest request) throws PaymentApiException {
  final TenantContext tenantContext = context.createContext(request);
  final List<Payment> payments = paymentApi.getInvoicePayments(UUID.fromString(invoiceId), tenantContext);
  final List<PaymentJson> result = new ArrayList<PaymentJson>(payments.size());
  if (payments.size() == 0) {
    return Response.status(Status.OK).entity(result).build();
  }
  final AccountAuditLogsForObjectType auditLogsForPayments = auditUserApi.getAccountAuditLogs(payments.get(0).getAccountId(),
                                                ObjectType.PAYMENT,
                                                auditMode.getLevel(),
                                                tenantContext);
  for (final Payment cur : payments) {
    result.add(new PaymentJson(cur, auditLogsForPayments.getAuditLogs(cur.getId())));
  }
  return Response.status(Status.OK).entity(result).build();
}
origin: com.ning.billing/killbill-jaxrs

@GET
@Path("/{paymentId:" + UUID_PATTERN + "}")
@Produces(APPLICATION_JSON)
public Response getPayment(@PathParam(ID_PARAM_NAME) final String paymentIdString,
              @QueryParam(QUERY_PAYMENT_WITH_REFUNDS_AND_CHARGEBACKS) @DefaultValue("false") final Boolean withRefundsAndChargebacks,
              @javax.ws.rs.core.Context final HttpServletRequest request) throws PaymentApiException {
  final TenantContext tenantContext = context.createContext(request);
  final UUID paymentId = UUID.fromString(paymentIdString);
  final Payment payment = paymentApi.getPayment(paymentId, false, tenantContext);
  final PaymentJson paymentJson;
  if (withRefundsAndChargebacks) {
    final List<RefundJson> refunds = new ArrayList<RefundJson>();
    for (final Refund refund : paymentApi.getPaymentRefunds(paymentId, tenantContext)) {
      refunds.add(new RefundJson(refund));
    }
    final List<ChargebackJson> chargebacks = new ArrayList<ChargebackJson>();
    for (final InvoicePayment chargeback : invoicePaymentApi.getChargebacksByPaymentId(paymentId, tenantContext)) {
      chargebacks.add(new ChargebackJson(payment.getAccountId(), chargeback));
    }
    paymentJson = new PaymentJson(payment,
                   null, // TODO - the keys are really only used for the timeline
                   refunds,
                   chargebacks);
  } else {
    paymentJson = new PaymentJson(payment, null);
  }
  return Response.status(Status.OK).entity(paymentJson).build();
}
origin: com.ning.billing/killbill-jaxrs

  @Override
  public PaymentJson apply(final Payment payment) {
    // Cache audit logs per account
    if (accountsAuditLogs.get().get(payment.getAccountId()) == null) {
      accountsAuditLogs.get().put(payment.getAccountId(), auditUserApi.getAccountAuditLogs(payment.getAccountId(), auditMode.getLevel(), tenantContext));
    }
    return new PaymentJson(payment, accountsAuditLogs.get().get(payment.getAccountId()).getAuditLogsForPayment(payment.getId()));
  }
},
origin: com.ning.billing/killbill-jaxrs

  @Override
  public PaymentJson apply(final Payment payment) {
    // Cache audit logs per account
    if (accountsAuditLogs.get().get(payment.getAccountId()) == null) {
      accountsAuditLogs.get().put(payment.getAccountId(), auditUserApi.getAccountAuditLogs(payment.getAccountId(), auditMode.getLevel(), tenantContext));
    }
    return new PaymentJson(payment, accountsAuditLogs.get().get(payment.getAccountId()).getAuditLogsForPayment(payment.getId()));
  }
},
origin: com.ning.billing/killbill-jaxrs

  private PaymentJson createPayment(final UUID accountId, final UUID invoiceId) {
    final UUID paymentId = UUID.randomUUID();
    final Integer paymentNumber = 17;
    final UUID paymentMethodId = UUID.randomUUID();
    final BigDecimal paidAmount = BigDecimal.TEN;
    final BigDecimal amount = BigDecimal.ZERO;
    final DateTime paymentRequestedDate = clock.getUTCNow();
    final DateTime paymentEffectiveDate = clock.getUTCNow();
    final Integer retryCount = Integer.MAX_VALUE;
    final String currency = "USD";
    final String status = UUID.randomUUID().toString();
    final String gatewayErrorCode = "OK";
    final String gatewayErrorMsg = "Excellent...";
    return new PaymentJson(amount, paidAmount, accountId.toString(), invoiceId.toString(), paymentId.toString(), paymentNumber.toString(),
                   paymentMethodId.toString(), paymentRequestedDate, paymentEffectiveDate, retryCount, currency, status,
                   gatewayErrorCode, gatewayErrorMsg, null, null, null, null);
  }
}
origin: com.ning.billing/killbill-jaxrs

this.payments.add(new PaymentJson(payment,
                 getBundleExternalKey(payment.getInvoiceId(), invoices, bundles),
                 refunds,
com.ning.billing.jaxrs.jsonPaymentJson

Most used methods

  • <init>
  • getAccountId
  • getAmount
  • getInvoiceId
  • toAuditLogJson

Popular in Java

  • Updating database using SQL prepared statement
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • addToBackStack (FragmentTransaction)
  • onRequestPermissionsResult (Fragment)
  • PrintWriter (java.io)
    Wraps either an existing OutputStream or an existing Writerand provides convenience methods for prin
  • SocketTimeoutException (java.net)
    This exception is thrown when a timeout expired on a socket read or accept operation.
  • Path (java.nio.file)
  • GregorianCalendar (java.util)
    GregorianCalendar is a concrete subclass of Calendarand provides the standard calendar used by most
  • Iterator (java.util)
    An iterator over a sequence of objects, such as a collection.If a collection has been changed since
  • JButton (javax.swing)
  • Top plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now