// Generated by the protocol buffer compiler.  DO NOT EDIT!
// source: paymentrequest.proto

package org.bitcoin.protocols.payments;

public final class Protos {
  private Protos() {}
  public static void registerAllExtensions(
      com.google.protobuf.ExtensionRegistry registry) {
  }
  public interface OutputOrBuilder extends
      // @@protoc_insertion_point(interface_extends:payments.Output)
      com.google.protobuf.MessageOrBuilder {

    /**
     * <code>optional uint64 amount = 1 [default = 0];</code>
     *
     * <pre>
     * amount is integer-number-of-satoshis
     * </pre>
     */
    boolean hasAmount();
    /**
     * <code>optional uint64 amount = 1 [default = 0];</code>
     *
     * <pre>
     * amount is integer-number-of-satoshis
     * </pre>
     */
    long getAmount();

    /**
     * <code>required bytes script = 2;</code>
     *
     * <pre>
     * usually one of the standard Script forms
     * </pre>
     */
    boolean hasScript();
    /**
     * <code>required bytes script = 2;</code>
     *
     * <pre>
     * usually one of the standard Script forms
     * </pre>
     */
    com.google.protobuf.ByteString getScript();
  }
  /**
   * Protobuf type {@code payments.Output}
   *
   * <pre>
   * Generalized form of "send payment to this/these bitcoin addresses"
   * </pre>
   */
  public static final class Output extends
      com.google.protobuf.GeneratedMessage implements
      // @@protoc_insertion_point(message_implements:payments.Output)
      OutputOrBuilder {
    // Use Output.newBuilder() to construct.
    private Output(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
      super(builder);
      this.unknownFields = builder.getUnknownFields();
    }
    private Output(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }

    private static final Output defaultInstance;
    public static Output getDefaultInstance() {
      return defaultInstance;
    }

    public Output getDefaultInstanceForType() {
      return defaultInstance;
    }

    private final com.google.protobuf.UnknownFieldSet unknownFields;
    @java.lang.Override
    public final com.google.protobuf.UnknownFieldSet
        getUnknownFields() {
      return this.unknownFields;
    }
    private Output(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      initFields();
      int mutable_bitField0_ = 0;
      com.google.protobuf.UnknownFieldSet.Builder unknownFields =
          com.google.protobuf.UnknownFieldSet.newBuilder();
      try {
        boolean done = false;
        while (!done) {
          int tag = input.readTag();
          switch (tag) {
            case 0:
              done = true;
              break;
            default: {
              if (!parseUnknownField(input, unknownFields,
                                     extensionRegistry, tag)) {
                done = true;
              }
              break;
            }
            case 8: {
              bitField0_ |= 0x00000001;
              amount_ = input.readUInt64();
              break;
            }
            case 18: {
              bitField0_ |= 0x00000002;
              script_ = input.readBytes();
              break;
            }
          }
        }
      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
        throw e.setUnfinishedMessage(this);
      } catch (java.io.IOException e) {
        throw new com.google.protobuf.InvalidProtocolBufferException(
            e.getMessage()).setUnfinishedMessage(this);
      } finally {
        this.unknownFields = unknownFields.build();
        makeExtensionsImmutable();
      }
    }
    public static final com.google.protobuf.Descriptors.Descriptor
        getDescriptor() {
      return org.bitcoin.protocols.payments.Protos.internal_static_payments_Output_descriptor;
    }

    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return org.bitcoin.protocols.payments.Protos.internal_static_payments_Output_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              org.bitcoin.protocols.payments.Protos.Output.class, org.bitcoin.protocols.payments.Protos.Output.Builder.class);
    }

    public static com.google.protobuf.Parser<Output> PARSER =
        new com.google.protobuf.AbstractParser<Output>() {
      public Output parsePartialFrom(
          com.google.protobuf.CodedInputStream input,
          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
          throws com.google.protobuf.InvalidProtocolBufferException {
        return new Output(input, extensionRegistry);
      }
    };

    @java.lang.Override
    public com.google.protobuf.Parser<Output> getParserForType() {
      return PARSER;
    }

    private int bitField0_;
    public static final int AMOUNT_FIELD_NUMBER = 1;
    private long amount_;
    /**
     * <code>optional uint64 amount = 1 [default = 0];</code>
     *
     * <pre>
     * amount is integer-number-of-satoshis
     * </pre>
     */
    public boolean hasAmount() {
      return ((bitField0_ & 0x00000001) == 0x00000001);
    }
    /**
     * <code>optional uint64 amount = 1 [default = 0];</code>
     *
     * <pre>
     * amount is integer-number-of-satoshis
     * </pre>
     */
    public long getAmount() {
      return amount_;
    }

    public static final int SCRIPT_FIELD_NUMBER = 2;
    private com.google.protobuf.ByteString script_;
    /**
     * <code>required bytes script = 2;</code>
     *
     * <pre>
     * usually one of the standard Script forms
     * </pre>
     */
    public boolean hasScript() {
      return ((bitField0_ & 0x00000002) == 0x00000002);
    }
    /**
     * <code>required bytes script = 2;</code>
     *
     * <pre>
     * usually one of the standard Script forms
     * </pre>
     */
    public com.google.protobuf.ByteString getScript() {
      return script_;
    }

    private void initFields() {
      amount_ = 0L;
      script_ = com.google.protobuf.ByteString.EMPTY;
    }
    private byte memoizedIsInitialized = -1;
    public final boolean isInitialized() {
      byte isInitialized = memoizedIsInitialized;
      if (isInitialized == 1) return true;
      if (isInitialized == 0) return false;

      if (!hasScript()) {
        memoizedIsInitialized = 0;
        return false;
      }
      memoizedIsInitialized = 1;
      return true;
    }

    public void writeTo(com.google.protobuf.CodedOutputStream output)
                        throws java.io.IOException {
      getSerializedSize();
      if (((bitField0_ & 0x00000001) == 0x00000001)) {
        output.writeUInt64(1, amount_);
      }
      if (((bitField0_ & 0x00000002) == 0x00000002)) {
        output.writeBytes(2, script_);
      }
      getUnknownFields().writeTo(output);
    }

    private int memoizedSerializedSize = -1;
    public int getSerializedSize() {
      int size = memoizedSerializedSize;
      if (size != -1) return size;

      size = 0;
      if (((bitField0_ & 0x00000001) == 0x00000001)) {
        size += com.google.protobuf.CodedOutputStream
          .computeUInt64Size(1, amount_);
      }
      if (((bitField0_ & 0x00000002) == 0x00000002)) {
        size += com.google.protobuf.CodedOutputStream
          .computeBytesSize(2, script_);
      }
      size += getUnknownFields().getSerializedSize();
      memoizedSerializedSize = size;
      return size;
    }

    private static final long serialVersionUID = 0L;
    @java.lang.Override
    protected java.lang.Object writeReplace()
        throws java.io.ObjectStreamException {
      return super.writeReplace();
    }

    public static org.bitcoin.protocols.payments.Protos.Output parseFrom(
        com.google.protobuf.ByteString data)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data);
    }
    public static org.bitcoin.protocols.payments.Protos.Output parseFrom(
        com.google.protobuf.ByteString data,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data, extensionRegistry);
    }
    public static org.bitcoin.protocols.payments.Protos.Output parseFrom(byte[] data)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data);
    }
    public static org.bitcoin.protocols.payments.Protos.Output parseFrom(
        byte[] data,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data, extensionRegistry);
    }
    public static org.bitcoin.protocols.payments.Protos.Output parseFrom(java.io.InputStream input)
        throws java.io.IOException {
      return PARSER.parseFrom(input);
    }
    public static org.bitcoin.protocols.payments.Protos.Output parseFrom(
        java.io.InputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      return PARSER.parseFrom(input, extensionRegistry);
    }
    public static org.bitcoin.protocols.payments.Protos.Output parseDelimitedFrom(java.io.InputStream input)
        throws java.io.IOException {
      return PARSER.parseDelimitedFrom(input);
    }
    public static org.bitcoin.protocols.payments.Protos.Output parseDelimitedFrom(
        java.io.InputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      return PARSER.parseDelimitedFrom(input, extensionRegistry);
    }
    public static org.bitcoin.protocols.payments.Protos.Output parseFrom(
        com.google.protobuf.CodedInputStream input)
        throws java.io.IOException {
      return PARSER.parseFrom(input);
    }
    public static org.bitcoin.protocols.payments.Protos.Output parseFrom(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      return PARSER.parseFrom(input, extensionRegistry);
    }

    public static Builder newBuilder() { return Builder.create(); }
    public Builder newBuilderForType() { return newBuilder(); }
    public static Builder newBuilder(org.bitcoin.protocols.payments.Protos.Output prototype) {
      return newBuilder().mergeFrom(prototype);
    }
    public Builder toBuilder() { return newBuilder(this); }

    @java.lang.Override
    protected Builder newBuilderForType(
        com.google.protobuf.GeneratedMessage.BuilderParent parent) {
      Builder builder = new Builder(parent);
      return builder;
    }
    /**
     * Protobuf type {@code payments.Output}
     *
     * <pre>
     * Generalized form of "send payment to this/these bitcoin addresses"
     * </pre>
     */
    public static final class Builder extends
        com.google.protobuf.GeneratedMessage.Builder<Builder> implements
        // @@protoc_insertion_point(builder_implements:payments.Output)
        org.bitcoin.protocols.payments.Protos.OutputOrBuilder {
      public static final com.google.protobuf.Descriptors.Descriptor
          getDescriptor() {
        return org.bitcoin.protocols.payments.Protos.internal_static_payments_Output_descriptor;
      }

      protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
          internalGetFieldAccessorTable() {
        return org.bitcoin.protocols.payments.Protos.internal_static_payments_Output_fieldAccessorTable
            .ensureFieldAccessorsInitialized(
                org.bitcoin.protocols.payments.Protos.Output.class, org.bitcoin.protocols.payments.Protos.Output.Builder.class);
      }

      // Construct using org.bitcoin.protocols.payments.Protos.Output.newBuilder()
      private Builder() {
        maybeForceBuilderInitialization();
      }

      private Builder(
          com.google.protobuf.GeneratedMessage.BuilderParent parent) {
        super(parent);
        maybeForceBuilderInitialization();
      }
      private void maybeForceBuilderInitialization() {
        if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
        }
      }
      private static Builder create() {
        return new Builder();
      }

      public Builder clear() {
        super.clear();
        amount_ = 0L;
        bitField0_ = (bitField0_ & ~0x00000001);
        script_ = com.google.protobuf.ByteString.EMPTY;
        bitField0_ = (bitField0_ & ~0x00000002);
        return this;
      }

      public Builder clone() {
        return create().mergeFrom(buildPartial());
      }

      public com.google.protobuf.Descriptors.Descriptor
          getDescriptorForType() {
        return org.bitcoin.protocols.payments.Protos.internal_static_payments_Output_descriptor;
      }

      public org.bitcoin.protocols.payments.Protos.Output getDefaultInstanceForType() {
        return org.bitcoin.protocols.payments.Protos.Output.getDefaultInstance();
      }

      public org.bitcoin.protocols.payments.Protos.Output build() {
        org.bitcoin.protocols.payments.Protos.Output result = buildPartial();
        if (!result.isInitialized()) {
          throw newUninitializedMessageException(result);
        }
        return result;
      }

      public org.bitcoin.protocols.payments.Protos.Output buildPartial() {
        org.bitcoin.protocols.payments.Protos.Output result = new org.bitcoin.protocols.payments.Protos.Output(this);
        int from_bitField0_ = bitField0_;
        int to_bitField0_ = 0;
        if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
          to_bitField0_ |= 0x00000001;
        }
        result.amount_ = amount_;
        if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
          to_bitField0_ |= 0x00000002;
        }
        result.script_ = script_;
        result.bitField0_ = to_bitField0_;
        onBuilt();
        return result;
      }

      public Builder mergeFrom(com.google.protobuf.Message other) {
        if (other instanceof org.bitcoin.protocols.payments.Protos.Output) {
          return mergeFrom((org.bitcoin.protocols.payments.Protos.Output)other);
        } else {
          super.mergeFrom(other);
          return this;
        }
      }

      public Builder mergeFrom(org.bitcoin.protocols.payments.Protos.Output other) {
        if (other == org.bitcoin.protocols.payments.Protos.Output.getDefaultInstance()) return this;
        if (other.hasAmount()) {
          setAmount(other.getAmount());
        }
        if (other.hasScript()) {
          setScript(other.getScript());
        }
        this.mergeUnknownFields(other.getUnknownFields());
        return this;
      }

      public final boolean isInitialized() {
        if (!hasScript()) {
          
          return false;
        }
        return true;
      }

      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_;

      private long amount_ ;
      /**
       * <code>optional uint64 amount = 1 [default = 0];</code>
       *
       * <pre>
       * amount is integer-number-of-satoshis
       * </pre>
       */
      public boolean hasAmount() {
        return ((bitField0_ & 0x00000001) == 0x00000001);
      }
      /**
       * <code>optional uint64 amount = 1 [default = 0];</code>
       *
       * <pre>
       * amount is integer-number-of-satoshis
       * </pre>
       */
      public long getAmount() {
        return amount_;
      }
      /**
       * <code>optional uint64 amount = 1 [default = 0];</code>
       *
       * <pre>
       * amount is integer-number-of-satoshis
       * </pre>
       */
      public Builder setAmount(long value) {
        bitField0_ |= 0x00000001;
        amount_ = value;
        onChanged();
        return this;
      }
      /**
       * <code>optional uint64 amount = 1 [default = 0];</code>
       *
       * <pre>
       * amount is integer-number-of-satoshis
       * </pre>
       */
      public Builder clearAmount() {
        bitField0_ = (bitField0_ & ~0x00000001);
        amount_ = 0L;
        onChanged();
        return this;
      }

      private com.google.protobuf.ByteString script_ = com.google.protobuf.ByteString.EMPTY;
      /**
       * <code>required bytes script = 2;</code>
       *
       * <pre>
       * usually one of the standard Script forms
       * </pre>
       */
      public boolean hasScript() {
        return ((bitField0_ & 0x00000002) == 0x00000002);
      }
      /**
       * <code>required bytes script = 2;</code>
       *
       * <pre>
       * usually one of the standard Script forms
       * </pre>
       */
      public com.google.protobuf.ByteString getScript() {
        return script_;
      }
      /**
       * <code>required bytes script = 2;</code>
       *
       * <pre>
       * usually one of the standard Script forms
       * </pre>
       */
      public Builder setScript(com.google.protobuf.ByteString value) {
        if (value == null) {
    throw new NullPointerException();
  }
  bitField0_ |= 0x00000002;
        script_ = value;
        onChanged();
        return this;
      }
      /**
       * <code>required bytes script = 2;</code>
       *
       * <pre>
       * usually one of the standard Script forms
       * </pre>
       */
      public Builder clearScript() {
        bitField0_ = (bitField0_ & ~0x00000002);
        script_ = getDefaultInstance().getScript();
        onChanged();
        return this;
      }

      // @@protoc_insertion_point(builder_scope:payments.Output)
    }

    static {
      defaultInstance = new Output(true);
      defaultInstance.initFields();
    }

    // @@protoc_insertion_point(class_scope:payments.Output)
  }

  public interface PaymentDetailsOrBuilder extends
      // @@protoc_insertion_point(interface_extends:payments.PaymentDetails)
      com.google.protobuf.MessageOrBuilder {

    /**
     * <code>optional string network = 1 [default = "main"];</code>
     *
     * <pre>
     * "main" or "test"
     * </pre>
     */
    boolean hasNetwork();
    /**
     * <code>optional string network = 1 [default = "main"];</code>
     *
     * <pre>
     * "main" or "test"
     * </pre>
     */
    java.lang.String getNetwork();
    /**
     * <code>optional string network = 1 [default = "main"];</code>
     *
     * <pre>
     * "main" or "test"
     * </pre>
     */
    com.google.protobuf.ByteString
        getNetworkBytes();

    /**
     * <code>repeated .payments.Output outputs = 2;</code>
     *
     * <pre>
     * Where payment should be sent
     * </pre>
     */
    java.util.List<org.bitcoin.protocols.payments.Protos.Output> 
        getOutputsList();
    /**
     * <code>repeated .payments.Output outputs = 2;</code>
     *
     * <pre>
     * Where payment should be sent
     * </pre>
     */
    org.bitcoin.protocols.payments.Protos.Output getOutputs(int index);
    /**
     * <code>repeated .payments.Output outputs = 2;</code>
     *
     * <pre>
     * Where payment should be sent
     * </pre>
     */
    int getOutputsCount();
    /**
     * <code>repeated .payments.Output outputs = 2;</code>
     *
     * <pre>
     * Where payment should be sent
     * </pre>
     */
    java.util.List<? extends org.bitcoin.protocols.payments.Protos.OutputOrBuilder> 
        getOutputsOrBuilderList();
    /**
     * <code>repeated .payments.Output outputs = 2;</code>
     *
     * <pre>
     * Where payment should be sent
     * </pre>
     */
    org.bitcoin.protocols.payments.Protos.OutputOrBuilder getOutputsOrBuilder(
        int index);

    /**
     * <code>required uint64 time = 3;</code>
     *
     * <pre>
     * Timestamp; when payment request created
     * </pre>
     */
    boolean hasTime();
    /**
     * <code>required uint64 time = 3;</code>
     *
     * <pre>
     * Timestamp; when payment request created
     * </pre>
     */
    long getTime();

    /**
     * <code>optional uint64 expires = 4;</code>
     *
     * <pre>
     * Timestamp; when this request should be considered invalid
     * </pre>
     */
    boolean hasExpires();
    /**
     * <code>optional uint64 expires = 4;</code>
     *
     * <pre>
     * Timestamp; when this request should be considered invalid
     * </pre>
     */
    long getExpires();

    /**
     * <code>optional string memo = 5;</code>
     *
     * <pre>
     * Human-readable description of request for the customer
     * </pre>
     */
    boolean hasMemo();
    /**
     * <code>optional string memo = 5;</code>
     *
     * <pre>
     * Human-readable description of request for the customer
     * </pre>
     */
    java.lang.String getMemo();
    /**
     * <code>optional string memo = 5;</code>
     *
     * <pre>
     * Human-readable description of request for the customer
     * </pre>
     */
    com.google.protobuf.ByteString
        getMemoBytes();

    /**
     * <code>optional string payment_url = 6;</code>
     *
     * <pre>
     * URL to send Payment and get PaymentACK
     * </pre>
     */
    boolean hasPaymentUrl();
    /**
     * <code>optional string payment_url = 6;</code>
     *
     * <pre>
     * URL to send Payment and get PaymentACK
     * </pre>
     */
    java.lang.String getPaymentUrl();
    /**
     * <code>optional string payment_url = 6;</code>
     *
     * <pre>
     * URL to send Payment and get PaymentACK
     * </pre>
     */
    com.google.protobuf.ByteString
        getPaymentUrlBytes();

    /**
     * <code>optional bytes merchant_data = 7;</code>
     *
     * <pre>
     * Arbitrary data to include in the Payment message
     * </pre>
     */
    boolean hasMerchantData();
    /**
     * <code>optional bytes merchant_data = 7;</code>
     *
     * <pre>
     * Arbitrary data to include in the Payment message
     * </pre>
     */
    com.google.protobuf.ByteString getMerchantData();
  }
  /**
   * Protobuf type {@code payments.PaymentDetails}
   */
  public static final class PaymentDetails extends
      com.google.protobuf.GeneratedMessage implements
      // @@protoc_insertion_point(message_implements:payments.PaymentDetails)
      PaymentDetailsOrBuilder {
    // Use PaymentDetails.newBuilder() to construct.
    private PaymentDetails(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
      super(builder);
      this.unknownFields = builder.getUnknownFields();
    }
    private PaymentDetails(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }

    private static final PaymentDetails defaultInstance;
    public static PaymentDetails getDefaultInstance() {
      return defaultInstance;
    }

    public PaymentDetails getDefaultInstanceForType() {
      return defaultInstance;
    }

    private final com.google.protobuf.UnknownFieldSet unknownFields;
    @java.lang.Override
    public final com.google.protobuf.UnknownFieldSet
        getUnknownFields() {
      return this.unknownFields;
    }
    private PaymentDetails(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      initFields();
      int mutable_bitField0_ = 0;
      com.google.protobuf.UnknownFieldSet.Builder unknownFields =
          com.google.protobuf.UnknownFieldSet.newBuilder();
      try {
        boolean done = false;
        while (!done) {
          int tag = input.readTag();
          switch (tag) {
            case 0:
              done = true;
              break;
            default: {
              if (!parseUnknownField(input, unknownFields,
                                     extensionRegistry, tag)) {
                done = true;
              }
              break;
            }
            case 10: {
              com.google.protobuf.ByteString bs = input.readBytes();
              bitField0_ |= 0x00000001;
              network_ = bs;
              break;
            }
            case 18: {
              if (!((mutable_bitField0_ & 0x00000002) == 0x00000002)) {
                outputs_ = new java.util.ArrayList<org.bitcoin.protocols.payments.Protos.Output>();
                mutable_bitField0_ |= 0x00000002;
              }
              outputs_.add(input.readMessage(org.bitcoin.protocols.payments.Protos.Output.PARSER, extensionRegistry));
              break;
            }
            case 24: {
              bitField0_ |= 0x00000002;
              time_ = input.readUInt64();
              break;
            }
            case 32: {
              bitField0_ |= 0x00000004;
              expires_ = input.readUInt64();
              break;
            }
            case 42: {
              com.google.protobuf.ByteString bs = input.readBytes();
              bitField0_ |= 0x00000008;
              memo_ = bs;
              break;
            }
            case 50: {
              com.google.protobuf.ByteString bs = input.readBytes();
              bitField0_ |= 0x00000010;
              paymentUrl_ = bs;
              break;
            }
            case 58: {
              bitField0_ |= 0x00000020;
              merchantData_ = input.readBytes();
              break;
            }
          }
        }
      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
        throw e.setUnfinishedMessage(this);
      } catch (java.io.IOException e) {
        throw new com.google.protobuf.InvalidProtocolBufferException(
            e.getMessage()).setUnfinishedMessage(this);
      } finally {
        if (((mutable_bitField0_ & 0x00000002) == 0x00000002)) {
          outputs_ = java.util.Collections.unmodifiableList(outputs_);
        }
        this.unknownFields = unknownFields.build();
        makeExtensionsImmutable();
      }
    }
    public static final com.google.protobuf.Descriptors.Descriptor
        getDescriptor() {
      return org.bitcoin.protocols.payments.Protos.internal_static_payments_PaymentDetails_descriptor;
    }

    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return org.bitcoin.protocols.payments.Protos.internal_static_payments_PaymentDetails_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              org.bitcoin.protocols.payments.Protos.PaymentDetails.class, org.bitcoin.protocols.payments.Protos.PaymentDetails.Builder.class);
    }

    public static com.google.protobuf.Parser<PaymentDetails> PARSER =
        new com.google.protobuf.AbstractParser<PaymentDetails>() {
      public PaymentDetails parsePartialFrom(
          com.google.protobuf.CodedInputStream input,
          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
          throws com.google.protobuf.InvalidProtocolBufferException {
        return new PaymentDetails(input, extensionRegistry);
      }
    };

    @java.lang.Override
    public com.google.protobuf.Parser<PaymentDetails> getParserForType() {
      return PARSER;
    }

    private int bitField0_;
    public static final int NETWORK_FIELD_NUMBER = 1;
    private java.lang.Object network_;
    /**
     * <code>optional string network = 1 [default = "main"];</code>
     *
     * <pre>
     * "main" or "test"
     * </pre>
     */
    public boolean hasNetwork() {
      return ((bitField0_ & 0x00000001) == 0x00000001);
    }
    /**
     * <code>optional string network = 1 [default = "main"];</code>
     *
     * <pre>
     * "main" or "test"
     * </pre>
     */
    public java.lang.String getNetwork() {
      java.lang.Object ref = network_;
      if (ref instanceof java.lang.String) {
        return (java.lang.String) ref;
      } else {
        com.google.protobuf.ByteString bs = 
            (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        if (bs.isValidUtf8()) {
          network_ = s;
        }
        return s;
      }
    }
    /**
     * <code>optional string network = 1 [default = "main"];</code>
     *
     * <pre>
     * "main" or "test"
     * </pre>
     */
    public com.google.protobuf.ByteString
        getNetworkBytes() {
      java.lang.Object ref = network_;
      if (ref instanceof java.lang.String) {
        com.google.protobuf.ByteString b = 
            com.google.protobuf.ByteString.copyFromUtf8(
                (java.lang.String) ref);
        network_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }

    public static final int OUTPUTS_FIELD_NUMBER = 2;
    private java.util.List<org.bitcoin.protocols.payments.Protos.Output> outputs_;
    /**
     * <code>repeated .payments.Output outputs = 2;</code>
     *
     * <pre>
     * Where payment should be sent
     * </pre>
     */
    public java.util.List<org.bitcoin.protocols.payments.Protos.Output> getOutputsList() {
      return outputs_;
    }
    /**
     * <code>repeated .payments.Output outputs = 2;</code>
     *
     * <pre>
     * Where payment should be sent
     * </pre>
     */
    public java.util.List<? extends org.bitcoin.protocols.payments.Protos.OutputOrBuilder> 
        getOutputsOrBuilderList() {
      return outputs_;
    }
    /**
     * <code>repeated .payments.Output outputs = 2;</code>
     *
     * <pre>
     * Where payment should be sent
     * </pre>
     */
    public int getOutputsCount() {
      return outputs_.size();
    }
    /**
     * <code>repeated .payments.Output outputs = 2;</code>
     *
     * <pre>
     * Where payment should be sent
     * </pre>
     */
    public org.bitcoin.protocols.payments.Protos.Output getOutputs(int index) {
      return outputs_.get(index);
    }
    /**
     * <code>repeated .payments.Output outputs = 2;</code>
     *
     * <pre>
     * Where payment should be sent
     * </pre>
     */
    public org.bitcoin.protocols.payments.Protos.OutputOrBuilder getOutputsOrBuilder(
        int index) {
      return outputs_.get(index);
    }

    public static final int TIME_FIELD_NUMBER = 3;
    private long time_;
    /**
     * <code>required uint64 time = 3;</code>
     *
     * <pre>
     * Timestamp; when payment request created
     * </pre>
     */
    public boolean hasTime() {
      return ((bitField0_ & 0x00000002) == 0x00000002);
    }
    /**
     * <code>required uint64 time = 3;</code>
     *
     * <pre>
     * Timestamp; when payment request created
     * </pre>
     */
    public long getTime() {
      return time_;
    }

    public static final int EXPIRES_FIELD_NUMBER = 4;
    private long expires_;
    /**
     * <code>optional uint64 expires = 4;</code>
     *
     * <pre>
     * Timestamp; when this request should be considered invalid
     * </pre>
     */
    public boolean hasExpires() {
      return ((bitField0_ & 0x00000004) == 0x00000004);
    }
    /**
     * <code>optional uint64 expires = 4;</code>
     *
     * <pre>
     * Timestamp; when this request should be considered invalid
     * </pre>
     */
    public long getExpires() {
      return expires_;
    }

    public static final int MEMO_FIELD_NUMBER = 5;
    private java.lang.Object memo_;
    /**
     * <code>optional string memo = 5;</code>
     *
     * <pre>
     * Human-readable description of request for the customer
     * </pre>
     */
    public boolean hasMemo() {
      return ((bitField0_ & 0x00000008) == 0x00000008);
    }
    /**
     * <code>optional string memo = 5;</code>
     *
     * <pre>
     * Human-readable description of request for the customer
     * </pre>
     */
    public java.lang.String getMemo() {
      java.lang.Object ref = memo_;
      if (ref instanceof java.lang.String) {
        return (java.lang.String) ref;
      } else {
        com.google.protobuf.ByteString bs = 
            (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        if (bs.isValidUtf8()) {
          memo_ = s;
        }
        return s;
      }
    }
    /**
     * <code>optional string memo = 5;</code>
     *
     * <pre>
     * Human-readable description of request for the customer
     * </pre>
     */
    public com.google.protobuf.ByteString
        getMemoBytes() {
      java.lang.Object ref = memo_;
      if (ref instanceof java.lang.String) {
        com.google.protobuf.ByteString b = 
            com.google.protobuf.ByteString.copyFromUtf8(
                (java.lang.String) ref);
        memo_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }

    public static final int PAYMENT_URL_FIELD_NUMBER = 6;
    private java.lang.Object paymentUrl_;
    /**
     * <code>optional string payment_url = 6;</code>
     *
     * <pre>
     * URL to send Payment and get PaymentACK
     * </pre>
     */
    public boolean hasPaymentUrl() {
      return ((bitField0_ & 0x00000010) == 0x00000010);
    }
    /**
     * <code>optional string payment_url = 6;</code>
     *
     * <pre>
     * URL to send Payment and get PaymentACK
     * </pre>
     */
    public java.lang.String getPaymentUrl() {
      java.lang.Object ref = paymentUrl_;
      if (ref instanceof java.lang.String) {
        return (java.lang.String) ref;
      } else {
        com.google.protobuf.ByteString bs = 
            (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        if (bs.isValidUtf8()) {
          paymentUrl_ = s;
        }
        return s;
      }
    }
    /**
     * <code>optional string payment_url = 6;</code>
     *
     * <pre>
     * URL to send Payment and get PaymentACK
     * </pre>
     */
    public com.google.protobuf.ByteString
        getPaymentUrlBytes() {
      java.lang.Object ref = paymentUrl_;
      if (ref instanceof java.lang.String) {
        com.google.protobuf.ByteString b = 
            com.google.protobuf.ByteString.copyFromUtf8(
                (java.lang.String) ref);
        paymentUrl_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }

    public static final int MERCHANT_DATA_FIELD_NUMBER = 7;
    private com.google.protobuf.ByteString merchantData_;
    /**
     * <code>optional bytes merchant_data = 7;</code>
     *
     * <pre>
     * Arbitrary data to include in the Payment message
     * </pre>
     */
    public boolean hasMerchantData() {
      return ((bitField0_ & 0x00000020) == 0x00000020);
    }
    /**
     * <code>optional bytes merchant_data = 7;</code>
     *
     * <pre>
     * Arbitrary data to include in the Payment message
     * </pre>
     */
    public com.google.protobuf.ByteString getMerchantData() {
      return merchantData_;
    }

    private void initFields() {
      network_ = "main";
      outputs_ = java.util.Collections.emptyList();
      time_ = 0L;
      expires_ = 0L;
      memo_ = "";
      paymentUrl_ = "";
      merchantData_ = com.google.protobuf.ByteString.EMPTY;
    }
    private byte memoizedIsInitialized = -1;
    public final boolean isInitialized() {
      byte isInitialized = memoizedIsInitialized;
      if (isInitialized == 1) return true;
      if (isInitialized == 0) return false;

      if (!hasTime()) {
        memoizedIsInitialized = 0;
        return false;
      }
      for (int i = 0; i < getOutputsCount(); i++) {
        if (!getOutputs(i).isInitialized()) {
          memoizedIsInitialized = 0;
          return false;
        }
      }
      memoizedIsInitialized = 1;
      return true;
    }

    public void writeTo(com.google.protobuf.CodedOutputStream output)
                        throws java.io.IOException {
      getSerializedSize();
      if (((bitField0_ & 0x00000001) == 0x00000001)) {
        output.writeBytes(1, getNetworkBytes());
      }
      for (int i = 0; i < outputs_.size(); i++) {
        output.writeMessage(2, outputs_.get(i));
      }
      if (((bitField0_ & 0x00000002) == 0x00000002)) {
        output.writeUInt64(3, time_);
      }
      if (((bitField0_ & 0x00000004) == 0x00000004)) {
        output.writeUInt64(4, expires_);
      }
      if (((bitField0_ & 0x00000008) == 0x00000008)) {
        output.writeBytes(5, getMemoBytes());
      }
      if (((bitField0_ & 0x00000010) == 0x00000010)) {
        output.writeBytes(6, getPaymentUrlBytes());
      }
      if (((bitField0_ & 0x00000020) == 0x00000020)) {
        output.writeBytes(7, merchantData_);
      }
      getUnknownFields().writeTo(output);
    }

    private int memoizedSerializedSize = -1;
    public int getSerializedSize() {
      int size = memoizedSerializedSize;
      if (size != -1) return size;

      size = 0;
      if (((bitField0_ & 0x00000001) == 0x00000001)) {
        size += com.google.protobuf.CodedOutputStream
          .computeBytesSize(1, getNetworkBytes());
      }
      for (int i = 0; i < outputs_.size(); i++) {
        size += com.google.protobuf.CodedOutputStream
          .computeMessageSize(2, outputs_.get(i));
      }
      if (((bitField0_ & 0x00000002) == 0x00000002)) {
        size += com.google.protobuf.CodedOutputStream
          .computeUInt64Size(3, time_);
      }
      if (((bitField0_ & 0x00000004) == 0x00000004)) {
        size += com.google.protobuf.CodedOutputStream
          .computeUInt64Size(4, expires_);
      }
      if (((bitField0_ & 0x00000008) == 0x00000008)) {
        size += com.google.protobuf.CodedOutputStream
          .computeBytesSize(5, getMemoBytes());
      }
      if (((bitField0_ & 0x00000010) == 0x00000010)) {
        size += com.google.protobuf.CodedOutputStream
          .computeBytesSize(6, getPaymentUrlBytes());
      }
      if (((bitField0_ & 0x00000020) == 0x00000020)) {
        size += com.google.protobuf.CodedOutputStream
          .computeBytesSize(7, merchantData_);
      }
      size += getUnknownFields().getSerializedSize();
      memoizedSerializedSize = size;
      return size;
    }

    private static final long serialVersionUID = 0L;
    @java.lang.Override
    protected java.lang.Object writeReplace()
        throws java.io.ObjectStreamException {
      return super.writeReplace();
    }

    public static org.bitcoin.protocols.payments.Protos.PaymentDetails parseFrom(
        com.google.protobuf.ByteString data)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data);
    }
    public static org.bitcoin.protocols.payments.Protos.PaymentDetails parseFrom(
        com.google.protobuf.ByteString data,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data, extensionRegistry);
    }
    public static org.bitcoin.protocols.payments.Protos.PaymentDetails parseFrom(byte[] data)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data);
    }
    public static org.bitcoin.protocols.payments.Protos.PaymentDetails parseFrom(
        byte[] data,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data, extensionRegistry);
    }
    public static org.bitcoin.protocols.payments.Protos.PaymentDetails parseFrom(java.io.InputStream input)
        throws java.io.IOException {
      return PARSER.parseFrom(input);
    }
    public static org.bitcoin.protocols.payments.Protos.PaymentDetails parseFrom(
        java.io.InputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      return PARSER.parseFrom(input, extensionRegistry);
    }
    public static org.bitcoin.protocols.payments.Protos.PaymentDetails parseDelimitedFrom(java.io.InputStream input)
        throws java.io.IOException {
      return PARSER.parseDelimitedFrom(input);
    }
    public static org.bitcoin.protocols.payments.Protos.PaymentDetails parseDelimitedFrom(
        java.io.InputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      return PARSER.parseDelimitedFrom(input, extensionRegistry);
    }
    public static org.bitcoin.protocols.payments.Protos.PaymentDetails parseFrom(
        com.google.protobuf.CodedInputStream input)
        throws java.io.IOException {
      return PARSER.parseFrom(input);
    }
    public static org.bitcoin.protocols.payments.Protos.PaymentDetails parseFrom(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      return PARSER.parseFrom(input, extensionRegistry);
    }

    public static Builder newBuilder() { return Builder.create(); }
    public Builder newBuilderForType() { return newBuilder(); }
    public static Builder newBuilder(org.bitcoin.protocols.payments.Protos.PaymentDetails prototype) {
      return newBuilder().mergeFrom(prototype);
    }
    public Builder toBuilder() { return newBuilder(this); }

    @java.lang.Override
    protected Builder newBuilderForType(
        com.google.protobuf.GeneratedMessage.BuilderParent parent) {
      Builder builder = new Builder(parent);
      return builder;
    }
    /**
     * Protobuf type {@code payments.PaymentDetails}
     */
    public static final class Builder extends
        com.google.protobuf.GeneratedMessage.Builder<Builder> implements
        // @@protoc_insertion_point(builder_implements:payments.PaymentDetails)
        org.bitcoin.protocols.payments.Protos.PaymentDetailsOrBuilder {
      public static final com.google.protobuf.Descriptors.Descriptor
          getDescriptor() {
        return org.bitcoin.protocols.payments.Protos.internal_static_payments_PaymentDetails_descriptor;
      }

      protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
          internalGetFieldAccessorTable() {
        return org.bitcoin.protocols.payments.Protos.internal_static_payments_PaymentDetails_fieldAccessorTable
            .ensureFieldAccessorsInitialized(
                org.bitcoin.protocols.payments.Protos.PaymentDetails.class, org.bitcoin.protocols.payments.Protos.PaymentDetails.Builder.class);
      }

      // Construct using org.bitcoin.protocols.payments.Protos.PaymentDetails.newBuilder()
      private Builder() {
        maybeForceBuilderInitialization();
      }

      private Builder(
          com.google.protobuf.GeneratedMessage.BuilderParent parent) {
        super(parent);
        maybeForceBuilderInitialization();
      }
      private void maybeForceBuilderInitialization() {
        if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
          getOutputsFieldBuilder();
        }
      }
      private static Builder create() {
        return new Builder();
      }

      public Builder clear() {
        super.clear();
        network_ = "main";
        bitField0_ = (bitField0_ & ~0x00000001);
        if (outputsBuilder_ == null) {
          outputs_ = java.util.Collections.emptyList();
          bitField0_ = (bitField0_ & ~0x00000002);
        } else {
          outputsBuilder_.clear();
        }
        time_ = 0L;
        bitField0_ = (bitField0_ & ~0x00000004);
        expires_ = 0L;
        bitField0_ = (bitField0_ & ~0x00000008);
        memo_ = "";
        bitField0_ = (bitField0_ & ~0x00000010);
        paymentUrl_ = "";
        bitField0_ = (bitField0_ & ~0x00000020);
        merchantData_ = com.google.protobuf.ByteString.EMPTY;
        bitField0_ = (bitField0_ & ~0x00000040);
        return this;
      }

      public Builder clone() {
        return create().mergeFrom(buildPartial());
      }

      public com.google.protobuf.Descriptors.Descriptor
          getDescriptorForType() {
        return org.bitcoin.protocols.payments.Protos.internal_static_payments_PaymentDetails_descriptor;
      }

      public org.bitcoin.protocols.payments.Protos.PaymentDetails getDefaultInstanceForType() {
        return org.bitcoin.protocols.payments.Protos.PaymentDetails.getDefaultInstance();
      }

      public org.bitcoin.protocols.payments.Protos.PaymentDetails build() {
        org.bitcoin.protocols.payments.Protos.PaymentDetails result = buildPartial();
        if (!result.isInitialized()) {
          throw newUninitializedMessageException(result);
        }
        return result;
      }

      public org.bitcoin.protocols.payments.Protos.PaymentDetails buildPartial() {
        org.bitcoin.protocols.payments.Protos.PaymentDetails result = new org.bitcoin.protocols.payments.Protos.PaymentDetails(this);
        int from_bitField0_ = bitField0_;
        int to_bitField0_ = 0;
        if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
          to_bitField0_ |= 0x00000001;
        }
        result.network_ = network_;
        if (outputsBuilder_ == null) {
          if (((bitField0_ & 0x00000002) == 0x00000002)) {
            outputs_ = java.util.Collections.unmodifiableList(outputs_);
            bitField0_ = (bitField0_ & ~0x00000002);
          }
          result.outputs_ = outputs_;
        } else {
          result.outputs_ = outputsBuilder_.build();
        }
        if (((from_bitField0_ & 0x00000004) == 0x00000004)) {
          to_bitField0_ |= 0x00000002;
        }
        result.time_ = time_;
        if (((from_bitField0_ & 0x00000008) == 0x00000008)) {
          to_bitField0_ |= 0x00000004;
        }
        result.expires_ = expires_;
        if (((from_bitField0_ & 0x00000010) == 0x00000010)) {
          to_bitField0_ |= 0x00000008;
        }
        result.memo_ = memo_;
        if (((from_bitField0_ & 0x00000020) == 0x00000020)) {
          to_bitField0_ |= 0x00000010;
        }
        result.paymentUrl_ = paymentUrl_;
        if (((from_bitField0_ & 0x00000040) == 0x00000040)) {
          to_bitField0_ |= 0x00000020;
        }
        result.merchantData_ = merchantData_;
        result.bitField0_ = to_bitField0_;
        onBuilt();
        return result;
      }

      public Builder mergeFrom(com.google.protobuf.Message other) {
        if (other instanceof org.bitcoin.protocols.payments.Protos.PaymentDetails) {
          return mergeFrom((org.bitcoin.protocols.payments.Protos.PaymentDetails)other);
        } else {
          super.mergeFrom(other);
          return this;
        }
      }

      public Builder mergeFrom(org.bitcoin.protocols.payments.Protos.PaymentDetails other) {
        if (other == org.bitcoin.protocols.payments.Protos.PaymentDetails.getDefaultInstance()) return this;
        if (other.hasNetwork()) {
          bitField0_ |= 0x00000001;
          network_ = other.network_;
          onChanged();
        }
        if (outputsBuilder_ == null) {
          if (!other.outputs_.isEmpty()) {
            if (outputs_.isEmpty()) {
              outputs_ = other.outputs_;
              bitField0_ = (bitField0_ & ~0x00000002);
            } else {
              ensureOutputsIsMutable();
              outputs_.addAll(other.outputs_);
            }
            onChanged();
          }
        } else {
          if (!other.outputs_.isEmpty()) {
            if (outputsBuilder_.isEmpty()) {
              outputsBuilder_.dispose();
              outputsBuilder_ = null;
              outputs_ = other.outputs_;
              bitField0_ = (bitField0_ & ~0x00000002);
              outputsBuilder_ = 
                com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ?
                   getOutputsFieldBuilder() : null;
            } else {
              outputsBuilder_.addAllMessages(other.outputs_);
            }
          }
        }
        if (other.hasTime()) {
          setTime(other.getTime());
        }
        if (other.hasExpires()) {
          setExpires(other.getExpires());
        }
        if (other.hasMemo()) {
          bitField0_ |= 0x00000010;
          memo_ = other.memo_;
          onChanged();
        }
        if (other.hasPaymentUrl()) {
          bitField0_ |= 0x00000020;
          paymentUrl_ = other.paymentUrl_;
          onChanged();
        }
        if (other.hasMerchantData()) {
          setMerchantData(other.getMerchantData());
        }
        this.mergeUnknownFields(other.getUnknownFields());
        return this;
      }

      public final boolean isInitialized() {
        if (!hasTime()) {
          
          return false;
        }
        for (int i = 0; i < getOutputsCount(); i++) {
          if (!getOutputs(i).isInitialized()) {
            
            return false;
          }
        }
        return true;
      }

      public Builder mergeFrom(
          com.google.protobuf.CodedInputStream input,
          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
          throws java.io.IOException {
        org.bitcoin.protocols.payments.Protos.PaymentDetails parsedMessage = null;
        try {
          parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
          parsedMessage = (org.bitcoin.protocols.payments.Protos.PaymentDetails) e.getUnfinishedMessage();
          throw e;
        } finally {
          if (parsedMessage != null) {
            mergeFrom(parsedMessage);
          }
        }
        return this;
      }
      private int bitField0_;

      private java.lang.Object network_ = "main";
      /**
       * <code>optional string network = 1 [default = "main"];</code>
       *
       * <pre>
       * "main" or "test"
       * </pre>
       */
      public boolean hasNetwork() {
        return ((bitField0_ & 0x00000001) == 0x00000001);
      }
      /**
       * <code>optional string network = 1 [default = "main"];</code>
       *
       * <pre>
       * "main" or "test"
       * </pre>
       */
      public java.lang.String getNetwork() {
        java.lang.Object ref = network_;
        if (!(ref instanceof java.lang.String)) {
          com.google.protobuf.ByteString bs =
              (com.google.protobuf.ByteString) ref;
          java.lang.String s = bs.toStringUtf8();
          if (bs.isValidUtf8()) {
            network_ = s;
          }
          return s;
        } else {
          return (java.lang.String) ref;
        }
      }
      /**
       * <code>optional string network = 1 [default = "main"];</code>
       *
       * <pre>
       * "main" or "test"
       * </pre>
       */
      public com.google.protobuf.ByteString
          getNetworkBytes() {
        java.lang.Object ref = network_;
        if (ref instanceof String) {
          com.google.protobuf.ByteString b = 
              com.google.protobuf.ByteString.copyFromUtf8(
                  (java.lang.String) ref);
          network_ = b;
          return b;
        } else {
          return (com.google.protobuf.ByteString) ref;
        }
      }
      /**
       * <code>optional string network = 1 [default = "main"];</code>
       *
       * <pre>
       * "main" or "test"
       * </pre>
       */
      public Builder setNetwork(
          java.lang.String value) {
        if (value == null) {
    throw new NullPointerException();
  }
  bitField0_ |= 0x00000001;
        network_ = value;
        onChanged();
        return this;
      }
      /**
       * <code>optional string network = 1 [default = "main"];</code>
       *
       * <pre>
       * "main" or "test"
       * </pre>
       */
      public Builder clearNetwork() {
        bitField0_ = (bitField0_ & ~0x00000001);
        network_ = getDefaultInstance().getNetwork();
        onChanged();
        return this;
      }
      /**
       * <code>optional string network = 1 [default = "main"];</code>
       *
       * <pre>
       * "main" or "test"
       * </pre>
       */
      public Builder setNetworkBytes(
          com.google.protobuf.ByteString value) {
        if (value == null) {
    throw new NullPointerException();
  }
  bitField0_ |= 0x00000001;
        network_ = value;
        onChanged();
        return this;
      }

      private java.util.List<org.bitcoin.protocols.payments.Protos.Output> outputs_ =
        java.util.Collections.emptyList();
      private void ensureOutputsIsMutable() {
        if (!((bitField0_ & 0x00000002) == 0x00000002)) {
          outputs_ = new java.util.ArrayList<org.bitcoin.protocols.payments.Protos.Output>(outputs_);
          bitField0_ |= 0x00000002;
         }
      }

      private com.google.protobuf.RepeatedFieldBuilder<
          org.bitcoin.protocols.payments.Protos.Output, org.bitcoin.protocols.payments.Protos.Output.Builder, org.bitcoin.protocols.payments.Protos.OutputOrBuilder> outputsBuilder_;

      /**
       * <code>repeated .payments.Output outputs = 2;</code>
       *
       * <pre>
       * Where payment should be sent
       * </pre>
       */
      public java.util.List<org.bitcoin.protocols.payments.Protos.Output> getOutputsList() {
        if (outputsBuilder_ == null) {
          return java.util.Collections.unmodifiableList(outputs_);
        } else {
          return outputsBuilder_.getMessageList();
        }
      }
      /**
       * <code>repeated .payments.Output outputs = 2;</code>
       *
       * <pre>
       * Where payment should be sent
       * </pre>
       */
      public int getOutputsCount() {
        if (outputsBuilder_ == null) {
          return outputs_.size();
        } else {
          return outputsBuilder_.getCount();
        }
      }
      /**
       * <code>repeated .payments.Output outputs = 2;</code>
       *
       * <pre>
       * Where payment should be sent
       * </pre>
       */
      public org.bitcoin.protocols.payments.Protos.Output getOutputs(int index) {
        if (outputsBuilder_ == null) {
          return outputs_.get(index);
        } else {
          return outputsBuilder_.getMessage(index);
        }
      }
      /**
       * <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 value) {
        if (outputsBuilder_ == null) {
          if (value == null) {
            throw new NullPointerException();
          }
          ensureOutputsIsMutable();
          outputs_.set(index, value);
          onChanged();
        } else {
          outputsBuilder_.setMessage(index, value);
        }
        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 outputs = 2;</code>
       *
       * <pre>
       * Where payment should be sent
       * </pre>
       */
      public Builder addOutputs(org.bitcoin.protocols.payments.Protos.Output value) {
        if (outputsBuilder_ == null) {
          if (value == null) {
            throw new NullPointerException();
          }
          ensureOutputsIsMutable();
          outputs_.add(value);
          onChanged();
        } else {
          outputsBuilder_.addMessage(value);
        }
        return this;
      }
      /**
       * <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 value) {
        if (outputsBuilder_ == null) {
          if (value == null) {
            throw new NullPointerException();
          }
          ensureOutputsIsMutable();
          outputs_.add(index, value);
          onChanged();
        } else {
          outputsBuilder_.addMessage(index, value);
        }
        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 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 outputs = 2;</code>
       *
       * <pre>
       * Where payment should be sent
       * </pre>
       */
      public Builder addAllOutputs(
          java.lang.Iterable<? extends org.bitcoin.protocols.payments.Protos.Output> values) {
        if (outputsBuilder_ == null) {
          ensureOutputsIsMutable();
          com.google.protobuf.AbstractMessageLite.Builder.addAll(
              values, outputs_);
          onChanged();
        } else {
          outputsBuilder_.addAllMessages(values);
        }
        return this;
      }
      /**
       * <code>repeated .payments.Output outputs = 2;</code>
       *
       * <pre>
       * Where payment should be sent
       * </pre>
       */
      public Builder clearOutputs() {
        if (outputsBuilder_ == null) {
          outputs_ = java.util.Collections.emptyList();
          bitField0_ = (bitField0_ & ~0x00000002);
          onChanged();
        } else {
          outputsBuilder_.clear();
        }
        return this;
      }
      /**
       * <code>repeated .payments.Output outputs = 2;</code>
       *
       * <pre>
       * Where payment should be sent
       * </pre>
       */
      public Builder removeOutputs(int index) {
        if (outputsBuilder_ == null) {
          ensureOutputsIsMutable();
          outputs_.remove(index);
          onChanged();
        } else {
          outputsBuilder_.remove(index);
        }
        return this;
      }
      /**
       * <code>repeated .payments.Output outputs = 2;</code>
       *
       * <pre>
       * Where payment should be sent
       * </pre>
       */
      public org.bitcoin.protocols.payments.Protos.Output.Builder getOutputsBuilder(
          int index) {
        return getOutputsFieldBuilder().getBuilder(index);
      }
      /**
       * <code>repeated .payments.Output outputs = 2;</code>
       *
       * <pre>
       * Where payment should be sent
       * </pre>
       */
      public org.bitcoin.protocols.payments.Protos.OutputOrBuilder getOutputsOrBuilder(
          int index) {
        if (outputsBuilder_ == null) {
          return outputs_.get(index);  } else {
          return outputsBuilder_.getMessageOrBuilder(index);
        }
      }
      /**
       * <code>repeated .payments.Output outputs = 2;</code>
       *
       * <pre>
       * Where payment should be sent
       * </pre>
       */
      public java.util.List<? extends org.bitcoin.protocols.payments.Protos.OutputOrBuilder> 
           getOutputsOrBuilderList() {
        if (outputsBuilder_ != null) {
          return outputsBuilder_.getMessageOrBuilderList();
        } else {
          return java.util.Collections.unmodifiableList(outputs_);
        }
      }
      /**
       * <code>repeated .payments.Output outputs = 2;</code>
       *
       * <pre>
       * Where payment should be sent
       * </pre>
       */
      public org.bitcoin.protocols.payments.Protos.Output.Builder addOutputsBuilder() {
        return getOutputsFieldBuilder().addBuilder(
            org.bitcoin.protocols.payments.Protos.Output.getDefaultInstance());
      }
      /**
       * <code>repeated .payments.Output outputs = 2;</code>
       *
       * <pre>
       * Where payment should be sent
       * </pre>
       */
      public org.bitcoin.protocols.payments.Protos.Output.Builder addOutputsBuilder(
          int index) {
        return getOutputsFieldBuilder().addBuilder(
            index, org.bitcoin.protocols.payments.Protos.Output.getDefaultInstance());
      }
      /**
       * <code>repeated .payments.Output outputs = 2;</code>
       *
       * <pre>
       * Where payment should be sent
       * </pre>
       */
      public java.util.List<org.bitcoin.protocols.payments.Protos.Output.Builder> 
           getOutputsBuilderList() {
        return getOutputsFieldBuilder().getBuilderList();
      }
      private com.google.protobuf.RepeatedFieldBuilder<
          org.bitcoin.protocols.payments.Protos.Output, org.bitcoin.protocols.payments.Protos.Output.Builder, org.bitcoin.protocols.payments.Protos.OutputOrBuilder> 
          getOutputsFieldBuilder() {
        if (outputsBuilder_ == null) {
          outputsBuilder_ = new com.google.protobuf.RepeatedFieldBuilder<
              org.bitcoin.protocols.payments.Protos.Output, org.bitcoin.protocols.payments.Protos.Output.Builder, org.bitcoin.protocols.payments.Protos.OutputOrBuilder>(
                  outputs_,
                  ((bitField0_ & 0x00000002) == 0x00000002),
                  getParentForChildren(),
                  isClean());
          outputs_ = null;
        }
        return outputsBuilder_;
      }

      private long time_ ;
      /**
       * <code>required uint64 time = 3;</code>
       *
       * <pre>
       * Timestamp; when payment request created
       * </pre>
       */
      public boolean hasTime() {
        return ((bitField0_ & 0x00000004) == 0x00000004);
      }
      /**
       * <code>required uint64 time = 3;</code>
       *
       * <pre>
       * Timestamp; when payment request created
       * </pre>
       */
      public long getTime() {
        return time_;
      }
      /**
       * <code>required uint64 time = 3;</code>
       *
       * <pre>
       * Timestamp; when payment request created
       * </pre>
       */
      public Builder setTime(long value) {
        bitField0_ |= 0x00000004;
        time_ = value;
        onChanged();
        return this;
      }
      /**
       * <code>required uint64 time = 3;</code>
       *
       * <pre>
       * Timestamp; when payment request created
       * </pre>
       */
      public Builder clearTime() {
        bitField0_ = (bitField0_ & ~0x00000004);
        time_ = 0L;
        onChanged();
        return this;
      }

      private long expires_ ;
      /**
       * <code>optional uint64 expires = 4;</code>
       *
       * <pre>
       * Timestamp; when this request should be considered invalid
       * </pre>
       */
      public boolean hasExpires() {
        return ((bitField0_ & 0x00000008) == 0x00000008);
      }
      /**
       * <code>optional uint64 expires = 4;</code>
       *
       * <pre>
       * Timestamp; when this request should be considered invalid
       * </pre>
       */
      public long getExpires() {
        return expires_;
      }
      /**
       * <code>optional uint64 expires = 4;</code>
       *
       * <pre>
       * Timestamp; when this request should be considered invalid
       * </pre>
       */
      public Builder setExpires(long value) {
        bitField0_ |= 0x00000008;
        expires_ = value;
        onChanged();
        return this;
      }
      /**
       * <code>optional uint64 expires = 4;</code>
       *
       * <pre>
       * Timestamp; when this request should be considered invalid
       * </pre>
       */
      public Builder clearExpires() {
        bitField0_ = (bitField0_ & ~0x00000008);
        expires_ = 0L;
        onChanged();
        return this;
      }

      private java.lang.Object memo_ = "";
      /**
       * <code>optional string memo = 5;</code>
       *
       * <pre>
       * Human-readable description of request for the customer
       * </pre>
       */
      public boolean hasMemo() {
        return ((bitField0_ & 0x00000010) == 0x00000010);
      }
      /**
       * <code>optional string memo = 5;</code>
       *
       * <pre>
       * Human-readable description of request for the customer
       * </pre>
       */
      public java.lang.String getMemo() {
        java.lang.Object ref = memo_;
        if (!(ref instanceof java.lang.String)) {
          com.google.protobuf.ByteString bs =
              (com.google.protobuf.ByteString) ref;
          java.lang.String s = bs.toStringUtf8();
          if (bs.isValidUtf8()) {
            memo_ = s;
          }
          return s;
        } else {
          return (java.lang.String) ref;
        }
      }
      /**
       * <code>optional string memo = 5;</code>
       *
       * <pre>
       * Human-readable description of request for the customer
       * </pre>
       */
      public com.google.protobuf.ByteString
          getMemoBytes() {
        java.lang.Object ref = memo_;
        if (ref instanceof String) {
          com.google.protobuf.ByteString b = 
              com.google.protobuf.ByteString.copyFromUtf8(
                  (java.lang.String) ref);
          memo_ = b;
          return b;
        } else {
          return (com.google.protobuf.ByteString) ref;
        }
      }
      /**
       * <code>optional string memo = 5;</code>
       *
       * <pre>
       * Human-readable description of request for the customer
       * </pre>
       */
      public Builder setMemo(
          java.lang.String value) {
        if (value == null) {
    throw new NullPointerException();
  }
  bitField0_ |= 0x00000010;
        memo_ = value;
        onChanged();
        return this;
      }
      /**
       * <code>optional string memo = 5;</code>
       *
       * <pre>
       * Human-readable description of request for the customer
       * </pre>
       */
      public Builder clearMemo() {
        bitField0_ = (bitField0_ & ~0x00000010);
        memo_ = getDefaultInstance().getMemo();
        onChanged();
        return this;
      }
      /**
       * <code>optional string memo = 5;</code>
       *
       * <pre>
       * Human-readable description of request for the customer
       * </pre>
       */
      public Builder setMemoBytes(
          com.google.protobuf.ByteString value) {
        if (value == null) {
    throw new NullPointerException();
  }
  bitField0_ |= 0x00000010;
        memo_ = value;
        onChanged();
        return this;
      }

      private java.lang.Object paymentUrl_ = "";
      /**
       * <code>optional string payment_url = 6;</code>
       *
       * <pre>
       * URL to send Payment and get PaymentACK
       * </pre>
       */
      public boolean hasPaymentUrl() {
        return ((bitField0_ & 0x00000020) == 0x00000020);
      }
      /**
       * <code>optional string payment_url = 6;</code>
       *
       * <pre>
       * URL to send Payment and get PaymentACK
       * </pre>
       */
      public java.lang.String getPaymentUrl() {
        java.lang.Object ref = paymentUrl_;
        if (!(ref instanceof java.lang.String)) {
          com.google.protobuf.ByteString bs =
              (com.google.protobuf.ByteString) ref;
          java.lang.String s = bs.toStringUtf8();
          if (bs.isValidUtf8()) {
            paymentUrl_ = s;
          }
          return s;
        } else {
          return (java.lang.String) ref;
        }
      }
      /**
       * <code>optional string payment_url = 6;</code>
       *
       * <pre>
       * URL to send Payment and get PaymentACK
       * </pre>
       */
      public com.google.protobuf.ByteString
          getPaymentUrlBytes() {
        java.lang.Object ref = paymentUrl_;
        if (ref instanceof String) {
          com.google.protobuf.ByteString b = 
              com.google.protobuf.ByteString.copyFromUtf8(
                  (java.lang.String) ref);
          paymentUrl_ = b;
          return b;
        } else {
          return (com.google.protobuf.ByteString) ref;
        }
      }
      /**
       * <code>optional string payment_url = 6;</code>
       *
       * <pre>
       * URL to send Payment and get PaymentACK
       * </pre>
       */
      public Builder setPaymentUrl(
          java.lang.String value) {
        if (value == null) {
    throw new NullPointerException();
  }
  bitField0_ |= 0x00000020;
        paymentUrl_ = value;
        onChanged();
        return this;
      }
      /**
       * <code>optional string payment_url = 6;</code>
       *
       * <pre>
       * URL to send Payment and get PaymentACK
       * </pre>
       */
      public Builder clearPaymentUrl() {
        bitField0_ = (bitField0_ & ~0x00000020);
        paymentUrl_ = getDefaultInstance().getPaymentUrl();
        onChanged();
        return this;
      }
      /**
       * <code>optional string payment_url = 6;</code>
       *
       * <pre>
       * URL to send Payment and get PaymentACK
       * </pre>
       */
      public Builder setPaymentUrlBytes(
          com.google.protobuf.ByteString value) {
        if (value == null) {
    throw new NullPointerException();
  }
  bitField0_ |= 0x00000020;
        paymentUrl_ = value;
        onChanged();
        return this;
      }

      private com.google.protobuf.ByteString merchantData_ = com.google.protobuf.ByteString.EMPTY;
      /**
       * <code>optional bytes merchant_data = 7;</code>
       *
       * <pre>
       * Arbitrary data to include in the Payment message
       * </pre>
       */
      public boolean hasMerchantData() {
        return ((bitField0_ & 0x00000040) == 0x00000040);
      }
      /**
       * <code>optional bytes merchant_data = 7;</code>
       *
       * <pre>
       * Arbitrary data to include in the Payment message
       * </pre>
       */
      public com.google.protobuf.ByteString getMerchantData() {
        return merchantData_;
      }
      /**
       * <code>optional bytes merchant_data = 7;</code>
       *
       * <pre>
       * Arbitrary data to include in the Payment message
       * </pre>
       */
      public Builder setMerchantData(com.google.protobuf.ByteString value) {
        if (value == null) {
    throw new NullPointerException();
  }
  bitField0_ |= 0x00000040;
        merchantData_ = value;
        onChanged();
        return this;
      }
      /**
       * <code>optional bytes merchant_data = 7;</code>
       *
       * <pre>
       * Arbitrary data to include in the Payment message
       * </pre>
       */
      public Builder clearMerchantData() {
        bitField0_ = (bitField0_ & ~0x00000040);
        merchantData_ = getDefaultInstance().getMerchantData();
        onChanged();
        return this;
      }

      // @@protoc_insertion_point(builder_scope:payments.PaymentDetails)
    }

    static {
      defaultInstance = new PaymentDetails(true);
      defaultInstance.initFields();
    }

    // @@protoc_insertion_point(class_scope:payments.PaymentDetails)
  }

  public interface PaymentRequestOrBuilder extends
      // @@protoc_insertion_point(interface_extends:payments.PaymentRequest)
      com.google.protobuf.MessageOrBuilder {

    /**
     * <code>optional uint32 payment_details_version = 1 [default = 1];</code>
     */
    boolean hasPaymentDetailsVersion();
    /**
     * <code>optional uint32 payment_details_version = 1 [default = 1];</code>
     */
    int getPaymentDetailsVersion();

    /**
     * <code>optional string pki_type = 2 [default = "none"];</code>
     *
     * <pre>
     * none / x509+sha256 / x509+sha1
     * </pre>
     */
    boolean hasPkiType();
    /**
     * <code>optional string pki_type = 2 [default = "none"];</code>
     *
     * <pre>
     * none / x509+sha256 / x509+sha1
     * </pre>
     */
    java.lang.String getPkiType();
    /**
     * <code>optional string pki_type = 2 [default = "none"];</code>
     *
     * <pre>
     * none / x509+sha256 / x509+sha1
     * </pre>
     */
    com.google.protobuf.ByteString
        getPkiTypeBytes();

    /**
     * <code>optional bytes pki_data = 3;</code>
     *
     * <pre>
     * depends on pki_type
     * </pre>
     */
    boolean hasPkiData();
    /**
     * <code>optional bytes pki_data = 3;</code>
     *
     * <pre>
     * depends on pki_type
     * </pre>
     */
    com.google.protobuf.ByteString getPkiData();

    /**
     * <code>required bytes serialized_payment_details = 4;</code>
     *
     * <pre>
     * PaymentDetails
     * </pre>
     */
    boolean hasSerializedPaymentDetails();
    /**
     * <code>required bytes serialized_payment_details = 4;</code>
     *
     * <pre>
     * PaymentDetails
     * </pre>
     */
    com.google.protobuf.ByteString getSerializedPaymentDetails();

    /**
     * <code>optional bytes signature = 5;</code>
     *
     * <pre>
     * pki-dependent signature
     * </pre>
     */
    boolean hasSignature();
    /**
     * <code>optional bytes signature = 5;</code>
     *
     * <pre>
     * pki-dependent signature
     * </pre>
     */
    com.google.protobuf.ByteString getSignature();
  }
  /**
   * Protobuf type {@code payments.PaymentRequest}
   */
  public static final class PaymentRequest extends
      com.google.protobuf.GeneratedMessage implements
      // @@protoc_insertion_point(message_implements:payments.PaymentRequest)
      PaymentRequestOrBuilder {
    // Use PaymentRequest.newBuilder() to construct.
    private PaymentRequest(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
      super(builder);
      this.unknownFields = builder.getUnknownFields();
    }
    private PaymentRequest(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }

    private static final PaymentRequest defaultInstance;
    public static PaymentRequest getDefaultInstance() {
      return defaultInstance;
    }

    public PaymentRequest getDefaultInstanceForType() {
      return defaultInstance;
    }

    private final com.google.protobuf.UnknownFieldSet unknownFields;
    @java.lang.Override
    public final com.google.protobuf.UnknownFieldSet
        getUnknownFields() {
      return this.unknownFields;
    }
    private PaymentRequest(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      initFields();
      int mutable_bitField0_ = 0;
      com.google.protobuf.UnknownFieldSet.Builder unknownFields =
          com.google.protobuf.UnknownFieldSet.newBuilder();
      try {
        boolean done = false;
        while (!done) {
          int tag = input.readTag();
          switch (tag) {
            case 0:
              done = true;
              break;
            default: {
              if (!parseUnknownField(input, unknownFields,
                                     extensionRegistry, tag)) {
                done = true;
              }
              break;
            }
            case 8: {
              bitField0_ |= 0x00000001;
              paymentDetailsVersion_ = input.readUInt32();
              break;
            }
            case 18: {
              com.google.protobuf.ByteString bs = input.readBytes();
              bitField0_ |= 0x00000002;
              pkiType_ = bs;
              break;
            }
            case 26: {
              bitField0_ |= 0x00000004;
              pkiData_ = input.readBytes();
              break;
            }
            case 34: {
              bitField0_ |= 0x00000008;
              serializedPaymentDetails_ = input.readBytes();
              break;
            }
            case 42: {
              bitField0_ |= 0x00000010;
              signature_ = input.readBytes();
              break;
            }
          }
        }
      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
        throw e.setUnfinishedMessage(this);
      } catch (java.io.IOException e) {
        throw new com.google.protobuf.InvalidProtocolBufferException(
            e.getMessage()).setUnfinishedMessage(this);
      } finally {
        this.unknownFields = unknownFields.build();
        makeExtensionsImmutable();
      }
    }
    public static final com.google.protobuf.Descriptors.Descriptor
        getDescriptor() {
      return org.bitcoin.protocols.payments.Protos.internal_static_payments_PaymentRequest_descriptor;
    }

    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return org.bitcoin.protocols.payments.Protos.internal_static_payments_PaymentRequest_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              org.bitcoin.protocols.payments.Protos.PaymentRequest.class, org.bitcoin.protocols.payments.Protos.PaymentRequest.Builder.class);
    }

    public static com.google.protobuf.Parser<PaymentRequest> PARSER =
        new com.google.protobuf.AbstractParser<PaymentRequest>() {
      public PaymentRequest parsePartialFrom(
          com.google.protobuf.CodedInputStream input,
          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
          throws com.google.protobuf.InvalidProtocolBufferException {
        return new PaymentRequest(input, extensionRegistry);
      }
    };

    @java.lang.Override
    public com.google.protobuf.Parser<PaymentRequest> getParserForType() {
      return PARSER;
    }

    private int bitField0_;
    public static final int PAYMENT_DETAILS_VERSION_FIELD_NUMBER = 1;
    private int paymentDetailsVersion_;
    /**
     * <code>optional uint32 payment_details_version = 1 [default = 1];</code>
     */
    public boolean hasPaymentDetailsVersion() {
      return ((bitField0_ & 0x00000001) == 0x00000001);
    }
    /**
     * <code>optional uint32 payment_details_version = 1 [default = 1];</code>
     */
    public int getPaymentDetailsVersion() {
      return paymentDetailsVersion_;
    }

    public static final int PKI_TYPE_FIELD_NUMBER = 2;
    private java.lang.Object pkiType_;
    /**
     * <code>optional string pki_type = 2 [default = "none"];</code>
     *
     * <pre>
     * none / x509+sha256 / x509+sha1
     * </pre>
     */
    public boolean hasPkiType() {
      return ((bitField0_ & 0x00000002) == 0x00000002);
    }
    /**
     * <code>optional string pki_type = 2 [default = "none"];</code>
     *
     * <pre>
     * none / x509+sha256 / x509+sha1
     * </pre>
     */
    public java.lang.String getPkiType() {
      java.lang.Object ref = pkiType_;
      if (ref instanceof java.lang.String) {
        return (java.lang.String) ref;
      } else {
        com.google.protobuf.ByteString bs = 
            (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        if (bs.isValidUtf8()) {
          pkiType_ = s;
        }
        return s;
      }
    }
    /**
     * <code>optional string pki_type = 2 [default = "none"];</code>
     *
     * <pre>
     * none / x509+sha256 / x509+sha1
     * </pre>
     */
    public com.google.protobuf.ByteString
        getPkiTypeBytes() {
      java.lang.Object ref = pkiType_;
      if (ref instanceof java.lang.String) {
        com.google.protobuf.ByteString b = 
            com.google.protobuf.ByteString.copyFromUtf8(
                (java.lang.String) ref);
        pkiType_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }

    public static final int PKI_DATA_FIELD_NUMBER = 3;
    private com.google.protobuf.ByteString pkiData_;
    /**
     * <code>optional bytes pki_data = 3;</code>
     *
     * <pre>
     * depends on pki_type
     * </pre>
     */
    public boolean hasPkiData() {
      return ((bitField0_ & 0x00000004) == 0x00000004);
    }
    /**
     * <code>optional bytes pki_data = 3;</code>
     *
     * <pre>
     * depends on pki_type
     * </pre>
     */
    public com.google.protobuf.ByteString getPkiData() {
      return pkiData_;
    }

    public static final int SERIALIZED_PAYMENT_DETAILS_FIELD_NUMBER = 4;
    private com.google.protobuf.ByteString serializedPaymentDetails_;
    /**
     * <code>required bytes serialized_payment_details = 4;</code>
     *
     * <pre>
     * PaymentDetails
     * </pre>
     */
    public boolean hasSerializedPaymentDetails() {
      return ((bitField0_ & 0x00000008) == 0x00000008);
    }
    /**
     * <code>required bytes serialized_payment_details = 4;</code>
     *
     * <pre>
     * PaymentDetails
     * </pre>
     */
    public com.google.protobuf.ByteString getSerializedPaymentDetails() {
      return serializedPaymentDetails_;
    }

    public static final int SIGNATURE_FIELD_NUMBER = 5;
    private com.google.protobuf.ByteString signature_;
    /**
     * <code>optional bytes signature = 5;</code>
     *
     * <pre>
     * pki-dependent signature
     * </pre>
     */
    public boolean hasSignature() {
      return ((bitField0_ & 0x00000010) == 0x00000010);
    }
    /**
     * <code>optional bytes signature = 5;</code>
     *
     * <pre>
     * pki-dependent signature
     * </pre>
     */
    public com.google.protobuf.ByteString getSignature() {
      return signature_;
    }

    private void initFields() {
      paymentDetailsVersion_ = 1;
      pkiType_ = "none";
      pkiData_ = com.google.protobuf.ByteString.EMPTY;
      serializedPaymentDetails_ = com.google.protobuf.ByteString.EMPTY;
      signature_ = com.google.protobuf.ByteString.EMPTY;
    }
    private byte memoizedIsInitialized = -1;
    public final boolean isInitialized() {
      byte isInitialized = memoizedIsInitialized;
      if (isInitialized == 1) return true;
      if (isInitialized == 0) return false;

      if (!hasSerializedPaymentDetails()) {
        memoizedIsInitialized = 0;
        return false;
      }
      memoizedIsInitialized = 1;
      return true;
    }

    public void writeTo(com.google.protobuf.CodedOutputStream output)
                        throws java.io.IOException {
      getSerializedSize();
      if (((bitField0_ & 0x00000001) == 0x00000001)) {
        output.writeUInt32(1, paymentDetailsVersion_);
      }
      if (((bitField0_ & 0x00000002) == 0x00000002)) {
        output.writeBytes(2, getPkiTypeBytes());
      }
      if (((bitField0_ & 0x00000004) == 0x00000004)) {
        output.writeBytes(3, pkiData_);
      }
      if (((bitField0_ & 0x00000008) == 0x00000008)) {
        output.writeBytes(4, serializedPaymentDetails_);
      }
      if (((bitField0_ & 0x00000010) == 0x00000010)) {
        output.writeBytes(5, signature_);
      }
      getUnknownFields().writeTo(output);
    }

    private int memoizedSerializedSize = -1;
    public int getSerializedSize() {
      int size = memoizedSerializedSize;
      if (size != -1) return size;

      size = 0;
      if (((bitField0_ & 0x00000001) == 0x00000001)) {
        size += com.google.protobuf.CodedOutputStream
          .computeUInt32Size(1, paymentDetailsVersion_);
      }
      if (((bitField0_ & 0x00000002) == 0x00000002)) {
        size += com.google.protobuf.CodedOutputStream
          .computeBytesSize(2, getPkiTypeBytes());
      }
      if (((bitField0_ & 0x00000004) == 0x00000004)) {
        size += com.google.protobuf.CodedOutputStream
          .computeBytesSize(3, pkiData_);
      }
      if (((bitField0_ & 0x00000008) == 0x00000008)) {
        size += com.google.protobuf.CodedOutputStream
          .computeBytesSize(4, serializedPaymentDetails_);
      }
      if (((bitField0_ & 0x00000010) == 0x00000010)) {
        size += com.google.protobuf.CodedOutputStream
          .computeBytesSize(5, signature_);
      }
      size += getUnknownFields().getSerializedSize();
      memoizedSerializedSize = size;
      return size;
    }

    private static final long serialVersionUID = 0L;
    @java.lang.Override
    protected java.lang.Object writeReplace()
        throws java.io.ObjectStreamException {
      return super.writeReplace();
    }

    public static org.bitcoin.protocols.payments.Protos.PaymentRequest parseFrom(
        com.google.protobuf.ByteString data)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data);
    }
    public static org.bitcoin.protocols.payments.Protos.PaymentRequest parseFrom(
        com.google.protobuf.ByteString data,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data, extensionRegistry);
    }
    public static org.bitcoin.protocols.payments.Protos.PaymentRequest parseFrom(byte[] data)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data);
    }
    public static org.bitcoin.protocols.payments.Protos.PaymentRequest parseFrom(
        byte[] data,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data, extensionRegistry);
    }
    public static org.bitcoin.protocols.payments.Protos.PaymentRequest parseFrom(java.io.InputStream input)
        throws java.io.IOException {
      return PARSER.parseFrom(input);
    }
    public static org.bitcoin.protocols.payments.Protos.PaymentRequest parseFrom(
        java.io.InputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      return PARSER.parseFrom(input, extensionRegistry);
    }
    public static org.bitcoin.protocols.payments.Protos.PaymentRequest parseDelimitedFrom(java.io.InputStream input)
        throws java.io.IOException {
      return PARSER.parseDelimitedFrom(input);
    }
    public static org.bitcoin.protocols.payments.Protos.PaymentRequest parseDelimitedFrom(
        java.io.InputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      return PARSER.parseDelimitedFrom(input, extensionRegistry);
    }
    public static org.bitcoin.protocols.payments.Protos.PaymentRequest parseFrom(
        com.google.protobuf.CodedInputStream input)
        throws java.io.IOException {
      return PARSER.parseFrom(input);
    }
    public static org.bitcoin.protocols.payments.Protos.PaymentRequest parseFrom(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      return PARSER.parseFrom(input, extensionRegistry);
    }

    public static Builder newBuilder() { return Builder.create(); }
    public Builder newBuilderForType() { return newBuilder(); }
    public static Builder newBuilder(org.bitcoin.protocols.payments.Protos.PaymentRequest prototype) {
      return newBuilder().mergeFrom(prototype);
    }
    public Builder toBuilder() { return newBuilder(this); }

    @java.lang.Override
    protected Builder newBuilderForType(
        com.google.protobuf.GeneratedMessage.BuilderParent parent) {
      Builder builder = new Builder(parent);
      return builder;
    }
    /**
     * Protobuf type {@code payments.PaymentRequest}
     */
    public static final class Builder extends
        com.google.protobuf.GeneratedMessage.Builder<Builder> implements
        // @@protoc_insertion_point(builder_implements:payments.PaymentRequest)
        org.bitcoin.protocols.payments.Protos.PaymentRequestOrBuilder {
      public static final com.google.protobuf.Descriptors.Descriptor
          getDescriptor() {
        return org.bitcoin.protocols.payments.Protos.internal_static_payments_PaymentRequest_descriptor;
      }

      protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
          internalGetFieldAccessorTable() {
        return org.bitcoin.protocols.payments.Protos.internal_static_payments_PaymentRequest_fieldAccessorTable
            .ensureFieldAccessorsInitialized(
                org.bitcoin.protocols.payments.Protos.PaymentRequest.class, org.bitcoin.protocols.payments.Protos.PaymentRequest.Builder.class);
      }

      // Construct using org.bitcoin.protocols.payments.Protos.PaymentRequest.newBuilder()
      private Builder() {
        maybeForceBuilderInitialization();
      }

      private Builder(
          com.google.protobuf.GeneratedMessage.BuilderParent parent) {
        super(parent);
        maybeForceBuilderInitialization();
      }
      private void maybeForceBuilderInitialization() {
        if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
        }
      }
      private static Builder create() {
        return new Builder();
      }

      public Builder clear() {
        super.clear();
        paymentDetailsVersion_ = 1;
        bitField0_ = (bitField0_ & ~0x00000001);
        pkiType_ = "none";
        bitField0_ = (bitField0_ & ~0x00000002);
        pkiData_ = com.google.protobuf.ByteString.EMPTY;
        bitField0_ = (bitField0_ & ~0x00000004);
        serializedPaymentDetails_ = com.google.protobuf.ByteString.EMPTY;
        bitField0_ = (bitField0_ & ~0x00000008);
        signature_ = com.google.protobuf.ByteString.EMPTY;
        bitField0_ = (bitField0_ & ~0x00000010);
        return this;
      }

      public Builder clone() {
        return create().mergeFrom(buildPartial());
      }

      public com.google.protobuf.Descriptors.Descriptor
          getDescriptorForType() {
        return org.bitcoin.protocols.payments.Protos.internal_static_payments_PaymentRequest_descriptor;
      }

      public org.bitcoin.protocols.payments.Protos.PaymentRequest getDefaultInstanceForType() {
        return org.bitcoin.protocols.payments.Protos.PaymentRequest.getDefaultInstance();
      }

      public org.bitcoin.protocols.payments.Protos.PaymentRequest build() {
        org.bitcoin.protocols.payments.Protos.PaymentRequest result = buildPartial();
        if (!result.isInitialized()) {
          throw newUninitializedMessageException(result);
        }
        return result;
      }

      public org.bitcoin.protocols.payments.Protos.PaymentRequest buildPartial() {
        org.bitcoin.protocols.payments.Protos.PaymentRequest result = new org.bitcoin.protocols.payments.Protos.PaymentRequest(this);
        int from_bitField0_ = bitField0_;
        int to_bitField0_ = 0;
        if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
          to_bitField0_ |= 0x00000001;
        }
        result.paymentDetailsVersion_ = paymentDetailsVersion_;
        if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
          to_bitField0_ |= 0x00000002;
        }
        result.pkiType_ = pkiType_;
        if (((from_bitField0_ & 0x00000004) == 0x00000004)) {
          to_bitField0_ |= 0x00000004;
        }
        result.pkiData_ = pkiData_;
        if (((from_bitField0_ & 0x00000008) == 0x00000008)) {
          to_bitField0_ |= 0x00000008;
        }
        result.serializedPaymentDetails_ = serializedPaymentDetails_;
        if (((from_bitField0_ & 0x00000010) == 0x00000010)) {
          to_bitField0_ |= 0x00000010;
        }
        result.signature_ = signature_;
        result.bitField0_ = to_bitField0_;
        onBuilt();
        return result;
      }

      public Builder mergeFrom(com.google.protobuf.Message other) {
        if (other instanceof org.bitcoin.protocols.payments.Protos.PaymentRequest) {
          return mergeFrom((org.bitcoin.protocols.payments.Protos.PaymentRequest)other);
        } else {
          super.mergeFrom(other);
          return this;
        }
      }

      public Builder mergeFrom(org.bitcoin.protocols.payments.Protos.PaymentRequest other) {
        if (other == org.bitcoin.protocols.payments.Protos.PaymentRequest.getDefaultInstance()) return this;
        if (other.hasPaymentDetailsVersion()) {
          setPaymentDetailsVersion(other.getPaymentDetailsVersion());
        }
        if (other.hasPkiType()) {
          bitField0_ |= 0x00000002;
          pkiType_ = other.pkiType_;
          onChanged();
        }
        if (other.hasPkiData()) {
          setPkiData(other.getPkiData());
        }
        if (other.hasSerializedPaymentDetails()) {
          setSerializedPaymentDetails(other.getSerializedPaymentDetails());
        }
        if (other.hasSignature()) {
          setSignature(other.getSignature());
        }
        this.mergeUnknownFields(other.getUnknownFields());
        return this;
      }

      public final boolean isInitialized() {
        if (!hasSerializedPaymentDetails()) {
          
          return false;
        }
        return true;
      }

      public Builder mergeFrom(
          com.google.protobuf.CodedInputStream input,
          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
          throws java.io.IOException {
        org.bitcoin.protocols.payments.Protos.PaymentRequest parsedMessage = null;
        try {
          parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
          parsedMessage = (org.bitcoin.protocols.payments.Protos.PaymentRequest) e.getUnfinishedMessage();
          throw e;
        } finally {
          if (parsedMessage != null) {
            mergeFrom(parsedMessage);
          }
        }
        return this;
      }
      private int bitField0_;

      private int paymentDetailsVersion_ = 1;
      /**
       * <code>optional uint32 payment_details_version = 1 [default = 1];</code>
       */
      public boolean hasPaymentDetailsVersion() {
        return ((bitField0_ & 0x00000001) == 0x00000001);
      }
      /**
       * <code>optional uint32 payment_details_version = 1 [default = 1];</code>
       */
      public int getPaymentDetailsVersion() {
        return paymentDetailsVersion_;
      }
      /**
       * <code>optional uint32 payment_details_version = 1 [default = 1];</code>
       */
      public Builder setPaymentDetailsVersion(int value) {
        bitField0_ |= 0x00000001;
        paymentDetailsVersion_ = value;
        onChanged();
        return this;
      }
      /**
       * <code>optional uint32 payment_details_version = 1 [default = 1];</code>
       */
      public Builder clearPaymentDetailsVersion() {
        bitField0_ = (bitField0_ & ~0x00000001);
        paymentDetailsVersion_ = 1;
        onChanged();
        return this;
      }

      private java.lang.Object pkiType_ = "none";
      /**
       * <code>optional string pki_type = 2 [default = "none"];</code>
       *
       * <pre>
       * none / x509+sha256 / x509+sha1
       * </pre>
       */
      public boolean hasPkiType() {
        return ((bitField0_ & 0x00000002) == 0x00000002);
      }
      /**
       * <code>optional string pki_type = 2 [default = "none"];</code>
       *
       * <pre>
       * none / x509+sha256 / x509+sha1
       * </pre>
       */
      public java.lang.String getPkiType() {
        java.lang.Object ref = pkiType_;
        if (!(ref instanceof java.lang.String)) {
          com.google.protobuf.ByteString bs =
              (com.google.protobuf.ByteString) ref;
          java.lang.String s = bs.toStringUtf8();
          if (bs.isValidUtf8()) {
            pkiType_ = s;
          }
          return s;
        } else {
          return (java.lang.String) ref;
        }
      }
      /**
       * <code>optional string pki_type = 2 [default = "none"];</code>
       *
       * <pre>
       * none / x509+sha256 / x509+sha1
       * </pre>
       */
      public com.google.protobuf.ByteString
          getPkiTypeBytes() {
        java.lang.Object ref = pkiType_;
        if (ref instanceof String) {
          com.google.protobuf.ByteString b = 
              com.google.protobuf.ByteString.copyFromUtf8(
                  (java.lang.String) ref);
          pkiType_ = b;
          return b;
        } else {
          return (com.google.protobuf.ByteString) ref;
        }
      }
      /**
       * <code>optional string pki_type = 2 [default = "none"];</code>
       *
       * <pre>
       * none / x509+sha256 / x509+sha1
       * </pre>
       */
      public Builder setPkiType(
          java.lang.String value) {
        if (value == null) {
    throw new NullPointerException();
  }
  bitField0_ |= 0x00000002;
        pkiType_ = value;
        onChanged();
        return this;
      }
      /**
       * <code>optional string pki_type = 2 [default = "none"];</code>
       *
       * <pre>
       * none / x509+sha256 / x509+sha1
       * </pre>
       */
      public Builder clearPkiType() {
        bitField0_ = (bitField0_ & ~0x00000002);
        pkiType_ = getDefaultInstance().getPkiType();
        onChanged();
        return this;
      }
      /**
       * <code>optional string pki_type = 2 [default = "none"];</code>
       *
       * <pre>
       * none / x509+sha256 / x509+sha1
       * </pre>
       */
      public Builder setPkiTypeBytes(
          com.google.protobuf.ByteString value) {
        if (value == null) {
    throw new NullPointerException();
  }
  bitField0_ |= 0x00000002;
        pkiType_ = value;
        onChanged();
        return this;
      }

      private com.google.protobuf.ByteString pkiData_ = com.google.protobuf.ByteString.EMPTY;
      /**
       * <code>optional bytes pki_data = 3;</code>
       *
       * <pre>
       * depends on pki_type
       * </pre>
       */
      public boolean hasPkiData() {
        return ((bitField0_ & 0x00000004) == 0x00000004);
      }
      /**
       * <code>optional bytes pki_data = 3;</code>
       *
       * <pre>
       * depends on pki_type
       * </pre>
       */
      public com.google.protobuf.ByteString getPkiData() {
        return pkiData_;
      }
      /**
       * <code>optional bytes pki_data = 3;</code>
       *
       * <pre>
       * depends on pki_type
       * </pre>
       */
      public Builder setPkiData(com.google.protobuf.ByteString value) {
        if (value == null) {
    throw new NullPointerException();
  }
  bitField0_ |= 0x00000004;
        pkiData_ = value;
        onChanged();
        return this;
      }
      /**
       * <code>optional bytes pki_data = 3;</code>
       *
       * <pre>
       * depends on pki_type
       * </pre>
       */
      public Builder clearPkiData() {
        bitField0_ = (bitField0_ & ~0x00000004);
        pkiData_ = getDefaultInstance().getPkiData();
        onChanged();
        return this;
      }

      private com.google.protobuf.ByteString serializedPaymentDetails_ = com.google.protobuf.ByteString.EMPTY;
      /**
       * <code>required bytes serialized_payment_details = 4;</code>
       *
       * <pre>
       * PaymentDetails
       * </pre>
       */
      public boolean hasSerializedPaymentDetails() {
        return ((bitField0_ & 0x00000008) == 0x00000008);
      }
      /**
       * <code>required bytes serialized_payment_details = 4;</code>
       *
       * <pre>
       * PaymentDetails
       * </pre>
       */
      public com.google.protobuf.ByteString getSerializedPaymentDetails() {
        return serializedPaymentDetails_;
      }
      /**
       * <code>required bytes serialized_payment_details = 4;</code>
       *
       * <pre>
       * PaymentDetails
       * </pre>
       */
      public Builder setSerializedPaymentDetails(com.google.protobuf.ByteString value) {
        if (value == null) {
    throw new NullPointerException();
  }
  bitField0_ |= 0x00000008;
        serializedPaymentDetails_ = value;
        onChanged();
        return this;
      }
      /**
       * <code>required bytes serialized_payment_details = 4;</code>
       *
       * <pre>
       * PaymentDetails
       * </pre>
       */
      public Builder clearSerializedPaymentDetails() {
        bitField0_ = (bitField0_ & ~0x00000008);
        serializedPaymentDetails_ = getDefaultInstance().getSerializedPaymentDetails();
        onChanged();
        return this;
      }

      private com.google.protobuf.ByteString signature_ = com.google.protobuf.ByteString.EMPTY;
      /**
       * <code>optional bytes signature = 5;</code>
       *
       * <pre>
       * pki-dependent signature
       * </pre>
       */
      public boolean hasSignature() {
        return ((bitField0_ & 0x00000010) == 0x00000010);
      }
      /**
       * <code>optional bytes signature = 5;</code>
       *
       * <pre>
       * pki-dependent signature
       * </pre>
       */
      public com.google.protobuf.ByteString getSignature() {
        return signature_;
      }
      /**
       * <code>optional bytes signature = 5;</code>
       *
       * <pre>
       * pki-dependent signature
       * </pre>
       */
      public Builder setSignature(com.google.protobuf.ByteString value) {
        if (value == null) {
    throw new NullPointerException();
  }
  bitField0_ |= 0x00000010;
        signature_ = value;
        onChanged();
        return this;
      }
      /**
       * <code>optional bytes signature = 5;</code>
       *
       * <pre>
       * pki-dependent signature
       * </pre>
       */
      public Builder clearSignature() {
        bitField0_ = (bitField0_ & ~0x00000010);
        signature_ = getDefaultInstance().getSignature();
        onChanged();
        return this;
      }

      // @@protoc_insertion_point(builder_scope:payments.PaymentRequest)
    }

    static {
      defaultInstance = new PaymentRequest(true);
      defaultInstance.initFields();
    }

    // @@protoc_insertion_point(class_scope:payments.PaymentRequest)
  }

  public interface X509CertificatesOrBuilder extends
      // @@protoc_insertion_point(interface_extends:payments.X509Certificates)
      com.google.protobuf.MessageOrBuilder {

    /**
     * <code>repeated bytes certificate = 1;</code>
     *
     * <pre>
     * DER-encoded X.509 certificate chain
     * </pre>
     */
    java.util.List<com.google.protobuf.ByteString> getCertificateList();
    /**
     * <code>repeated bytes certificate = 1;</code>
     *
     * <pre>
     * DER-encoded X.509 certificate chain
     * </pre>
     */
    int getCertificateCount();
    /**
     * <code>repeated bytes certificate = 1;</code>
     *
     * <pre>
     * DER-encoded X.509 certificate chain
     * </pre>
     */
    com.google.protobuf.ByteString getCertificate(int index);
  }
  /**
   * Protobuf type {@code payments.X509Certificates}
   */
  public static final class X509Certificates extends
      com.google.protobuf.GeneratedMessage implements
      // @@protoc_insertion_point(message_implements:payments.X509Certificates)
      X509CertificatesOrBuilder {
    // Use X509Certificates.newBuilder() to construct.
    private X509Certificates(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
      super(builder);
      this.unknownFields = builder.getUnknownFields();
    }
    private X509Certificates(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }

    private static final X509Certificates defaultInstance;
    public static X509Certificates getDefaultInstance() {
      return defaultInstance;
    }

    public X509Certificates getDefaultInstanceForType() {
      return defaultInstance;
    }

    private final com.google.protobuf.UnknownFieldSet unknownFields;
    @java.lang.Override
    public final com.google.protobuf.UnknownFieldSet
        getUnknownFields() {
      return this.unknownFields;
    }
    private X509Certificates(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      initFields();
      int mutable_bitField0_ = 0;
      com.google.protobuf.UnknownFieldSet.Builder unknownFields =
          com.google.protobuf.UnknownFieldSet.newBuilder();
      try {
        boolean done = false;
        while (!done) {
          int tag = input.readTag();
          switch (tag) {
            case 0:
              done = true;
              break;
            default: {
              if (!parseUnknownField(input, unknownFields,
                                     extensionRegistry, tag)) {
                done = true;
              }
              break;
            }
            case 10: {
              if (!((mutable_bitField0_ & 0x00000001) == 0x00000001)) {
                certificate_ = new java.util.ArrayList<com.google.protobuf.ByteString>();
                mutable_bitField0_ |= 0x00000001;
              }
              certificate_.add(input.readBytes());
              break;
            }
          }
        }
      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
        throw e.setUnfinishedMessage(this);
      } catch (java.io.IOException e) {
        throw new com.google.protobuf.InvalidProtocolBufferException(
            e.getMessage()).setUnfinishedMessage(this);
      } finally {
        if (((mutable_bitField0_ & 0x00000001) == 0x00000001)) {
          certificate_ = java.util.Collections.unmodifiableList(certificate_);
        }
        this.unknownFields = unknownFields.build();
        makeExtensionsImmutable();
      }
    }
    public static final com.google.protobuf.Descriptors.Descriptor
        getDescriptor() {
      return org.bitcoin.protocols.payments.Protos.internal_static_payments_X509Certificates_descriptor;
    }

    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return org.bitcoin.protocols.payments.Protos.internal_static_payments_X509Certificates_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              org.bitcoin.protocols.payments.Protos.X509Certificates.class, org.bitcoin.protocols.payments.Protos.X509Certificates.Builder.class);
    }

    public static com.google.protobuf.Parser<X509Certificates> PARSER =
        new com.google.protobuf.AbstractParser<X509Certificates>() {
      public X509Certificates parsePartialFrom(
          com.google.protobuf.CodedInputStream input,
          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
          throws com.google.protobuf.InvalidProtocolBufferException {
        return new X509Certificates(input, extensionRegistry);
      }
    };

    @java.lang.Override
    public com.google.protobuf.Parser<X509Certificates> getParserForType() {
      return PARSER;
    }

    public static final int CERTIFICATE_FIELD_NUMBER = 1;
    private java.util.List<com.google.protobuf.ByteString> certificate_;
    /**
     * <code>repeated bytes certificate = 1;</code>
     *
     * <pre>
     * DER-encoded X.509 certificate chain
     * </pre>
     */
    public java.util.List<com.google.protobuf.ByteString>
        getCertificateList() {
      return certificate_;
    }
    /**
     * <code>repeated bytes certificate = 1;</code>
     *
     * <pre>
     * DER-encoded X.509 certificate chain
     * </pre>
     */
    public int getCertificateCount() {
      return certificate_.size();
    }
    /**
     * <code>repeated bytes certificate = 1;</code>
     *
     * <pre>
     * DER-encoded X.509 certificate chain
     * </pre>
     */
    public com.google.protobuf.ByteString getCertificate(int index) {
      return certificate_.get(index);
    }

    private void initFields() {
      certificate_ = java.util.Collections.emptyList();
    }
    private byte memoizedIsInitialized = -1;
    public final boolean isInitialized() {
      byte isInitialized = memoizedIsInitialized;
      if (isInitialized == 1) return true;
      if (isInitialized == 0) return false;

      memoizedIsInitialized = 1;
      return true;
    }

    public void writeTo(com.google.protobuf.CodedOutputStream output)
                        throws java.io.IOException {
      getSerializedSize();
      for (int i = 0; i < certificate_.size(); i++) {
        output.writeBytes(1, certificate_.get(i));
      }
      getUnknownFields().writeTo(output);
    }

    private int memoizedSerializedSize = -1;
    public int getSerializedSize() {
      int size = memoizedSerializedSize;
      if (size != -1) return size;

      size = 0;
      {
        int dataSize = 0;
        for (int i = 0; i < certificate_.size(); i++) {
          dataSize += com.google.protobuf.CodedOutputStream
            .computeBytesSizeNoTag(certificate_.get(i));
        }
        size += dataSize;
        size += 1 * getCertificateList().size();
      }
      size += getUnknownFields().getSerializedSize();
      memoizedSerializedSize = size;
      return size;
    }

    private static final long serialVersionUID = 0L;
    @java.lang.Override
    protected java.lang.Object writeReplace()
        throws java.io.ObjectStreamException {
      return super.writeReplace();
    }

    public static org.bitcoin.protocols.payments.Protos.X509Certificates parseFrom(
        com.google.protobuf.ByteString data)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data);
    }
    public static org.bitcoin.protocols.payments.Protos.X509Certificates parseFrom(
        com.google.protobuf.ByteString data,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data, extensionRegistry);
    }
    public static org.bitcoin.protocols.payments.Protos.X509Certificates parseFrom(byte[] data)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data);
    }
    public static org.bitcoin.protocols.payments.Protos.X509Certificates parseFrom(
        byte[] data,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data, extensionRegistry);
    }
    public static org.bitcoin.protocols.payments.Protos.X509Certificates parseFrom(java.io.InputStream input)
        throws java.io.IOException {
      return PARSER.parseFrom(input);
    }
    public static org.bitcoin.protocols.payments.Protos.X509Certificates parseFrom(
        java.io.InputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      return PARSER.parseFrom(input, extensionRegistry);
    }
    public static org.bitcoin.protocols.payments.Protos.X509Certificates parseDelimitedFrom(java.io.InputStream input)
        throws java.io.IOException {
      return PARSER.parseDelimitedFrom(input);
    }
    public static org.bitcoin.protocols.payments.Protos.X509Certificates parseDelimitedFrom(
        java.io.InputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      return PARSER.parseDelimitedFrom(input, extensionRegistry);
    }
    public static org.bitcoin.protocols.payments.Protos.X509Certificates parseFrom(
        com.google.protobuf.CodedInputStream input)
        throws java.io.IOException {
      return PARSER.parseFrom(input);
    }
    public static org.bitcoin.protocols.payments.Protos.X509Certificates parseFrom(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      return PARSER.parseFrom(input, extensionRegistry);
    }

    public static Builder newBuilder() { return Builder.create(); }
    public Builder newBuilderForType() { return newBuilder(); }
    public static Builder newBuilder(org.bitcoin.protocols.payments.Protos.X509Certificates prototype) {
      return newBuilder().mergeFrom(prototype);
    }
    public Builder toBuilder() { return newBuilder(this); }

    @java.lang.Override
    protected Builder newBuilderForType(
        com.google.protobuf.GeneratedMessage.BuilderParent parent) {
      Builder builder = new Builder(parent);
      return builder;
    }
    /**
     * Protobuf type {@code payments.X509Certificates}
     */
    public static final class Builder extends
        com.google.protobuf.GeneratedMessage.Builder<Builder> implements
        // @@protoc_insertion_point(builder_implements:payments.X509Certificates)
        org.bitcoin.protocols.payments.Protos.X509CertificatesOrBuilder {
      public static final com.google.protobuf.Descriptors.Descriptor
          getDescriptor() {
        return org.bitcoin.protocols.payments.Protos.internal_static_payments_X509Certificates_descriptor;
      }

      protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
          internalGetFieldAccessorTable() {
        return org.bitcoin.protocols.payments.Protos.internal_static_payments_X509Certificates_fieldAccessorTable
            .ensureFieldAccessorsInitialized(
                org.bitcoin.protocols.payments.Protos.X509Certificates.class, org.bitcoin.protocols.payments.Protos.X509Certificates.Builder.class);
      }

      // Construct using org.bitcoin.protocols.payments.Protos.X509Certificates.newBuilder()
      private Builder() {
        maybeForceBuilderInitialization();
      }

      private Builder(
          com.google.protobuf.GeneratedMessage.BuilderParent parent) {
        super(parent);
        maybeForceBuilderInitialization();
      }
      private void maybeForceBuilderInitialization() {
        if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
        }
      }
      private static Builder create() {
        return new Builder();
      }

      public Builder clear() {
        super.clear();
        certificate_ = java.util.Collections.emptyList();
        bitField0_ = (bitField0_ & ~0x00000001);
        return this;
      }

      public Builder clone() {
        return create().mergeFrom(buildPartial());
      }

      public com.google.protobuf.Descriptors.Descriptor
          getDescriptorForType() {
        return org.bitcoin.protocols.payments.Protos.internal_static_payments_X509Certificates_descriptor;
      }

      public org.bitcoin.protocols.payments.Protos.X509Certificates getDefaultInstanceForType() {
        return org.bitcoin.protocols.payments.Protos.X509Certificates.getDefaultInstance();
      }

      public org.bitcoin.protocols.payments.Protos.X509Certificates build() {
        org.bitcoin.protocols.payments.Protos.X509Certificates result = buildPartial();
        if (!result.isInitialized()) {
          throw newUninitializedMessageException(result);
        }
        return result;
      }

      public org.bitcoin.protocols.payments.Protos.X509Certificates buildPartial() {
        org.bitcoin.protocols.payments.Protos.X509Certificates result = new org.bitcoin.protocols.payments.Protos.X509Certificates(this);
        int from_bitField0_ = bitField0_;
        if (((bitField0_ & 0x00000001) == 0x00000001)) {
          certificate_ = java.util.Collections.unmodifiableList(certificate_);
          bitField0_ = (bitField0_ & ~0x00000001);
        }
        result.certificate_ = certificate_;
        onBuilt();
        return result;
      }

      public Builder mergeFrom(com.google.protobuf.Message other) {
        if (other instanceof org.bitcoin.protocols.payments.Protos.X509Certificates) {
          return mergeFrom((org.bitcoin.protocols.payments.Protos.X509Certificates)other);
        } else {
          super.mergeFrom(other);
          return this;
        }
      }

      public Builder mergeFrom(org.bitcoin.protocols.payments.Protos.X509Certificates other) {
        if (other == org.bitcoin.protocols.payments.Protos.X509Certificates.getDefaultInstance()) return this;
        if (!other.certificate_.isEmpty()) {
          if (certificate_.isEmpty()) {
            certificate_ = other.certificate_;
            bitField0_ = (bitField0_ & ~0x00000001);
          } else {
            ensureCertificateIsMutable();
            certificate_.addAll(other.certificate_);
          }
          onChanged();
        }
        this.mergeUnknownFields(other.getUnknownFields());
        return this;
      }

      public final boolean isInitialized() {
        return true;
      }

      public Builder mergeFrom(
          com.google.protobuf.CodedInputStream input,
          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
          throws java.io.IOException {
        org.bitcoin.protocols.payments.Protos.X509Certificates parsedMessage = null;
        try {
          parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
          parsedMessage = (org.bitcoin.protocols.payments.Protos.X509Certificates) e.getUnfinishedMessage();
          throw e;
        } finally {
          if (parsedMessage != null) {
            mergeFrom(parsedMessage);
          }
        }
        return this;
      }
      private int bitField0_;

      private java.util.List<com.google.protobuf.ByteString> certificate_ = java.util.Collections.emptyList();
      private void ensureCertificateIsMutable() {
        if (!((bitField0_ & 0x00000001) == 0x00000001)) {
          certificate_ = new java.util.ArrayList<com.google.protobuf.ByteString>(certificate_);
          bitField0_ |= 0x00000001;
         }
      }
      /**
       * <code>repeated bytes certificate = 1;</code>
       *
       * <pre>
       * DER-encoded X.509 certificate chain
       * </pre>
       */
      public java.util.List<com.google.protobuf.ByteString>
          getCertificateList() {
        return java.util.Collections.unmodifiableList(certificate_);
      }
      /**
       * <code>repeated bytes certificate = 1;</code>
       *
       * <pre>
       * DER-encoded X.509 certificate chain
       * </pre>
       */
      public int getCertificateCount() {
        return certificate_.size();
      }
      /**
       * <code>repeated bytes certificate = 1;</code>
       *
       * <pre>
       * DER-encoded X.509 certificate chain
       * </pre>
       */
      public com.google.protobuf.ByteString getCertificate(int index) {
        return certificate_.get(index);
      }
      /**
       * <code>repeated bytes certificate = 1;</code>
       *
       * <pre>
       * DER-encoded X.509 certificate chain
       * </pre>
       */
      public Builder setCertificate(
          int index, com.google.protobuf.ByteString value) {
        if (value == null) {
    throw new NullPointerException();
  }
  ensureCertificateIsMutable();
        certificate_.set(index, value);
        onChanged();
        return this;
      }
      /**
       * <code>repeated bytes certificate = 1;</code>
       *
       * <pre>
       * DER-encoded X.509 certificate chain
       * </pre>
       */
      public Builder addCertificate(com.google.protobuf.ByteString value) {
        if (value == null) {
    throw new NullPointerException();
  }
  ensureCertificateIsMutable();
        certificate_.add(value);
        onChanged();
        return this;
      }
      /**
       * <code>repeated bytes certificate = 1;</code>
       *
       * <pre>
       * DER-encoded X.509 certificate chain
       * </pre>
       */
      public Builder addAllCertificate(
          java.lang.Iterable<? extends com.google.protobuf.ByteString> values) {
        ensureCertificateIsMutable();
        com.google.protobuf.AbstractMessageLite.Builder.addAll(
            values, certificate_);
        onChanged();
        return this;
      }
      /**
       * <code>repeated bytes certificate = 1;</code>
       *
       * <pre>
       * DER-encoded X.509 certificate chain
       * </pre>
       */
      public Builder clearCertificate() {
        certificate_ = java.util.Collections.emptyList();
        bitField0_ = (bitField0_ & ~0x00000001);
        onChanged();
        return this;
      }

      // @@protoc_insertion_point(builder_scope:payments.X509Certificates)
    }

    static {
      defaultInstance = new X509Certificates(true);
      defaultInstance.initFields();
    }

    // @@protoc_insertion_point(class_scope:payments.X509Certificates)
  }

  public interface PaymentOrBuilder extends
      // @@protoc_insertion_point(interface_extends:payments.Payment)
      com.google.protobuf.MessageOrBuilder {

    /**
     * <code>optional bytes merchant_data = 1;</code>
     *
     * <pre>
     * From PaymentDetails.merchant_data
     * </pre>
     */
    boolean hasMerchantData();
    /**
     * <code>optional bytes merchant_data = 1;</code>
     *
     * <pre>
     * From PaymentDetails.merchant_data
     * </pre>
     */
    com.google.protobuf.ByteString getMerchantData();

    /**
     * <code>repeated bytes transactions = 2;</code>
     *
     * <pre>
     * Signed transactions that satisfy PaymentDetails.outputs
     * </pre>
     */
    java.util.List<com.google.protobuf.ByteString> getTransactionsList();
    /**
     * <code>repeated bytes transactions = 2;</code>
     *
     * <pre>
     * Signed transactions that satisfy PaymentDetails.outputs
     * </pre>
     */
    int getTransactionsCount();
    /**
     * <code>repeated bytes transactions = 2;</code>
     *
     * <pre>
     * Signed transactions that satisfy PaymentDetails.outputs
     * </pre>
     */
    com.google.protobuf.ByteString getTransactions(int index);

    /**
     * <code>repeated .payments.Output refund_to = 3;</code>
     *
     * <pre>
     * Where to send refunds, if a refund is necessary
     * </pre>
     */
    java.util.List<org.bitcoin.protocols.payments.Protos.Output> 
        getRefundToList();
    /**
     * <code>repeated .payments.Output refund_to = 3;</code>
     *
     * <pre>
     * Where to send refunds, if a refund is necessary
     * </pre>
     */
    org.bitcoin.protocols.payments.Protos.Output getRefundTo(int index);
    /**
     * <code>repeated .payments.Output refund_to = 3;</code>
     *
     * <pre>
     * Where to send refunds, if a refund is necessary
     * </pre>
     */
    int getRefundToCount();
    /**
     * <code>repeated .payments.Output refund_to = 3;</code>
     *
     * <pre>
     * Where to send refunds, if a refund is necessary
     * </pre>
     */
    java.util.List<? extends org.bitcoin.protocols.payments.Protos.OutputOrBuilder> 
        getRefundToOrBuilderList();
    /**
     * <code>repeated .payments.Output refund_to = 3;</code>
     *
     * <pre>
     * Where to send refunds, if a refund is necessary
     * </pre>
     */
    org.bitcoin.protocols.payments.Protos.OutputOrBuilder getRefundToOrBuilder(
        int index);

    /**
     * <code>optional string memo = 4;</code>
     *
     * <pre>
     * Human-readable message for the merchant
     * </pre>
     */
    boolean hasMemo();
    /**
     * <code>optional string memo = 4;</code>
     *
     * <pre>
     * Human-readable message for the merchant
     * </pre>
     */
    java.lang.String getMemo();
    /**
     * <code>optional string memo = 4;</code>
     *
     * <pre>
     * Human-readable message for the merchant
     * </pre>
     */
    com.google.protobuf.ByteString
        getMemoBytes();
  }
  /**
   * Protobuf type {@code payments.Payment}
   */
  public static final class Payment extends
      com.google.protobuf.GeneratedMessage implements
      // @@protoc_insertion_point(message_implements:payments.Payment)
      PaymentOrBuilder {
    // Use Payment.newBuilder() to construct.
    private Payment(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
      super(builder);
      this.unknownFields = builder.getUnknownFields();
    }
    private Payment(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }

    private static final Payment defaultInstance;
    public static Payment getDefaultInstance() {
      return defaultInstance;
    }

    public Payment getDefaultInstanceForType() {
      return defaultInstance;
    }

    private final com.google.protobuf.UnknownFieldSet unknownFields;
    @java.lang.Override
    public final com.google.protobuf.UnknownFieldSet
        getUnknownFields() {
      return this.unknownFields;
    }
    private Payment(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      initFields();
      int mutable_bitField0_ = 0;
      com.google.protobuf.UnknownFieldSet.Builder unknownFields =
          com.google.protobuf.UnknownFieldSet.newBuilder();
      try {
        boolean done = false;
        while (!done) {
          int tag = input.readTag();
          switch (tag) {
            case 0:
              done = true;
              break;
            default: {
              if (!parseUnknownField(input, unknownFields,
                                     extensionRegistry, tag)) {
                done = true;
              }
              break;
            }
            case 10: {
              bitField0_ |= 0x00000001;
              merchantData_ = input.readBytes();
              break;
            }
            case 18: {
              if (!((mutable_bitField0_ & 0x00000002) == 0x00000002)) {
                transactions_ = new java.util.ArrayList<com.google.protobuf.ByteString>();
                mutable_bitField0_ |= 0x00000002;
              }
              transactions_.add(input.readBytes());
              break;
            }
            case 26: {
              if (!((mutable_bitField0_ & 0x00000004) == 0x00000004)) {
                refundTo_ = new java.util.ArrayList<org.bitcoin.protocols.payments.Protos.Output>();
                mutable_bitField0_ |= 0x00000004;
              }
              refundTo_.add(input.readMessage(org.bitcoin.protocols.payments.Protos.Output.PARSER, extensionRegistry));
              break;
            }
            case 34: {
              com.google.protobuf.ByteString bs = input.readBytes();
              bitField0_ |= 0x00000002;
              memo_ = bs;
              break;
            }
          }
        }
      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
        throw e.setUnfinishedMessage(this);
      } catch (java.io.IOException e) {
        throw new com.google.protobuf.InvalidProtocolBufferException(
            e.getMessage()).setUnfinishedMessage(this);
      } finally {
        if (((mutable_bitField0_ & 0x00000002) == 0x00000002)) {
          transactions_ = java.util.Collections.unmodifiableList(transactions_);
        }
        if (((mutable_bitField0_ & 0x00000004) == 0x00000004)) {
          refundTo_ = java.util.Collections.unmodifiableList(refundTo_);
        }
        this.unknownFields = unknownFields.build();
        makeExtensionsImmutable();
      }
    }
    public static final com.google.protobuf.Descriptors.Descriptor
        getDescriptor() {
      return org.bitcoin.protocols.payments.Protos.internal_static_payments_Payment_descriptor;
    }

    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return org.bitcoin.protocols.payments.Protos.internal_static_payments_Payment_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              org.bitcoin.protocols.payments.Protos.Payment.class, org.bitcoin.protocols.payments.Protos.Payment.Builder.class);
    }

    public static com.google.protobuf.Parser<Payment> PARSER =
        new com.google.protobuf.AbstractParser<Payment>() {
      public Payment parsePartialFrom(
          com.google.protobuf.CodedInputStream input,
          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
          throws com.google.protobuf.InvalidProtocolBufferException {
        return new Payment(input, extensionRegistry);
      }
    };

    @java.lang.Override
    public com.google.protobuf.Parser<Payment> getParserForType() {
      return PARSER;
    }

    private int bitField0_;
    public static final int MERCHANT_DATA_FIELD_NUMBER = 1;
    private com.google.protobuf.ByteString merchantData_;
    /**
     * <code>optional bytes merchant_data = 1;</code>
     *
     * <pre>
     * From PaymentDetails.merchant_data
     * </pre>
     */
    public boolean hasMerchantData() {
      return ((bitField0_ & 0x00000001) == 0x00000001);
    }
    /**
     * <code>optional bytes merchant_data = 1;</code>
     *
     * <pre>
     * From PaymentDetails.merchant_data
     * </pre>
     */
    public com.google.protobuf.ByteString getMerchantData() {
      return merchantData_;
    }

    public static final int TRANSACTIONS_FIELD_NUMBER = 2;
    private java.util.List<com.google.protobuf.ByteString> transactions_;
    /**
     * <code>repeated bytes transactions = 2;</code>
     *
     * <pre>
     * Signed transactions that satisfy PaymentDetails.outputs
     * </pre>
     */
    public java.util.List<com.google.protobuf.ByteString>
        getTransactionsList() {
      return transactions_;
    }
    /**
     * <code>repeated bytes transactions = 2;</code>
     *
     * <pre>
     * Signed transactions that satisfy PaymentDetails.outputs
     * </pre>
     */
    public int getTransactionsCount() {
      return transactions_.size();
    }
    /**
     * <code>repeated bytes transactions = 2;</code>
     *
     * <pre>
     * Signed transactions that satisfy PaymentDetails.outputs
     * </pre>
     */
    public com.google.protobuf.ByteString getTransactions(int index) {
      return transactions_.get(index);
    }

    public static final int REFUND_TO_FIELD_NUMBER = 3;
    private java.util.List<org.bitcoin.protocols.payments.Protos.Output> refundTo_;
    /**
     * <code>repeated .payments.Output refund_to = 3;</code>
     *
     * <pre>
     * Where to send refunds, if a refund is necessary
     * </pre>
     */
    public java.util.List<org.bitcoin.protocols.payments.Protos.Output> getRefundToList() {
      return refundTo_;
    }
    /**
     * <code>repeated .payments.Output refund_to = 3;</code>
     *
     * <pre>
     * Where to send refunds, if a refund is necessary
     * </pre>
     */
    public java.util.List<? extends org.bitcoin.protocols.payments.Protos.OutputOrBuilder> 
        getRefundToOrBuilderList() {
      return refundTo_;
    }
    /**
     * <code>repeated .payments.Output refund_to = 3;</code>
     *
     * <pre>
     * Where to send refunds, if a refund is necessary
     * </pre>
     */
    public int getRefundToCount() {
      return refundTo_.size();
    }
    /**
     * <code>repeated .payments.Output refund_to = 3;</code>
     *
     * <pre>
     * Where to send refunds, if a refund is necessary
     * </pre>
     */
    public org.bitcoin.protocols.payments.Protos.Output getRefundTo(int index) {
      return refundTo_.get(index);
    }
    /**
     * <code>repeated .payments.Output refund_to = 3;</code>
     *
     * <pre>
     * Where to send refunds, if a refund is necessary
     * </pre>
     */
    public org.bitcoin.protocols.payments.Protos.OutputOrBuilder getRefundToOrBuilder(
        int index) {
      return refundTo_.get(index);
    }

    public static final int MEMO_FIELD_NUMBER = 4;
    private java.lang.Object memo_;
    /**
     * <code>optional string memo = 4;</code>
     *
     * <pre>
     * Human-readable message for the merchant
     * </pre>
     */
    public boolean hasMemo() {
      return ((bitField0_ & 0x00000002) == 0x00000002);
    }
    /**
     * <code>optional string memo = 4;</code>
     *
     * <pre>
     * Human-readable message for the merchant
     * </pre>
     */
    public java.lang.String getMemo() {
      java.lang.Object ref = memo_;
      if (ref instanceof java.lang.String) {
        return (java.lang.String) ref;
      } else {
        com.google.protobuf.ByteString bs = 
            (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        if (bs.isValidUtf8()) {
          memo_ = s;
        }
        return s;
      }
    }
    /**
     * <code>optional string memo = 4;</code>
     *
     * <pre>
     * Human-readable message for the merchant
     * </pre>
     */
    public com.google.protobuf.ByteString
        getMemoBytes() {
      java.lang.Object ref = memo_;
      if (ref instanceof java.lang.String) {
        com.google.protobuf.ByteString b = 
            com.google.protobuf.ByteString.copyFromUtf8(
                (java.lang.String) ref);
        memo_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }

    private void initFields() {
      merchantData_ = com.google.protobuf.ByteString.EMPTY;
      transactions_ = java.util.Collections.emptyList();
      refundTo_ = java.util.Collections.emptyList();
      memo_ = "";
    }
    private byte memoizedIsInitialized = -1;
    public final boolean isInitialized() {
      byte isInitialized = memoizedIsInitialized;
      if (isInitialized == 1) return true;
      if (isInitialized == 0) return false;

      for (int i = 0; i < getRefundToCount(); i++) {
        if (!getRefundTo(i).isInitialized()) {
          memoizedIsInitialized = 0;
          return false;
        }
      }
      memoizedIsInitialized = 1;
      return true;
    }

    public void writeTo(com.google.protobuf.CodedOutputStream output)
                        throws java.io.IOException {
      getSerializedSize();
      if (((bitField0_ & 0x00000001) == 0x00000001)) {
        output.writeBytes(1, merchantData_);
      }
      for (int i = 0; i < transactions_.size(); i++) {
        output.writeBytes(2, transactions_.get(i));
      }
      for (int i = 0; i < refundTo_.size(); i++) {
        output.writeMessage(3, refundTo_.get(i));
      }
      if (((bitField0_ & 0x00000002) == 0x00000002)) {
        output.writeBytes(4, getMemoBytes());
      }
      getUnknownFields().writeTo(output);
    }

    private int memoizedSerializedSize = -1;
    public int getSerializedSize() {
      int size = memoizedSerializedSize;
      if (size != -1) return size;

      size = 0;
      if (((bitField0_ & 0x00000001) == 0x00000001)) {
        size += com.google.protobuf.CodedOutputStream
          .computeBytesSize(1, merchantData_);
      }
      {
        int dataSize = 0;
        for (int i = 0; i < transactions_.size(); i++) {
          dataSize += com.google.protobuf.CodedOutputStream
            .computeBytesSizeNoTag(transactions_.get(i));
        }
        size += dataSize;
        size += 1 * getTransactionsList().size();
      }
      for (int i = 0; i < refundTo_.size(); i++) {
        size += com.google.protobuf.CodedOutputStream
          .computeMessageSize(3, refundTo_.get(i));
      }
      if (((bitField0_ & 0x00000002) == 0x00000002)) {
        size += com.google.protobuf.CodedOutputStream
          .computeBytesSize(4, getMemoBytes());
      }
      size += getUnknownFields().getSerializedSize();
      memoizedSerializedSize = size;
      return size;
    }

    private static final long serialVersionUID = 0L;
    @java.lang.Override
    protected java.lang.Object writeReplace()
        throws java.io.ObjectStreamException {
      return super.writeReplace();
    }

    public static org.bitcoin.protocols.payments.Protos.Payment parseFrom(
        com.google.protobuf.ByteString data)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data);
    }
    public static org.bitcoin.protocols.payments.Protos.Payment parseFrom(
        com.google.protobuf.ByteString data,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data, extensionRegistry);
    }
    public static org.bitcoin.protocols.payments.Protos.Payment parseFrom(byte[] data)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data);
    }
    public static org.bitcoin.protocols.payments.Protos.Payment parseFrom(
        byte[] data,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data, extensionRegistry);
    }
    public static org.bitcoin.protocols.payments.Protos.Payment parseFrom(java.io.InputStream input)
        throws java.io.IOException {
      return PARSER.parseFrom(input);
    }
    public static org.bitcoin.protocols.payments.Protos.Payment parseFrom(
        java.io.InputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      return PARSER.parseFrom(input, extensionRegistry);
    }
    public static org.bitcoin.protocols.payments.Protos.Payment parseDelimitedFrom(java.io.InputStream input)
        throws java.io.IOException {
      return PARSER.parseDelimitedFrom(input);
    }
    public static org.bitcoin.protocols.payments.Protos.Payment parseDelimitedFrom(
        java.io.InputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      return PARSER.parseDelimitedFrom(input, extensionRegistry);
    }
    public static org.bitcoin.protocols.payments.Protos.Payment parseFrom(
        com.google.protobuf.CodedInputStream input)
        throws java.io.IOException {
      return PARSER.parseFrom(input);
    }
    public static org.bitcoin.protocols.payments.Protos.Payment parseFrom(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      return PARSER.parseFrom(input, extensionRegistry);
    }

    public static Builder newBuilder() { return Builder.create(); }
    public Builder newBuilderForType() { return newBuilder(); }
    public static Builder newBuilder(org.bitcoin.protocols.payments.Protos.Payment prototype) {
      return newBuilder().mergeFrom(prototype);
    }
    public Builder toBuilder() { return newBuilder(this); }

    @java.lang.Override
    protected Builder newBuilderForType(
        com.google.protobuf.GeneratedMessage.BuilderParent parent) {
      Builder builder = new Builder(parent);
      return builder;
    }
    /**
     * Protobuf type {@code payments.Payment}
     */
    public static final class Builder extends
        com.google.protobuf.GeneratedMessage.Builder<Builder> implements
        // @@protoc_insertion_point(builder_implements:payments.Payment)
        org.bitcoin.protocols.payments.Protos.PaymentOrBuilder {
      public static final com.google.protobuf.Descriptors.Descriptor
          getDescriptor() {
        return org.bitcoin.protocols.payments.Protos.internal_static_payments_Payment_descriptor;
      }

      protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
          internalGetFieldAccessorTable() {
        return org.bitcoin.protocols.payments.Protos.internal_static_payments_Payment_fieldAccessorTable
            .ensureFieldAccessorsInitialized(
                org.bitcoin.protocols.payments.Protos.Payment.class, org.bitcoin.protocols.payments.Protos.Payment.Builder.class);
      }

      // Construct using org.bitcoin.protocols.payments.Protos.Payment.newBuilder()
      private Builder() {
        maybeForceBuilderInitialization();
      }

      private Builder(
          com.google.protobuf.GeneratedMessage.BuilderParent parent) {
        super(parent);
        maybeForceBuilderInitialization();
      }
      private void maybeForceBuilderInitialization() {
        if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
          getRefundToFieldBuilder();
        }
      }
      private static Builder create() {
        return new Builder();
      }

      public Builder clear() {
        super.clear();
        merchantData_ = com.google.protobuf.ByteString.EMPTY;
        bitField0_ = (bitField0_ & ~0x00000001);
        transactions_ = java.util.Collections.emptyList();
        bitField0_ = (bitField0_ & ~0x00000002);
        if (refundToBuilder_ == null) {
          refundTo_ = java.util.Collections.emptyList();
          bitField0_ = (bitField0_ & ~0x00000004);
        } else {
          refundToBuilder_.clear();
        }
        memo_ = "";
        bitField0_ = (bitField0_ & ~0x00000008);
        return this;
      }

      public Builder clone() {
        return create().mergeFrom(buildPartial());
      }

      public com.google.protobuf.Descriptors.Descriptor
          getDescriptorForType() {
        return org.bitcoin.protocols.payments.Protos.internal_static_payments_Payment_descriptor;
      }

      public org.bitcoin.protocols.payments.Protos.Payment getDefaultInstanceForType() {
        return org.bitcoin.protocols.payments.Protos.Payment.getDefaultInstance();
      }

      public org.bitcoin.protocols.payments.Protos.Payment build() {
        org.bitcoin.protocols.payments.Protos.Payment result = buildPartial();
        if (!result.isInitialized()) {
          throw newUninitializedMessageException(result);
        }
        return result;
      }

      public org.bitcoin.protocols.payments.Protos.Payment buildPartial() {
        org.bitcoin.protocols.payments.Protos.Payment result = new org.bitcoin.protocols.payments.Protos.Payment(this);
        int from_bitField0_ = bitField0_;
        int to_bitField0_ = 0;
        if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
          to_bitField0_ |= 0x00000001;
        }
        result.merchantData_ = merchantData_;
        if (((bitField0_ & 0x00000002) == 0x00000002)) {
          transactions_ = java.util.Collections.unmodifiableList(transactions_);
          bitField0_ = (bitField0_ & ~0x00000002);
        }
        result.transactions_ = transactions_;
        if (refundToBuilder_ == null) {
          if (((bitField0_ & 0x00000004) == 0x00000004)) {
            refundTo_ = java.util.Collections.unmodifiableList(refundTo_);
            bitField0_ = (bitField0_ & ~0x00000004);
          }
          result.refundTo_ = refundTo_;
        } else {
          result.refundTo_ = refundToBuilder_.build();
        }
        if (((from_bitField0_ & 0x00000008) == 0x00000008)) {
          to_bitField0_ |= 0x00000002;
        }
        result.memo_ = memo_;
        result.bitField0_ = to_bitField0_;
        onBuilt();
        return result;
      }

      public Builder mergeFrom(com.google.protobuf.Message other) {
        if (other instanceof org.bitcoin.protocols.payments.Protos.Payment) {
          return mergeFrom((org.bitcoin.protocols.payments.Protos.Payment)other);
        } else {
          super.mergeFrom(other);
          return this;
        }
      }

      public Builder mergeFrom(org.bitcoin.protocols.payments.Protos.Payment other) {
        if (other == org.bitcoin.protocols.payments.Protos.Payment.getDefaultInstance()) return this;
        if (other.hasMerchantData()) {
          setMerchantData(other.getMerchantData());
        }
        if (!other.transactions_.isEmpty()) {
          if (transactions_.isEmpty()) {
            transactions_ = other.transactions_;
            bitField0_ = (bitField0_ & ~0x00000002);
          } else {
            ensureTransactionsIsMutable();
            transactions_.addAll(other.transactions_);
          }
          onChanged();
        }
        if (refundToBuilder_ == null) {
          if (!other.refundTo_.isEmpty()) {
            if (refundTo_.isEmpty()) {
              refundTo_ = other.refundTo_;
              bitField0_ = (bitField0_ & ~0x00000004);
            } else {
              ensureRefundToIsMutable();
              refundTo_.addAll(other.refundTo_);
            }
            onChanged();
          }
        } else {
          if (!other.refundTo_.isEmpty()) {
            if (refundToBuilder_.isEmpty()) {
              refundToBuilder_.dispose();
              refundToBuilder_ = null;
              refundTo_ = other.refundTo_;
              bitField0_ = (bitField0_ & ~0x00000004);
              refundToBuilder_ = 
                com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ?
                   getRefundToFieldBuilder() : null;
            } else {
              refundToBuilder_.addAllMessages(other.refundTo_);
            }
          }
        }
        if (other.hasMemo()) {
          bitField0_ |= 0x00000008;
          memo_ = other.memo_;
          onChanged();
        }
        this.mergeUnknownFields(other.getUnknownFields());
        return this;
      }

      public final boolean isInitialized() {
        for (int i = 0; i < getRefundToCount(); i++) {
          if (!getRefundTo(i).isInitialized()) {
            
            return false;
          }
        }
        return true;
      }

      public Builder mergeFrom(
          com.google.protobuf.CodedInputStream input,
          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
          throws java.io.IOException {
        org.bitcoin.protocols.payments.Protos.Payment parsedMessage = null;
        try {
          parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
          parsedMessage = (org.bitcoin.protocols.payments.Protos.Payment) e.getUnfinishedMessage();
          throw e;
        } finally {
          if (parsedMessage != null) {
            mergeFrom(parsedMessage);
          }
        }
        return this;
      }
      private int bitField0_;

      private com.google.protobuf.ByteString merchantData_ = com.google.protobuf.ByteString.EMPTY;
      /**
       * <code>optional bytes merchant_data = 1;</code>
       *
       * <pre>
       * From PaymentDetails.merchant_data
       * </pre>
       */
      public boolean hasMerchantData() {
        return ((bitField0_ & 0x00000001) == 0x00000001);
      }
      /**
       * <code>optional bytes merchant_data = 1;</code>
       *
       * <pre>
       * From PaymentDetails.merchant_data
       * </pre>
       */
      public com.google.protobuf.ByteString getMerchantData() {
        return merchantData_;
      }
      /**
       * <code>optional bytes merchant_data = 1;</code>
       *
       * <pre>
       * From PaymentDetails.merchant_data
       * </pre>
       */
      public Builder setMerchantData(com.google.protobuf.ByteString value) {
        if (value == null) {
    throw new NullPointerException();
  }
  bitField0_ |= 0x00000001;
        merchantData_ = value;
        onChanged();
        return this;
      }
      /**
       * <code>optional bytes merchant_data = 1;</code>
       *
       * <pre>
       * From PaymentDetails.merchant_data
       * </pre>
       */
      public Builder clearMerchantData() {
        bitField0_ = (bitField0_ & ~0x00000001);
        merchantData_ = getDefaultInstance().getMerchantData();
        onChanged();
        return this;
      }

      private java.util.List<com.google.protobuf.ByteString> transactions_ = java.util.Collections.emptyList();
      private void ensureTransactionsIsMutable() {
        if (!((bitField0_ & 0x00000002) == 0x00000002)) {
          transactions_ = new java.util.ArrayList<com.google.protobuf.ByteString>(transactions_);
          bitField0_ |= 0x00000002;
         }
      }
      /**
       * <code>repeated bytes transactions = 2;</code>
       *
       * <pre>
       * Signed transactions that satisfy PaymentDetails.outputs
       * </pre>
       */
      public java.util.List<com.google.protobuf.ByteString>
          getTransactionsList() {
        return java.util.Collections.unmodifiableList(transactions_);
      }
      /**
       * <code>repeated bytes transactions = 2;</code>
       *
       * <pre>
       * Signed transactions that satisfy PaymentDetails.outputs
       * </pre>
       */
      public int getTransactionsCount() {
        return transactions_.size();
      }
      /**
       * <code>repeated bytes transactions = 2;</code>
       *
       * <pre>
       * Signed transactions that satisfy PaymentDetails.outputs
       * </pre>
       */
      public com.google.protobuf.ByteString getTransactions(int index) {
        return transactions_.get(index);
      }
      /**
       * <code>repeated bytes transactions = 2;</code>
       *
       * <pre>
       * Signed transactions that satisfy PaymentDetails.outputs
       * </pre>
       */
      public Builder setTransactions(
          int index, com.google.protobuf.ByteString value) {
        if (value == null) {
    throw new NullPointerException();
  }
  ensureTransactionsIsMutable();
        transactions_.set(index, value);
        onChanged();
        return this;
      }
      /**
       * <code>repeated bytes transactions = 2;</code>
       *
       * <pre>
       * Signed transactions that satisfy PaymentDetails.outputs
       * </pre>
       */
      public Builder addTransactions(com.google.protobuf.ByteString value) {
        if (value == null) {
    throw new NullPointerException();
  }
  ensureTransactionsIsMutable();
        transactions_.add(value);
        onChanged();
        return this;
      }
      /**
       * <code>repeated bytes transactions = 2;</code>
       *
       * <pre>
       * Signed transactions that satisfy PaymentDetails.outputs
       * </pre>
       */
      public Builder addAllTransactions(
          java.lang.Iterable<? extends com.google.protobuf.ByteString> values) {
        ensureTransactionsIsMutable();
        com.google.protobuf.AbstractMessageLite.Builder.addAll(
            values, transactions_);
        onChanged();
        return this;
      }
      /**
       * <code>repeated bytes transactions = 2;</code>
       *
       * <pre>
       * Signed transactions that satisfy PaymentDetails.outputs
       * </pre>
       */
      public Builder clearTransactions() {
        transactions_ = java.util.Collections.emptyList();
        bitField0_ = (bitField0_ & ~0x00000002);
        onChanged();
        return this;
      }

      private java.util.List<org.bitcoin.protocols.payments.Protos.Output> refundTo_ =
        java.util.Collections.emptyList();
      private void ensureRefundToIsMutable() {
        if (!((bitField0_ & 0x00000004) == 0x00000004)) {
          refundTo_ = new java.util.ArrayList<org.bitcoin.protocols.payments.Protos.Output>(refundTo_);
          bitField0_ |= 0x00000004;
         }
      }

      private com.google.protobuf.RepeatedFieldBuilder<
          org.bitcoin.protocols.payments.Protos.Output, org.bitcoin.protocols.payments.Protos.Output.Builder, org.bitcoin.protocols.payments.Protos.OutputOrBuilder> refundToBuilder_;

      /**
       * <code>repeated .payments.Output refund_to = 3;</code>
       *
       * <pre>
       * Where to send refunds, if a refund is necessary
       * </pre>
       */
      public java.util.List<org.bitcoin.protocols.payments.Protos.Output> getRefundToList() {
        if (refundToBuilder_ == null) {
          return java.util.Collections.unmodifiableList(refundTo_);
        } else {
          return refundToBuilder_.getMessageList();
        }
      }
      /**
       * <code>repeated .payments.Output refund_to = 3;</code>
       *
       * <pre>
       * Where to send refunds, if a refund is necessary
       * </pre>
       */
      public int getRefundToCount() {
        if (refundToBuilder_ == null) {
          return refundTo_.size();
        } else {
          return refundToBuilder_.getCount();
        }
      }
      /**
       * <code>repeated .payments.Output refund_to = 3;</code>
       *
       * <pre>
       * Where to send refunds, if a refund is necessary
       * </pre>
       */
      public org.bitcoin.protocols.payments.Protos.Output getRefundTo(int index) {
        if (refundToBuilder_ == null) {
          return refundTo_.get(index);
        } else {
          return refundToBuilder_.getMessage(index);
        }
      }
      /**
       * <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 value) {
        if (refundToBuilder_ == null) {
          if (value == null) {
            throw new NullPointerException();
          }
          ensureRefundToIsMutable();
          refundTo_.set(index, value);
          onChanged();
        } else {
          refundToBuilder_.setMessage(index, value);
        }
        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(org.bitcoin.protocols.payments.Protos.Output value) {
        if (refundToBuilder_ == null) {
          if (value == null) {
            throw new NullPointerException();
          }
          ensureRefundToIsMutable();
          refundTo_.add(value);
          onChanged();
        } else {
          refundToBuilder_.addMessage(value);
        }
        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 value) {
        if (refundToBuilder_ == null) {
          if (value == null) {
            throw new NullPointerException();
          }
          ensureRefundToIsMutable();
          refundTo_.add(index, value);
          onChanged();
        } else {
          refundToBuilder_.addMessage(index, value);
        }
        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(
          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 addAllRefundTo(
          java.lang.Iterable<? extends org.bitcoin.protocols.payments.Protos.Output> values) {
        if (refundToBuilder_ == null) {
          ensureRefundToIsMutable();
          com.google.protobuf.AbstractMessageLite.Builder.addAll(
              values, refundTo_);
          onChanged();
        } else {
          refundToBuilder_.addAllMessages(values);
        }
        return this;
      }
      /**
       * <code>repeated .payments.Output refund_to = 3;</code>
       *
       * <pre>
       * Where to send refunds, if a refund is necessary
       * </pre>
       */
      public Builder clearRefundTo() {
        if (refundToBuilder_ == null) {
          refundTo_ = java.util.Collections.emptyList();
          bitField0_ = (bitField0_ & ~0x00000004);
          onChanged();
        } else {
          refundToBuilder_.clear();
        }
        return this;
      }
      /**
       * <code>repeated .payments.Output refund_to = 3;</code>
       *
       * <pre>
       * Where to send refunds, if a refund is necessary
       * </pre>
       */
      public Builder removeRefundTo(int index) {
        if (refundToBuilder_ == null) {
          ensureRefundToIsMutable();
          refundTo_.remove(index);
          onChanged();
        } else {
          refundToBuilder_.remove(index);
        }
        return this;
      }
      /**
       * <code>repeated .payments.Output refund_to = 3;</code>
       *
       * <pre>
       * Where to send refunds, if a refund is necessary
       * </pre>
       */
      public org.bitcoin.protocols.payments.Protos.Output.Builder getRefundToBuilder(
          int index) {
        return getRefundToFieldBuilder().getBuilder(index);
      }
      /**
       * <code>repeated .payments.Output refund_to = 3;</code>
       *
       * <pre>
       * Where to send refunds, if a refund is necessary
       * </pre>
       */
      public org.bitcoin.protocols.payments.Protos.OutputOrBuilder getRefundToOrBuilder(
          int index) {
        if (refundToBuilder_ == null) {
          return refundTo_.get(index);  } else {
          return refundToBuilder_.getMessageOrBuilder(index);
        }
      }
      /**
       * <code>repeated .payments.Output refund_to = 3;</code>
       *
       * <pre>
       * Where to send refunds, if a refund is necessary
       * </pre>
       */
      public java.util.List<? extends org.bitcoin.protocols.payments.Protos.OutputOrBuilder> 
           getRefundToOrBuilderList() {
        if (refundToBuilder_ != null) {
          return refundToBuilder_.getMessageOrBuilderList();
        } else {
          return java.util.Collections.unmodifiableList(refundTo_);
        }
      }
      /**
       * <code>repeated .payments.Output refund_to = 3;</code>
       *
       * <pre>
       * Where to send refunds, if a refund is necessary
       * </pre>
       */
      public org.bitcoin.protocols.payments.Protos.Output.Builder addRefundToBuilder() {
        return getRefundToFieldBuilder().addBuilder(
            org.bitcoin.protocols.payments.Protos.Output.getDefaultInstance());
      }
      /**
       * <code>repeated .payments.Output refund_to = 3;</code>
       *
       * <pre>
       * Where to send refunds, if a refund is necessary
       * </pre>
       */
      public org.bitcoin.protocols.payments.Protos.Output.Builder addRefundToBuilder(
          int index) {
        return getRefundToFieldBuilder().addBuilder(
            index, org.bitcoin.protocols.payments.Protos.Output.getDefaultInstance());
      }
      /**
       * <code>repeated .payments.Output refund_to = 3;</code>
       *
       * <pre>
       * Where to send refunds, if a refund is necessary
       * </pre>
       */
      public java.util.List<org.bitcoin.protocols.payments.Protos.Output.Builder> 
           getRefundToBuilderList() {
        return getRefundToFieldBuilder().getBuilderList();
      }
      private com.google.protobuf.RepeatedFieldBuilder<
          org.bitcoin.protocols.payments.Protos.Output, org.bitcoin.protocols.payments.Protos.Output.Builder, org.bitcoin.protocols.payments.Protos.OutputOrBuilder> 
          getRefundToFieldBuilder() {
        if (refundToBuilder_ == null) {
          refundToBuilder_ = new com.google.protobuf.RepeatedFieldBuilder<
              org.bitcoin.protocols.payments.Protos.Output, org.bitcoin.protocols.payments.Protos.Output.Builder, org.bitcoin.protocols.payments.Protos.OutputOrBuilder>(
                  refundTo_,
                  ((bitField0_ & 0x00000004) == 0x00000004),
                  getParentForChildren(),
                  isClean());
          refundTo_ = null;
        }
        return refundToBuilder_;
      }

      private java.lang.Object memo_ = "";
      /**
       * <code>optional string memo = 4;</code>
       *
       * <pre>
       * Human-readable message for the merchant
       * </pre>
       */
      public boolean hasMemo() {
        return ((bitField0_ & 0x00000008) == 0x00000008);
      }
      /**
       * <code>optional string memo = 4;</code>
       *
       * <pre>
       * Human-readable message for the merchant
       * </pre>
       */
      public java.lang.String getMemo() {
        java.lang.Object ref = memo_;
        if (!(ref instanceof java.lang.String)) {
          com.google.protobuf.ByteString bs =
              (com.google.protobuf.ByteString) ref;
          java.lang.String s = bs.toStringUtf8();
          if (bs.isValidUtf8()) {
            memo_ = s;
          }
          return s;
        } else {
          return (java.lang.String) ref;
        }
      }
      /**
       * <code>optional string memo = 4;</code>
       *
       * <pre>
       * Human-readable message for the merchant
       * </pre>
       */
      public com.google.protobuf.ByteString
          getMemoBytes() {
        java.lang.Object ref = memo_;
        if (ref instanceof String) {
          com.google.protobuf.ByteString b = 
              com.google.protobuf.ByteString.copyFromUtf8(
                  (java.lang.String) ref);
          memo_ = b;
          return b;
        } else {
          return (com.google.protobuf.ByteString) ref;
        }
      }
      /**
       * <code>optional string memo = 4;</code>
       *
       * <pre>
       * Human-readable message for the merchant
       * </pre>
       */
      public Builder setMemo(
          java.lang.String value) {
        if (value == null) {
    throw new NullPointerException();
  }
  bitField0_ |= 0x00000008;
        memo_ = value;
        onChanged();
        return this;
      }
      /**
       * <code>optional string memo = 4;</code>
       *
       * <pre>
       * Human-readable message for the merchant
       * </pre>
       */
      public Builder clearMemo() {
        bitField0_ = (bitField0_ & ~0x00000008);
        memo_ = getDefaultInstance().getMemo();
        onChanged();
        return this;
      }
      /**
       * <code>optional string memo = 4;</code>
       *
       * <pre>
       * Human-readable message for the merchant
       * </pre>
       */
      public Builder setMemoBytes(
          com.google.protobuf.ByteString value) {
        if (value == null) {
    throw new NullPointerException();
  }
  bitField0_ |= 0x00000008;
        memo_ = value;
        onChanged();
        return this;
      }

      // @@protoc_insertion_point(builder_scope:payments.Payment)
    }

    static {
      defaultInstance = new Payment(true);
      defaultInstance.initFields();
    }

    // @@protoc_insertion_point(class_scope:payments.Payment)
  }

  public interface PaymentACKOrBuilder extends
      // @@protoc_insertion_point(interface_extends:payments.PaymentACK)
      com.google.protobuf.MessageOrBuilder {

    /**
     * <code>required .payments.Payment payment = 1;</code>
     *
     * <pre>
     * Payment message that triggered this ACK
     * </pre>
     */
    boolean hasPayment();
    /**
     * <code>required .payments.Payment payment = 1;</code>
     *
     * <pre>
     * Payment message that triggered this ACK
     * </pre>
     */
    org.bitcoin.protocols.payments.Protos.Payment getPayment();
    /**
     * <code>required .payments.Payment payment = 1;</code>
     *
     * <pre>
     * Payment message that triggered this ACK
     * </pre>
     */
    org.bitcoin.protocols.payments.Protos.PaymentOrBuilder getPaymentOrBuilder();

    /**
     * <code>optional string memo = 2;</code>
     *
     * <pre>
     * human-readable message for customer
     * </pre>
     */
    boolean hasMemo();
    /**
     * <code>optional string memo = 2;</code>
     *
     * <pre>
     * human-readable message for customer
     * </pre>
     */
    java.lang.String getMemo();
    /**
     * <code>optional string memo = 2;</code>
     *
     * <pre>
     * human-readable message for customer
     * </pre>
     */
    com.google.protobuf.ByteString
        getMemoBytes();
  }
  /**
   * Protobuf type {@code payments.PaymentACK}
   */
  public static final class PaymentACK extends
      com.google.protobuf.GeneratedMessage implements
      // @@protoc_insertion_point(message_implements:payments.PaymentACK)
      PaymentACKOrBuilder {
    // Use PaymentACK.newBuilder() to construct.
    private PaymentACK(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
      super(builder);
      this.unknownFields = builder.getUnknownFields();
    }
    private PaymentACK(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }

    private static final PaymentACK defaultInstance;
    public static PaymentACK getDefaultInstance() {
      return defaultInstance;
    }

    public PaymentACK getDefaultInstanceForType() {
      return defaultInstance;
    }

    private final com.google.protobuf.UnknownFieldSet unknownFields;
    @java.lang.Override
    public final com.google.protobuf.UnknownFieldSet
        getUnknownFields() {
      return this.unknownFields;
    }
    private PaymentACK(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      initFields();
      int mutable_bitField0_ = 0;
      com.google.protobuf.UnknownFieldSet.Builder unknownFields =
          com.google.protobuf.UnknownFieldSet.newBuilder();
      try {
        boolean done = false;
        while (!done) {
          int tag = input.readTag();
          switch (tag) {
            case 0:
              done = true;
              break;
            default: {
              if (!parseUnknownField(input, unknownFields,
                                     extensionRegistry, tag)) {
                done = true;
              }
              break;
            }
            case 10: {
              org.bitcoin.protocols.payments.Protos.Payment.Builder subBuilder = null;
              if (((bitField0_ & 0x00000001) == 0x00000001)) {
                subBuilder = payment_.toBuilder();
              }
              payment_ = input.readMessage(org.bitcoin.protocols.payments.Protos.Payment.PARSER, extensionRegistry);
              if (subBuilder != null) {
                subBuilder.mergeFrom(payment_);
                payment_ = subBuilder.buildPartial();
              }
              bitField0_ |= 0x00000001;
              break;
            }
            case 18: {
              com.google.protobuf.ByteString bs = input.readBytes();
              bitField0_ |= 0x00000002;
              memo_ = bs;
              break;
            }
          }
        }
      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
        throw e.setUnfinishedMessage(this);
      } catch (java.io.IOException e) {
        throw new com.google.protobuf.InvalidProtocolBufferException(
            e.getMessage()).setUnfinishedMessage(this);
      } finally {
        this.unknownFields = unknownFields.build();
        makeExtensionsImmutable();
      }
    }
    public static final com.google.protobuf.Descriptors.Descriptor
        getDescriptor() {
      return org.bitcoin.protocols.payments.Protos.internal_static_payments_PaymentACK_descriptor;
    }

    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return org.bitcoin.protocols.payments.Protos.internal_static_payments_PaymentACK_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              org.bitcoin.protocols.payments.Protos.PaymentACK.class, org.bitcoin.protocols.payments.Protos.PaymentACK.Builder.class);
    }

    public static com.google.protobuf.Parser<PaymentACK> PARSER =
        new com.google.protobuf.AbstractParser<PaymentACK>() {
      public PaymentACK parsePartialFrom(
          com.google.protobuf.CodedInputStream input,
          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
          throws com.google.protobuf.InvalidProtocolBufferException {
        return new PaymentACK(input, extensionRegistry);
      }
    };

    @java.lang.Override
    public com.google.protobuf.Parser<PaymentACK> getParserForType() {
      return PARSER;
    }

    private int bitField0_;
    public static final int PAYMENT_FIELD_NUMBER = 1;
    private org.bitcoin.protocols.payments.Protos.Payment payment_;
    /**
     * <code>required .payments.Payment payment = 1;</code>
     *
     * <pre>
     * Payment message that triggered this ACK
     * </pre>
     */
    public boolean hasPayment() {
      return ((bitField0_ & 0x00000001) == 0x00000001);
    }
    /**
     * <code>required .payments.Payment payment = 1;</code>
     *
     * <pre>
     * Payment message that triggered this ACK
     * </pre>
     */
    public org.bitcoin.protocols.payments.Protos.Payment getPayment() {
      return payment_;
    }
    /**
     * <code>required .payments.Payment payment = 1;</code>
     *
     * <pre>
     * Payment message that triggered this ACK
     * </pre>
     */
    public org.bitcoin.protocols.payments.Protos.PaymentOrBuilder getPaymentOrBuilder() {
      return payment_;
    }

    public static final int MEMO_FIELD_NUMBER = 2;
    private java.lang.Object memo_;
    /**
     * <code>optional string memo = 2;</code>
     *
     * <pre>
     * human-readable message for customer
     * </pre>
     */
    public boolean hasMemo() {
      return ((bitField0_ & 0x00000002) == 0x00000002);
    }
    /**
     * <code>optional string memo = 2;</code>
     *
     * <pre>
     * human-readable message for customer
     * </pre>
     */
    public java.lang.String getMemo() {
      java.lang.Object ref = memo_;
      if (ref instanceof java.lang.String) {
        return (java.lang.String) ref;
      } else {
        com.google.protobuf.ByteString bs = 
            (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        if (bs.isValidUtf8()) {
          memo_ = s;
        }
        return s;
      }
    }
    /**
     * <code>optional string memo = 2;</code>
     *
     * <pre>
     * human-readable message for customer
     * </pre>
     */
    public com.google.protobuf.ByteString
        getMemoBytes() {
      java.lang.Object ref = memo_;
      if (ref instanceof java.lang.String) {
        com.google.protobuf.ByteString b = 
            com.google.protobuf.ByteString.copyFromUtf8(
                (java.lang.String) ref);
        memo_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }

    private void initFields() {
      payment_ = org.bitcoin.protocols.payments.Protos.Payment.getDefaultInstance();
      memo_ = "";
    }
    private byte memoizedIsInitialized = -1;
    public final boolean isInitialized() {
      byte isInitialized = memoizedIsInitialized;
      if (isInitialized == 1) return true;
      if (isInitialized == 0) return false;

      if (!hasPayment()) {
        memoizedIsInitialized = 0;
        return false;
      }
      if (!getPayment().isInitialized()) {
        memoizedIsInitialized = 0;
        return false;
      }
      memoizedIsInitialized = 1;
      return true;
    }

    public void writeTo(com.google.protobuf.CodedOutputStream output)
                        throws java.io.IOException {
      getSerializedSize();
      if (((bitField0_ & 0x00000001) == 0x00000001)) {
        output.writeMessage(1, payment_);
      }
      if (((bitField0_ & 0x00000002) == 0x00000002)) {
        output.writeBytes(2, getMemoBytes());
      }
      getUnknownFields().writeTo(output);
    }

    private int memoizedSerializedSize = -1;
    public int getSerializedSize() {
      int size = memoizedSerializedSize;
      if (size != -1) return size;

      size = 0;
      if (((bitField0_ & 0x00000001) == 0x00000001)) {
        size += com.google.protobuf.CodedOutputStream
          .computeMessageSize(1, payment_);
      }
      if (((bitField0_ & 0x00000002) == 0x00000002)) {
        size += com.google.protobuf.CodedOutputStream
          .computeBytesSize(2, getMemoBytes());
      }
      size += getUnknownFields().getSerializedSize();
      memoizedSerializedSize = size;
      return size;
    }

    private static final long serialVersionUID = 0L;
    @java.lang.Override
    protected java.lang.Object writeReplace()
        throws java.io.ObjectStreamException {
      return super.writeReplace();
    }

    public static org.bitcoin.protocols.payments.Protos.PaymentACK parseFrom(
        com.google.protobuf.ByteString data)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data);
    }
    public static org.bitcoin.protocols.payments.Protos.PaymentACK parseFrom(
        com.google.protobuf.ByteString data,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data, extensionRegistry);
    }
    public static org.bitcoin.protocols.payments.Protos.PaymentACK parseFrom(byte[] data)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data);
    }
    public static org.bitcoin.protocols.payments.Protos.PaymentACK parseFrom(
        byte[] data,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data, extensionRegistry);
    }
    public static org.bitcoin.protocols.payments.Protos.PaymentACK parseFrom(java.io.InputStream input)
        throws java.io.IOException {
      return PARSER.parseFrom(input);
    }
    public static org.bitcoin.protocols.payments.Protos.PaymentACK parseFrom(
        java.io.InputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      return PARSER.parseFrom(input, extensionRegistry);
    }
    public static org.bitcoin.protocols.payments.Protos.PaymentACK parseDelimitedFrom(java.io.InputStream input)
        throws java.io.IOException {
      return PARSER.parseDelimitedFrom(input);
    }
    public static org.bitcoin.protocols.payments.Protos.PaymentACK parseDelimitedFrom(
        java.io.InputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      return PARSER.parseDelimitedFrom(input, extensionRegistry);
    }
    public static org.bitcoin.protocols.payments.Protos.PaymentACK parseFrom(
        com.google.protobuf.CodedInputStream input)
        throws java.io.IOException {
      return PARSER.parseFrom(input);
    }
    public static org.bitcoin.protocols.payments.Protos.PaymentACK parseFrom(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      return PARSER.parseFrom(input, extensionRegistry);
    }

    public static Builder newBuilder() { return Builder.create(); }
    public Builder newBuilderForType() { return newBuilder(); }
    public static Builder newBuilder(org.bitcoin.protocols.payments.Protos.PaymentACK prototype) {
      return newBuilder().mergeFrom(prototype);
    }
    public Builder toBuilder() { return newBuilder(this); }

    @java.lang.Override
    protected Builder newBuilderForType(
        com.google.protobuf.GeneratedMessage.BuilderParent parent) {
      Builder builder = new Builder(parent);
      return builder;
    }
    /**
     * Protobuf type {@code payments.PaymentACK}
     */
    public static final class Builder extends
        com.google.protobuf.GeneratedMessage.Builder<Builder> implements
        // @@protoc_insertion_point(builder_implements:payments.PaymentACK)
        org.bitcoin.protocols.payments.Protos.PaymentACKOrBuilder {
      public static final com.google.protobuf.Descriptors.Descriptor
          getDescriptor() {
        return org.bitcoin.protocols.payments.Protos.internal_static_payments_PaymentACK_descriptor;
      }

      protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
          internalGetFieldAccessorTable() {
        return org.bitcoin.protocols.payments.Protos.internal_static_payments_PaymentACK_fieldAccessorTable
            .ensureFieldAccessorsInitialized(
                org.bitcoin.protocols.payments.Protos.PaymentACK.class, org.bitcoin.protocols.payments.Protos.PaymentACK.Builder.class);
      }

      // Construct using org.bitcoin.protocols.payments.Protos.PaymentACK.newBuilder()
      private Builder() {
        maybeForceBuilderInitialization();
      }

      private Builder(
          com.google.protobuf.GeneratedMessage.BuilderParent parent) {
        super(parent);
        maybeForceBuilderInitialization();
      }
      private void maybeForceBuilderInitialization() {
        if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
          getPaymentFieldBuilder();
        }
      }
      private static Builder create() {
        return new Builder();
      }

      public Builder clear() {
        super.clear();
        if (paymentBuilder_ == null) {
          payment_ = org.bitcoin.protocols.payments.Protos.Payment.getDefaultInstance();
        } else {
          paymentBuilder_.clear();
        }
        bitField0_ = (bitField0_ & ~0x00000001);
        memo_ = "";
        bitField0_ = (bitField0_ & ~0x00000002);
        return this;
      }

      public Builder clone() {
        return create().mergeFrom(buildPartial());
      }

      public com.google.protobuf.Descriptors.Descriptor
          getDescriptorForType() {
        return org.bitcoin.protocols.payments.Protos.internal_static_payments_PaymentACK_descriptor;
      }

      public org.bitcoin.protocols.payments.Protos.PaymentACK getDefaultInstanceForType() {
        return org.bitcoin.protocols.payments.Protos.PaymentACK.getDefaultInstance();
      }

      public org.bitcoin.protocols.payments.Protos.PaymentACK build() {
        org.bitcoin.protocols.payments.Protos.PaymentACK result = buildPartial();
        if (!result.isInitialized()) {
          throw newUninitializedMessageException(result);
        }
        return result;
      }

      public org.bitcoin.protocols.payments.Protos.PaymentACK buildPartial() {
        org.bitcoin.protocols.payments.Protos.PaymentACK result = new org.bitcoin.protocols.payments.Protos.PaymentACK(this);
        int from_bitField0_ = bitField0_;
        int to_bitField0_ = 0;
        if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
          to_bitField0_ |= 0x00000001;
        }
        if (paymentBuilder_ == null) {
          result.payment_ = payment_;
        } else {
          result.payment_ = paymentBuilder_.build();
        }
        if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
          to_bitField0_ |= 0x00000002;
        }
        result.memo_ = memo_;
        result.bitField0_ = to_bitField0_;
        onBuilt();
        return result;
      }

      public Builder mergeFrom(com.google.protobuf.Message other) {
        if (other instanceof org.bitcoin.protocols.payments.Protos.PaymentACK) {
          return mergeFrom((org.bitcoin.protocols.payments.Protos.PaymentACK)other);
        } else {
          super.mergeFrom(other);
          return this;
        }
      }

      public Builder mergeFrom(org.bitcoin.protocols.payments.Protos.PaymentACK other) {
        if (other == org.bitcoin.protocols.payments.Protos.PaymentACK.getDefaultInstance()) return this;
        if (other.hasPayment()) {
          mergePayment(other.getPayment());
        }
        if (other.hasMemo()) {
          bitField0_ |= 0x00000002;
          memo_ = other.memo_;
          onChanged();
        }
        this.mergeUnknownFields(other.getUnknownFields());
        return this;
      }

      public final boolean isInitialized() {
        if (!hasPayment()) {
          
          return false;
        }
        if (!getPayment().isInitialized()) {
          
          return false;
        }
        return true;
      }

      public Builder mergeFrom(
          com.google.protobuf.CodedInputStream input,
          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
          throws java.io.IOException {
        org.bitcoin.protocols.payments.Protos.PaymentACK parsedMessage = null;
        try {
          parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
          parsedMessage = (org.bitcoin.protocols.payments.Protos.PaymentACK) e.getUnfinishedMessage();
          throw e;
        } finally {
          if (parsedMessage != null) {
            mergeFrom(parsedMessage);
          }
        }
        return this;
      }
      private int bitField0_;

      private org.bitcoin.protocols.payments.Protos.Payment payment_ = org.bitcoin.protocols.payments.Protos.Payment.getDefaultInstance();
      private com.google.protobuf.SingleFieldBuilder<
          org.bitcoin.protocols.payments.Protos.Payment, org.bitcoin.protocols.payments.Protos.Payment.Builder, org.bitcoin.protocols.payments.Protos.PaymentOrBuilder> paymentBuilder_;
      /**
       * <code>required .payments.Payment payment = 1;</code>
       *
       * <pre>
       * Payment message that triggered this ACK
       * </pre>
       */
      public boolean hasPayment() {
        return ((bitField0_ & 0x00000001) == 0x00000001);
      }
      /**
       * <code>required .payments.Payment payment = 1;</code>
       *
       * <pre>
       * Payment message that triggered this ACK
       * </pre>
       */
      public org.bitcoin.protocols.payments.Protos.Payment getPayment() {
        if (paymentBuilder_ == null) {
          return payment_;
        } else {
          return paymentBuilder_.getMessage();
        }
      }
      /**
       * <code>required .payments.Payment payment = 1;</code>
       *
       * <pre>
       * Payment message that triggered this ACK
       * </pre>
       */
      public Builder setPayment(org.bitcoin.protocols.payments.Protos.Payment value) {
        if (paymentBuilder_ == null) {
          if (value == null) {
            throw new NullPointerException();
          }
          payment_ = value;
          onChanged();
        } else {
          paymentBuilder_.setMessage(value);
        }
        bitField0_ |= 0x00000001;
        return this;
      }
      /**
       * <code>required .payments.Payment payment = 1;</code>
       *
       * <pre>
       * Payment message that triggered this ACK
       * </pre>
       */
      public Builder setPayment(
          org.bitcoin.protocols.payments.Protos.Payment.Builder builderForValue) {
        if (paymentBuilder_ == null) {
          payment_ = builderForValue.build();
          onChanged();
        } else {
          paymentBuilder_.setMessage(builderForValue.build());
        }
        bitField0_ |= 0x00000001;
        return this;
      }
      /**
       * <code>required .payments.Payment payment = 1;</code>
       *
       * <pre>
       * Payment message that triggered this ACK
       * </pre>
       */
      public Builder mergePayment(org.bitcoin.protocols.payments.Protos.Payment value) {
        if (paymentBuilder_ == null) {
          if (((bitField0_ & 0x00000001) == 0x00000001) &&
              payment_ != org.bitcoin.protocols.payments.Protos.Payment.getDefaultInstance()) {
            payment_ =
              org.bitcoin.protocols.payments.Protos.Payment.newBuilder(payment_).mergeFrom(value).buildPartial();
          } else {
            payment_ = value;
          }
          onChanged();
        } else {
          paymentBuilder_.mergeFrom(value);
        }
        bitField0_ |= 0x00000001;
        return this;
      }
      /**
       * <code>required .payments.Payment payment = 1;</code>
       *
       * <pre>
       * Payment message that triggered this ACK
       * </pre>
       */
      public Builder clearPayment() {
        if (paymentBuilder_ == null) {
          payment_ = org.bitcoin.protocols.payments.Protos.Payment.getDefaultInstance();
          onChanged();
        } else {
          paymentBuilder_.clear();
        }
        bitField0_ = (bitField0_ & ~0x00000001);
        return this;
      }
      /**
       * <code>required .payments.Payment payment = 1;</code>
       *
       * <pre>
       * Payment message that triggered this ACK
       * </pre>
       */
      public org.bitcoin.protocols.payments.Protos.Payment.Builder getPaymentBuilder() {
        bitField0_ |= 0x00000001;
        onChanged();
        return getPaymentFieldBuilder().getBuilder();
      }
      /**
       * <code>required .payments.Payment payment = 1;</code>
       *
       * <pre>
       * Payment message that triggered this ACK
       * </pre>
       */
      public org.bitcoin.protocols.payments.Protos.PaymentOrBuilder getPaymentOrBuilder() {
        if (paymentBuilder_ != null) {
          return paymentBuilder_.getMessageOrBuilder();
        } else {
          return payment_;
        }
      }
      /**
       * <code>required .payments.Payment payment = 1;</code>
       *
       * <pre>
       * Payment message that triggered this ACK
       * </pre>
       */
      private com.google.protobuf.SingleFieldBuilder<
          org.bitcoin.protocols.payments.Protos.Payment, org.bitcoin.protocols.payments.Protos.Payment.Builder, org.bitcoin.protocols.payments.Protos.PaymentOrBuilder> 
          getPaymentFieldBuilder() {
        if (paymentBuilder_ == null) {
          paymentBuilder_ = new com.google.protobuf.SingleFieldBuilder<
              org.bitcoin.protocols.payments.Protos.Payment, org.bitcoin.protocols.payments.Protos.Payment.Builder, org.bitcoin.protocols.payments.Protos.PaymentOrBuilder>(
                  getPayment(),
                  getParentForChildren(),
                  isClean());
          payment_ = null;
        }
        return paymentBuilder_;
      }

      private java.lang.Object memo_ = "";
      /**
       * <code>optional string memo = 2;</code>
       *
       * <pre>
       * human-readable message for customer
       * </pre>
       */
      public boolean hasMemo() {
        return ((bitField0_ & 0x00000002) == 0x00000002);
      }
      /**
       * <code>optional string memo = 2;</code>
       *
       * <pre>
       * human-readable message for customer
       * </pre>
       */
      public java.lang.String getMemo() {
        java.lang.Object ref = memo_;
        if (!(ref instanceof java.lang.String)) {
          com.google.protobuf.ByteString bs =
              (com.google.protobuf.ByteString) ref;
          java.lang.String s = bs.toStringUtf8();
          if (bs.isValidUtf8()) {
            memo_ = s;
          }
          return s;
        } else {
          return (java.lang.String) ref;
        }
      }
      /**
       * <code>optional string memo = 2;</code>
       *
       * <pre>
       * human-readable message for customer
       * </pre>
       */
      public com.google.protobuf.ByteString
          getMemoBytes() {
        java.lang.Object ref = memo_;
        if (ref instanceof String) {
          com.google.protobuf.ByteString b = 
              com.google.protobuf.ByteString.copyFromUtf8(
                  (java.lang.String) ref);
          memo_ = b;
          return b;
        } else {
          return (com.google.protobuf.ByteString) ref;
        }
      }
      /**
       * <code>optional string memo = 2;</code>
       *
       * <pre>
       * human-readable message for customer
       * </pre>
       */
      public Builder setMemo(
          java.lang.String value) {
        if (value == null) {
    throw new NullPointerException();
  }
  bitField0_ |= 0x00000002;
        memo_ = value;
        onChanged();
        return this;
      }
      /**
       * <code>optional string memo = 2;</code>
       *
       * <pre>
       * human-readable message for customer
       * </pre>
       */
      public Builder clearMemo() {
        bitField0_ = (bitField0_ & ~0x00000002);
        memo_ = getDefaultInstance().getMemo();
        onChanged();
        return this;
      }
      /**
       * <code>optional string memo = 2;</code>
       *
       * <pre>
       * human-readable message for customer
       * </pre>
       */
      public Builder setMemoBytes(
          com.google.protobuf.ByteString value) {
        if (value == null) {
    throw new NullPointerException();
  }
  bitField0_ |= 0x00000002;
        memo_ = value;
        onChanged();
        return this;
      }

      // @@protoc_insertion_point(builder_scope:payments.PaymentACK)
    }

    static {
      defaultInstance = new PaymentACK(true);
      defaultInstance.initFields();
    }

    // @@protoc_insertion_point(class_scope:payments.PaymentACK)
  }

  private static final com.google.protobuf.Descriptors.Descriptor
    internal_static_payments_Output_descriptor;
  private static
    com.google.protobuf.GeneratedMessage.FieldAccessorTable
      internal_static_payments_Output_fieldAccessorTable;
  private static final com.google.protobuf.Descriptors.Descriptor
    internal_static_payments_PaymentDetails_descriptor;
  private static
    com.google.protobuf.GeneratedMessage.FieldAccessorTable
      internal_static_payments_PaymentDetails_fieldAccessorTable;
  private static final com.google.protobuf.Descriptors.Descriptor
    internal_static_payments_PaymentRequest_descriptor;
  private static
    com.google.protobuf.GeneratedMessage.FieldAccessorTable
      internal_static_payments_PaymentRequest_fieldAccessorTable;
  private static final com.google.protobuf.Descriptors.Descriptor
    internal_static_payments_X509Certificates_descriptor;
  private static
    com.google.protobuf.GeneratedMessage.FieldAccessorTable
      internal_static_payments_X509Certificates_fieldAccessorTable;
  private static final com.google.protobuf.Descriptors.Descriptor
    internal_static_payments_Payment_descriptor;
  private static
    com.google.protobuf.GeneratedMessage.FieldAccessorTable
      internal_static_payments_Payment_fieldAccessorTable;
  private static final com.google.protobuf.Descriptors.Descriptor
    internal_static_payments_PaymentACK_descriptor;
  private static
    com.google.protobuf.GeneratedMessage.FieldAccessorTable
      internal_static_payments_PaymentACK_fieldAccessorTable;

  public static com.google.protobuf.Descriptors.FileDescriptor
      getDescriptor() {
    return descriptor;
  }
  private static com.google.protobuf.Descriptors.FileDescriptor
      descriptor;
  static {
    java.lang.String[] descriptorData = {
      "\n\024paymentrequest.proto\022\010payments\"+\n\006Outp" +
      "ut\022\021\n\006amount\030\001 \001(\004:\0010\022\016\n\006script\030\002 \002(\014\"\243\001" +
      "\n\016PaymentDetails\022\025\n\007network\030\001 \001(\t:\004main\022" +
      "!\n\007outputs\030\002 \003(\0132\020.payments.Output\022\014\n\004ti" +
      "me\030\003 \002(\004\022\017\n\007expires\030\004 \001(\004\022\014\n\004memo\030\005 \001(\t\022" +
      "\023\n\013payment_url\030\006 \001(\t\022\025\n\rmerchant_data\030\007 " +
      "\001(\014\"\225\001\n\016PaymentRequest\022\"\n\027payment_detail" +
      "s_version\030\001 \001(\r:\0011\022\026\n\010pki_type\030\002 \001(\t:\004no" +
      "ne\022\020\n\010pki_data\030\003 \001(\014\022\"\n\032serialized_payme" +
      "nt_details\030\004 \002(\014\022\021\n\tsignature\030\005 \001(\014\"\'\n\020X",
      "509Certificates\022\023\n\013certificate\030\001 \003(\014\"i\n\007" +
      "Payment\022\025\n\rmerchant_data\030\001 \001(\014\022\024\n\014transa" +
      "ctions\030\002 \003(\014\022#\n\trefund_to\030\003 \003(\0132\020.paymen" +
      "ts.Output\022\014\n\004memo\030\004 \001(\t\">\n\nPaymentACK\022\"\n" +
      "\007payment\030\001 \002(\0132\021.payments.Payment\022\014\n\004mem" +
      "o\030\002 \001(\tB(\n\036org.bitcoin.protocols.payment" +
      "sB\006Protos"
    };
    com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
        new com.google.protobuf.Descriptors.FileDescriptor.    InternalDescriptorAssigner() {
          public com.google.protobuf.ExtensionRegistry assignDescriptors(
              com.google.protobuf.Descriptors.FileDescriptor root) {
            descriptor = root;
            return null;
          }
        };
    com.google.protobuf.Descriptors.FileDescriptor
      .internalBuildGeneratedFileFrom(descriptorData,
        new com.google.protobuf.Descriptors.FileDescriptor[] {
        }, assigner);
    internal_static_payments_Output_descriptor =
      getDescriptor().getMessageTypes().get(0);
    internal_static_payments_Output_fieldAccessorTable = new
      com.google.protobuf.GeneratedMessage.FieldAccessorTable(
        internal_static_payments_Output_descriptor,
        new java.lang.String[] { "Amount", "Script", });
    internal_static_payments_PaymentDetails_descriptor =
      getDescriptor().getMessageTypes().get(1);
    internal_static_payments_PaymentDetails_fieldAccessorTable = new
      com.google.protobuf.GeneratedMessage.FieldAccessorTable(
        internal_static_payments_PaymentDetails_descriptor,
        new java.lang.String[] { "Network", "Outputs", "Time", "Expires", "Memo", "PaymentUrl", "MerchantData", });
    internal_static_payments_PaymentRequest_descriptor =
      getDescriptor().getMessageTypes().get(2);
    internal_static_payments_PaymentRequest_fieldAccessorTable = new
      com.google.protobuf.GeneratedMessage.FieldAccessorTable(
        internal_static_payments_PaymentRequest_descriptor,
        new java.lang.String[] { "PaymentDetailsVersion", "PkiType", "PkiData", "SerializedPaymentDetails", "Signature", });
    internal_static_payments_X509Certificates_descriptor =
      getDescriptor().getMessageTypes().get(3);
    internal_static_payments_X509Certificates_fieldAccessorTable = new
      com.google.protobuf.GeneratedMessage.FieldAccessorTable(
        internal_static_payments_X509Certificates_descriptor,
        new java.lang.String[] { "Certificate", });
    internal_static_payments_Payment_descriptor =
      getDescriptor().getMessageTypes().get(4);
    internal_static_payments_Payment_fieldAccessorTable = new
      com.google.protobuf.GeneratedMessage.FieldAccessorTable(
        internal_static_payments_Payment_descriptor,
        new java.lang.String[] { "MerchantData", "Transactions", "RefundTo", "Memo", });
    internal_static_payments_PaymentACK_descriptor =
      getDescriptor().getMessageTypes().get(5);
    internal_static_payments_PaymentACK_fieldAccessorTable = new
      com.google.protobuf.GeneratedMessage.FieldAccessorTable(
        internal_static_payments_PaymentACK_descriptor,
        new java.lang.String[] { "Payment", "Memo", });
  }

  // @@protoc_insertion_point(outer_class_scope)
}
