Java源码示例:org.bitcoinj.protocols.payments.PaymentSession

示例1
private void processPaymentRequestUrl(final String requestUrl) {
    final GaService service = getGAService();
    final GaActivity gaActivity = getGaActivity();

    UI.show(mBip70Progress);
    UI.disable(mRecipientEdit, mSendButton);
    UI.hide(mNoteIcon);
    Log.d(TAG, "BIP70 url: " + requestUrl);

    Futures.addCallback(service.fetchPaymentRequest(requestUrl),
            new CB.Toast<PaymentSession>(gaActivity) {
                @Override
                public void onSuccess(final PaymentSession session) {
                    onPaymentSessionInitiated(session, requestUrl);
                }

                @Override
                public void onFailure(final Throwable t) {
                    super.onFailure(t);
                    gaActivity.runOnUiThread(new Runnable() {
                        public void run() {
                            UI.hide(mBip70Progress);
                            UI.enable(mRecipientEdit, mSendButton);
                            UI.show(mNoteIcon);
                        }
                    });
                }
            });
}
 
示例2
public ListenableFuture<PaymentSession> fetchPaymentRequest(final String url) {
    return mClient.fetchPaymentRequest(url);
}
 
示例3
public ListenableFuture<PaymentProtocol.Ack>
sendPayment(final PaymentSession paymentSession, final List<Transaction> txns, final Address refundAddr, final String memo)
    throws PaymentProtocolException.InvalidNetwork, PaymentProtocolException.InvalidPaymentURL,
        PaymentProtocolException.Expired, IOException {
    return mClient.sendPayment(paymentSession, txns, refundAddr, memo);
}