private void pay()

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


  private void pay(
      final StellarAccountId targetAccountId,
      final BigDecimal amount,
      final Asset sendAsset,
      final Asset receiveAsset,
      final char[] stellarAccountPrivateKey)
      throws InvalidConfigurationException, StellarPaymentFailedException
  {
    final KeyPair sourceAccountKeyPair = KeyPair.fromSecretSeed(stellarAccountPrivateKey);
    final KeyPair targetAccountKeyPair = KeyPair.fromAccountId(targetAccountId.getPublicKey());

    final Account sourceAccount = accounts.getUnchecked(sourceAccountKeyPair.getAccountId());

    final Transaction.Builder transferTransactionBuilder
        = new Transaction.Builder(sourceAccount);
    final PathPaymentOperation paymentOperation =
        new PathPaymentOperation.Builder(
            sendAsset,
            StellarAccountHelpers.bigDecimalToStellarBalance(amount),
            targetAccountKeyPair,
            receiveAsset,
            StellarAccountHelpers.bigDecimalToStellarBalance(amount))
            .setSourceAccount(sourceAccountKeyPair).build();

    transferTransactionBuilder.addOperation(paymentOperation);

    if (targetAccountId.getSubAccount().isPresent())
    {
      final Memo subAccountMemo = Memo.text(targetAccountId.getSubAccount().get());
      transferTransactionBuilder.addMemo(subAccountMemo);
    }

    submitTransaction(sourceAccount, transferTransactionBuilder, sourceAccountKeyPair,
        StellarPaymentFailedException::transactionFailed);
  }