Search in sources :

Example 1 with MirrorCustomFees

use of com.hedera.mirror.test.e2e.acceptance.props.MirrorCustomFees in project hedera-mirror-node by hashgraph.

the class TokenFeature method verifyTokenWithCustomFeesSchedule.

private void verifyTokenWithCustomFeesSchedule(TokenId tokenId, String createdTimestamp) {
    MirrorTokenResponse response = verifyToken(tokenId);
    MirrorCustomFees expected = new MirrorCustomFees();
    expected.setCreatedTimestamp(createdTimestamp);
    for (CustomFee customFee : tokenCustomFees.get(tokenId)) {
        if (customFee instanceof CustomFixedFee) {
            CustomFixedFee sdkFixedFee = (CustomFixedFee) customFee;
            MirrorFixedFee fixedFee = new MirrorFixedFee();
            fixedFee.setAmount(sdkFixedFee.getAmount());
            fixedFee.setCollectorAccountId(sdkFixedFee.getFeeCollectorAccountId().toString());
            if (sdkFixedFee.getDenominatingTokenId() != null) {
                fixedFee.setDenominatingTokenId(sdkFixedFee.getDenominatingTokenId().toString());
            }
            expected.getFixedFees().add(fixedFee);
        } else {
            CustomFractionalFee sdkFractionalFee = (CustomFractionalFee) customFee;
            MirrorFractionalFee fractionalFee = new MirrorFractionalFee();
            MirrorFraction fraction = new MirrorFraction();
            fraction.setNumerator(sdkFractionalFee.getNumerator());
            fraction.setDenominator(sdkFractionalFee.getDenominator());
            fractionalFee.setAmount(fraction);
            fractionalFee.setCollectorAccountId(sdkFractionalFee.getFeeCollectorAccountId().toString());
            fractionalFee.setDenominatingTokenId(tokenId.toString());
            if (sdkFractionalFee.getMax() != 0) {
                fractionalFee.setMaximum(sdkFractionalFee.getMax());
            }
            fractionalFee.setMinimum(sdkFractionalFee.getMin());
            expected.getFractionalFees().add(fractionalFee);
        }
    }
    MirrorCustomFees actual = response.getCustomFees();
    assertThat(actual).usingRecursiveComparison(RecursiveComparisonConfiguration.builder().withIgnoreCollectionOrder(true).build()).isEqualTo(expected);
}
Also used : MirrorCustomFees(com.hedera.mirror.test.e2e.acceptance.props.MirrorCustomFees) MirrorFraction(com.hedera.mirror.test.e2e.acceptance.props.MirrorFraction) CustomFractionalFee(com.hedera.hashgraph.sdk.CustomFractionalFee) CustomFee(com.hedera.hashgraph.sdk.CustomFee) MirrorAssessedCustomFee(com.hedera.mirror.test.e2e.acceptance.props.MirrorAssessedCustomFee) CustomFixedFee(com.hedera.hashgraph.sdk.CustomFixedFee) MirrorFractionalFee(com.hedera.mirror.test.e2e.acceptance.props.MirrorFractionalFee) MirrorFixedFee(com.hedera.mirror.test.e2e.acceptance.props.MirrorFixedFee) MirrorTokenResponse(com.hedera.mirror.test.e2e.acceptance.response.MirrorTokenResponse)

Aggregations

CustomFee (com.hedera.hashgraph.sdk.CustomFee)1 CustomFixedFee (com.hedera.hashgraph.sdk.CustomFixedFee)1 CustomFractionalFee (com.hedera.hashgraph.sdk.CustomFractionalFee)1 MirrorAssessedCustomFee (com.hedera.mirror.test.e2e.acceptance.props.MirrorAssessedCustomFee)1 MirrorCustomFees (com.hedera.mirror.test.e2e.acceptance.props.MirrorCustomFees)1 MirrorFixedFee (com.hedera.mirror.test.e2e.acceptance.props.MirrorFixedFee)1 MirrorFraction (com.hedera.mirror.test.e2e.acceptance.props.MirrorFraction)1 MirrorFractionalFee (com.hedera.mirror.test.e2e.acceptance.props.MirrorFractionalFee)1 MirrorTokenResponse (com.hedera.mirror.test.e2e.acceptance.response.MirrorTokenResponse)1