Class Payments


public class Payments extends AccountingResource
  • Constructor Details

  • Method Details

    • getPath

      protected String getPath()
      Specified by:
      getPath in class AccountingResource
    • list

      public PaymentList list(String accountId) throws FreshBooksException
      Get a list of payments using the query strings generated by the QueryBuilder list.
      Parameters:
      accountId - Id of the account
      Returns:
      PaymentList containing payments and pagination details
      Throws:
      FreshBooksException - If the call is not successful
    • list

      public PaymentList list(String accountId, List<QueryBuilder> builders) throws FreshBooksException
      Get a list of payments using the query strings generated by the QueryBuilder list.
      Parameters:
      accountId - Id of the account
      builders - List of QueryBuilders
      Returns:
      PaymentList containing payments and pagination details
      Throws:
      FreshBooksException - If the call is not successful
    • get

      public Payment get(String accountId, long paymentId) throws FreshBooksException
      Get a single payment with the corresponding id.
      Parameters:
      accountId - The alpha-numeric account id
      paymentId - Id of the resource to return
      Returns:
      The Payment
      Throws:
      FreshBooksException - If the call is not successful
    • get

      public Payment get(String accountId, long paymentId, IncludesQueryBuilder builder) throws FreshBooksException
      Get a single payment with the corresponding id.
      Parameters:
      accountId - The alpha-numeric account id
      paymentId - Id of the resource to return
      builder - IncludesQueryBuilder object for including additional data, sub-resources, etc.
      Returns:
      The Payment
      Throws:
      FreshBooksException - If the call is not successful
    • create

      public Payment create(String accountId, Payment data) throws FreshBooksException
      Create a new payment from the provided Payment model. Makes a POST call against the payment resource endpoint. This calls `payment.getContent()` to get a hash map of data.
      Parameters:
      accountId - The alpha-numeric account id
      data - Payment model with create data
      Returns:
      The created Payment
      Throws:
      FreshBooksException - If the call is not successful
    • create

      public Payment create(String accountId, Map<String,Object> data) throws FreshBooksException
      Create a new payment from the provided data. Makes a POST call against the payment resource endpoint.
      Parameters:
      accountId - The alpha-numeric account id
      data - Map of create data
      Returns:
      The created Payment
      Throws:
      FreshBooksException - If the call is not successful
    • update

      public Payment update(String accountId, long paymentId, Payment data) throws FreshBooksException
      Update the payment with the corresponding id. Makes a PUT call against the payment resource endpoint.
      Parameters:
      accountId - The alpha-numeric account id
      paymentId - Id of the resource to return
      data - Payment model with updated data
      Returns:
      The updated Payment
      Throws:
      FreshBooksException - If the call is not successful
    • update

      public Payment update(String accountId, long paymentId, Map<String,Object> data) throws FreshBooksException
      Update the payment with the corresponding id. Makes a PUT call against the payment resource endpoint.
      Parameters:
      accountId - The alpha-numeric account id
      paymentId - Id of the resource to update
      data - Map of data to change
      Returns:
      The updated Payment
      Throws:
      FreshBooksException - If the call is not successful
    • delete

      public Payment delete(String accountId, long paymentId) throws FreshBooksException
      Delete the payment with the corresponding id. Makes a PUT call against the payment resource endpoint with a `vis_state` of deleted.

      Note: Most FreshBooks resources are soft-deleted,
      Parameters:
      accountId - The alpha-numeric account id
      paymentId - Id of the resource to update
      Returns:
      The deleted Payment
      Throws:
      FreshBooksException - If the call is not successful
      See Also: