Skip to content

Commit

Permalink
Merge branch 'master' of github.com:hyperwallet/java-sdk into feature…
Browse files Browse the repository at this point in the history
…/HW-57146_java_sdk_for_transfer_refunds1
  • Loading branch information
ramahalingam committed Aug 23, 2020
2 parents 8311be4 + f4bed29 commit 3883dc5
Show file tree
Hide file tree
Showing 29 changed files with 841 additions and 105 deletions.
9 changes: 4 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
language: java
jdk:
- oraclejdk8
- openjdk7
- openjdk8
after_success:
- if [ $TRAVIS_JDK_VERSION = 'oraclejdk7' ] && [ $TRAVIS_BRANCH = 'master' ] && [ $TRAVIS_PULL_REQUEST = 'false' ]; then sh ./scripts/travisPublishDocs.sh; fi
- if [ $TRAVIS_JDK_VERSION = 'oraclejdk7' ]; then mvn clean cobertura:cobertura coveralls:report; fi
- if [ $TRAVIS_JDK_VERSION = 'openjdk8' ] && [ $TRAVIS_BRANCH = 'master' ] && [ $TRAVIS_PULL_REQUEST = 'false' ]; then sh ./scripts/travisPublishDocs.sh; fi
- if [ $TRAVIS_JDK_VERSION = 'openjdk8' ]; then mvn clean cobertura:cobertura coveralls:report; fi
env:
global:
secure: LsOj/2HbbRfMvUQd2RMR6ycM8BLn4SrnGtaitR3cJfqkoi25GuiLQBVv19XaAe0FWyrkX8YE9ciVLtVX1lQ1fx3BTMrSbCVhmV5I3AE2gK1sKaC598SlRflUPY6kl97/UNAHE+5JlMv7op66syngQgaZ+eKVxoo69o1SqxC5CqdyC+zrEgzj1q5JA2y+/R/k2lkGFus6qJCbADEmiChoWyBN99Kmw+lhW9HSan/+bbmwpe99TlvHOX+CrXlHTq9T/4VCRRJL1OYi6eI5npWGU3UzmWnNab3vBRl/B67AC2mbH8Y1da/uxgjY/1uxNVfB4FoiGQwZodcV3pSzt3tGcPM7ONIsodWJpcZ0h2Lp1J1tZBGMfg9yiL98guDJuFF+kCGrTgpTm58c26yT6U7ezL/L5d1uX8FUyCn3F9Du6cQ+VRwwgx6Km8n1Xd6/l5AQzCYwVqZq+gsgavqHiYAAJ6MaUJ6vkR9COzK2bi/2qjprHrC4ftRdzVgPkVCLnz/YiSA54xJsz1Y5HOIyYJF2UEWd+BRfGSZC7Z1sbNyCh38OnAJSU1ECV3f+ROCZjNyad5GYfAvIsjNPuY+4IuMCR9WWHfTLDFg3DYJFzppCmYfE6utVGJF7Wlm/vb1qlRbHhHLnVhf11UagRkojWDss14h0PQGY+dOOxR8hGCiXbyQ=
secure: qd20UmZR2wd9gZqIJieEsxrMD212I8+dJQ9k0B7YMTf1PtyM1LHxZog2sv1/h0GF7FFp0xhanDNXBxfAbPqFI3TebpxVL/8tQOomsKJl+VL/5ZWSNugTNHTMdEwTWuKFm08u2tZ8Zwl7vK7mhKV+B/NJxl7ySWvtn9+rfsWaPDPcj7TC4QdbUet51Hxf85Lca03UHeqGHYUgv1iYxvRznnOUmzPHS+pYVrBzh3MITLnq0LrRfN+Bh1cHQ8kd65Ze1pVICrDkS1w8fUqkyceWEwg9pjEmemJoSzFnYUqcFAqj4eCaqL5toDyo4x7kPFJ9OhEFCHiqioj8nEclFKCmwqgH/d/V36q3Wa0ibgz+HNMflH6Cx4g3WPx7gqalNrpAqys/FfsdXpmmtK3TiYArJvhuX77fo71tZn34XkhTzimelDYZi9v4FJLKmTh+b6UqjOKbwI8qcFqdoo6W0ACwQklEBpTMwzpOQK/cnFR885j85EJuYxOOxwckqFKE9i0rUKRHrMPrhN86p7XF54VZmy3W0NcN4TRIxWb1323gXpB/E0pvjv3k9F0L5pgQiB0cSyw7GVLfBLbjpb9RteevStwlYHmbswK0184KO02oYGDKVjh/NEHslUHLMk1Awr+gwflCnNAXM2OlqaVFFngsSfQ+OiyQq+7xjC9sLay2AuM=

script:
mvn verify -B
17 changes: 16 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,22 @@
Changelog
=========
1.4.2
------------------
- Added status param to HyperwalletPayment

1.4.1
-------------------
- Added support for new businessType field values.

1.4.0
-------------------
- Fix TypeError thrown when response status is 204 No content
- Add CVV field to the SDK
- Remove Relationship field from Server SDK
- Add Business Operating Name Field to User
- Add PayPal account status transitions

1.3.0
1.3.0 (2019-01-28)
-------------------
- Added field "VerificationStatus" to User
- Client-token endpoint renamed to authentication-token
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ Installation
<dependency>
<groupId>com.hyperwallet</groupId>
<artifactId>sdk</artifactId>
<version>0.5.0</version>
<version>1.4.2</version>
</dependency>
```

**Gradle**
```
compile 'com.hyperwallet:sdk:0.5.0'
compile 'com.hyperwallet:sdk:1.4.0'
```

Documentation
Expand All @@ -41,7 +41,7 @@ API Overview
To write an app using the SDK

* Register for a sandbox account and get your username, password and program token at the [Hyperwallet Program Portal](https://portal.hyperwallet.com).
* Add dependency `com.hyperwallet:sdk:0.5.0` to your `pom.xml` (or `build.gradle`).
* Add dependency `com.hyperwallet:sdk:1.4.0` to your `pom.xml` (or `build.gradle`).

* Create a instance of the Hyperwallet Client (with username, password and program token)
```java
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>com.hyperwallet</groupId>
<artifactId>sdk</artifactId>
<version>1.3.1-SNAPSHOT</version>
<version>1.4.3-SNAPSHOT</version>
<packaging>jar</packaging>

<name>hyperwallet-java-sdk</name>
Expand Down Expand Up @@ -140,7 +140,7 @@
<dependency>
<groupId>com.nimbusds</groupId>
<artifactId>nimbus-jose-jwt</artifactId>
<version>5.8</version>
<version>7.9</version>
</dependency>
<dependency>
<groupId>org.json</groupId>
Expand Down
109 changes: 107 additions & 2 deletions src/main/java/com/hyperwallet/clientsdk/Hyperwallet.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*/
public class Hyperwallet {

public static final String VERSION = "0.1.0";
public static final String VERSION = "1.4.2";

private final HyperwalletApiClient apiClient;
private final String programToken;
Expand Down Expand Up @@ -496,7 +496,7 @@ public HyperwalletBankCard createBankCard(HyperwalletBankCard bankCard) {
/**
* Get Bank Card
*
* @param userToken User token assigned
* @param userToken User token assigned
* @param bankCardToken Bank Card token
* @return HyperwalletBankCard Bank Card
*/
Expand Down Expand Up @@ -1095,6 +1095,111 @@ public HyperwalletList<HyperwalletPayPalAccount> listPayPalAccounts(String userT
return listPayPalAccounts(userToken, null);
}

/**
* Deactivate PayPal Account
*
* @param userToken User token
* @param payPalAccountToken PayPal Account token
* @return HyperwalletStatusTransition deactivated PayPal account
*/
public HyperwalletStatusTransition deactivatePayPalAccount(String userToken, String payPalAccountToken) {
return deactivatePayPalAccount(userToken, payPalAccountToken, null);
}

/**
* Deactivate PayPal Account
*
* @param userToken User token
* @param payPalAccountToken PayPal Account token
* @param notes Comments regarding the status change
* @return HyperwalletStatusTransition deactivated PayPal account
*/
public HyperwalletStatusTransition deactivatePayPalAccount(String userToken, String payPalAccountToken, String notes) {
return createPayPalAccountStatusTransition(userToken,
payPalAccountToken,
new HyperwalletStatusTransition(HyperwalletStatusTransition.Status.DE_ACTIVATED).notes(notes));
}

/**
* Create PayPal Account Status Transition
*
* @param userToken User token
* @param payPalAccountToken PayPal Account token
* @param transition Status transition information
* @return HyperwalletStatusTransition new status for PayPal Account
*/
public HyperwalletStatusTransition createPayPalAccountStatusTransition(String userToken, String payPalAccountToken, HyperwalletStatusTransition transition) {
if (transition == null) {
throw new HyperwalletException("Transition is required");
}
if (StringUtils.isEmpty(userToken)) {
throw new HyperwalletException("User token is required");
}
if (StringUtils.isEmpty(payPalAccountToken)) {
throw new HyperwalletException("PayPal Account token is required");
}
if (!StringUtils.isEmpty(transition.getToken())) {
throw new HyperwalletException("Status Transition token may not be present");
}
transition = copy(transition);
transition.setCreatedOn(null);
transition.setFromStatus(null);
transition.setToStatus(null);
return apiClient.post(url + "/users/" + userToken + "/paypal-accounts/" + payPalAccountToken + "/status-transitions", transition, HyperwalletStatusTransition.class);
}

/**
* Get PayPal Account Status Transition
*
* @param userToken User token
* @param payPalAccountToken PayPal Account token
* @param statusTransitionToken Status transition token
* @return HyperwalletStatusTransition
*/
public HyperwalletStatusTransition getPayPalAccountStatusTransition(String userToken, String payPalAccountToken, String statusTransitionToken) {
if (StringUtils.isEmpty(userToken)) {
throw new HyperwalletException("User token is required");
}
if (StringUtils.isEmpty(payPalAccountToken)) {
throw new HyperwalletException("PayPal Account token is required");
}
if (StringUtils.isEmpty(statusTransitionToken)) {
throw new HyperwalletException("Transition token is required");
}
return apiClient.get(url + "/users/" + userToken + "/paypal-accounts/" + payPalAccountToken + "/status-transitions/" + statusTransitionToken, HyperwalletStatusTransition.class);
}

/**
* List All PayPal Account Status Transition information
*
* @param userToken User token
* @param payPalAccountToken PayPal Account token
* @return HyperwalletList of HyperwalletStatusTransition
*/
public HyperwalletList<HyperwalletStatusTransition> listPayPalAccountStatusTransitions(String userToken, String payPalAccountToken) {
return listPayPalAccountStatusTransitions(userToken, payPalAccountToken, null);
}

/**
* List PayPal Account Status Transition information
*
* @param userToken User token
* @param payPalAccountToken PayPal Account token
* @param options List filter option
* @return HyperwalletList of HyperwalletStatusTransition
*/
public HyperwalletList<HyperwalletStatusTransition> listPayPalAccountStatusTransitions(String userToken, String payPalAccountToken, HyperwalletPaginationOptions options) {
if (StringUtils.isEmpty(userToken)) {
throw new HyperwalletException("User token is required");
}
if (StringUtils.isEmpty(payPalAccountToken)) {
throw new HyperwalletException("PayPal Account token is required");
}
String url = paginate(this.url + "/users/" + userToken + "/paypal-accounts/" + payPalAccountToken + "/status-transitions", options);
return apiClient.get(url, new TypeReference<HyperwalletList<HyperwalletStatusTransition>>() {
});
}

//--------------------------------------
// Bank Accounts
//--------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ public static enum Status {ACTIVATED, INVALID, DE_ACTIVATED}
private String branchName;
private String branchId;
private String bankAccountId;
private HyperwalletTransferMethod.BankAccountRelationship bankAccountRelationship;
private String bankAccountPurpose;

private String branchAddressLine1;
Expand All @@ -56,6 +55,7 @@ public static enum Status {ACTIVATED, INVALID, DE_ACTIVATED}
private HyperwalletUser.ProfileType profileType;

private String businessName;
private String businessOperatingName;
private String businessRegistrationId;
private String businessRegistrationStateProvince;
private String businessRegistrationCountry;
Expand Down Expand Up @@ -311,27 +311,6 @@ public HyperwalletBankAccount clearBankAccountId() {
return this;
}

public HyperwalletTransferMethod.BankAccountRelationship getBankAccountRelationship() {
return bankAccountRelationship;
}

public void setBankAccountRelationship(HyperwalletTransferMethod.BankAccountRelationship bankAccountRelationship) {
addField("bankAccountRelationship", bankAccountRelationship);
this.bankAccountRelationship = bankAccountRelationship;
}

public HyperwalletBankAccount bankAccountRelationship(HyperwalletTransferMethod.BankAccountRelationship bankAccountRelationship) {
addField("bankAccountRelationship", bankAccountRelationship);
this.bankAccountRelationship = bankAccountRelationship;
return this;
}

public HyperwalletBankAccount clearBankAccountRelationship() {
clearField("bankAccountRelationship");
bankAccountRelationship = null;
return this;
}

public String getBankAccountPurpose() {
return bankAccountPurpose;
}
Expand Down Expand Up @@ -752,6 +731,27 @@ public HyperwalletBankAccount clearBusinessName() {
return this;
}

public String getBusinessOperatingName() {
return businessOperatingName;
}

public void setBusinessOperatingName(String businessOperatingName) {
addField("businessOperatingName", businessOperatingName);
this.businessOperatingName = businessOperatingName;
}

public HyperwalletBankAccount businessOperatingName(String businessOperatingName) {
addField("businessOperatingName", businessOperatingName);
this.businessOperatingName = businessOperatingName;
return this;
}

public HyperwalletBankAccount clearBusinessOperatingName() {
clearField("businessOperatingName");
businessOperatingName = null;
return this;
}

public String getBusinessRegistrationId() {
return businessRegistrationId;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ public enum GovernmentIdType {PASSPORT,NATIONAL_ID_CARD}
private Boolean isDefaultTransferMethod;
private String addressLine1;
private String addressLine2;
private HyperwalletTransferMethod.BankAccountRelationship bankAccountRelationship;
private HyperwalletUser.BusinessContactRole businessContactRole;
private String businessName;
private String businessOperatingName;
private String businessRegistrationCountry;
private String businessRegistrationId;
private String businessRegistrationStateProvince;
Expand Down Expand Up @@ -245,27 +245,6 @@ public HyperwalletPaperCheck clearAddressLine2() {
return this;
}

public HyperwalletTransferMethod.BankAccountRelationship getBankAccountRelationship() {
return bankAccountRelationship;
}

public void setBankAccountRelationship(HyperwalletTransferMethod.BankAccountRelationship bankAccountRelationship) {
addField("bankAccountRelationship", bankAccountRelationship);
this.bankAccountRelationship = bankAccountRelationship;
}

public HyperwalletPaperCheck bankAccountRelationship(HyperwalletTransferMethod.BankAccountRelationship bankAccountRelationship) {
addField("bankAccountRelationship", bankAccountRelationship);
this.bankAccountRelationship = bankAccountRelationship;
return this;
}

public HyperwalletPaperCheck clearBankAccountRelationship() {
clearField("bankAccountRelationship");
this.bankAccountRelationship = null;
return this;
}

public HyperwalletUser.BusinessContactRole getBusinessContactRole() {
return businessContactRole;
}
Expand Down Expand Up @@ -308,6 +287,27 @@ public HyperwalletPaperCheck clearBusinessName() {
return this;
}

public String getBusinessOperatingName() {
return businessOperatingName;
}

public void setBusinessOperatingName(String businessOperatingName) {
addField("businessOperatingName", businessOperatingName);
this.businessOperatingName = businessOperatingName;
}

public HyperwalletPaperCheck businessOperatingName(String businessOperatingName) {
addField("businessOperatingName", businessOperatingName);
this.businessOperatingName = businessOperatingName;
return this;
}

public HyperwalletPaperCheck clearBusinessOperatingName() {
clearField("businessOperatingName");
businessOperatingName = null;
return this;
}

public String getBusinessRegistrationCountry() {
return businessRegistrationCountry;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
public class HyperwalletPayment extends HyperwalletBaseMonitor {

private String token;
private String status;

private Date createdOn;
private Double amount;
Expand Down Expand Up @@ -48,6 +49,27 @@ public HyperwalletPayment clearToken() {
return this;
}

public String getStatus() {
return status;
}

public void setStatus(String status) {
addField("status", status);
this.status = status;
}

public HyperwalletPayment status(String status) {
addField("status", status);
this.status = status;
return this;
}

public HyperwalletPayment clearStatus() {
clearField("status");
status = null;
return this;
}

public String getClientPaymentId() {
return clientPaymentId;
}
Expand Down
Loading

0 comments on commit 3883dc5

Please sign in to comment.