-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from seyiadisa/SDK/Java
#7 - Sdk/java
- Loading branch information
Showing
16 changed files
with
1,896 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.vscode/ | ||
code/ | ||
target/ | ||
.env | ||
Test*.java |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
# Chimoney4j | ||
|
||
Chimoney4j is a Java wrapper for <a href="https://chimoney.io">Chimoney</a>. | ||
|
||
## Getting Started | ||
|
||
- Register with <a href="https://chimoney.io">Chimoney</a> | ||
- Request for API KEY from support | ||
- set Your "CHIMONEY_API_KEY" environment variable | ||
You can use a .env file as shown below to set your API key | ||
|
||
```env | ||
CHIMONEY_API_KEY="YOUR API KEY" | ||
``` | ||
|
||
## Installation | ||
|
||
You need <a href="https://maven.apache.org/download.cgi">Maven</a> installed with at least JDK 11. This project has not yet been deployed to Maven Central. You need the JAR file downloaded locally. The recommended approach is to download it <a href="https://seyiadisa.github.io/chimoney">here</a>. Alternatively, you can build the repo to generate the JAR file. | ||
|
||
- Clone this repo to your computer. | ||
|
||
- In the root directory (`SDK Submissions/Chimoney-Java/chimoney`), run: | ||
|
||
``` | ||
mvn package | ||
``` | ||
|
||
- Copy the generated JAR file in `chimoney/target` directory | ||
|
||
- Run the following command: | ||
|
||
```bash | ||
mvn install:install-file -Dfile=/path/to/chimoney-1.0.jar -DgroupId=io.chimoney -DartifactId=chimoney -Dversion=1.0 -Dpackaging=jar | ||
|
||
``` | ||
|
||
- Add the dependecy to your `pom.xml` | ||
|
||
```xml | ||
<dependency> | ||
<groupId>io.chimoney</groupId> | ||
<artifactId>chimoney</artifactId> | ||
<version>1.0</version> | ||
</dependency> | ||
``` | ||
|
||
Alternatively, you can tell the project to find the `.jar` in the system path like this: | ||
|
||
```xml | ||
<dependency> | ||
<groupId>io.chimoney</groupId> | ||
<artifactId>chimoney</artifactId> | ||
<version>1.0</version> | ||
<scope>system</scope> | ||
<systemPath>/path/to/chimoney-1.0.jar</systemPath> | ||
</dependency> | ||
``` | ||
|
||
## Usage | ||
|
||
There are two ways you can set your API key. | ||
|
||
- You can export it as an environment variable or create a `.env` file in the directory that contains your package (recommended) | ||
- You can pass it as an argument when initialising chimoney | ||
|
||
```java | ||
import io.chimoney.chimoney.Chimoney; | ||
|
||
// initialise without API key (recommended) | ||
Chimoney chimoney = new Chimoney(); | ||
|
||
// initialise without API key | ||
String API_KEY = "your_api_key"; | ||
Chimoney chimoney = new Chimoney(API_KEY); | ||
``` | ||
|
||
You can also use the library in sandbox mode, but you will require a sandbox API key. You can read more about chimoney sandbox [here](https://chimoney.readme.io/reference/sandbox-environment) | ||
|
||
```java | ||
Chimoney chimoney = Chimoney.sandbox(); | ||
``` | ||
|
||
or | ||
|
||
```java | ||
String API_KEY = "your_api_key"; | ||
Chimoney chimoney = Chimoney.withSandbox(API_KEY); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<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>io.chimoney</groupId> | ||
<artifactId>chimoney</artifactId> | ||
<version>1.0</version> | ||
<packaging>jar</packaging> | ||
|
||
<name>chimoney</name> | ||
<description>Wrapper for Chimoney API</description> | ||
<url>https://chimoney.io</url> | ||
|
||
<licenses> | ||
<license> | ||
<name>MIT License</name> | ||
<url>https://mit-license.org/</url> | ||
<distribution>manual</distribution> | ||
</license> | ||
</licenses> | ||
|
||
<developers> | ||
<developer> | ||
<name>Oluwaseyi Adisa</name> | ||
<email>[email protected]</email> | ||
</developer> | ||
</developers> | ||
|
||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
<maven.compiler.source>11</maven.compiler.source> | ||
<maven.compiler.target>11</maven.compiler.target> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> | ||
<version>4.11</version> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>io.github.cdimascio</groupId> | ||
<artifactId>dotenv-java</artifactId> | ||
<version>3.0.0</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.json</groupId> | ||
<artifactId>json</artifactId> | ||
<version>20231013</version> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<finalName>chimoney-${project.version}</finalName> | ||
<pluginManagement> | ||
<plugins> | ||
<plugin> | ||
<artifactId>maven-clean-plugin</artifactId> | ||
<version>3.1.0</version> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-resources-plugin</artifactId> | ||
<version>3.0.2</version> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>3.8.0</version> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-surefire-plugin</artifactId> | ||
<version>2.22.1</version> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-jar-plugin</artifactId> | ||
<version>3.0.2</version> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-install-plugin</artifactId> | ||
<version>2.5.2</version> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-deploy-plugin</artifactId> | ||
<version>2.8.2</version> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-site-plugin</artifactId> | ||
<version>3.7.1</version> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-project-info-reports-plugin</artifactId> | ||
<version>3.0.0</version> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-assembly-plugin</artifactId> | ||
<configuration> | ||
<archive> | ||
<manifest> | ||
<mainClass>fully.qualified.MainClass</mainClass> | ||
</manifest> | ||
</archive> | ||
<descriptorRefs> | ||
<descriptorRef>jar-with-dependencies</descriptorRef> | ||
</descriptorRefs> | ||
</configuration> | ||
<executions> | ||
<execution> | ||
<id>make-assembly</id> | ||
<phase>package</phase> | ||
<goals> | ||
<goal>single</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</pluginManagement> | ||
</build> | ||
</project> |
Oops, something went wrong.