use of com.hederahashgraph.api.proto.java.ResponseCodeEnum in project hedera-services by hashgraph.
the class FeeChargingPolicyTest method chargesFullFeesAsExpected.
@Test
void chargesFullFeesAsExpected() {
givenPayerWillingAndAbleForAllFees();
// when:
ResponseCodeEnum outcome = subject.apply(fees);
// then:
verify(narratedCharging).setFees(fees);
verify(narratedCharging).chargePayerAllFees();
// and:
assertEquals(OK, outcome);
}
use of com.hederahashgraph.api.proto.java.ResponseCodeEnum in project hedera-services by hashgraph.
the class FeeChargingPolicyTest method requiresWillingToPayServiceWhenTriggeredTxn.
@Test
void requiresWillingToPayServiceWhenTriggeredTxn() {
given(narratedCharging.isPayerWillingToCoverServiceFee()).willReturn(false);
// when:
ResponseCodeEnum outcome = subject.applyForTriggered(fees);
// then:
verify(narratedCharging).setFees(fees);
verify(narratedCharging, never()).chargePayerServiceFee();
// and:
assertEquals(INSUFFICIENT_TX_FEE, outcome);
}
use of com.hederahashgraph.api.proto.java.ResponseCodeEnum in project hedera-services by hashgraph.
the class FeeChargingPolicyTest method chargesNodePenaltyForPayerUnableToPayNetwork.
@Test
void chargesNodePenaltyForPayerUnableToPayNetwork() {
given(narratedCharging.isPayerWillingToCoverNetworkFee()).willReturn(true);
given(narratedCharging.canPayerAffordNetworkFee()).willReturn(false);
// when:
ResponseCodeEnum outcome = subject.apply(fees);
// then:
verify(narratedCharging).setFees(fees);
verify(narratedCharging).chargeSubmittingNodeUpToNetworkFee();
// and:
assertEquals(INSUFFICIENT_PAYER_BALANCE, outcome);
}
use of com.hederahashgraph.api.proto.java.ResponseCodeEnum in project hedera-services by hashgraph.
the class PureTransferSemanticChecks method validateTokenTransferSemantics.
ResponseCodeEnum validateTokenTransferSemantics(List<TokenTransferList> tokenTransfersList) {
if (tokenTransfersList.isEmpty()) {
return OK;
}
ResponseCodeEnum validity;
final Set<TokenID> uniqueTokens = new HashSet<>();
for (var tokenTransfers : tokenTransfersList) {
validity = validateScopedTransferSemantics(uniqueTokens, tokenTransfers);
if (validity != OK) {
return validity;
}
}
if (uniqueTokens.size() < tokenTransfersList.size()) {
return TOKEN_ID_REPEATED_IN_TOKEN_LIST;
}
return OK;
}
use of com.hederahashgraph.api.proto.java.ResponseCodeEnum in project hedera-services by hashgraph.
the class SigRequirementsTest method reportsGeneralErrorInCryptoTransfer.
@Test
void reportsGeneralErrorInCryptoTransfer() throws Throwable {
// given:
setupForNonStdLookup(CRYPTO_TRANSFER_NO_RECEIVER_SIG_SCENARIO, new DelegatingSigMetadataLookup(FileAdapter.throwingUoe(), AccountAdapter.withSafe(id -> SafeLookupResult.failure(KeyOrderingFailure.MISSING_FILE)), ContractAdapter.withSafe(id -> SafeLookupResult.failure(KeyOrderingFailure.INVALID_CONTRACT)), TopicAdapter.throwingUoe(), id -> null, id -> null));
mockSummaryFactory();
// and:
SigningOrderResult<ResponseCodeEnum> result = mock(SigningOrderResult.class);
given(mockSummaryFactory.forGeneralError()).willReturn(result);
// when:
subject.keysForOtherParties(txn, mockSummaryFactory);
// then:
verify(mockSummaryFactory).forGeneralError();
}
Aggregations