/** * @return The memo from the payment session object */ public Optional<String> getPaymentSessionMemo() { if (hasPaymentSession()) { return Optional.fromNullable(paymentSession.get().getMemo()); } else { return Optional.absent(); } }
/** * <p>The server has returned a well-formed payment request</p> * * @param paymentSession The payment session containing meta data (cannot be null to be OK) * @param pkiVerificationData The PKI verification data containing identity information (cannot be null to be OK) * * @return A new "payment session OK" summary */ public static PaymentSessionSummary newPaymentSessionOK(PaymentSession paymentSession, PaymentProtocol.PkiVerificationData pkiVerificationData) { Preconditions.checkNotNull(paymentSession, "'paymentSession' must be present"); return new PaymentSessionSummary( Optional.of(paymentSession), Optional.fromNullable(pkiVerificationData), PaymentSessionStatus.TRUSTED, RAGStatus.GREEN, CoreMessageKey.PAYMENT_SESSION_OK, new String[]{paymentSession.getMemo()} ); }
RAGStatus.AMBER, CoreMessageKey.PAYMENT_SESSION_PKI_INVALID, new String[]{paymentSession.getMemo(), e.getMessage()} ); RAGStatus.AMBER, CoreMessageKey.PAYMENT_SESSION_PKI_INVALID_TYPE, new String[]{paymentSession.getMemo(), e.getMessage()} ); RAGStatus.AMBER, CoreMessageKey.PAYMENT_SESSION_PKI_MISSING, new String[]{paymentSession.getMemo(), e.getMessage()} ); RAGStatus.AMBER, CoreMessageKey.PAYMENT_SESSION_PKI_UNTRUSTED_CA, new String[]{paymentSession.getMemo(), e.getMessage()} ); return newPaymentSessionFromException(e, paymentSession.getMemo());
System.out.println("Coin: " + session.getValue().toFriendlyString()); System.out.println("Date: " + session.getDate()); System.out.println("Memo: " + session.getMemo()); if (session.pkiVerificationData != null) { System.out.println("Pki-Verified Name: " + session.pkiVerificationData.displayName);
RAGStatus.PINK, CoreMessageKey.PAYMENT_SESSION_PKI_INVALID, new String[]{paymentSession.getMemo()} ); } else if (bitcoinUri.getPaymentRequestUrls().size() == 1) {
@Test public void testPaymentRequest() throws Exception { // Create PaymentRequest paymentRequest = PaymentProtocol.createPaymentRequest(TestNet3Params.get(), AMOUNT, TO_ADDRESS, MEMO, PAYMENT_URL, MERCHANT_DATA).build(); byte[] paymentRequestBytes = paymentRequest.toByteArray(); // Parse PaymentSession parsedPaymentRequest = PaymentProtocol.parsePaymentRequest(PaymentRequest .parseFrom(paymentRequestBytes)); final List<Output> parsedOutputs = parsedPaymentRequest.getOutputs(); assertEquals(1, parsedOutputs.size()); assertEquals(AMOUNT, parsedOutputs.get(0).amount); assertArrayEquals(ScriptBuilder.createOutputScript(TO_ADDRESS).getProgram(), parsedOutputs.get(0).scriptData); assertEquals(MEMO, parsedPaymentRequest.getMemo()); assertEquals(PAYMENT_URL, parsedPaymentRequest.getPaymentUrl()); assertArrayEquals(MERCHANT_DATA, parsedPaymentRequest.getMerchantData()); }