Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.
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
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [2.1.6] - 2022-08-03
### Added
- Add AES signature(https://github.com/AfterShip/aftership-sdk-java/pull/42)

## [2.1.5] - 2022-07-20
### Added
- Add predict-batch endpoint and update tracking fields https://github.com/AfterShip/aftership-sdk-java/pull/37
Expand Down Expand Up @@ -57,6 +61,7 @@ Compatibility
### Changed
- Solving issue at Checkpoint.java, typo in ```country_iso3```

[2.1.6]: https://github.com/AfterShip/aftership-sdk-java/compare/2.1.5...2.1.6
[2.1.5]: https://github.com/AfterShip/aftership-sdk-java/compare/v2.1.3...2.1.5
[2.1.3]: https://github.com/AfterShip/aftership-sdk-java/compare/v2.1.2...v2.1.3
[2.1.2]: https://github.com/AfterShip/aftership-sdk-java/compare/v2.1.0...v2.1.2
Expand Down
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ Requirements:
<dependency>
<groupId>com.aftership</groupId>
<artifactId>aftership-sdk</artifactId>
<version>2.1.5</version>
<version>2.1.6</version>
</dependency>
```

### Gradle

```text
implementation "com.aftership:aftership-sdk:2.1.5"
implementation "com.aftership:aftership-sdk:2.1.6"
```


Expand All @@ -40,6 +40,10 @@ The following code example shows the `three main steps` to use aftership-sdk-jav
```java
AfterShip afterShip = new AfterShip("YOUR_API_KEY",
new AftershipOption("https://api.aftership.com/v4"));

// if add aes sign
AfterShip afterShip = new AfterShip("YOUR_API_KEY",AuthenticationType.AES,"YOUR_API_SECRET",
new AftershipOption("https://api.aftership.com/v4"));
```

2. Get the Endpoint Interface and call the method, then return the object.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,12 @@
import com.aftership.sdk.auth.AuthenticationType;
import com.aftership.sdk.auth.SignHeader;
import com.aftership.sdk.auth.SignatureContent;
import com.aftership.sdk.utils.*;
import com.google.gson.JsonElement;
import com.google.gson.JsonParser;

import java.time.ZoneOffset;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import java.util.AbstractMap;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.text.SimpleDateFormat;
import java.util.*;

import com.aftership.sdk.AfterShip;
import com.aftership.sdk.exception.AftershipException;
Expand All @@ -23,10 +19,6 @@
import com.aftership.sdk.model.AftershipResponse;
import com.aftership.sdk.model.Meta;
import com.aftership.sdk.model.RateLimit;
import com.aftership.sdk.utils.Define;
import com.aftership.sdk.utils.JsonUtils;
import com.aftership.sdk.utils.StrUtils;
import com.aftership.sdk.utils.UrlUtils;
import okhttp3.Call;
import okhttp3.Headers;
import okhttp3.MediaType;
Expand Down Expand Up @@ -107,7 +99,9 @@ public <T, R> AftershipResponse<R> makeRequest(
if (authenticationType == AuthenticationType.AES) {
requestHeaders.put("as-api-key", app.getApiKey());
// add sign
String date = DateTimeFormatter.RFC_1123_DATE_TIME.format(ZonedDateTime.now(ZoneOffset.UTC));
SimpleDateFormat sdf3 = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss z", Locale.US);
sdf3.setTimeZone(TimeZone.getTimeZone("GMT"));
String date = sdf3.format(new Date());
SignHeader signHeader = app.getSigner().sign(
SignatureContent.builder()
.contentType(JSON.toString())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
public final class Define {

/** Version of the current component */
public static final String VERSION = "2.1.5";
public static final String VERSION = "2.1.6";

/** The range of http status codes for successful API requests */
public static final int[] SUCCESSFUL_CODE_RANGE;
Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ buildscript {

allprojects {
group 'com.aftership'
version '2.1.5'
version '2.1.6'

repositories {
mavenCentral()
Expand Down Expand Up @@ -109,7 +109,7 @@ project(':aftership-sdk') {
project(':aftership-sample'){
dependencies {
// compile project(':aftership-sdk')
implementation "com.aftership:aftership-sdk:2.1.5"
implementation "com.aftership:aftership-sdk:2.1.6"
}

jar {
Expand Down