Package com.google.bitcoin.protocols.payments

Examples of com.google.bitcoin.protocols.payments.PaymentSession


        try {
            org.bitcoin.protocols.payments.Protos.PaymentRequest paymentRequest =
                org.bitcoin.protocols.payments.Protos.PaymentRequest.parseFrom(stream);

            PaymentSession session = new PaymentSession(paymentRequest, false);

            validatePaymentRequest(session);

            int sessionId = ++paymentSessionsSequenceId;
            paymentSessions.put(sessionId, session);
View Full Code Here


    public void sendPaymentRequest(final int sessionId, char[] utf16Password, final int callbackId)
            throws WrongPasswordException, InsufficientMoneyException, PaymentRequestException, IOException {
        KeyParameter aesKey = null;

        try {
            PaymentSession session = paymentSessions.get(sessionId);
            final Wallet.SendRequest request = session.getSendRequest();

            if (utf16Password != null) {
                aesKey = aesKeyForPassword(utf16Password);
                request.aesKey = aesKey;
            }

            wallet.completeTx(request);

            final Transaction tx = request.tx;
            Address refundAddress = wallet.getKeys().get(0).toAddress(networkParams);
            List<Transaction> transactions = ImmutableList.of(tx);

            ListenableFuture<PaymentSession.Ack> fack = session.sendPayment(transactions, refundAddress, null);

            if (fack != null) {
                Futures.addCallback(fack, new FutureCallback<PaymentSession.Ack>() {
                    public void onSuccess(PaymentSession.Ack ack) {
                        try {
View Full Code Here

TOP

Related Classes of com.google.bitcoin.protocols.payments.PaymentSession

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.