Skip to content

Commit 73d7512

Browse files
authored
Release/1.0.2 (#7)
- Release SDK for gift card service 🚀 - Add support for geographical recharge plan in Airtime SDK - Bug fixes - Documentation clean-up & code improvements/optimizations
1 parent a29fb2a commit 73d7512

File tree

130 files changed

+26262
-215
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

130 files changed

+26262
-215
lines changed

GENERAL-CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ an Issue to discuss your proposal first. This is not required but can save time
5959

6060
In general, we follow the ["fork-and-pull" Git workflow](https://github.com/susam/gitpr)
6161

62-
1. Fork the repository to your own Github account
62+
1. Fork the repository to your own GitHub account
6363
2. Clone the project to your machine
6464
3. Create a branch locally with a succinct but descriptive name
6565
4. Commit changes to the branch

README.md

Lines changed: 36 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
<img src="icon.png" width="100" height="105" align="right" alt="reloadly-java-icon"/>
2+
13
<!--
24
Title: Reloadly SDK for Java
35
Description: Reloadly Java SDK for sending Airtime Topups to over 4 billion mobile phones.
@@ -7,15 +9,15 @@
79
# Reloadly SDK for Java
810

911
[![CircleCI][circle-ci-badge]][circle-ci-url]
10-
[![MIT][mit-badge]][mit-url]
1112
[![codecov][codecov-badge]][codecov-url]
12-
<!--[![Maven][maven-badge]][maven-url]-->
13+
[![MIT][mit-badge]][mit-url]
14+
[![Maven Central][maven-badge]][maven-url]
1315

1416
The **Reloadly SDK for Java** enables Java developers to easily work with [Reloadly Services][reloadly-main-site]
15-
and build scalable solutions. For example, you can start sending **Airtime topups** in minutes instead of days by using the **Reloadly SDK for Java**.
16-
You can get started by using Maven or any build system that supports MavenCentral as an artifact source.
17+
and build scalable solutions. You can get started in minutes using Maven or any build system that supports MavenCentral
18+
as an artifact source.
1719

18-
* [SDK Homepage][sdk-website] (Coming soon)
20+
* [SDK Homepage][sdk-website]
1921
* [Sample Code][sample-code]
2022
* [API Docs][docs-api]
2123
* [Issues][sdk-issues]
@@ -26,7 +28,7 @@ You can get started by using Maven or any build system that supports MavenCentra
2628

2729
#### Sign up for Reloadly ####
2830

29-
Before you begin, you need a Reloadly account. Please see the [Sign Up for Reloadly][reloadly-signup-help] section of
31+
Before you begin, you need a Reloadly account. Please see the [Sign-Up for Reloadly][reloadly-signup-help] section of
3032
the knowledge-base for information about how to create a Reloadly account and retrieve
3133
your [Reloadly APIs credentials][api-credentials-help].
3234

@@ -36,7 +38,7 @@ To run the SDK you will need **Java 1.8+**
3638

3739
## Using the SDK Modules
3840

39-
The SDK is made up of several modules such as **Authentication, Airtime, etc...**, you can alternatively add
41+
The SDK is made up of several modules such as **Authentication, Airtime, Giftcard etc...**, you can alternatively add
4042
dependencies for the specific services you use only. For example : Authentication & Airtime
4143
***(currently all modules have the same version, but this may not always be the case)***
4244

@@ -45,13 +47,19 @@ dependencies for the specific services you use only. For example : Authenticatio
4547
Add specific dependencies to your project's build file:
4648

4749
```groovy
48-
implementation "software.reloadly:java-sdk-authentication:1.0.0"
50+
implementation "software.reloadly:java-sdk-authentication:1.0.2"
4951
```
5052

5153
**OR**
5254

5355
```groovy
54-
implementation "software.reloadly:java-sdk-airtime:1.0.0"
56+
implementation "software.reloadly:java-sdk-airtime:1.0.2"
57+
```
58+
59+
**OR**
60+
61+
```groovy
62+
implementation "software.reloadly:java-sdk-giftcard:1.0.2"
5563
```
5664

5765
### Maven users
@@ -63,7 +71,7 @@ Add specific dependencies to your project's POM:
6371
<dependency>
6472
<groupId>software.reloadly</groupId>
6573
<artifactId>java-sdk-authentication</artifactId>
66-
<version>1.0.0</version>
74+
<version>1.0.2</version>
6775
</dependency>
6876
```
6977

@@ -74,7 +82,18 @@ Add specific dependencies to your project's POM:
7482
<dependency>
7583
<groupId>software.reloadly</groupId>
7684
<artifactId>java-sdk-airtime</artifactId>
77-
<version>1.0.0</version>
85+
<version>1.0.2</version>
86+
</dependency>
87+
```
88+
89+
**OR**
90+
91+
```xml
92+
93+
<dependency>
94+
<groupId>software.reloadly</groupId>
95+
<artifactId>java-sdk-giftcard</artifactId>
96+
<version>1.0.2</version>
7897
</dependency>
7998
```
8099

@@ -93,7 +112,7 @@ getting help:
93112
* Talk to us live on our chat tool on our [website][reloadly-main-site] (bottom right)
94113
* Ask a question on [StackOverflow][stack-overflow] and tag it with `reloadly-java-sdk`
95114
* Articulate your feature request or upvote existing ones on our [Issues][features] page
96-
* Take a look at our [youtube series][youtube-series] for plenty of helpful walkthroughs and tips
115+
* Take a look at our [YouTube series][youtube-series] for plenty of helpful walkthroughs and tips
97116
* Open a case via with the [Reloadly Support Center][support-center]
98117
* If it turns out that you may have found a bug, please open an [issue][sdk-issues]
99118

@@ -112,7 +131,7 @@ We need your help in making this SDK great. Please participate in the community
112131
submitting issues, participating in discussion forums and submitting pull requests through the following channels:
113132

114133
* Submit [issues][sdk-issues] - this is the preferred channel to interact with our team
115-
* Come join the Reloadly Java community chat on [Gitter][gitter]
134+
* Come join the Reloadly Java community chat on [Slack][slack]
116135
* Articulate your feature request or upvote existing ones on our [Issues][features] page
117136
* Send feedback directly to the team at oss@reloadly.com
118137

@@ -122,7 +141,7 @@ This project is licensed under the MIT license. See the [LICENSE](LICENSE) file
122141

123142
[reloadly-main-site]: https://www.reloadly.com/
124143

125-
[sdk-website]: https://sdk.reloadly.com/java
144+
[sdk-website]: https://docs.reloadly.com/devtools/toolbox/libraries-and-sdks
126145

127146
[reloadly-signup-help]: https://faq.reloadly.com/en/articles/2307724-how-do-i-register-for-my-free-account
128147

@@ -132,7 +151,7 @@ This project is licensed under the MIT license. See the [LICENSE](LICENSE) file
132151

133152
[sdk-license]: http://www.reloadly.com/software/apache2.0/
134153

135-
[gitter]: https://gitter.im/reloadly/reloadly-sdk-java
154+
[slack]: https://reloadly-developers.slack.com/
136155

137156
[sample-code]: https://github.com/reloadly/reloadly-sdk-java/blob/master/SAMPLE-CODE.md
138157

@@ -152,9 +171,9 @@ This project is licensed under the MIT license. See the [LICENSE](LICENSE) file
152171

153172
[mit-url]: https://github.com/reloadly/reloadly-sdk-java/raw/master/LICENSE
154173

155-
[maven-badge]: https://img.shields.io/maven-central/v/software.reloadly/java-sdk-airtime.svg?label=Maven%20Central
174+
[maven-badge]: https://maven-badges.herokuapp.com/maven-central/software.reloadly/java-sdk/badge.svg
156175

157-
[maven-url]: https://search.maven.org/search?q=g:software.reloadly
176+
[maven-url]: https://maven-badges.herokuapp.com/maven-central/software.reloadly/java-sdk
158177

159178
[circle-ci-badge]: https://circleci.com/gh/Reloadly/reloadly-sdk-java.svg?style=svg&circle-token=f06dbc5f2511715447dd8d62ff00065cb245701e
160179

icon.png

79.4 KB
Loading

java-sdk-airtime/USAGE.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Some key things to keep in mind regarding the Airtime API :
1212
* The API has 2 environments, SANDBOX (for development & testing) and LIVE.
1313
* If neither environment is specified, the SDK defaults to SANDBOX
1414
* Each environment has a set of credentials (client id & secret) that are different from the other.<br />
15-
* SANBOX credentials can only be used for SANDBOX environment
15+
* SANDBOX credentials can only be used for SANDBOX environment
1616
* LIVE credentials can only be used for LIVE environment
1717
* If not environment is specified the SDK defaults to SANDBOX
1818
* You MUST supply either the credentials, or an access token in order to call the API
@@ -26,14 +26,14 @@ Set the client id & client secret; this is probably the most straight-forward or
2626
acquired automatically before the API call is made.
2727

2828
```java
29-
Request<AccountBalance> request = AirtimeAPI.builder()
29+
Request<AccountBalanceInfo> request = AirtimeAPI.builder()
3030
.clientId(clientId)
3131
.clientSecret(clientSecret)
3232
.environment(Environment.SANDBOX) //Airtime service has 2 environments, LIVE and SANDBOX. If not environment is specified, the SDK defaults to SANDBOX
3333
.build()
3434
.accounts().getBalance();
3535

36-
AccountBalance accountBalance = null;
36+
AccountBalanceInfo accountBalance = null;
3737
try {
3838
accountBalance = request.execute();
3939
} catch (APIException e) {
@@ -71,15 +71,15 @@ try {
7171
// all others
7272
}
7373

74-
Request<AccountBalance> request = AirtimeAPI.builder()
74+
Request<AccountBalanceInfo> request = AirtimeAPI.builder()
7575
.clientId(clientId)
7676
.clientSecret(clientSecret)
7777
.accessToken(tokenHolder.getAccessToken()) //Set the access token to be used by here
7878
.environment(Environment.SANDBOX)
7979
.build()
8080
.accounts().getBalance();
8181

82-
AccountBalance accountBalance = null;
82+
AccountBalanceInfo accountBalance = null;
8383
try {
8484
accountBalance = request.execute();
8585
} catch (APIException e) {
@@ -139,8 +139,8 @@ AirtimeAPI airtimeAPI = AirtimeAPI.builder()
139139
.environment(Environment.SANDBOX)
140140
.build();
141141

142-
AccountBalance balance = null;
143-
Request<AccountBalance> request = airtimeAPI.accounts().getBalance();
142+
AccountBalanceInfo balance = null;
143+
Request<AccountBalanceInfo> request = airtimeAPI.accounts().getBalance();
144144
try {
145145
balance = request.execute();
146146
} catch (APIException e) {

java-sdk-airtime/pom.xml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,33 +2,31 @@
22
<project xmlns="http://maven.apache.org/POM/4.0.0"
33
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
44
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5-
<modelVersion>4.0.0</modelVersion>
65

76
<parent>
87
<groupId>software.reloadly</groupId>
98
<artifactId>java-sdk</artifactId>
10-
<version>1.0.0</version>
9+
<version>1.0.2</version>
1110
</parent>
1211

12+
<modelVersion>4.0.0</modelVersion>
1313
<artifactId>java-sdk-airtime</artifactId>
14-
<version>1.0.0</version>
14+
<version>1.0.2</version>
1515
<name>Reloadly Java SDK :: Services :: Reloadly Airtime Service</name>
1616
<url>https://github.com/reloadly/reloadly-sdk-java</url>
1717

18-
<description>The Reloadly Java SDK for the Auth API. The module holds the client classes
18+
<description>The Reloadly Java SDK for the Airtime API. The module holds the client classes
1919
that are used for communicating with Reloadly Airtime Service.
2020
</description>
2121

2222
<properties>
23-
<nv-i18n.version>1.27</nv-i18n.version>
24-
<sdk-authentication.version>1.0.0</sdk-authentication.version>
23+
<nv-i18n.version>1.29</nv-i18n.version>
2524
</properties>
2625

2726
<dependencies>
2827
<dependency>
2928
<groupId>software.reloadly</groupId>
3029
<artifactId>java-sdk-authentication</artifactId>
31-
<version>${sdk-authentication.version}</version>
3230
<optional>false</optional>
3331
</dependency>
3432
<dependency>

java-sdk-airtime/src/main/java/software/reloadly/sdk/airtime/client/AirtimeAPI.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ public class AirtimeAPI extends ServiceAPI {
3232
private final Environment environment;
3333

3434
@Builder
35+
@SuppressWarnings("unused")
3536
public AirtimeAPI(String clientId, String clientSecret, String accessToken,
3637
Environment environment, boolean enableLogging,
3738
List<String> redactHeaders, HttpOptions options, Boolean enableTelemetry) {
@@ -41,7 +42,7 @@ public AirtimeAPI(String clientId, String clientSecret, String accessToken,
4142

4243
validateCredentials();
4344
this.environment = environment;
44-
baseUrl = createBaseUrl();
45+
baseUrl = createBaseUrl(environment);
4546
}
4647

4748
public OperatorOperations operators() throws ReloadlyException {
@@ -86,10 +87,10 @@ public void refreshAccessToken(Request<?> request) throws ReloadlyException {
8687
customizableRequest.addHeader(HttpHeader.AUTHORIZATION, "Bearer " + newAccessToken);
8788
}
8889

89-
private HttpUrl createBaseUrl() {
90+
private HttpUrl createBaseUrl(Environment environment) {
9091
Service service = getServiceByEnvironment(environment);
9192
Asserter.assertNotNull(service, "Service");
92-
HttpUrl url = HttpUrl.parse(service.getUrl());
93+
HttpUrl url = HttpUrl.parse(service.getServiceUrl());
9394
if (url == null) {
9495
throw new IllegalArgumentException(
9596
"The airtime base url had an invalid format and couldn't be parsed as a URL."

java-sdk-airtime/src/main/java/software/reloadly/sdk/airtime/dto/request/EmailTopupRequest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ public class EmailTopupRequest extends TopupRequest implements Serializable {
2323
private final String recipientEmail;
2424

2525
@Builder
26+
@SuppressWarnings("unused")
2627
public EmailTopupRequest(Double amount, Long operatorId, String recipientEmail,
2728
Phone senderPhone, boolean useLocalAmount, String customIdentifier) {
2829

java-sdk-airtime/src/main/java/software/reloadly/sdk/airtime/dto/request/PhoneTopupRequest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ public class PhoneTopupRequest extends TopupRequest implements Serializable {
2323
private final Phone recipientPhone;
2424

2525
@Builder
26+
@SuppressWarnings("unused")
2627
public PhoneTopupRequest(Double amount, Long operatorId,
2728
Phone recipientPhone, boolean useLocalAmount, Phone senderPhone, String customIdentifier) {
2829

java-sdk-airtime/src/main/java/software/reloadly/sdk/airtime/dto/request/Topupable.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import software.reloadly.sdk.airtime.dto.Phone;
44

5+
@SuppressWarnings("unused")
56
public interface Topupable {
67
Double getAmount();
78
Long getOperatorId();
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package software.reloadly.sdk.airtime.dto.response;
2+
3+
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
4+
import com.fasterxml.jackson.annotation.JsonInclude;
5+
import com.fasterxml.jackson.annotation.JsonProperty;
6+
import lombok.EqualsAndHashCode;
7+
import lombok.Getter;
8+
import lombok.ToString;
9+
import software.reloadly.sdk.airtime.enums.AirtimeTransactionStatus;
10+
11+
import java.io.Serializable;
12+
13+
@Getter
14+
@ToString
15+
@EqualsAndHashCode
16+
@JsonInclude(JsonInclude.Include.NON_NULL)
17+
@JsonIgnoreProperties(ignoreUnknown = true)
18+
public class AirtimeTransactionStatusResponse implements Serializable {
19+
20+
private static final long serialVersionUID = -107316033333805883L;
21+
@JsonProperty("code")
22+
private String errorCode;
23+
@JsonProperty("message")
24+
private String errorMessage;
25+
private TopupTransaction transaction;
26+
private AirtimeTransactionStatus status;
27+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package software.reloadly.sdk.airtime.dto.response;
2+
3+
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
4+
import com.fasterxml.jackson.annotation.JsonInclude;
5+
import lombok.EqualsAndHashCode;
6+
import lombok.Getter;
7+
import lombok.ToString;
8+
9+
import java.io.Serializable;
10+
11+
@Getter
12+
@ToString
13+
@EqualsAndHashCode
14+
@JsonInclude(JsonInclude.Include.NON_NULL)
15+
@JsonIgnoreProperties(ignoreUnknown = true)
16+
public class AsyncAirtimeResponse implements Serializable {
17+
18+
private static final long serialVersionUID = -6885242699797871608L;
19+
private Long transactionId;
20+
}

java-sdk-airtime/src/main/java/software/reloadly/sdk/airtime/dto/response/FxRate.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
@Getter
1010
@ToString
1111
@EqualsAndHashCode
12+
@SuppressWarnings("unused")
1213
@JsonInclude(JsonInclude.Include.NON_NULL)
1314
@JsonIgnoreProperties(ignoreUnknown = true)
1415
public class FxRate implements Serializable {
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package software.reloadly.sdk.airtime.dto.response;
2+
3+
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
4+
import com.fasterxml.jackson.annotation.JsonInclude;
5+
import lombok.*;
6+
7+
import java.io.Serializable;
8+
import java.math.BigDecimal;
9+
import java.util.TreeMap;
10+
import java.util.TreeSet;
11+
12+
@Getter
13+
@Setter
14+
@ToString
15+
@NoArgsConstructor
16+
@AllArgsConstructor
17+
@JsonInclude(JsonInclude.Include.NON_NULL)
18+
@JsonIgnoreProperties(ignoreUnknown = true)
19+
public class GeographicalRechargePlan implements Serializable {
20+
21+
private static final long serialVersionUID = -5652377401301285195L;
22+
private String locationCode;
23+
private String locationName;
24+
private TreeSet<BigDecimal> fixedAmounts;
25+
private TreeSet<BigDecimal> localAmounts;
26+
private TreeMap<BigDecimal, String> fixedAmountsPlanNames;
27+
private TreeMap<BigDecimal, String> fixedAmountsDescriptions;
28+
private TreeMap<BigDecimal, String> localFixedAmountsPlanNames;
29+
private TreeMap<BigDecimal, String> localFixedAmountsDescriptions;
30+
}

0 commit comments

Comments
 (0)