Examples of PaymentSession


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

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

    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

Examples of org.bitcoinj.protocols.payments.PaymentSession

    public Project(LHProtos.Project proto) throws PaymentProtocolException, InvalidProtocolBufferException {
        hash = Sha256Hash.create(proto.toByteArray());
        // "Cast" it to a regular BIP70 payment request, possibly losing data along the way, but that's OK
        // because we only want to do this to reuse the existing APIs.
        Protos.PaymentRequest paymentRequest = Protos.PaymentRequest.parseFrom(proto.toByteString());
        PaymentSession session = new PaymentSession(paymentRequest, false);
        this.outputs = ImmutableList.copyOf(session.getSendRequest().tx.getOutputs());
        this.params = session.getNetworkParameters();
        this.projectReq = LHProtos.ProjectDetails.parseFrom(proto.getSerializedPaymentDetails());
        this.goalAmount = this.projectReq.getOutputsList().stream().mapToLong(LHProtos.Output::getAmount).sum();
        this.minPledgeAmount = this.projectReq.getExtraDetails().getMinPledgeSize();
        if (this.goalAmount <= 0)
            throw new Ex.ValueMismatch(this.goalAmount);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.