Skip to content

Invoiced/invoiced-java

Repository files navigation

invoiced-java

This repository contains the Java client library for the Invoiced API.

You can find detailed API documentation along with java code snippets here.

CI Coverage Status Maven Central

Installing

You can build the jar file by doing

gradle jar

or build the complete all in one jar file by doing

gradle fatJar

Requirements

  • Gradle 5.6.4
  • Java 8+

Usage

First, you must instantiate a new client

import com.invoiced.entity.Connection;

Connection invoiced = new Connection("{YOUR_API_KEY}",false);

Then, API calls can be made like this:

# retrieve invoice
Invoice invoice = invoiced.newInvoice().retrieve({INVOICE_ID});

# mark as paid
Payment payment = invoiced.newPayment();
payment.amount = invoice.balance;
payment.method = "check";
paymentItem = new PaymentItem();
paymentItem.type = "invoice";
paymentItem.invoice = invoice.id;
paymentItem.amount = invoice.balance;
payment.appliedTo = PaymentItem{paymentItem};
payment.create();

If you want to use the sandbox API instead then you must set the second argument on the client to true like this:

import com.invoiced.entity.Connection;

Connection invoiced = new Connection("{YOUR_API_KEY}",true);

Developing

The test suite can be ran with gradle test

Deployment

  1. Run the "Publish" action in GitHub.
  2. On Nexus Repository Manager find the staging repository and click "Close".
  3. Click "Refresh" until the status goes from open to closed.
  4. Click "Release".