use of org.thoughtcrime.securesms.payments.proto.PaymentMetaData in project Signal-Android by WhisperSystems.
the class LedgerReconcileTest method payment.
private static Payment payment(String note, Money.MobileCoin valueAndDirection, Set<ByteString> keyImages, Set<ByteString> publicKeys) {
UUID uuid = UUID.randomUUID();
PaymentMetaData.MobileCoinTxoIdentification.Builder builderForValue = PaymentMetaData.MobileCoinTxoIdentification.newBuilder();
builderForValue.addAllKeyImages(keyImages);
builderForValue.addAllPublicKey(publicKeys);
PaymentMetaData paymentMetaData = PaymentMetaData.newBuilder().setMobileCoinTxoIdentification(builderForValue).build();
return new Payment() {
@Override
@NonNull
public UUID getUuid() {
return uuid;
}
@Override
@NonNull
public Payee getPayee() {
return new Payee(RecipientId.from(1));
}
@Override
public long getBlockIndex() {
return 0;
}
@Override
public long getBlockTimestamp() {
return 0;
}
@Override
public long getTimestamp() {
return 0;
}
@Override
@NonNull
public Direction getDirection() {
return valueAndDirection.isNegative() ? Direction.SENT : Direction.RECEIVED;
}
@Override
@NonNull
public State getState() {
return State.SUCCESSFUL;
}
@Override
@Nullable
public FailureReason getFailureReason() {
return null;
}
@Override
@NonNull
public String getNote() {
return note;
}
@Override
@NonNull
public Money getAmount() {
return valueAndDirection.abs();
}
@Override
@NonNull
public Money getFee() {
return getAmount().toZero();
}
@Override
@NonNull
public PaymentMetaData getPaymentMetaData() {
return paymentMetaData;
}
@Override
public boolean isSeen() {
return true;
}
};
}
Aggregations