-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(EWT-389): Full support for cVRP and simplified headless authoris…
…ation in acceptance tests (#243) Co-authored-by: tl-luca-baggi <luca.baggi@truelayer.com>
- Loading branch information
1 parent
617ead0
commit 55ff477
Showing
21 changed files
with
462 additions
and
166 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 6 additions & 6 deletions
12
src/main/java/com/truelayer/java/commonapi/ICommonHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
package com.truelayer.java.commonapi; | ||
|
||
import com.truelayer.java.commonapi.entities.SubmitPaymentReturnParametersRequest; | ||
import com.truelayer.java.commonapi.entities.SubmitPaymentReturnParametersResponse; | ||
import com.truelayer.java.commonapi.entities.SubmitPaymentsProviderReturnRequest; | ||
import com.truelayer.java.commonapi.entities.SubmitPaymentsProviderReturnResponse; | ||
import com.truelayer.java.http.entities.ApiResponse; | ||
import com.truelayer.java.http.entities.Headers; | ||
import java.util.concurrent.CompletableFuture; | ||
|
||
public interface ICommonHandler { | ||
|
||
CompletableFuture<ApiResponse<SubmitPaymentReturnParametersResponse>> submitPaymentReturnParameters( | ||
SubmitPaymentReturnParametersRequest request); | ||
CompletableFuture<ApiResponse<SubmitPaymentsProviderReturnResponse>> submitPaymentReturnParameters( | ||
SubmitPaymentsProviderReturnRequest request); | ||
|
||
CompletableFuture<ApiResponse<SubmitPaymentReturnParametersResponse>> submitPaymentReturnParameters( | ||
Headers headers, SubmitPaymentReturnParametersRequest request); | ||
CompletableFuture<ApiResponse<SubmitPaymentsProviderReturnResponse>> submitPaymentReturnParameters( | ||
Headers headers, SubmitPaymentsProviderReturnRequest request); | ||
} |
12 changes: 12 additions & 0 deletions
12
src/main/java/com/truelayer/java/commonapi/entities/MandateProviderReturnResource.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.truelayer.java.commonapi.entities; | ||
|
||
import lombok.EqualsAndHashCode; | ||
import lombok.Value; | ||
|
||
@Value | ||
@EqualsAndHashCode(callSuper = false) | ||
public class MandateProviderReturnResource extends ProviderReturnResource { | ||
Type type = Type.MANDATE; | ||
|
||
String mandateId; | ||
} |
12 changes: 12 additions & 0 deletions
12
src/main/java/com/truelayer/java/commonapi/entities/PaymentProviderReturnResource.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.truelayer.java.commonapi.entities; | ||
|
||
import lombok.EqualsAndHashCode; | ||
import lombok.Value; | ||
|
||
@Value | ||
@EqualsAndHashCode(callSuper = false) | ||
public class PaymentProviderReturnResource extends ProviderReturnResource { | ||
Type type = Type.PAYMENT; | ||
|
||
String paymentId; | ||
} |
65 changes: 65 additions & 0 deletions
65
src/main/java/com/truelayer/java/commonapi/entities/ProviderReturnResource.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
package com.truelayer.java.commonapi.entities; | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnore; | ||
import com.fasterxml.jackson.annotation.JsonSubTypes; | ||
import com.fasterxml.jackson.annotation.JsonTypeInfo; | ||
import com.fasterxml.jackson.annotation.JsonValue; | ||
import com.truelayer.java.TrueLayerException; | ||
import lombok.Getter; | ||
import lombok.RequiredArgsConstructor; | ||
|
||
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", defaultImpl = PaymentProviderReturnResource.class) | ||
@JsonSubTypes({ | ||
@JsonSubTypes.Type(value = PaymentProviderReturnResource.class, name = "payment"), | ||
@JsonSubTypes.Type(value = MandateProviderReturnResource.class, name = "mandate") | ||
}) | ||
@Getter | ||
public abstract class ProviderReturnResource { | ||
String type; | ||
|
||
String paymentId; | ||
|
||
@JsonIgnore | ||
public abstract Type getType(); | ||
|
||
@JsonIgnore | ||
public boolean isPaymentProviderReturnResponse() { | ||
return this instanceof PaymentProviderReturnResource; | ||
} | ||
|
||
@JsonIgnore | ||
public boolean isMandateProviderReturnResponse() { | ||
return this instanceof MandateProviderReturnResource; | ||
} | ||
|
||
@JsonIgnore | ||
public PaymentProviderReturnResource asPaymentProviderReturnResponse() { | ||
if (!isPaymentProviderReturnResponse()) { | ||
throw new TrueLayerException(buildErrorMessage()); | ||
} | ||
return (PaymentProviderReturnResource) this; | ||
} | ||
|
||
@JsonIgnore | ||
public MandateProviderReturnResource asMandateProviderReturnResponse() { | ||
if (!isMandateProviderReturnResponse()) { | ||
throw new TrueLayerException(buildErrorMessage()); | ||
} | ||
return (MandateProviderReturnResource) this; | ||
} | ||
|
||
private String buildErrorMessage() { | ||
return String.format( | ||
"Provider return resource is of type %s.", this.getClass().getSimpleName()); | ||
} | ||
|
||
@RequiredArgsConstructor | ||
@Getter | ||
public enum Type { | ||
PAYMENT("payment"), | ||
MANDATE("mandate"); | ||
|
||
@JsonValue | ||
private final String type; | ||
} | ||
} |
16 changes: 0 additions & 16 deletions
16
...ain/java/com/truelayer/java/commonapi/entities/SubmitPaymentReturnParametersResponse.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
...main/java/com/truelayer/java/commonapi/entities/SubmitPaymentsProviderReturnResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package com.truelayer.java.commonapi.entities; | ||
|
||
import lombok.Value; | ||
|
||
@Value | ||
public class SubmitPaymentsProviderReturnResponse { | ||
ProviderReturnResource resource; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.