Skip to content

Commit

Permalink
Add SignerInfo to DocumentTypeDescription
Browse files Browse the repository at this point in the history
  • Loading branch information
vladyslav-vasyliev committed Oct 12, 2018
1 parent 41a5c71 commit 49154a2
Show file tree
Hide file tree
Showing 11 changed files with 146 additions and 3 deletions.
14 changes: 14 additions & 0 deletions proto/Documents/Types/DocumentTypeDescription.proto
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import "Invoicing/ExtendedSigner.proto";

package Diadoc.Api.Proto.Documents.Types;

message DocumentTypeDescription {
Expand Down Expand Up @@ -41,10 +43,22 @@ message DocumentTitle {
required bool IsFormal = 1;
optional string XsdUrl = 2;
optional string UserDataXsdUrl = 5;
required SignerInfo SignerInfo = 6;
repeated DocumentMetadataItem MetadataItems = 3;
repeated DocumentMetadataItem EncryptedMetadataItems = 4;
}

message SignerInfo {
required SignerType SignerType = 1;
required Invoicing.Signers.DocumentTitleType ExtendedDocumentTitleType = 2 [default = Absent];
}

enum SignerType {
None = 0;
Signer = 1;
ExtendedSigner = 2;
}

message DocumentMetadataItem {
required string Id = 1;
required DocumentMetadataItemType Type = 2;
Expand Down
1 change: 1 addition & 0 deletions proto/Invoicing/ExtendedSigner.proto
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ enum SignerStatus {
}

enum DocumentTitleType {
Absent = -1;
UtdSeller = 0; // Данные для титула продавца УПД
UtdBuyer = 1; // Данные для титула покупателя УПД
UcdSeller = 2; // Данные для титула продавца УКД
Expand Down
16 changes: 16 additions & 0 deletions src/Com/DocumentTitleSignerType.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using System.Runtime.InteropServices;
using System.Xml.Serialization;

namespace Diadoc.Api.Com
{
[ComVisible(true)]
[Guid("63D6AE87-F026-4DAC-AD9B-A415C57B0B7B")]
//NOTE: Это хотели, чтобы можно было использовать XML-сериализацию для классов
[XmlType(TypeName = "SignerType", Namespace = "https://diadoc-api.kontur.ru")]
public enum DocumentTitleSignerType
{
None = 0,
Signer = 1,
ExtendedSigner = 2
}
}
22 changes: 22 additions & 0 deletions src/Com/DocumentTitleType.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using System.Runtime.InteropServices;
using System.Xml.Serialization;

namespace Diadoc.Api.Com
{
[ComVisible(true)]
[Guid("D096C16C-8C6F-4177-8362-54A5F09503B1")]
//NOTE: Это хотели, чтобы можно было использовать XML-сериализацию для классов
[XmlType(TypeName = "SignerType", Namespace = "https://diadoc-api.kontur.ru")]
public enum DocumentTitleType
{
Absent = -1,
UtdSeller = 0,
UtdBuyer = 1,
UcdSeller = 2,
UcdBuyer = 3,
TovTorg551Seller = 4,
TovTorg551Buyer = 5,
AccCert552Seller = 6,
AccCert552Buyer = 7
}
}
1 change: 1 addition & 0 deletions src/ComDiadocApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
using Diadoc.Api.Proto.Invoicing.Signers;
using Diadoc.Api.Proto.Recognition;
using Diadoc.Api.Proto.Users;
using DocumentTitleType = Diadoc.Api.Proto.Invoicing.Signers.DocumentTitleType;
using DocumentType = Diadoc.Api.Proto.DocumentType;
using Employee = Diadoc.Api.Proto.Employees.Employee;

Expand Down
2 changes: 2 additions & 0 deletions src/DiadocApi-net35.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@
<Compile Include="Com\DocumentDocflow.cs" />
<Compile Include="Com\DocumentMetadataItemType.cs" />
<Compile Include="Com\DocumentMetadataSource.cs" />
<Compile Include="Com\DocumentTitleSignerType.cs" />
<Compile Include="Com\DocumentTitleType.cs" />
<Compile Include="Com\DocumentType.cs" />
<Compile Include="Com\Employees.cs" />
<Compile Include="Com\EntityType.cs" />
Expand Down
2 changes: 2 additions & 0 deletions src/DiadocApi-net45.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@
</ItemGroup>
<ItemGroup>
<Compile Include="AggregateException.cs" />
<Compile Include="Com\DocumentTitleSignerType.cs" />
<Compile Include="Com\DocumentTitleType.cs" />
<Compile Include="Com\Users.cs" />
<Compile Include="DiadocHttpApi.Employees.Async.cs" />
<Compile Include="DiadocHttpApi.Employees.cs" />
Expand Down
25 changes: 22 additions & 3 deletions src/Proto/Documents/Types/DocumentTypeDescription.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public partial class DocumentTypeDescription : SafeComObject, IDocumentTypeDescr
{
ReadonlyList IDocumentTypeDescription.SupportedDocflowList
{
get { return new ReadonlyList(SupportedDocflows.Select(x => (Com.DocumentDocflow)(int)x).ToArray()); }
get { return new ReadonlyList(SupportedDocflows.Select(x => (Com.DocumentDocflow) (int) x).ToArray()); }
}

ReadonlyList IDocumentTypeDescription.FunctionList
Expand Down Expand Up @@ -97,7 +97,7 @@ ReadonlyList IDocumentVersion.TitleList
{
get { return new ReadonlyList(Titles); }
}

ReadonlyList IDocumentVersion.WorkflowList
{
get { return new ReadonlyList(Workflows); }
Expand Down Expand Up @@ -149,6 +149,25 @@ ReadonlyList IDocumentTitle.EncryptedMetadataItemList
}
}

public interface ISignerInfo
{
DocumentTitleSignerType SignerTypeValue { get; }
DocumentTitleType ExtendedDocumentTitleTypeValue { get; }
}

public partial class SignerInfo : SafeComObject, ISignerInfo
{
public DocumentTitleSignerType SignerTypeValue
{
get { return (DocumentTitleSignerType) SignerType; }
}

public DocumentTitleType ExtendedDocumentTitleTypeValue
{
get { return (DocumentTitleType) ExtendedDocumentTitleType; }
}
}

[ComVisible(true)]
[Guid("760F4134-378A-444C-96D3-233D43222A43")]
public interface IDocumentMetadataItem
Expand All @@ -173,7 +192,7 @@ Com.DocumentMetadataItemType IDocumentMetadataItem.ItemType

Com.DocumentMetadataSource IDocumentMetadataItem.MetadataSource
{
get { return (Com.DocumentMetadataSource)(int)Source; }
get { return (Com.DocumentMetadataSource) (int) Source; }
}
}
}
46 changes: 46 additions & 0 deletions src/Proto/Documents/Types/DocumentTypeDescription.proto.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
//------------------------------------------------------------------------------

// Generated from: Documents/Types/DocumentTypeDescription.proto
// Note: requires additional types generated from: Invoicing/ExtendedSigner.proto
namespace Diadoc.Api.Proto.Documents.Types
{
[global::System.Serializable, global::ProtoBuf.ProtoContract(Name=@"DocumentTypeDescription")]
Expand Down Expand Up @@ -209,6 +210,13 @@ public string UserDataXsdUrl
get { return _UserDataXsdUrl; }
set { _UserDataXsdUrl = value; }
}
private Diadoc.Api.Proto.Documents.Types.SignerInfo _SignerInfo;
[global::ProtoBuf.ProtoMember(6, IsRequired = true, Name=@"SignerInfo", DataFormat = global::ProtoBuf.DataFormat.Default)]
public Diadoc.Api.Proto.Documents.Types.SignerInfo SignerInfo
{
get { return _SignerInfo; }
set { _SignerInfo = value; }
}
private readonly global::System.Collections.Generic.List<Diadoc.Api.Proto.Documents.Types.DocumentMetadataItem> _MetadataItems = new global::System.Collections.Generic.List<Diadoc.Api.Proto.Documents.Types.DocumentMetadataItem>();
[global::ProtoBuf.ProtoMember(3, Name=@"MetadataItems", DataFormat = global::ProtoBuf.DataFormat.Default)]
public global::System.Collections.Generic.List<Diadoc.Api.Proto.Documents.Types.DocumentMetadataItem> MetadataItems
Expand All @@ -228,6 +236,30 @@ public string UserDataXsdUrl
{ return global::ProtoBuf.Extensible.GetExtensionObject(ref extensionObject, createIfMissing); }
}

[global::System.Serializable, global::ProtoBuf.ProtoContract(Name=@"SignerInfo")]
public partial class SignerInfo : global::ProtoBuf.IExtensible
{
public SignerInfo() {}

private Diadoc.Api.Proto.Documents.Types.SignerType _SignerType;
[global::ProtoBuf.ProtoMember(1, IsRequired = true, Name=@"SignerType", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
public Diadoc.Api.Proto.Documents.Types.SignerType SignerType
{
get { return _SignerType; }
set { _SignerType = value; }
}
private Diadoc.Api.Proto.Invoicing.Signers.DocumentTitleType _ExtendedDocumentTitleType;
[global::ProtoBuf.ProtoMember(2, IsRequired = true, Name=@"ExtendedDocumentTitleType", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
public Diadoc.Api.Proto.Invoicing.Signers.DocumentTitleType ExtendedDocumentTitleType
{
get { return _ExtendedDocumentTitleType; }
set { _ExtendedDocumentTitleType = value; }
}
private global::ProtoBuf.IExtension extensionObject;
global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
{ return global::ProtoBuf.Extensible.GetExtensionObject(ref extensionObject, createIfMissing); }
}

[global::System.Serializable, global::ProtoBuf.ProtoContract(Name=@"DocumentMetadataItem")]
public partial class DocumentMetadataItem : global::ProtoBuf.IExtensible
{
Expand Down Expand Up @@ -325,6 +357,20 @@ public enum DocumentDocflow
Internal = 1
}

[global::ProtoBuf.ProtoContract(Name=@"SignerType")]
public enum SignerType
{

[global::ProtoBuf.ProtoEnum(Name=@"None", Value=0)]
None = 0,

[global::ProtoBuf.ProtoEnum(Name=@"Signer", Value=1)]
Signer = 1,

[global::ProtoBuf.ProtoEnum(Name=@"ExtendedSigner", Value=2)]
ExtendedSigner = 2
}

[global::ProtoBuf.ProtoContract(Name=@"DocumentMetadataItemType")]
public enum DocumentMetadataItemType
{
Expand Down
3 changes: 3 additions & 0 deletions src/Proto/Invoicing/ExtendedSigner.proto.cs
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,9 @@ public enum SignerStatus
public enum DocumentTitleType
{

[global::ProtoBuf.ProtoEnum(Name=@"Absent", Value=-1)]
Absent = -1,

[global::ProtoBuf.ProtoEnum(Name=@"UtdSeller", Value=0)]
UtdSeller = 0,

Expand Down
17 changes: 17 additions & 0 deletions tests/ComEnumsAreCompatibleWithProtoEnums_Test.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
using Diadoc.Api.Proto.Invoicing.Organizations;
using Diadoc.Api.Proto.Invoicing.Signers;
using NUnit.Framework;
using SignerType = Diadoc.Api.Proto.Invoicing.Signers.SignerType;

namespace Diadoc.Api.Tests
{
Expand Down Expand Up @@ -190,6 +191,22 @@ public void Test_SignerType()
typeof(SignerType));
}

[Test]
public void Test_DocumentTitleSignerType()
{
AssertEnumsAreCompatible(
typeof(Com.DocumentTitleSignerType),
typeof(Diadoc.Api.Proto.Documents.Types.SignerType));
}

[Test]
public void Test_DocumentTitleType()
{
AssertEnumsAreCompatible(
typeof(Com.DocumentTitleType),
typeof(DocumentTitleType));
}

[Test]
public void Test_DocumentDocflow()
{
Expand Down

0 comments on commit 49154a2

Please sign in to comment.