/** * Create a standard pay to address output for usage in {@link #createPaymentRequest} and * {@link #createPaymentMessage}. * * @param amount amount to pay, or null * @param address address to pay to * @return output */ public static Protos.Output createPayToAddressOutput(@Nullable Coin amount, Address address) { Protos.Output.Builder output = Protos.Output.newBuilder(); if (amount != null) { final NetworkParameters params = address.getParameters(); if (params.hasMaxMoney() && amount.compareTo(params.getMaxMoney()) > 0) throw new IllegalArgumentException("Amount too big: " + amount); output.setAmount(amount.value); } else { output.setAmount(0); } output.setScript(ByteString.copyFrom(ScriptBuilder.createOutputScript(address).getProgram())); return output.build(); }
public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { org.bitcoin.protocols.payments.Protos.Output parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (org.bitcoin.protocols.payments.Protos.Output) e.getUnfinishedMessage(); throw e; } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int bitField0_;
/** * <code>repeated .payments.Output outputs = 2;</code> * * <pre> * Where payment should be sent * </pre> */ public Builder addOutputs( int index, org.bitcoin.protocols.payments.Protos.Output.Builder builderForValue) { if (outputsBuilder_ == null) { ensureOutputsIsMutable(); outputs_.add(index, builderForValue.build()); onChanged(); } else { outputsBuilder_.addMessage(index, builderForValue.build()); } return this; } /**
/** * <code>repeated .payments.Output refund_to = 3;</code> * * <pre> * Where to send refunds, if a refund is necessary * </pre> */ public Builder addRefundTo( org.bitcoin.protocols.payments.Protos.Output.Builder builderForValue) { if (refundToBuilder_ == null) { ensureRefundToIsMutable(); refundTo_.add(builderForValue.build()); onChanged(); } else { refundToBuilder_.addMessage(builderForValue.build()); } return this; } /**
/** * <code>repeated .payments.Output refund_to = 3;</code> * * <pre> * Where to send refunds, if a refund is necessary * </pre> */ public Builder addRefundTo( org.bitcoin.protocols.payments.Protos.Output.Builder builderForValue) { if (refundToBuilder_ == null) { ensureRefundToIsMutable(); refundTo_.add(builderForValue.build()); onChanged(); } else { refundToBuilder_.addMessage(builderForValue.build()); } return this; } /**
/** * Create a standard pay to address output for usage in {@link #createPaymentRequest} and * {@link #createPaymentMessage}. * * @param amount amount to pay, or null * @param address address to pay to * @return output */ public static Protos.Output createPayToAddressOutput(@Nullable Coin amount, Address address) { Protos.Output.Builder output = Protos.Output.newBuilder(); if (amount != null) { if (amount.compareTo(NetworkParameters.MAX_MONEY) > 0) throw new IllegalArgumentException("Amount too big: " + amount); output.setAmount(amount.value); } else { output.setAmount(0); } output.setScript(ByteString.copyFrom(ScriptBuilder.createOutputScript(address).getProgram())); return output.build(); }
/** * Create a standard pay to address output for usage in {@link #createPaymentRequest} and * {@link #createPaymentMessage}. * * @param amount amount to pay, or null * @param address address to pay to * @return output */ public static Protos.Output createPayToAddressOutput(@Nullable Coin amount, Address address) { Protos.Output.Builder output = Protos.Output.newBuilder(); if (amount != null) { final NetworkParameters params = address.getParameters(); if (params.hasMaxMoney() && amount.compareTo(params.getMaxMoney()) > 0) throw new IllegalArgumentException("Amount too big: " + amount); output.setAmount(amount.value); } else { output.setAmount(0); } output.setScript(ByteString.copyFrom(ScriptBuilder.createOutputScript(address).getProgram())); return output.build(); }
/** * <code>repeated .payments.Output refund_to = 3;</code> * * <pre> * Where to send refunds, if a refund is necessary * </pre> */ public Builder addRefundTo( int index, org.bitcoin.protocols.payments.Protos.Output.Builder builderForValue) { if (refundToBuilder_ == null) { ensureRefundToIsMutable(); refundTo_.add(index, builderForValue.build()); onChanged(); } else { refundToBuilder_.addMessage(index, builderForValue.build()); } return this; } /**
/** * <code>repeated .payments.Output outputs = 2;</code> * * <pre> * Where payment should be sent * </pre> */ public Builder setOutputs( int index, org.bitcoin.protocols.payments.Protos.Output.Builder builderForValue) { if (outputsBuilder_ == null) { ensureOutputsIsMutable(); outputs_.set(index, builderForValue.build()); onChanged(); } else { outputsBuilder_.setMessage(index, builderForValue.build()); } return this; } /**
/** * <code>repeated .payments.Output refund_to = 3;</code> * * <pre> * Where to send refunds, if a refund is necessary * </pre> */ public Builder addRefundTo( int index, org.bitcoin.protocols.payments.Protos.Output.Builder builderForValue) { if (refundToBuilder_ == null) { ensureRefundToIsMutable(); refundTo_.add(index, builderForValue.build()); onChanged(); } else { refundToBuilder_.addMessage(index, builderForValue.build()); } return this; } /**
/** * <code>repeated .payments.Output refund_to = 3;</code> * * <pre> * Where to send refunds, if a refund is necessary * </pre> */ public Builder setRefundTo( int index, org.bitcoin.protocols.payments.Protos.Output.Builder builderForValue) { if (refundToBuilder_ == null) { ensureRefundToIsMutable(); refundTo_.set(index, builderForValue.build()); onChanged(); } else { refundToBuilder_.setMessage(index, builderForValue.build()); } return this; } /**
/** * <code>repeated .payments.Output refund_to = 3;</code> * * <pre> * Where to send refunds, if a refund is necessary * </pre> */ public Builder addRefundTo( int index, org.bitcoin.protocols.payments.Protos.Output.Builder builderForValue) { if (refundToBuilder_ == null) { ensureRefundToIsMutable(); refundTo_.add(index, builderForValue.build()); onChanged(); } else { refundToBuilder_.addMessage(index, builderForValue.build()); } return this; } /**
/** * <code>repeated .payments.Output refund_to = 3;</code> * * <pre> * Where to send refunds, if a refund is necessary * </pre> */ public Builder addRefundTo( org.bitcoin.protocols.payments.Protos.Output.Builder builderForValue) { if (refundToBuilder_ == null) { ensureRefundToIsMutable(); refundTo_.add(builderForValue.build()); onChanged(); } else { refundToBuilder_.addMessage(builderForValue.build()); } return this; } /**
/** * <code>repeated .payments.Output outputs = 2;</code> * * <pre> * Where payment should be sent * </pre> */ public Builder addOutputs( org.bitcoin.protocols.payments.Protos.Output.Builder builderForValue) { if (outputsBuilder_ == null) { ensureOutputsIsMutable(); outputs_.add(builderForValue.build()); onChanged(); } else { outputsBuilder_.addMessage(builderForValue.build()); } return this; } /**
/** * <code>repeated .payments.Output outputs = 2;</code> * * <pre> * Where payment should be sent * </pre> */ public Builder setOutputs( int index, org.bitcoin.protocols.payments.Protos.Output.Builder builderForValue) { if (outputsBuilder_ == null) { ensureOutputsIsMutable(); outputs_.set(index, builderForValue.build()); onChanged(); } else { outputsBuilder_.setMessage(index, builderForValue.build()); } return this; } /**
/** * Create a standard pay to address output for usage in {@link #createPaymentRequest} and * {@link #createPaymentMessage}. * * @param amount amount to pay, or null * @param address address to pay to * @return output */ public static Protos.Output createPayToAddressOutput(@Nullable Coin amount, Address address) { Protos.Output.Builder output = Protos.Output.newBuilder(); if (amount != null) { final NetworkParameters params = address.getParameters(); if (params.hasMaxMoney() && amount.compareTo(params.getMaxMoney()) > 0) throw new IllegalArgumentException("Amount too big: " + amount); output.setAmount(amount.value); } else { output.setAmount(0); } output.setScript(ByteString.copyFrom(ScriptBuilder.createOutputScript(address).getProgram())); return output.build(); }
private Protos.PaymentRequest newExpiredPaymentRequest() { Protos.Output.Builder outputBuilder = Protos.Output.newBuilder() .setAmount(coin.value) .setScript(ByteString.copyFrom(outputToMe.getScriptBytes())); Protos.PaymentDetails paymentDetails = Protos.PaymentDetails.newBuilder() .setNetwork("test") .setTime(time - 10) .setExpires(time - 1) .setPaymentUrl(simplePaymentUrl) .addOutputs(outputBuilder) .setMemo(paymentRequestMemo) .setMerchantData(merchantData) .build(); return Protos.PaymentRequest.newBuilder() .setPaymentDetailsVersion(1) .setPkiType("none") .setSerializedPaymentDetails(paymentDetails.toByteString()) .build(); }
/** * <code>repeated .payments.Output outputs = 2;</code> * * <pre> * Where payment should be sent * </pre> */ public Builder addOutputs( int index, org.bitcoin.protocols.payments.Protos.Output.Builder builderForValue) { if (outputsBuilder_ == null) { ensureOutputsIsMutable(); outputs_.add(index, builderForValue.build()); onChanged(); } else { outputsBuilder_.addMessage(index, builderForValue.build()); } return this; } /**
/** * <code>repeated .payments.Output refund_to = 3;</code> * * <pre> * Where to send refunds, if a refund is necessary * </pre> */ public Builder addRefundTo( int index, org.bitcoin.protocols.payments.Protos.Output.Builder builderForValue) { if (refundToBuilder_ == null) { ensureRefundToIsMutable(); refundTo_.add(index, builderForValue.build()); onChanged(); } else { refundToBuilder_.addMessage(index, builderForValue.build()); } return this; } /**