Skip to content

Commit

Permalink
Add search payments providers endpoint + statement reference to merch…
Browse files Browse the repository at this point in the history
…ant account (#330)
  • Loading branch information
tl-luca-baggi authored Dec 10, 2024
1 parent a23875c commit 653cd57
Show file tree
Hide file tree
Showing 38 changed files with 499 additions and 15 deletions.
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 {
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;

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;
}
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

0 comments on commit 653cd57

Please sign in to comment.