com.truelayer.java.merchantaccounts.entities.transactions.Payout Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of truelayer-java Show documentation
Show all versions of truelayer-java Show documentation
TrueLayer Java SDK for https://truelayer.com
package com.truelayer.java.merchantaccounts.entities.transactions;
import com.fasterxml.jackson.annotation.JsonGetter;
import com.fasterxml.jackson.annotation.JsonValue;
import com.truelayer.java.entities.CurrencyCode;
import com.truelayer.java.entities.beneficiary.Beneficiary;
import java.time.ZonedDateTime;
import java.util.Optional;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import lombok.Value;
/**
* DTO class that represents both pending
and executed
payouts.
* We're not defining explicit variants in this case based on the status
field because
* it seems that the library used for deserialization is not capable of handling more than one deserialization hints,
* which would be required in this case to first select a DTO based on the type
and then on the
* status
fields.
*/
@Value
@EqualsAndHashCode(callSuper = false)
public class Payout extends Transaction {
Transaction.Type type = Transaction.Type.PAYOUT;
String id;
CurrencyCode currency;
int amountInMinor;
/**
* Represents the status of the payout.
* Either pending
or executed
.
*/
Transaction.Status status;
ZonedDateTime createdAt;
ZonedDateTime executedAt;
Beneficiary beneficiary;
Payout.ContextCode contextCode;
String payoutId;
@JsonGetter
public Optional getExecutedAt() {
return Optional.ofNullable(executedAt);
}
@RequiredArgsConstructor
@Getter
public enum ContextCode {
WITHDRAWAL("withdrawal"),
SERVICE_PAYMENT("service_payment"),
INTERNAL("internal");
@JsonValue
private final String status;
}
}