Skip to content
Open
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
71 changes: 0 additions & 71 deletions .github/workflows/codeql-analysis.yml

This file was deleted.

4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[![Maven Central](https://img.shields.io/maven-central/v/com.currencycloud.currencycloud-java/currencycloud-java.svg?label=Maven%20Central)](https://search.maven.org/search?q=g:%22com.currencycloud.currencycloud-java%22%20AND%20a:%22currencycloud-java%22) [![CodeQL](https://github.com/CurrencyCloud/currencycloud-java/actions/workflows/github-code-scanning/codeql/badge.svg)](https://github.com/CurrencyCloud/currencycloud-java/actions/workflows/github-code-scanning/codeql)

# Currencycloud API v2 Java client
## Version: 7.3.1
This is the official Java SDK for the Currencycloud API. Additional documentation for each API endpoint can be found at [developer.currencycloud.com][docs].

If you have any queries please contact our development team at development@currencycloud.com Please quote your login Id in any correspondence as this allows us to locate your account and give you the support you need.
Expand Down Expand Up @@ -232,6 +231,9 @@ Once a feature has been marked as deprecated, we no longer develop the code or i
We actively support the latest version of the SDK. We support the immediate previous version on best-efforts basis. All other versions are no longer supported nor maintained.

# Release History
* [8.2.0](https://github.com/CurrencyCloud/currencycloud-java/releases/tag/currencycloud-java-8.2.0)
* Adds GET /funding_transactions/{id}
* Adds PUT /collections_screening/{transactionId}/complete
* [8.1.0](https://github.com/CurrencyCloud/currencycloud-java/releases/tag/currencycloud-java-8.1.0)
* Adds support for JDK25
* Adds `payer_ultimate_account_number` to POST /payments/{create, validate, update}
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>com.currencycloud.currencycloud-java</groupId>
<artifactId>currencycloud-java</artifactId>
<version>8.1.0</version>
<version>8.2.0</version>
<packaging>jar</packaging>

<name>Currencycloud</name>
Expand Down
32 changes: 32 additions & 0 deletions src/main/java/com/currencycloud/client/CurrencyCloud.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import com.currencycloud.client.model.Beneficiary;
import com.currencycloud.client.model.BeneficiaryAccountVerification;
import com.currencycloud.client.model.BeneficiaryRequiredDetails;
import com.currencycloud.client.model.CompleteCollectionsScreeningResponse;
import com.currencycloud.client.model.Contact;
import com.currencycloud.client.model.Contacts;
import com.currencycloud.client.model.Conversion;
Expand All @@ -29,6 +30,7 @@
import com.currencycloud.client.model.Currencies;
import com.currencycloud.client.model.DetailedRate;
import com.currencycloud.client.model.FundingAccounts;
import com.currencycloud.client.model.FundingTransaction;
import com.currencycloud.client.model.MarginBalanceTopUp;
import com.currencycloud.client.model.Pagination;
import com.currencycloud.client.model.Payer;
Expand Down Expand Up @@ -69,6 +71,7 @@
import jakarta.ws.rs.GET;
import jakarta.ws.rs.HeaderParam;
import jakarta.ws.rs.POST;
import jakarta.ws.rs.PUT;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.PathParam;
import jakarta.ws.rs.Produces;
Expand Down Expand Up @@ -624,6 +627,24 @@ BeneficiaryAccountVerification verifyAccount(
@Nullable @FormParam("payment_type") String paymentType
) throws ResponseException;

///////////////////////////////////////////////////////////////////
///// COLLECTIONS API ////////////////////////////////////////////////

/**
* Accept or reject inbound transaction
*/
@PUT
@Path("collections_screening/{transactionId}/complete")
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
CompleteCollectionsScreeningResponse completeCollectionsScreening(
@HeaderParam("X-Auth-Token") String authToken,
@HeaderParam("User-Agent") String userAgent,
@PathParam("transactionId") String transactionId,
@FormParam("accepted") Boolean accepted,
@FormParam("reason") String reason
) throws ResponseException;


///////////////////////////////////////////////////////////////////
///// CONTACTS API ////////////////////////////////////////////////

Expand Down Expand Up @@ -947,6 +968,17 @@ FundingAccounts findFundingAccounts(
@Nullable @QueryParam("order_asc_desc") Pagination.SortOrder orderAscDesc
) throws ResponseException;

/**
* Get FundingTransaction
*/
@GET
@Path("funding_transactions/{id}")
FundingTransaction getFundingTransction(
@HeaderParam("X-Auth-Token") String authToken,
@HeaderParam("User-Agent") String userAgent,
@PathParam("id") String id,
@Nullable @QueryParam("on_behalf_of") String onBehalfOf
) throws ResponseException;

///////////////////////////////////////////////////////////////////
///// PAYERS API ///////////////////////////////////////////////////
Expand Down
31 changes: 30 additions & 1 deletion src/main/java/com/currencycloud/client/CurrencyCloudClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import com.currencycloud.client.model.Beneficiary;
import com.currencycloud.client.model.BeneficiaryAccountVerification;
import com.currencycloud.client.model.BeneficiaryAccountVerificationRequest;
import com.currencycloud.client.model.CompleteCollectionsScreeningResponse;
import com.currencycloud.client.model.Contact;
import com.currencycloud.client.model.Contacts;
import com.currencycloud.client.model.Conversion;
Expand All @@ -34,6 +35,7 @@
import com.currencycloud.client.model.DetailedRate;
import com.currencycloud.client.model.Entity;
import com.currencycloud.client.model.FundingAccounts;
import com.currencycloud.client.model.FundingTransaction;
import com.currencycloud.client.model.Iban;
import com.currencycloud.client.model.Ibans;
import com.currencycloud.client.model.MarginBalanceTopUp;
Expand Down Expand Up @@ -112,7 +114,7 @@ public class CurrencyCloudClient {
"[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}",
Pattern.CASE_INSENSITIVE
);
private static final String userAgent = "CurrencyCloudSDK/2.0 Java/8.1.0";
private static final String userAgent = "CurrencyCloudSDK/2.0 Java/8.2.0";

private final CurrencyCloud api;

Expand Down Expand Up @@ -710,6 +712,19 @@ public BeneficiaryAccountVerification verifyAccount(BeneficiaryAccountVerificati
beneficiary.getPaymentType());
}

///////////////////////////////////////////////////////////////////
///// COLLECTIONS /////////////////////////////////////////////////

public CompleteCollectionsScreeningResponse completeCollectionsScreening(String transactionId, Boolean accepted, String reason) throws CurrencyCloudException {
return api.completeCollectionsScreening(
authToken,
userAgent,
transactionId,
accepted,
reason
);
}

///////////////////////////////////////////////////////////////////
///// CONTACTS ////////////////////////////////////////////////////

Expand Down Expand Up @@ -996,6 +1011,20 @@ public FundingAccounts findFundingAccounts(String currency, @Nullable String acc
);
}

/**
* @param id The Related Entity UUID for the transaction.
* @return The associated Funding Transaction
* @throws CurrencyCloudException When an error occurs
*/
public FundingTransaction getFundingTransaction(String id) throws CurrencyCloudException {
return api.getFundingTransction(
authToken,
userAgent,
id,
getOnBehalfOf()
);
}

///////////////////////////////////////////////////////////////////
///// IBANS ///////////////////////////////////////////////////////

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
package com.currencycloud.client.model;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.PropertyNamingStrategies;
import com.fasterxml.jackson.databind.annotation.JsonNaming;

import java.util.HashMap;
import java.util.Map;

@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class)
@JsonInclude(JsonInclude.Include.NON_NULL)
public class CompleteCollectionsScreeningResponse {

private String transactionId;
private String accountId;
private String houseAccountId;
private Result result;

public String getTransactionId() {
return transactionId;
}

public void setTransactionId(String transactionId) {
this.transactionId = transactionId;
}

public String getAccountId() {
return accountId;
}

public void setAccountId(String accountId) {
this.accountId = accountId;
}

public String getHouseAccountId() {
return houseAccountId;
}

public void setHouseAccountId(String houseAccountId) {
this.houseAccountId = houseAccountId;
}

public Result getResult() {
return result;
}

public void setResult(Result result) {
this.result = result;
}

@Override
public String toString() {
final ObjectMapper objectMapper = new ObjectMapper();

Map<String, Object> map = new HashMap<>();
map.put("transactionId", transactionId);
map.put("accountId", accountId);
map.put("houseAccountId", houseAccountId);
map.put("result", result);

try {
return objectMapper.writeValueAsString(map);
} catch (JsonProcessingException e) {
return String.format("{\"error\": \"%s\"}", e.getMessage());
}
}

@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class)
@JsonInclude(JsonInclude.Include.NON_NULL)
public static class Result {
private String reason;
private Boolean accepted;

public String getReason() {
return reason;
}

public void setReason(String reason) {
this.reason = reason;
}

public Boolean getAccepted() {
return accepted;
}

public void setAccepted(Boolean accepted) {
this.accepted = accepted;
}

@Override
public String toString() {
final ObjectMapper objectMapper = new ObjectMapper();

Map<String, Object> map = new HashMap<>();
map.put("reason", reason);
map.put("accepted", accepted);

try {
return objectMapper.writeValueAsString(map);
} catch (JsonProcessingException e) {
return String.format("{\"error\": \"%s\"}", e.getMessage());
}
}
}
}
Loading
Loading