Esempio n. 1
0
 /**
  * Generates a Payment message and sends the payment to the merchant who sent the PaymentRequest.
  * Provide transactions built by the wallet. NOTE: This does not broadcast the transactions to the
  * bitcoin network, it merely sends a Payment message to the merchant confirming the payment.
  * Returns an object wrapping PaymentACK once received. If the PaymentRequest did not specify a
  * payment_url, returns null and does nothing.
  *
  * @param txns list of transactions to be included with the Payment message.
  * @param refundAddr will be used by the merchant to send money back if there was a problem.
  * @param memo is a message to include in the payment message sent to the merchant.
  */
 public @Nullable ListenableFuture<Ack> sendPayment(
     List<Transaction> txns, @Nullable Address refundAddr, @Nullable String memo)
     throws PaymentRequestException, VerificationException, IOException {
   Protos.Payment payment = getPayment(txns, refundAddr, memo);
   if (payment == null) return null;
   if (isExpired()) throw new PaymentRequestException.Expired("PaymentRequest is expired");
   URL url;
   try {
     url = new URL(paymentDetails.getPaymentUrl());
   } catch (MalformedURLException e) {
     throw new PaymentRequestException.InvalidPaymentURL(e);
   }
   return sendPayment(url, payment);
 }
Esempio n. 2
0
 /**
  * Returns the payment url where the Payment message should be sent. Returns null if no payment
  * url was provided in the PaymentRequest.
  */
 public @Nullable String getPaymentUrl() {
   if (paymentDetails.hasPaymentUrl()) return paymentDetails.getPaymentUrl();
   return null;
 }