@Test public void testProbeForPaymentSession_ProtobufError() throws Exception { final URI uri = URI.create("/fixtures/payments/test-net-faucet-broken.bitcoinpaymentrequest"); final PaymentSessionSummary paymentSessionSummary = testObject.probeForPaymentSession(uri, true, trustStoreLoader); assertThat(paymentSessionSummary.getStatus()).isEqualTo(PaymentSessionStatus.ERROR); assertThat(paymentSessionSummary.hasPaymentSession()).isFalse(); assertThat(paymentSessionSummary.getMessageKey()).isEqualTo(CoreMessageKey.PAYMENT_SESSION_ERROR); }
public PaymentSessionSummary probeForPaymentSession(URI paymentRequestUri, boolean checkPKI, TrustStoreLoader trustStoreLoader) { Preconditions.checkNotNull(paymentRequestUri, "'paymentRequestUri' must be present"); log.info("Probing '{}'", paymentRequestUri); String scheme = paymentRequestUri.getScheme() == null ? "" : paymentRequestUri.getScheme(); String hostName = paymentRequestUri.getHost() == null ? "" : paymentRequestUri.getHost(); Protos.PaymentRequest paymentRequest; try { PaymentSession paymentSession = null; if (scheme.startsWith("bitcoin")) { final BitcoinURI bitcoinUri = new BitcoinURI(networkParameters, paymentRequestUri.toString()); if (bitcoinUri.getPaymentRequestUrls().isEmpty()) { log.debug("Treating as BIP21 resource"); paymentSession = PaymentSession .createFromBitcoinUri(bitcoinUri, false, null) .get(); return new PaymentSessionSummary( Optional.of(paymentSession), null, PaymentSessionStatus.UNTRUSTED, RAGStatus.PINK, CoreMessageKey.PAYMENT_SESSION_PKI_INVALID, new String[]{paymentSession.getMemo()} ); } else if (bitcoinUri.getPaymentRequestUrls().size() == 1) { log.debug("Treating as single BIP72 resource"); paymentSession = PaymentSession .createFromBitcoinUri(bitcoinUri, checkPKI, trustStoreLoader) .get(PAYMENT_REQUEST_TIMEOUT_SECONDS, TimeUnit.SECONDS); } else { log.debug("Treating as multiple BIP72 resource"); for (String r : bitcoinUri.getPaymentRequestUrls()) { try { paymentSession = PaymentSession .createFromUrl(r, checkPKI, trustStoreLoader) .get(PAYMENT_REQUEST_TIMEOUT_SECONDS, TimeUnit.SECONDS); break; } catch (Exception e) { log.warn("Payment request from '{}' produced an exception: {}", r, e.getMessage()); } } } } else if (scheme.startsWith("http")) { log.debug("Treating as remote HTTP/S resource"); paymentSession = PaymentSession .createFromUrl(paymentRequestUri.toString(), checkPKI, trustStoreLoader) .get(PAYMENT_REQUEST_TIMEOUT_SECONDS, TimeUnit.SECONDS); } else if (scheme.startsWith("file")) { log.debug("Treating as file based resource"); byte[] paymentRequestBytes = Resources.toByteArray(paymentRequestUri.toURL()); paymentRequest = Protos.PaymentRequest.parseFrom(paymentRequestBytes); paymentSession = new PaymentSession(paymentRequest, checkPKI, trustStoreLoader); } else { log.debug("Treating as classpath based resource"); InputStream inputStream = PaymentProtocolService.class.getResourceAsStream(paymentRequestUri.toString()); paymentRequest = Protos.PaymentRequest.parseFrom(inputStream); paymentSession = new PaymentSession(paymentRequest, checkPKI, trustStoreLoader); } if (paymentSession == null) { log.warn("Failed to create a payment session"); throw new PaymentProtocolException.InvalidPaymentRequestURL("All payment request URLs have failed"); } PaymentProtocol.PkiVerificationData pkiVerificationData = paymentSession.pkiVerificationData; if (!checkPKI) { final TrustStoreLoader loader = trustStoreLoader != null ? trustStoreLoader : new TrustStoreLoader.DefaultTrustStoreLoader(); try { pkiVerificationData = PaymentProtocol.verifyPaymentRequestPki( paymentSession.getPaymentRequest(), loader.getKeyStore() ); } catch (PaymentProtocolException | KeyStoreException e) { return PaymentSessionSummary.newPaymentSessionAlmostOK(paymentSession, e); } } log.debug("Created payment session summary"); return PaymentSessionSummary.newPaymentSessionOK(paymentSession, pkiVerificationData); } catch (PaymentProtocolException e) { return PaymentSessionSummary.newPaymentSessionFromException(e, hostName); } catch (BitcoinURIParseException e) { return PaymentSessionSummary.newPaymentSessionFromException(e, hostName); } catch (ExecutionException e) { return PaymentSessionSummary.newPaymentSessionFromException(e, hostName); } catch (InterruptedException e) { return PaymentSessionSummary.newPaymentSessionFromException(e, hostName); } catch (InvalidProtocolBufferException e) { return PaymentSessionSummary.newPaymentSessionFromException(e, hostName); } catch (MalformedURLException e) { return PaymentSessionSummary.newPaymentSessionFromException(e, hostName); } catch (IOException e) { return PaymentSessionSummary.newPaymentSessionFromException(e, hostName); } catch (TimeoutException e) { return PaymentSessionSummary.newPaymentSessionFromException(e, hostName); } }
PaymentProtocolService extends AbstractService { public PaymentSessionSummary probeForPaymentSession(URI paymentRequestUri, boolean checkPKI, TrustStoreLoader trustStoreLoader) { Preconditions.checkNotNull(paymentRequestUri, "'paymentRequestUri' must be present"); log.info("Probing '{}'", paymentRequestUri); String scheme = paymentRequestUri.getScheme() == null ? "" : paymentRequestUri.getScheme(); String hostName = paymentRequestUri.getHost() == null ? "" : paymentRequestUri.getHost(); Protos.PaymentRequest paymentRequest; try { PaymentSession paymentSession = null; if (scheme.startsWith("bitcoin")) { final BitcoinURI bitcoinUri = new BitcoinURI(networkParameters, paymentRequestUri.toString()); if (bitcoinUri.getPaymentRequestUrls().isEmpty()) { log.debug("Treating as BIP21 resource"); paymentSession = PaymentSession .createFromBitcoinUri(bitcoinUri, false, null) .get(); return new PaymentSessionSummary( Optional.of(paymentSession), null, PaymentSessionStatus.UNTRUSTED, RAGStatus.PINK, CoreMessageKey.PAYMENT_SESSION_PKI_INVALID, new String[]{paymentSession.getMemo()} ); } else if (bitcoinUri.getPaymentRequestUrls().size() == 1) { log.debug("Treating as single BIP72 resource"); paymentSession = PaymentSession .createFromBitcoinUri(bitcoinUri, checkPKI, trustStoreLoader) .get(PAYMENT_REQUEST_TIMEOUT_SECONDS, TimeUnit.SECONDS); } else { log.debug("Treating as multiple BIP72 resource"); for (String r : bitcoinUri.getPaymentRequestUrls()) { try { paymentSession = PaymentSession .createFromUrl(r, checkPKI, trustStoreLoader) .get(PAYMENT_REQUEST_TIMEOUT_SECONDS, TimeUnit.SECONDS); break; } catch (Exception e) { log.warn("Payment request from '{}' produced an exception: {}", r, e.getMessage()); } } } } else if (scheme.startsWith("http")) { log.debug("Treating as remote HTTP/S resource"); paymentSession = PaymentSession .createFromUrl(paymentRequestUri.toString(), checkPKI, trustStoreLoader) .get(PAYMENT_REQUEST_TIMEOUT_SECONDS, TimeUnit.SECONDS); } else if (scheme.startsWith("file")) { log.debug("Treating as file based resource"); byte[] paymentRequestBytes = Resources.toByteArray(paymentRequestUri.toURL()); paymentRequest = Protos.PaymentRequest.parseFrom(paymentRequestBytes); paymentSession = new PaymentSession(paymentRequest, checkPKI, trustStoreLoader); } else { log.debug("Treating as classpath based resource"); InputStream inputStream = PaymentProtocolService.class.getResourceAsStream(paymentRequestUri.toString()); paymentRequest = Protos.PaymentRequest.parseFrom(inputStream); paymentSession = new PaymentSession(paymentRequest, checkPKI, trustStoreLoader); } if (paymentSession == null) { log.warn("Failed to create a payment session"); throw new PaymentProtocolException.InvalidPaymentRequestURL("All payment request URLs have failed"); } PaymentProtocol.PkiVerificationData pkiVerificationData = paymentSession.pkiVerificationData; if (!checkPKI) { final TrustStoreLoader loader = trustStoreLoader != null ? trustStoreLoader : new TrustStoreLoader.DefaultTrustStoreLoader(); try { pkiVerificationData = PaymentProtocol.verifyPaymentRequestPki( paymentSession.getPaymentRequest(), loader.getKeyStore() ); } catch (PaymentProtocolException | KeyStoreException e) { return PaymentSessionSummary.newPaymentSessionAlmostOK(paymentSession, e); } } log.debug("Created payment session summary"); return PaymentSessionSummary.newPaymentSessionOK(paymentSession, pkiVerificationData); } catch (PaymentProtocolException e) { return PaymentSessionSummary.newPaymentSessionFromException(e, hostName); } catch (BitcoinURIParseException e) { return PaymentSessionSummary.newPaymentSessionFromException(e, hostName); } catch (ExecutionException e) { return PaymentSessionSummary.newPaymentSessionFromException(e, hostName); } catch (InterruptedException e) { return PaymentSessionSummary.newPaymentSessionFromException(e, hostName); } catch (InvalidProtocolBufferException e) { return PaymentSessionSummary.newPaymentSessionFromException(e, hostName); } catch (MalformedURLException e) { return PaymentSessionSummary.newPaymentSessionFromException(e, hostName); } catch (IOException e) { return PaymentSessionSummary.newPaymentSessionFromException(e, hostName); } catch (TimeoutException e) { return PaymentSessionSummary.newPaymentSessionFromException(e, hostName); } } }
PaymentProtocolService extends AbstractService { public PaymentSessionSummary probeForPaymentSession(URI paymentRequestUri, boolean checkPKI, TrustStoreLoader trustStoreLoader) { Preconditions.checkNotNull(paymentRequestUri, "'paymentRequestUri' must be present"); log.info("Probing '{}'", paymentRequestUri); String scheme = paymentRequestUri.getScheme() == null ? "" : paymentRequestUri.getScheme(); String hostName = paymentRequestUri.getHost() == null ? "" : paymentRequestUri.getHost(); Protos.PaymentRequest paymentRequest; try { PaymentSession paymentSession = null; if (scheme.startsWith("bitcoin")) { final BitcoinURI bitcoinUri = new BitcoinURI(networkParameters, paymentRequestUri.toString()); if (bitcoinUri.getPaymentRequestUrls().isEmpty()) { log.debug("Treating as BIP21 resource"); paymentSession = PaymentSession .createFromBitcoinUri(bitcoinUri, false, null) .get(); return new PaymentSessionSummary( Optional.of(paymentSession), null, PaymentSessionStatus.UNTRUSTED, RAGStatus.PINK, CoreMessageKey.PAYMENT_SESSION_PKI_INVALID, new String[]{paymentSession.getMemo()} ); } else if (bitcoinUri.getPaymentRequestUrls().size() == 1) { log.debug("Treating as single BIP72 resource"); paymentSession = PaymentSession .createFromBitcoinUri(bitcoinUri, checkPKI, trustStoreLoader) .get(PAYMENT_REQUEST_TIMEOUT_SECONDS, TimeUnit.SECONDS); } else { log.debug("Treating as multiple BIP72 resource"); for (String r : bitcoinUri.getPaymentRequestUrls()) { try { paymentSession = PaymentSession .createFromUrl(r, checkPKI, trustStoreLoader) .get(PAYMENT_REQUEST_TIMEOUT_SECONDS, TimeUnit.SECONDS); break; } catch (Exception e) { log.warn("Payment request from '{}' produced an exception: {}", r, e.getMessage()); } } } } else if (scheme.startsWith("http")) { log.debug("Treating as remote HTTP/S resource"); paymentSession = PaymentSession .createFromUrl(paymentRequestUri.toString(), checkPKI, trustStoreLoader) .get(PAYMENT_REQUEST_TIMEOUT_SECONDS, TimeUnit.SECONDS); } else if (scheme.startsWith("file")) { log.debug("Treating as file based resource"); byte[] paymentRequestBytes = Resources.toByteArray(paymentRequestUri.toURL()); paymentRequest = Protos.PaymentRequest.parseFrom(paymentRequestBytes); paymentSession = new PaymentSession(paymentRequest, checkPKI, trustStoreLoader); } else { log.debug("Treating as classpath based resource"); InputStream inputStream = PaymentProtocolService.class.getResourceAsStream(paymentRequestUri.toString()); paymentRequest = Protos.PaymentRequest.parseFrom(inputStream); paymentSession = new PaymentSession(paymentRequest, checkPKI, trustStoreLoader); } if (paymentSession == null) { log.warn("Failed to create a payment session"); throw new PaymentProtocolException.InvalidPaymentRequestURL("All payment request URLs have failed"); } PaymentProtocol.PkiVerificationData pkiVerificationData = paymentSession.pkiVerificationData; if (!checkPKI) { final TrustStoreLoader loader = trustStoreLoader != null ? trustStoreLoader : new TrustStoreLoader.DefaultTrustStoreLoader(); try { pkiVerificationData = PaymentProtocol.verifyPaymentRequestPki( paymentSession.getPaymentRequest(), loader.getKeyStore() ); } catch (PaymentProtocolException | KeyStoreException e) { return PaymentSessionSummary.newPaymentSessionAlmostOK(paymentSession, e); } } log.debug("Created payment session summary"); return PaymentSessionSummary.newPaymentSessionOK(paymentSession, pkiVerificationData); } catch (PaymentProtocolException e) { return PaymentSessionSummary.newPaymentSessionFromException(e, hostName); } catch (BitcoinURIParseException e) { return PaymentSessionSummary.newPaymentSessionFromException(e, hostName); } catch (ExecutionException e) { return PaymentSessionSummary.newPaymentSessionFromException(e, hostName); } catch (InterruptedException e) { return PaymentSessionSummary.newPaymentSessionFromException(e, hostName); } catch (InvalidProtocolBufferException e) { return PaymentSessionSummary.newPaymentSessionFromException(e, hostName); } catch (MalformedURLException e) { return PaymentSessionSummary.newPaymentSessionFromException(e, hostName); } catch (IOException e) { return PaymentSessionSummary.newPaymentSessionFromException(e, hostName); } catch (TimeoutException e) { return PaymentSessionSummary.newPaymentSessionFromException(e, hostName); } } PaymentProtocolService(NetworkParameters networkParameters); }
PaymentProtocolService extends AbstractService { public PaymentSessionSummary probeForPaymentSession(URI paymentRequestUri, boolean checkPKI, TrustStoreLoader trustStoreLoader) { Preconditions.checkNotNull(paymentRequestUri, "'paymentRequestUri' must be present"); log.info("Probing '{}'", paymentRequestUri); String scheme = paymentRequestUri.getScheme() == null ? "" : paymentRequestUri.getScheme(); String hostName = paymentRequestUri.getHost() == null ? "" : paymentRequestUri.getHost(); Protos.PaymentRequest paymentRequest; try { PaymentSession paymentSession = null; if (scheme.startsWith("bitcoin")) { final BitcoinURI bitcoinUri = new BitcoinURI(networkParameters, paymentRequestUri.toString()); if (bitcoinUri.getPaymentRequestUrls().isEmpty()) { log.debug("Treating as BIP21 resource"); paymentSession = PaymentSession .createFromBitcoinUri(bitcoinUri, false, null) .get(); return new PaymentSessionSummary( Optional.of(paymentSession), null, PaymentSessionStatus.UNTRUSTED, RAGStatus.PINK, CoreMessageKey.PAYMENT_SESSION_PKI_INVALID, new String[]{paymentSession.getMemo()} ); } else if (bitcoinUri.getPaymentRequestUrls().size() == 1) { log.debug("Treating as single BIP72 resource"); paymentSession = PaymentSession .createFromBitcoinUri(bitcoinUri, checkPKI, trustStoreLoader) .get(PAYMENT_REQUEST_TIMEOUT_SECONDS, TimeUnit.SECONDS); } else { log.debug("Treating as multiple BIP72 resource"); for (String r : bitcoinUri.getPaymentRequestUrls()) { try { paymentSession = PaymentSession .createFromUrl(r, checkPKI, trustStoreLoader) .get(PAYMENT_REQUEST_TIMEOUT_SECONDS, TimeUnit.SECONDS); break; } catch (Exception e) { log.warn("Payment request from '{}' produced an exception: {}", r, e.getMessage()); } } } } else if (scheme.startsWith("http")) { log.debug("Treating as remote HTTP/S resource"); paymentSession = PaymentSession .createFromUrl(paymentRequestUri.toString(), checkPKI, trustStoreLoader) .get(PAYMENT_REQUEST_TIMEOUT_SECONDS, TimeUnit.SECONDS); } else if (scheme.startsWith("file")) { log.debug("Treating as file based resource"); byte[] paymentRequestBytes = Resources.toByteArray(paymentRequestUri.toURL()); paymentRequest = Protos.PaymentRequest.parseFrom(paymentRequestBytes); paymentSession = new PaymentSession(paymentRequest, checkPKI, trustStoreLoader); } else { log.debug("Treating as classpath based resource"); InputStream inputStream = PaymentProtocolService.class.getResourceAsStream(paymentRequestUri.toString()); paymentRequest = Protos.PaymentRequest.parseFrom(inputStream); paymentSession = new PaymentSession(paymentRequest, checkPKI, trustStoreLoader); } if (paymentSession == null) { log.warn("Failed to create a payment session"); throw new PaymentProtocolException.InvalidPaymentRequestURL("All payment request URLs have failed"); } PaymentProtocol.PkiVerificationData pkiVerificationData = paymentSession.pkiVerificationData; if (!checkPKI) { final TrustStoreLoader loader = trustStoreLoader != null ? trustStoreLoader : new TrustStoreLoader.DefaultTrustStoreLoader(); try { pkiVerificationData = PaymentProtocol.verifyPaymentRequestPki( paymentSession.getPaymentRequest(), loader.getKeyStore() ); } catch (PaymentProtocolException | KeyStoreException e) { return PaymentSessionSummary.newPaymentSessionAlmostOK(paymentSession, e); } } log.debug("Created payment session summary"); return PaymentSessionSummary.newPaymentSessionOK(paymentSession, pkiVerificationData); } catch (PaymentProtocolException e) { return PaymentSessionSummary.newPaymentSessionFromException(e, hostName); } catch (BitcoinURIParseException e) { return PaymentSessionSummary.newPaymentSessionFromException(e, hostName); } catch (ExecutionException e) { return PaymentSessionSummary.newPaymentSessionFromException(e, hostName); } catch (InterruptedException e) { return PaymentSessionSummary.newPaymentSessionFromException(e, hostName); } catch (InvalidProtocolBufferException e) { return PaymentSessionSummary.newPaymentSessionFromException(e, hostName); } catch (MalformedURLException e) { return PaymentSessionSummary.newPaymentSessionFromException(e, hostName); } catch (IOException e) { return PaymentSessionSummary.newPaymentSessionFromException(e, hostName); } catch (TimeoutException e) { return PaymentSessionSummary.newPaymentSessionFromException(e, hostName); } } PaymentProtocolService(NetworkParameters networkParameters); PaymentSessionSummary probeForPaymentSession(URI paymentRequestUri, boolean checkPKI, TrustStoreLoader trustStoreLoader); Optional<Protos.PaymentRequest> newSignedPaymentRequest(SignedPaymentRequestSummary signedPaymentRequestSummary); Optional<Protos.Payment> newPayment(byte[] merchantData, List<Transaction> transactions, Coin refundAmount, Address refundAddress, String paymentMemo); Optional<Protos.PaymentACK> newPaymentACK(Protos.Payment payment, String paymentACKMemo); }
PaymentProtocolService extends AbstractService { public PaymentSessionSummary probeForPaymentSession(URI paymentRequestUri, boolean checkPKI, TrustStoreLoader trustStoreLoader) { Preconditions.checkNotNull(paymentRequestUri, "'paymentRequestUri' must be present"); log.info("Probing '{}'", paymentRequestUri); String scheme = paymentRequestUri.getScheme() == null ? "" : paymentRequestUri.getScheme(); String hostName = paymentRequestUri.getHost() == null ? "" : paymentRequestUri.getHost(); Protos.PaymentRequest paymentRequest; try { PaymentSession paymentSession = null; if (scheme.startsWith("bitcoin")) { final BitcoinURI bitcoinUri = new BitcoinURI(networkParameters, paymentRequestUri.toString()); if (bitcoinUri.getPaymentRequestUrls().isEmpty()) { log.debug("Treating as BIP21 resource"); paymentSession = PaymentSession .createFromBitcoinUri(bitcoinUri, false, null) .get(); return new PaymentSessionSummary( Optional.of(paymentSession), null, PaymentSessionStatus.UNTRUSTED, RAGStatus.PINK, CoreMessageKey.PAYMENT_SESSION_PKI_INVALID, new String[]{paymentSession.getMemo()} ); } else if (bitcoinUri.getPaymentRequestUrls().size() == 1) { log.debug("Treating as single BIP72 resource"); paymentSession = PaymentSession .createFromBitcoinUri(bitcoinUri, checkPKI, trustStoreLoader) .get(PAYMENT_REQUEST_TIMEOUT_SECONDS, TimeUnit.SECONDS); } else { log.debug("Treating as multiple BIP72 resource"); for (String r : bitcoinUri.getPaymentRequestUrls()) { try { paymentSession = PaymentSession .createFromUrl(r, checkPKI, trustStoreLoader) .get(PAYMENT_REQUEST_TIMEOUT_SECONDS, TimeUnit.SECONDS); break; } catch (Exception e) { log.warn("Payment request from '{}' produced an exception: {}", r, e.getMessage()); } } } } else if (scheme.startsWith("http")) { log.debug("Treating as remote HTTP/S resource"); paymentSession = PaymentSession .createFromUrl(paymentRequestUri.toString(), checkPKI, trustStoreLoader) .get(PAYMENT_REQUEST_TIMEOUT_SECONDS, TimeUnit.SECONDS); } else if (scheme.startsWith("file")) { log.debug("Treating as file based resource"); byte[] paymentRequestBytes = Resources.toByteArray(paymentRequestUri.toURL()); paymentRequest = Protos.PaymentRequest.parseFrom(paymentRequestBytes); paymentSession = new PaymentSession(paymentRequest, checkPKI, trustStoreLoader); } else { log.debug("Treating as classpath based resource"); InputStream inputStream = PaymentProtocolService.class.getResourceAsStream(paymentRequestUri.toString()); paymentRequest = Protos.PaymentRequest.parseFrom(inputStream); paymentSession = new PaymentSession(paymentRequest, checkPKI, trustStoreLoader); } if (paymentSession == null) { log.warn("Failed to create a payment session"); throw new PaymentProtocolException.InvalidPaymentRequestURL("All payment request URLs have failed"); } PaymentProtocol.PkiVerificationData pkiVerificationData = paymentSession.pkiVerificationData; if (!checkPKI) { final TrustStoreLoader loader = trustStoreLoader != null ? trustStoreLoader : new TrustStoreLoader.DefaultTrustStoreLoader(); try { pkiVerificationData = PaymentProtocol.verifyPaymentRequestPki( paymentSession.getPaymentRequest(), loader.getKeyStore() ); } catch (PaymentProtocolException | KeyStoreException e) { return PaymentSessionSummary.newPaymentSessionAlmostOK(paymentSession, e); } } log.debug("Created payment session summary"); return PaymentSessionSummary.newPaymentSessionOK(paymentSession, pkiVerificationData); } catch (PaymentProtocolException e) { return PaymentSessionSummary.newPaymentSessionFromException(e, hostName); } catch (BitcoinURIParseException e) { return PaymentSessionSummary.newPaymentSessionFromException(e, hostName); } catch (ExecutionException e) { return PaymentSessionSummary.newPaymentSessionFromException(e, hostName); } catch (InterruptedException e) { return PaymentSessionSummary.newPaymentSessionFromException(e, hostName); } catch (InvalidProtocolBufferException e) { return PaymentSessionSummary.newPaymentSessionFromException(e, hostName); } catch (MalformedURLException e) { return PaymentSessionSummary.newPaymentSessionFromException(e, hostName); } catch (IOException e) { return PaymentSessionSummary.newPaymentSessionFromException(e, hostName); } catch (TimeoutException e) { return PaymentSessionSummary.newPaymentSessionFromException(e, hostName); } } PaymentProtocolService(NetworkParameters networkParameters); PaymentSessionSummary probeForPaymentSession(URI paymentRequestUri, boolean checkPKI, TrustStoreLoader trustStoreLoader); Optional<Protos.PaymentRequest> newSignedPaymentRequest(SignedPaymentRequestSummary signedPaymentRequestSummary); Optional<Protos.Payment> newPayment(byte[] merchantData, List<Transaction> transactions, Coin refundAmount, Address refundAddress, String paymentMemo); Optional<Protos.PaymentACK> newPaymentACK(Protos.Payment payment, String paymentACKMemo);  }