Tabnine Logo
PaymentApi.createPayment
Code IndexAdd Tabnine to your IDE (free)

How to use
createPayment
method
in
com.ning.billing.payment.api.PaymentApi

Best Java code snippets using com.ning.billing.payment.api.PaymentApi.createPayment (Showing top 8 results out of 315)

origin: com.ning.billing/killbill-jaxrs

@PUT
@Consumes(APPLICATION_JSON)
@Produces(APPLICATION_JSON)
@Path("/{accountId:" + UUID_PATTERN + "}/" + PAYMENT_METHODS + "/{paymentMethodId:" + UUID_PATTERN + "}/" + PAYMENT_METHODS_DEFAULT_PATH_POSTFIX)
public Response setDefaultPaymentMethod(@PathParam("accountId") final String accountId,
                    @PathParam("paymentMethodId") final String paymentMethodId,
                    @QueryParam(QUERY_PAY_ALL_UNPAID_INVOICES) @DefaultValue("false") final Boolean payAllUnpaidInvoices,
                    @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 Account account = accountUserApi.getAccountById(UUID.fromString(accountId), callContext);
  paymentApi.setDefaultPaymentMethod(account, UUID.fromString(paymentMethodId), callContext);
  if (payAllUnpaidInvoices) {
    final Collection<Invoice> unpaidInvoices = invoiceApi.getUnpaidInvoicesByAccountId(account.getId(), clock.getUTCToday(), callContext);
    for (final Invoice invoice : unpaidInvoices) {
      paymentApi.createPayment(account, invoice.getId(), invoice.getBalance(), callContext);
    }
  }
  return Response.status(Status.OK).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

@POST
@Produces(APPLICATION_JSON)
@Consumes(APPLICATION_JSON)
@Path("/{accountId:" + UUID_PATTERN + "}/" + PAYMENTS)
public Response payAllInvoices(@PathParam("accountId") final String accountId,
                @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) throws AccountApiException, PaymentApiException {
  final CallContext callContext = context.createContext(createdBy, reason, comment, request);
  final Account account = accountUserApi.getAccountById(UUID.fromString(accountId), callContext);
  final Collection<Invoice> unpaidInvoices = invoiceApi.getUnpaidInvoicesByAccountId(account.getId(), clock.getUTCToday(), callContext);
  for (final Invoice invoice : unpaidInvoices) {
    if (externalPayment) {
      paymentApi.createExternalPayment(account, invoice.getId(), invoice.getBalance(), callContext);
    } else {
      paymentApi.createPayment(account, invoice.getId(), invoice.getBalance(), callContext);
    }
  }
  return Response.status(Status.OK).build();
}
origin: com.ning.billing/killbill-jaxrs

@POST
@Path("/{accountId:" + UUID_PATTERN + "}/" + PAYMENT_METHODS)
@Consumes(APPLICATION_JSON)
@Produces(APPLICATION_JSON)
public Response createPaymentMethod(final PaymentMethodJson json,
                  @PathParam("accountId") final String accountId,
                  @QueryParam(QUERY_PAYMENT_METHOD_IS_DEFAULT) @DefaultValue("false") final Boolean isDefault,
                  @QueryParam(QUERY_PAY_ALL_UNPAID_INVOICES) @DefaultValue("false") final Boolean payAllUnpaidInvoices,
                  @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 UriInfo uriInfo,
                  @javax.ws.rs.core.Context final HttpServletRequest request) throws AccountApiException, PaymentApiException {
  final CallContext callContext = context.createContext(createdBy, reason, comment, request);
  final PaymentMethod data = json.toPaymentMethod(accountId);
  final Account account = accountUserApi.getAccountById(data.getAccountId(), callContext);
  final boolean hasDefaultPaymentMethod = account.getPaymentMethodId() != null || isDefault;
  final Collection<Invoice> unpaidInvoices = payAllUnpaidInvoices ? invoiceApi.getUnpaidInvoicesByAccountId(account.getId(), clock.getUTCToday(), callContext) :
                        Collections.<Invoice>emptyList();
  if (payAllUnpaidInvoices && unpaidInvoices.size() > 0 && !hasDefaultPaymentMethod) {
    return Response.status(Status.BAD_REQUEST).build();
  }
  final UUID paymentMethodId = paymentApi.addPaymentMethod(data.getPluginName(), account, isDefault, data.getPluginDetail(), callContext);
  if (payAllUnpaidInvoices && unpaidInvoices.size() > 0) {
    for (final Invoice invoice : unpaidInvoices) {
      paymentApi.createPayment(account, invoice.getId(), invoice.getBalance(), callContext);
    }
  }
  return uriBuilder.buildResponse(PaymentMethodResource.class, "getPaymentMethod", paymentMethodId, uriInfo.getBaseUri().toString());
}
origin: com.ning.billing/killbill-jaxrs

paymentApi.createPayment(account, invoice.getId(), invoice.getBalance(), callContext);
origin: com.ning.billing/killbill-jaxrs

paymentApi.createPayment(account, invoice.getId(), invoice.getBalance(), callContext);
origin: com.ning.billing/killbill-payment

  paymentApi.createPayment(account, invoice.getId(), requestedAmount, callContext);
} catch (PaymentApiException e) {
  Assert.assertEquals(e.getCode(), ErrorCode.PAYMENT_NO_DEFAULT_PAYMENT_METHOD.getCode());
origin: com.ning.billing/killbill-payment

final Payment paymentInfo = paymentApi.createPayment(account, invoice.getId(), requestedAmount, callContext);
if (expectedAmount == null) {
  fail("Expected to fail because requested amount > invoice amount");
com.ning.billing.payment.apiPaymentApicreatePayment

Popular methods of PaymentApi

  • addPaymentMethod
  • deletedPaymentMethod
  • getAccountPayments
  • getPaymentMethods
    Find all payment methods in a given plugin
  • createExternalPayment
  • createRefund
    Create a refund for a given payment. The associated invoice is not adjusted.
  • createRefundWithAdjustment
    Create a refund for a given payment. The associated invoice is adjusted.
  • createRefundWithItemsAdjustments
    Create a refund for a given payment. The specified invoice items are fully adjusted. The refund amou
  • getAccountRefunds
  • getInvoicePayments
  • getPayment
  • getPaymentMethodById
  • getPayment,
  • getPaymentMethodById,
  • getPaymentRefunds,
  • getPayments,
  • getRefund,
  • getRefunds,
  • retryPayment,
  • searchPaymentMethods,
  • searchPayments

Popular in Java

  • Creating JSON documents from java classes using gson
  • findViewById (Activity)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • runOnUiThread (Activity)
  • Font (java.awt)
    The Font class represents fonts, which are used to render text in a visible way. A font provides the
  • Proxy (java.net)
    This class represents proxy server settings. A created instance of Proxy stores a type and an addres
  • URLConnection (java.net)
    A connection to a URL for reading or writing. For HTTP connections, see HttpURLConnection for docume
  • BitSet (java.util)
    The BitSet class implements abit array [http://en.wikipedia.org/wiki/Bit_array]. Each element is eit
  • Vector (java.util)
    Vector is an implementation of List, backed by an array and synchronized. All optional operations in
  • Notification (javax.management)
  • CodeWhisperer alternatives
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