Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .github/workflows/maven-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Publish package to the Maven Central Repository
on:
release:
types: [published]
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Maven Central Repository
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'temurin'
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
- name: Publish package
run: mvn --batch-mode deploy
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License

Copyright (c) 2019 Payload (https://payload.co)
Copyright (c) 2024 Payload (https://payload.com)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
63 changes: 34 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,52 +1,61 @@
<p align="center">
<a href="https://payload.com">
<img src="https://payload.com/images/horizontal-logo.svg" alt="Payload Logo"/>
</a>
</p>

<p align="center">
<strong>Powerfully Simple Payments</strong>
</p>

<p align="center">
<a href="https://docs.payload.com/">
<img src="https://img.shields.io/badge/Payload-Documentation-blue?style=plastic&logo=https%3A%2F%2Fpayload.com%2Fimages%2Fhorizontal-logo.svg&logoColor=%230000FF&logoSize=auto" alt="Payload Documentation"/>
</a>
<a href="mailto:contact@payload.com">
<img src="https://img.shields.io/badge/Payload-Support-blue?style=plastic" alt="Payload Support"/>
</a>
<img src="https://github.com/payload-code/payload-java/actions/workflows/test-workflow.yml/badge.svg" alt="Java CI"/>
</p>

# Payload Java Library

A Java library for integrating [Payload](https://payload.co).
A Java library for integrating [Payload](https://payload.com).

## Installation

### Maven Dependency

```xml
<dependency>
<groupId>co.payload</groupId>
<groupId>com.payload</groupId>
<artifactId>payload</artifactId>
<version>0.2.0</version>
<version>1.0.0</version>
</dependency>
```

## Manual Installation

### 1) Download

Download the [latest](https://github.com/payload-code/payload-java/archive/master.zip)
version from GitHub.

### 2) Include in Project
### Manual Installation

Include the **Payload** folder in your Android Studio or Eclipse project.
1. **Download** the [latest version](https://github.com/payload-code/payload-java/archive/master.zip) from GitHub.
2. **Include in Project**: Include the **Payload** folder in your Android Studio or Eclipse project.

## Get Started

Once you've included the Payload Java library in your project,
include the `co.payload.pl` namespace to get started.

All Payload objects and methods are accessible using the `pl` static class.
Once you've included the Payload Java library in your project, include the `com.payload.pl` namespace to get started. All Payload objects and methods are accessible using the `pl` static class.

### API Authentication

To authenticate with the Payload API, you'll need a live or test API key. API
keys are accessible from within the Payload dashboard.
To authenticate with the Payload API, you'll need a live or test API key, accessible from the Payload dashboard.

```java
import co.payload.Session;
import com.payload.Session;

Session sess = Session("secret_key_3bW9JMZtPVDOfFNzwRdfE");
```

### Creating an Object

Interfacing with the Payload API is done primarily through Payload Objects. Below is an example of
creating a customer using the `pl.Customer` object.
Interfacing with the Payload API is done primarily through Payload Objects. Below is an example of creating a customer using the `pl.Customer` object.

```java
// Create a Customer
Expand All @@ -72,7 +81,6 @@ Object attributes are accessible through `getStr`, `getInt`, and `getFloat`.

```java
System.out.print(customer.getStr("email"));

```

### Updating an Object
Expand All @@ -84,7 +92,6 @@ Updating an object is a simple call to the `update` object method.
customer.update(pl.attr("email", "matt.perez@newwork.com"));
```


### Get an Object by ID

Grab an existing object by its ID using the `get` method.
Expand All @@ -105,8 +112,7 @@ List<pl.Customer> customers = sess.select(pl.Customer.class).filter_by(
);
```

Use the `pl.attr` attribute helper
interface to write powerful queries with a little extra syntax sugar.
Use the `pl.attr` attribute helper interface to write powerful queries with a little extra syntax sugar.

```java
List<pl.Payment> payments = sess.select(pl.Payment.class).filter_by(
Expand All @@ -117,15 +123,14 @@ List<pl.Payment> payments = sess.select(pl.Payment.class).filter_by(
).all();
```

### Testing the Payload Java Library
## Testing the Payload Java Library

Tests are contained within the `src/tests` directory. To run tests use the following command in terminal:
Tests are contained within the `src/tests` directory. To run tests, use the following command in terminal:

```bash
API_KEY=your_test_secret_key mvn test
```

## Documentation

To get further information on Payload's Java library and API capabilities,
visit the unabridged [Payload Documentation](https://docs.payload.co/?java).
For further information on Payload's Java library and API capabilities, visit the [Payload Documentation](https://docs.payload.co/?java).
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ repositories {

jar {
baseName = 'payload'
version = '0.2.0'
version = '1.0.0'
}

dependencies {
Expand Down
12 changes: 6 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>co.payload</groupId>
<groupId>com.payload</groupId>
<artifactId>payload</artifactId>
<version>0.2.0</version>
<version>1.0.0</version>
<name>payload</name>
<description>Payload Java Library</description>
<url>https://github.com/payload-code/payload-java</url>
Expand Down Expand Up @@ -43,8 +43,8 @@

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>

<dependencies>
Expand Down Expand Up @@ -100,8 +100,8 @@
<goal>compile</goal>
</goals>
<configuration>
<source>1.7</source>
<target>1.7</target>
<source>1.8</source>
<target>1.8</target>
</configuration>
</execution>
<execution>
Expand Down
98 changes: 0 additions & 98 deletions src/main/java/co/payload/Exceptions.java

This file was deleted.

Loading