Skip to content

Commit

Permalink
v4.0.0 (#113)
Browse files Browse the repository at this point in the history
* Auto generate codes (Models, Enums and Request Builders) (#92)

* Auto generate codes

* Add documentation to model classes + rename points to points_citi

* Add Schedule namespace

* Remove base Model from PlatformFee (#94)

* Remove base Model from PlatformFee

* Update test fixtures to include platform_fee and percentage

* Change float to Double

* Generate payload methods (#95)

* Regenerate codes + fix some tests

* Fix wrong fixtures path when class name contains more than 1 word e.g. ChargeSchedule

* Fix tests

* Fix inconsistencies in parameter's order from v3

* Update format

* Fix wrong property name

* Remove extra spaces

* Register Webhook type + update tests

* Rename date & time field names to make them consistence with API

* Add migration guide

* Remove test apk

* Add Github Actions for publishing package
  • Loading branch information
rezigned authored Aug 24, 2020
1 parent faa83eb commit c5fc95a
Show file tree
Hide file tree
Showing 75 changed files with 3,902 additions and 2,076 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ jobs:
uses: actions/setup-java@v1
with:
java-version: 1.8

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Build with Gradle
run: ./gradlew test
36 changes: 36 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# This workflow will build a package using Maven and then publish it to GitHub packages when a release is created
# For more information see: https://github.com/actions/setup-java#apache-maven-with-a-settings-path

name: Maven Package

on:
release:
types: [created]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
settings-path: ${{ github.workspace }} # location for the settings.xml file

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Build with Gradle
run: ./gradlew test

- name: Publish package
run: ./gradlew uploadArchives
env:
PGP_SIGNING_KEY: ${{ secrets.PGP_SIGNING_KEY }}
PGP_SIGNING_PASSWORD: ${{ secrets.PGP_SIGNING_PASSWORD }}
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
37 changes: 37 additions & 0 deletions MIGRATING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Migration Guide

### Migrating from v3 to v4

Most of the changes are related to the consistency of field, method and class names.

The benefit of having these consistencies allow the users of library to have predictable and consistent usage.

It also allows us to update our library quickly by using code generation in future releases.

The following contain all changes from v3 to v4.

#### Schedules
* Rename `ChargeScheduling` and `TransferScheduling` to `ChargeSchedule` and `TransferSchedule` respectively.

#### Cards
* Change order of params
- `Card.UpdateRequestBuilder(cardId, customerId)` contains wrong order of params (it should be `Card.UpdateRequestBuilder(customerId, cardId)`.

- `Document.GetRequestBuilder(documentId, disputeId)` to `Document.GetRequestBuilder(disputeId, documentId)`

#### Date & Time
- `Dispute.closedDate` -> `closedAt` (`closed_at` in API)
- `Receipt.issuedDate` -> `issuedOn` (`issued_on` in API)
- `Occurrence.scheduleDate` -> `scheduleOn` (`scheduled_on` in API)
- `Occurrence.retryDate` -> `retryOn` (`retry_on` in API)
- `Schedule.startDate` -> `startOn` (`start_on` in API)
- `Schedule.endDate` -> `endOn` (`end_on` in API)
- `Schedule.nextOccurrencesDates` -> `nextOccurrencesOn` (`next_occurrences_on` in API)

### Migrating to v3

The alteration made in the v3.0.0 of `omise-java` are breaking changes and would require code changes
from your side if you have already been using this library from previous versions. We have put
together a guide to make this process easier by pointing the changes to you. You can find the complete [version 3 migration guide here][1].

[1]: https://www.omise.co/omise-java-v3-migration
16 changes: 7 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![Maven Central][9]][10] [![Github Actions][0]][1] [![Discourse Forum][14]][15]

`Omise-java` provides a set of Java bindings to the [Omise REST API][5]. Please contact
`omise-java` provides a set of Java bindings to the [Omise REST API][5]. Please contact
[[email protected]][7] if you have any questions regarding this
library and the functionality it provides.

Expand All @@ -21,7 +21,7 @@ Adds to your `build.gradle` file.

```gradle
dependencies {
compile 'co.omise:omise-java:3.1.+'
compile 'co.omise:omise-java:4.0.+'
}
```

Expand All @@ -46,14 +46,13 @@ $ gradle shadowJar
BUILD SUCCESSFUL

$ ls builds/libs
omise-java-3.1.1-all.jar
omise-java-4.0.0-all.jar
```

### Migrate to version 3
### Migration Guide

The alteration made in the v3.0.0 of `omise-java` are breaking changes and would require code changes
from your side if you have already been using this library from previous versions. We have put
together a guide to make this process easier by pointing the changes to you. You can find the complete [version 3 migration guide here][16].
* [v4](MIGRATING.md#migrating-from-v3-to-v4)
* [v3](MIGRATING.md#migrating-to-v3)

## USAGE

Expand Down Expand Up @@ -112,5 +111,4 @@ System.out.println("created charge: " + charge.getId());
[12]: https://dashboard.omise.co/test/api-keys
[13]: https://github.com/johnrengelman/shadow
[14]: https://img.shields.io/badge/discourse-forum-1a53f0.svg?style=flat-square&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAYAAAAfSC3RAAAAAXNSR0IArs4c6QAAAAlwSFlzAAALEwAACxMBAJqcGAAAAVlpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IlhNUCBDb3JlIDUuNC4wIj4KICAgPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4KICAgICAgPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIKICAgICAgICAgICAgeG1sbnM6dGlmZj0iaHR0cDovL25zLmFkb2JlLmNvbS90aWZmLzEuMC8iPgogICAgICAgICA8dGlmZjpPcmllbnRhdGlvbj4xPC90aWZmOk9yaWVudGF0aW9uPgogICAgICA8L3JkZjpEZXNjcmlwdGlvbj4KICAgPC9yZGY6UkRGPgo8L3g6eG1wbWV0YT4KTMInWQAAAqlJREFUKBU9UVtLVFEU%2FvY%2B27mPtxl1dG7HbNRx0rwgFhJBPohBL9JTZfRQ0YO9RU%2FVL6iHCIKelaCXqIewl4gEBbEyxSGxzKkR8TbemmbmnDlzVvsYtOHbey1Y317fWh8DwCVMCfSHww3ElCs7CjuzbOcNIaEo9SbtlDRjZiNPY%2BvrqSWrTh7l3yPvrmh0KBZW59HcREjEqcGpElAuESRxopU648dTwfrIyH%2BCFXSH1cFgJLqHlma6443SG0CfqYY2NZjQnkV8eiMgP6ijjnizHglErlocdl5VA0mT3v102dseL2W14cYM99%2B9XGY%2FlQArd8Mo6JhbSJUePHytvf2UdnW0qen93cKQ4nWXX1%2FyOkZufsuZN0L7PPzkthDDZ4FQLajSA6XWR8HWIK861sCfj68ggGwl83mzfMclBmAQ%2BktrqBu9wOhcD%2BB0ErSiFFyEkdcYhKD27mal9%2F5FY36b4BB%2FTvO8XdQhlUe11F3WG2fc7QLlC8wai3MGGQCGDkcZQyymCqAPSmati3s45ygWseeqADwuWS%2F3wGS5hClDMMstxvJFHQuGU26yHsY6iHtL0sIaOyZzB9hZz0hHZW71kySSl6LIJlSgj5s5LO6VG53aFgpOfOFCyoFmYsOS5HZIaxVwKYsLSbJJn2kfU%2BlNdms5WMLqQRklX0FX26eFRnKYwzX0XRsgR0uUrWxplM7oqPIq8r8cZrdLNLqaABayxZMTTx2HVfglbP4xkcvqZEMNfmglevRi1ny5mGfJfTuQiBEq%2FMBvG0NqDh2TY47sbtJAuO%2Fe9%2Fn3STRFosm2WIxsFSFrFUfwHb11JNBNcaZSp8yb%2FEhHW3suWRNZRzDGvxb0oifk5lmnX2V2J2dEJkX1Q0baZ1MvYXPXHvhAga7x9PTEyj8a%2BF%2BXbxiTn78bSQAAAABJRU5ErkJggg%3D%3D
[15]: https://forum.omise.co
[16]: https://www.omise.co/omise-java-v3-migration
[15]: https://forum.omise.co
26 changes: 16 additions & 10 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: 'com.github.ben-manes.versions'

group 'co.omise'
version '3.1.1'
version '4.0.0'

sourceCompatibility = 1.8
targetCompatibility = 1.8
Expand Down Expand Up @@ -45,6 +45,11 @@ distributions {
}

signing {
def signingKey = System.getenv("PGP_SIGNING_KEY")
def signingPwd = System.getenv("PGP_SIGNING_PASSWORD")

useInMemoryPgpKeys(signingKey, signingPwd)

sign configurations.archives
}

Expand All @@ -57,14 +62,15 @@ uploadArchives {
repositories.mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }

if (project.properties.containsKey('ossrhUsername') && project.properties.containsKey('ossrhPassword')) {
repository(url: 'https://oss.sonatype.org/service/local/staging/deploy/maven2/') {
authentication(userName: ossrhUsername, password: ossrhPassword)
}
def ossrhUsername = System.getenv("SONATYPE_USERNAME")
def ossrhPassword = System.getenv("SONATYPE_PASSWORD")

snapshotRepository(url: 'https://oss.sonatype.org/content/repositories/snapshots') {
authentication(userName: ossrhUsername, password: ossrhPassword)
}
repository(url: 'https://oss.sonatype.org/service/local/staging/deploy/maven2/') {
authentication(userName: ossrhUsername, password: ossrhPassword)
}

snapshotRepository(url: 'https://oss.sonatype.org/content/repositories/snapshots') {
authentication(userName: ossrhUsername, password: ossrhPassword)
}

pom.project {
Expand All @@ -90,8 +96,8 @@ uploadArchives {
developers {
developer {
id 'chakrit'
name 'Chakrit Wichian'
email 'chakrit@omise.co'
name 'Omise'
email 'support@omise.co'
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/co/omise/Example.java
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ void listSchedule() throws IOException, ClientException, OmiseException {
}

void listChargeSchedule() throws IOException, ClientException, OmiseException {
Request<ScopedList<Schedule>> request = new Schedule.ChargeScheduleListRequestBuilder().build();
Request<ScopedList<Schedule>> request = new Charge.ListSchedulesRequestBuilder().build();

ScopedList<Schedule> schedules = client().sendRequest(request);
System.out.printf("total no. of charge schedules: %d", schedules.getTotal());
Expand Down Expand Up @@ -504,7 +504,7 @@ void createSchedule() throws ClientException, IOException, OmiseException {
.on(new ScheduleOn.Params().daysOfMonth(2))
.startDate(LocalDate.parse("2017-04-27"))
.endDate(LocalDate.parse("2018-04-27"))
.charge(new ChargeScheduling.Params()
.charge(new ChargeSchedule.Params()
.customer("cust_test_55bb3hkywglfyyachha")
.amount(88800)
.description("Monthly membership fee"))
Expand Down
Loading

0 comments on commit c5fc95a

Please sign in to comment.