-
Notifications
You must be signed in to change notification settings - Fork 9
[ACL-305] Adds support for Verified Payouts #380
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
0218b95
Add Verified Payout entities to Create and Get Payout request/response
dili91 56159bb
Adds unit and integration tests for Create and Get payout endpoints
dili91 dcb9fce
Apply code formatting
dili91 11a8f0c
Add payout support to HPP link builder
dili91 66d1df1
Add acceptance tests for verified payouts
dili91 54d146d
refactor
dili91 7a11703
version change
dili91 5db9a1b
Update CHANGELOG
dili91 738218a
Change version to 17.5.0 (non-breaking)
dili91 4cce977
primitive type used
dili91 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
6 changes: 6 additions & 0 deletions
6
src/main/java/com/truelayer/java/entities/HostedPageType.java
This file contains hidden or 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,6 @@ | ||
| package com.truelayer.java.entities; | ||
|
|
||
| public enum HostedPageType { | ||
| HPP, | ||
| HP2 | ||
| } |
This file contains hidden or 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,15 +1,20 @@ | ||
| package com.truelayer.java.entities; | ||
|
|
||
| import static com.truelayer.java.entities.HostedPageType.HP2; | ||
| import static com.truelayer.java.entities.HostedPageType.HPP; | ||
|
|
||
| import lombok.Getter; | ||
| import lombok.RequiredArgsConstructor; | ||
|
|
||
| @RequiredArgsConstructor | ||
| @Getter | ||
| public enum ResourceType { | ||
| PAYMENT("payments", "payment_id"), | ||
| MANDATE("mandates", "mandate_id"), | ||
| PAYMENT("payments", "payment_id", HPP), | ||
| MANDATE("mandates", "mandate_id", HPP), | ||
| PAYOUT("payouts", "payout_id", HP2), | ||
| ; | ||
|
|
||
| private final String hppLinkPath; | ||
| private final String hppLinkQueryParameter; | ||
| private final HostedPageType hostedPageType; | ||
| } | ||
This file contains hidden or 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
26 changes: 26 additions & 0 deletions
26
src/main/java/com/truelayer/java/entities/beneficiary/UserDetermined.java
This file contains hidden or 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,26 @@ | ||
| package com.truelayer.java.entities.beneficiary; | ||
|
|
||
| import static com.truelayer.java.entities.beneficiary.Beneficiary.Type.USER_DETERMINED; | ||
|
|
||
| import com.truelayer.java.merchantaccounts.entities.transactions.accountidentifier.AccountIdentifier; | ||
| import com.truelayer.java.payouts.entities.PayoutUser; | ||
| import com.truelayer.java.payouts.entities.beneficiary.Verification; | ||
| import java.util.List; | ||
| import lombok.EqualsAndHashCode; | ||
| import lombok.Value; | ||
|
|
||
| @Value | ||
| @EqualsAndHashCode(callSuper = false) | ||
| public class UserDetermined extends Beneficiary { | ||
| Type type = USER_DETERMINED; | ||
|
|
||
| String reference; | ||
|
|
||
| String accountHolderName; | ||
|
|
||
| List<AccountIdentifier> accountIdentifiers; | ||
|
|
||
| PayoutUser user; | ||
|
|
||
| Verification verification; | ||
| } |
16 changes: 16 additions & 0 deletions
16
src/main/java/com/truelayer/java/payouts/entities/AuthorizationRequiredPayout.java
This file contains hidden or 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,16 @@ | ||
| package com.truelayer.java.payouts.entities; | ||
|
|
||
| import com.truelayer.java.payouts.entities.beneficiary.Beneficiary; | ||
| import lombok.EqualsAndHashCode; | ||
| import lombok.Getter; | ||
| import lombok.ToString; | ||
|
|
||
| @Getter | ||
| @ToString(callSuper = true) | ||
| @EqualsAndHashCode(callSuper = true) | ||
| public class AuthorizationRequiredPayout extends CreatePayoutResponse { | ||
| private final Status status = Status.AUTHORIZATION_REQUIRED; | ||
| private String resourceToken; | ||
| private PayoutUser user; | ||
| private Beneficiary beneficiary; | ||
| } |
10 changes: 10 additions & 0 deletions
10
src/main/java/com/truelayer/java/payouts/entities/AuthorizationRequiredPayoutDetail.java
This file contains hidden or 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,10 @@ | ||
| package com.truelayer.java.payouts.entities; | ||
|
|
||
| import lombok.EqualsAndHashCode; | ||
| import lombok.Value; | ||
|
|
||
| @Value | ||
| @EqualsAndHashCode(callSuper = false) | ||
| public class AuthorizationRequiredPayoutDetail extends Payout { | ||
| Status status = Status.AUTHORIZATION_REQUIRED; | ||
| } |
10 changes: 10 additions & 0 deletions
10
src/main/java/com/truelayer/java/payouts/entities/AuthorizingPayout.java
This file contains hidden or 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,10 @@ | ||
| package com.truelayer.java.payouts.entities; | ||
|
|
||
| import lombok.EqualsAndHashCode; | ||
| import lombok.Value; | ||
|
|
||
| @Value | ||
| @EqualsAndHashCode(callSuper = false) | ||
| public class AuthorizingPayout extends Payout { | ||
| Status status = Status.AUTHORIZING; | ||
| } |
53 changes: 52 additions & 1 deletion
53
src/main/java/com/truelayer/java/payouts/entities/CreatePayoutResponse.java
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not considering this a breaking change, because:
|
This file contains hidden or 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,12 +1,63 @@ | ||
| package com.truelayer.java.payouts.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.EqualsAndHashCode; | ||
| import lombok.Getter; | ||
| import lombok.RequiredArgsConstructor; | ||
| import lombok.ToString; | ||
|
|
||
| @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "status", defaultImpl = CreatedPayout.class) | ||
| @JsonSubTypes({ | ||
| @JsonSubTypes.Type(value = CreatedPayout.class, name = "created"), | ||
| @JsonSubTypes.Type(value = AuthorizationRequiredPayout.class, name = "authorization_required") | ||
| }) | ||
| @ToString | ||
| @EqualsAndHashCode | ||
| @Getter | ||
| public class CreatePayoutResponse { | ||
| public abstract class CreatePayoutResponse { | ||
| private String id; | ||
|
|
||
| @JsonIgnore | ||
| public abstract Status getStatus(); | ||
|
|
||
| @JsonIgnore | ||
| public boolean isCreated() { | ||
| return this instanceof CreatedPayout; | ||
| } | ||
|
|
||
| @JsonIgnore | ||
| public boolean isAuthorizationRequired() { | ||
| return this instanceof AuthorizationRequiredPayout; | ||
| } | ||
|
|
||
| @JsonIgnore | ||
| public CreatedPayout asCreated() { | ||
| if (!isCreated()) throw new TrueLayerException(buildErrorMessage()); | ||
| return (CreatedPayout) this; | ||
| } | ||
|
|
||
| @JsonIgnore | ||
| public AuthorizationRequiredPayout asAuthorizationRequired() { | ||
| if (!isAuthorizationRequired()) throw new TrueLayerException(buildErrorMessage()); | ||
| return (AuthorizationRequiredPayout) this; | ||
| } | ||
|
|
||
| private String buildErrorMessage() { | ||
| return String.format( | ||
| "Create payout response is of type %s.", this.getClass().getSimpleName()); | ||
| } | ||
|
|
||
| @Getter | ||
| @RequiredArgsConstructor | ||
| public enum Status { | ||
| CREATED("created"), | ||
| AUTHORIZATION_REQUIRED("authorization_required"); | ||
|
|
||
| @JsonValue | ||
| private final String status; | ||
| } | ||
| } |
10 changes: 10 additions & 0 deletions
10
src/main/java/com/truelayer/java/payouts/entities/CreatedPayout.java
This file contains hidden or 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,10 @@ | ||
| package com.truelayer.java.payouts.entities; | ||
|
|
||
| import lombok.EqualsAndHashCode; | ||
| import lombok.Value; | ||
|
|
||
| @Value | ||
| @EqualsAndHashCode(callSuper = false) | ||
| public class CreatedPayout extends CreatePayoutResponse { | ||
| Status status = Status.CREATED; | ||
| } |
This file contains hidden or 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: 12 additions & 0 deletions
12
src/main/java/com/truelayer/java/payouts/entities/PayoutUser.java
This file contains hidden or 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.payouts.entities; | ||
|
|
||
| import lombok.EqualsAndHashCode; | ||
| import lombok.Getter; | ||
| import lombok.ToString; | ||
|
|
||
| @Getter | ||
| @ToString | ||
| @EqualsAndHashCode | ||
| public class PayoutUser { | ||
| private String id; | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.