public void findPathPay()

in service/src/main/java/org/apache/fineract/cn/stellarbridge/service/internal/horizonadapter/HorizonServerUtilities.java [160:185]


  public void findPathPay(
      final StellarAccountId targetAccountId,
      final BigDecimal amount,
      final String assetCode,
      final char[] stellarAccountPrivateKey)
      throws InvalidConfigurationException, StellarPaymentFailedException
  {
    logger.info("HorizonServerUtilities.findPathPay");
    final KeyPair sourceAccountKeyPair = KeyPair.fromSecretSeed(stellarAccountPrivateKey);
    final KeyPair targetAccountKeyPair = KeyPair.fromAccountId(targetAccountId.getPublicKey());

    final StellarAccountHelpers sourceAccount = getAccount(sourceAccountKeyPair);
    final StellarAccountHelpers targetAccount = getAccount(targetAccountKeyPair);

    final Set<Asset> targetAssets = targetAccount.findAssetsWithTrust(amount, assetCode);
    final Set<Asset> sourceAssets = sourceAccount.findAssetsWithBalance(amount, assetCode);

    final Optional<MatchingAssetPair> assetPair = findAnyMatchingAssetPair(
        amount, sourceAssets, targetAssets, sourceAccountKeyPair, targetAccountKeyPair);
    if (!assetPair.isPresent())
      throw StellarPaymentFailedException.noPathExists(assetCode);

    pay(targetAccountId, amount,
        assetPair.get().asset1, assetPair.get().asset2,
        stellarAccountPrivateKey);
  }