org.bitcoin.protocols.payments.Protos.Payment Java Examples
The following examples show how to use
org.bitcoin.protocols.payments.Protos.Payment.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PaymentProtocolTest.java From bcm-android with GNU General Public License v3.0 | 6 votes |
@Test public void testPaymentMessage() throws Exception { // Create List<Transaction> transactions = new LinkedList<>(); transactions.add(FakeTxBuilder.createFakeTx(UNITTEST, AMOUNT, TO_ADDRESS)); Coin refundAmount = Coin.SATOSHI; Address refundAddress = LegacyAddress.fromKey(UNITTEST, new ECKey()); Payment payment = PaymentProtocol.createPaymentMessage(transactions, refundAmount, refundAddress, MEMO, MERCHANT_DATA); byte[] paymentBytes = payment.toByteArray(); // Parse Payment parsedPayment = Payment.parseFrom(paymentBytes); List<Transaction> parsedTransactions = PaymentProtocol.parseTransactionsFromPaymentMessage(UNITTEST, parsedPayment); assertEquals(transactions, parsedTransactions); assertEquals(1, parsedPayment.getRefundToCount()); assertEquals(MEMO, parsedPayment.getMemo()); assertArrayEquals(MERCHANT_DATA, parsedPayment.getMerchantData().toByteArray()); }
Example #2
Source File: PaymentProtocolTest.java From green_android with GNU General Public License v3.0 | 6 votes |
@Test public void testPaymentMessage() throws Exception { // Create List<Transaction> transactions = new LinkedList<>(); transactions.add(FakeTxBuilder.createFakeTx(NETWORK_PARAMS, AMOUNT, TO_ADDRESS)); Coin refundAmount = Coin.SATOSHI; Address refundAddress = new ECKey().toAddress(NETWORK_PARAMS); Payment payment = PaymentProtocol.createPaymentMessage(transactions, refundAmount, refundAddress, MEMO, MERCHANT_DATA); byte[] paymentBytes = payment.toByteArray(); // Parse Payment parsedPayment = Payment.parseFrom(paymentBytes); List<Transaction> parsedTransactions = PaymentProtocol.parseTransactionsFromPaymentMessage(NETWORK_PARAMS, parsedPayment); assertEquals(transactions, parsedTransactions); assertEquals(1, parsedPayment.getRefundToCount()); assertEquals(MEMO, parsedPayment.getMemo()); assertArrayEquals(MERCHANT_DATA, parsedPayment.getMerchantData().toByteArray()); }
Example #3
Source File: PaymentProtocolTest.java From GreenBits with GNU General Public License v3.0 | 6 votes |
@Test public void testPaymentMessage() throws Exception { // Create List<Transaction> transactions = new LinkedList<>(); transactions.add(FakeTxBuilder.createFakeTx(NETWORK_PARAMS, AMOUNT, TO_ADDRESS)); Coin refundAmount = Coin.SATOSHI; Address refundAddress = new ECKey().toAddress(NETWORK_PARAMS); Payment payment = PaymentProtocol.createPaymentMessage(transactions, refundAmount, refundAddress, MEMO, MERCHANT_DATA); byte[] paymentBytes = payment.toByteArray(); // Parse Payment parsedPayment = Payment.parseFrom(paymentBytes); List<Transaction> parsedTransactions = PaymentProtocol.parseTransactionsFromPaymentMessage(NETWORK_PARAMS, parsedPayment); assertEquals(transactions, parsedTransactions); assertEquals(1, parsedPayment.getRefundToCount()); assertEquals(MEMO, parsedPayment.getMemo()); assertArrayEquals(MERCHANT_DATA, parsedPayment.getMerchantData().toByteArray()); }
Example #4
Source File: PaymentProtocolTest.java From bcm-android with GNU General Public License v3.0 | 5 votes |
@Test public void testPaymentAck() throws Exception { // Create Payment paymentMessage = Protos.Payment.newBuilder().build(); PaymentACK paymentAck = PaymentProtocol.createPaymentAck(paymentMessage, MEMO); byte[] paymentAckBytes = paymentAck.toByteArray(); // Parse PaymentACK parsedPaymentAck = PaymentACK.parseFrom(paymentAckBytes); assertEquals(paymentMessage, parsedPaymentAck.getPayment()); assertEquals(MEMO, parsedPaymentAck.getMemo()); }
Example #5
Source File: PaymentProtocolTest.java From green_android with GNU General Public License v3.0 | 5 votes |
@Test public void testPaymentAck() throws Exception { // Create Payment paymentMessage = Protos.Payment.newBuilder().build(); PaymentACK paymentAck = PaymentProtocol.createPaymentAck(paymentMessage, MEMO); byte[] paymentAckBytes = paymentAck.toByteArray(); // Parse PaymentACK parsedPaymentAck = PaymentACK.parseFrom(paymentAckBytes); assertEquals(paymentMessage, parsedPaymentAck.getPayment()); assertEquals(MEMO, parsedPaymentAck.getMemo()); }
Example #6
Source File: PaymentProtocolTest.java From GreenBits with GNU General Public License v3.0 | 5 votes |
@Test public void testPaymentAck() throws Exception { // Create Payment paymentMessage = Protos.Payment.newBuilder().build(); PaymentACK paymentAck = PaymentProtocol.createPaymentAck(paymentMessage, MEMO); byte[] paymentAckBytes = paymentAck.toByteArray(); // Parse PaymentACK parsedPaymentAck = PaymentACK.parseFrom(paymentAckBytes); assertEquals(paymentMessage, parsedPaymentAck.getPayment()); assertEquals(MEMO, parsedPaymentAck.getMemo()); }