Skip to content
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
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ dependencies {

// Mocking libraries
testImplementation group: 'org.mockito', name: 'mockito-core', version: '5.14.2'
testImplementation group: 'org.wiremock', name: 'wiremock', version: '3.9.2'
testImplementation group: 'org.wiremock', name: 'wiremock', version: '3.10.0'

// Wait test utility
testImplementation group: 'org.awaitility', name: 'awaitility', version: '4.2.2'
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Main properties
group=com.truelayer
archivesBaseName=truelayer-java
version=16.1.0
version=16.2.0

# Artifacts properties
sonatype_repository_url=https://s01.oss.sonatype.org/service/local/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,6 @@ public class MerchantAccount extends Beneficiary {
private String reference;

private Verification verification;

private String statementReference;
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
import com.truelayer.java.entities.RequestScopes;
import com.truelayer.java.http.entities.ApiResponse;
import com.truelayer.java.paymentsproviders.entities.PaymentsProvider;
import com.truelayer.java.paymentsproviders.entities.searchproviders.SearchPaymentProvidersRequest;
import com.truelayer.java.paymentsproviders.entities.searchproviders.SearchPaymentProvidersResponse;
import java.util.concurrent.CompletableFuture;
import retrofit2.http.GET;
import retrofit2.http.Path;
import retrofit2.http.Tag;
import retrofit2.http.*;

/**
* Interface that models /payments-providers/* endpoints
Expand All @@ -16,4 +16,8 @@ public interface IPaymentsProvidersApi {
@GET("/payments-providers/{id}")
CompletableFuture<ApiResponse<PaymentsProvider>> getProvider(
@Tag RequestScopes scopes, @Path("id") String providerId);

@POST("/payments-providers/search")
CompletableFuture<ApiResponse<SearchPaymentProvidersResponse>> searchPaymentProviders(
@Tag RequestScopes scopes, @Body SearchPaymentProvidersRequest request);
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import com.truelayer.java.http.entities.ApiResponse;
import com.truelayer.java.paymentsproviders.entities.PaymentsProvider;
import com.truelayer.java.paymentsproviders.entities.searchproviders.SearchPaymentProvidersRequest;
import com.truelayer.java.paymentsproviders.entities.searchproviders.SearchPaymentProvidersResponse;
import java.util.concurrent.CompletableFuture;

/**
Expand All @@ -19,4 +21,14 @@ public interface IPaymentsProvidersHandler {
* @see <a href="https://docs.truelayer.com/reference/get-payment-provider"><i>Get Payment Provider</i> API reference</a>
*/
CompletableFuture<ApiResponse<PaymentsProvider>> getProvider(String providerId);

/**
* Returns a list of payments providers.
*
* @param request the request with filters to search providers
* @return the response of the <i>Search Payments Providers</i> operation
* @see <a href="https://docs.truelayer.com/reference/search-payment-providers"><i>Search Payment Providers</i> API reference</a>
*/
CompletableFuture<ApiResponse<SearchPaymentProvidersResponse>> searchProviders(
SearchPaymentProvidersRequest request);
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import com.truelayer.java.entities.RequestScopes;
import com.truelayer.java.http.entities.ApiResponse;
import com.truelayer.java.paymentsproviders.entities.PaymentsProvider;
import com.truelayer.java.paymentsproviders.entities.searchproviders.SearchPaymentProvidersRequest;
import com.truelayer.java.paymentsproviders.entities.searchproviders.SearchPaymentProvidersResponse;
import java.util.concurrent.CompletableFuture;
import lombok.Builder;

Expand All @@ -29,4 +31,10 @@ public RequestScopes getRequestScopes() {
public CompletableFuture<ApiResponse<PaymentsProvider>> getProvider(String providerId) {
return paymentsProvidersApi.getProvider(getRequestScopes(), providerId);
}

@Override
public CompletableFuture<ApiResponse<SearchPaymentProvidersResponse>> searchProviders(
SearchPaymentProvidersRequest request) {
return paymentsProvidersApi.searchPaymentProviders(getRequestScopes(), request);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.truelayer.java.paymentsproviders.entities.searchproviders;

import java.util.List;
import lombok.*;

@Builder
@Getter
@ToString
@EqualsAndHashCode
public class AisConsent {
private List<Scope> scopes;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.truelayer.java.paymentsproviders.entities.searchproviders;

import lombok.*;

@Builder
@Getter
@ToString
@EqualsAndHashCode
public class AuthorizationFlow {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needed, right? Like, we don't have already a AuthFlow model with just the config object

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's correct, we have another AuthorizationFlow entity but it's different (it's a wrapper for an actions object and it's used in the start auth flow API response)

private Configuration configuration;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.truelayer.java.paymentsproviders.entities.searchproviders;

import lombok.Value;

@Value
public class BankTransferCapabilities {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.truelayer.java.paymentsproviders.entities.searchproviders;

import lombok.Builder;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.ToString;

@Builder
@Getter
@ToString
@EqualsAndHashCode
public class Capabilities {
PaymentsCapabilities payments;

MandatesCapabilities mandates;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.truelayer.java.paymentsproviders.entities.searchproviders;

import lombok.*;

@Builder
@Getter
@ToString
@EqualsAndHashCode
public class Configuration {
private ProviderSelection providerSelection;

private Redirect redirect;

private Form form;

private Consent consent;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.truelayer.java.paymentsproviders.entities.searchproviders;

import lombok.*;

@Builder
@Getter
@ToString
@EqualsAndHashCode
public class Consent {
private Requirements requirements;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.truelayer.java.paymentsproviders.entities.searchproviders;

import java.util.List;
import lombok.*;

@Builder
@Getter
@ToString
@EqualsAndHashCode
public class Form {
private List<InputType> inputTypes;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.truelayer.java.paymentsproviders.entities.searchproviders;

import lombok.*;

@Builder
@Getter
@ToString
@EqualsAndHashCode
public class Icon {
private IconType type;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.truelayer.java.paymentsproviders.entities.searchproviders;

import com.fasterxml.jackson.annotation.JsonValue;
import lombok.Getter;
import lombok.RequiredArgsConstructor;

@RequiredArgsConstructor
@Getter
public enum IconType {
DEFAULT("default"),
EXTENDED("extended"),
EXTENDED_SMALL("extended_small"),
EXTENDED_MEDIUM("extended_medium"),
EXTENDED_LARGE("extended_large");

@JsonValue
private final String iconType;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.truelayer.java.paymentsproviders.entities.searchproviders;

import com.fasterxml.jackson.annotation.JsonValue;
import lombok.Getter;
import lombok.RequiredArgsConstructor;

@RequiredArgsConstructor
@Getter
public enum InputType {
TEXT("text"),
TEXT_WITH_IMAGE("text_with_image"),
SELECT("select");

@JsonValue
private final String inputType;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.truelayer.java.paymentsproviders.entities.searchproviders;

import lombok.Builder;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.ToString;

@Builder
@Getter
@ToString
@EqualsAndHashCode
public class MandatesCapabilities {
VrpSweepingCapabilities vrpSweeping;

VrpCommercialCapabilities vrpCommercial;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.truelayer.java.paymentsproviders.entities.searchproviders;

import lombok.Builder;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.ToString;

@Builder
@Getter
@ToString
@EqualsAndHashCode
public class PaymentsCapabilities {
BankTransferCapabilities bankTransfer;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.truelayer.java.paymentsproviders.entities.searchproviders;

import lombok.*;

@Builder
@Getter
@ToString
@EqualsAndHashCode
public class PisConsent {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.truelayer.java.paymentsproviders.entities.searchproviders;

import lombok.*;

@Builder
@Getter
@ToString
@EqualsAndHashCode
public class ProviderSelection {
private Icon icon;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.truelayer.java.paymentsproviders.entities.searchproviders;

import lombok.*;

@Builder
@Getter
@ToString
@EqualsAndHashCode
public class Redirect {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.truelayer.java.paymentsproviders.entities.searchproviders;

import lombok.*;

@Builder
@Getter
@ToString
@EqualsAndHashCode
public class Requirements {
private PisConsent pis;

private AisConsent ais;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.truelayer.java.paymentsproviders.entities.searchproviders;

import com.fasterxml.jackson.annotation.JsonValue;
import lombok.Getter;
import lombok.RequiredArgsConstructor;

@RequiredArgsConstructor
@Getter
public enum Scope {
ACCOUNTS("accounts"),
BALANCE("balance");

@JsonValue
private final String scope;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package com.truelayer.java.paymentsproviders.entities.searchproviders;

import com.truelayer.java.entities.CurrencyCode;
import com.truelayer.java.payments.entities.CountryCode;
import com.truelayer.java.payments.entities.CustomerSegment;
import com.truelayer.java.payments.entities.ReleaseChannel;
import java.util.List;
import lombok.Builder;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.ToString;

@Builder
@Getter
@ToString
@EqualsAndHashCode
public class SearchPaymentProvidersRequest {
private List<CountryCode> countries;

private List<CurrencyCode> currencies;

private ReleaseChannel releaseChannel;

private List<CustomerSegment> customerSegments;

private Capabilities capabilities;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could not reuse the same Capabilities object already defined in the entities folder (currently used for responses) because in the request BankTransferCapabilites, VrpSweepingCapabilities and VrpCommercialCapabilities are empty objects (whereas they have additional properties in the response).

I initially considered reusing the same objects anyway as adding additional properties in the request was not creating side effects in the APIs, but then I thought it might have led to confusion clients if they were expecting to use those additional properties for filtering out providers


private AuthorizationFlow authorizationFlow;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.truelayer.java.paymentsproviders.entities.searchproviders;

import com.truelayer.java.paymentsproviders.entities.PaymentsProvider;
import java.util.List;
import lombok.Value;

@Value
public class SearchPaymentProvidersResponse {
List<PaymentsProvider> items;
Copy link
Contributor

@dili91 dili91 Dec 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it expected that we're not adding BIN ranges to this PaymentsProvider type, right? Happy to skip them

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually missed that, I would add it to keep feature parity with the API, unless you think is really not needed?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's bring this to @federico1525

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.truelayer.java.paymentsproviders.entities.searchproviders;

import lombok.Value;

@Value
public class VrpCommercialCapabilities {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.truelayer.java.paymentsproviders.entities.searchproviders;

import lombok.Value;

@Value
public class VrpSweepingCapabilities {}
Loading
Loading