添加文件: intelligence_finance_v1/types.go

This commit is contained in:
renzhiyuan 2026-08-17 15:48:48 +08:00
parent 255bf685f8
commit 78fce20c2e
1 changed files with 466 additions and 0 deletions

View File

@ -0,0 +1,466 @@
package intelligence_finance_v1
// ============================================================================
// 通用结构
// ============================================================================
// commonResponse 通用 API 响应结构(内部使用)
type commonResponse struct {
Code int `json:"code"`
Msg string `json:"msg"`
Data any `json:"data"`
}
// ============================================================================
// 订单开票(接口 1
// ============================================================================
// InvoiceRequest 订单开票请求参数
type InvoiceRequest struct {
// CompanyCode 开票的企业主体编码,不传则默认主体开票
CompanyCode string `json:"companyCode,omitempty"`
// OrderID 订单唯一标识(需保证在贵方系统内唯一)
OrderID string `json:"orderId"`
// InvoiceType 发票类型枚举1-专用发票2-普通发票3-普通发票(电子)4-专用发票(电子)8-数电专票9-数电普票
InvoiceType int `json:"invoiceType"`
// Products 货物/服务明细列表,至少一项
Products []ProductItem `json:"products"`
// Remark 订单备注(非发票备注)
Remark string `json:"remark,omitempty"`
// Purchaser 购方企业名称
Purchaser string `json:"purchaser"`
// Taxnum 购方纳税人识别号
Taxnum string `json:"taxnum,omitempty"`
// PurchaserAddress 购方地址
PurchaserAddress string `json:"purchaserAddress,omitempty"`
// PurchaserTel 购方电话
PurchaserTel string `json:"purchaserTel,omitempty"`
// BankName 购方开户行名称
BankName string `json:"bankName,omitempty"`
// BankAccount 购方银行账号
BankAccount string `json:"bankAccount,omitempty"`
// Phone 收票人手机号(用于接收电票短信)
Phone string `json:"phone,omitempty"`
// Email 收票人邮箱(用于接收电票邮件)
Email string `json:"email,omitempty"`
// ApplyPerson 开票申请人名称
ApplyPerson string `json:"applyPerson,omitempty"`
// Payee 收款人(发票票面)
Payee string `json:"payee,omitempty"`
// Reviewer 复核人(发票票面)
Reviewer string `json:"reviewer,omitempty"`
// InvoiceRemark 发票备注栏内容
InvoiceRemark string `json:"invoiceRemark,omitempty"`
// NaturalPerson 购买方自然人标识Y-是N-否默认N数电票可选传
NaturalPerson string `json:"naturalPerson,omitempty"`
// AdditionInfo 附加信息JSON数组字符串
AdditionInfo string `json:"additionInfo,omitempty"`
}
// ProductItem 货物/服务明细项
type ProductItem struct {
// ProductName 货物或服务名称
ProductName string `json:"productName"`
// RevenueCode 19位税收分类编码
RevenueCode string `json:"revenueCode"`
// AmountIncludeTax 单条明细含税总金额(单位:元)
AmountIncludeTax string `json:"amountIncludeTax"`
// Specs 规格型号
Specs string `json:"specs,omitempty"`
// Unit 计量单位(如:台、个、次)
Unit string `json:"unit,omitempty"`
// Quantity 数量
Quantity string `json:"quantity"`
// Discount 折扣金额无折扣传0
Discount string `json:"discount,omitempty"`
// TaxSign 是否含税0-不含税1-含税默认建议传1
TaxSign int `json:"taxSign,omitempty"`
// TaxRate 税率小数形式如0.13表示13%
TaxRate string `json:"taxRate,omitempty"`
}
// InvoiceResponse 订单开票响应数据
type InvoiceResponse struct {
// Status 开票状态0-未开票1-开票中2-部分失败3-开票成功4-开票失败5-部分未开6-未配置数电账号7-未配置自动开票配置
Status int `json:"status"`
// ErrorMsg 错误信息(开票失败时返回原因)
ErrorMsg string `json:"errorMsg,omitempty"`
// DataList 发票数据列表(一张订单可能对应多张发票)
DataList []InvoiceData `json:"dataList"`
}
// InvoiceData 发票数据
type InvoiceData struct {
// DeviceCode 税控设备号
DeviceCode string `json:"deviceCode"`
// Drawer 开票人
Drawer string `json:"drawer"`
// Email 邮箱(购方邮箱)
Email string `json:"email"`
// InvoiceType 发票类型1-专用发票2-普通发票3-普通发票电子4-专用发票电子8-数电专票9-数电普票
InvoiceType string `json:"invoiceType"`
// IssueType 开票类型0-正数票1-负数票(红冲)
IssueType string `json:"issueType"`
// ListFlag 清单标识0-无清单1-有清单
ListFlag string `json:"listFlag"`
// Mobile 手机号(购方手机)
Mobile string `json:"mobile"`
// OriginalInvCode 红冲时对应的原蓝票代码
OriginalInvCode string `json:"originalInvCode,omitempty"`
// OriginalInvNo 红冲时对应的原蓝票号码
OriginalInvNo string `json:"originalInvNo,omitempty"`
// AdditionInfo 数电发票备注栏的附加信息部分
AdditionInfo string `json:"additionInfo,omitempty"`
// Payee 收款人
Payee string `json:"payee"`
// PurchaserAddress 购方地址
PurchaserAddress string `json:"purchaserAddress"`
// PurchaserBankAccount 购方银行账号
PurchaserBankAccount string `json:"purchaserBankAccount"`
// PurchaserBankName 购方开户行
PurchaserBankName string `json:"purchaserBankName"`
// PurchaserName 购方名称
PurchaserName string `json:"purchaserName"`
// PurchaserTaxNo 购方税号
PurchaserTaxNo string `json:"purchaserTaxNo"`
// PurchaserTel 购方电话
PurchaserTel string `json:"purchaserTel"`
// NaturalPerson 购买方自然人标识Y-是N-否
NaturalPerson string `json:"naturalPerson,omitempty"`
// Remark 备注
Remark string `json:"remark"`
// Reviewer 复核人
Reviewer string `json:"reviewer"`
// SellerAddress 销方地址
SellerAddress string `json:"sellerAddress,omitempty"`
// SellerBankAccount 销方开户账号
SellerBankAccount string `json:"sellerBankAccount"`
// SellerBankName 销方开户行
SellerBankName string `json:"sellerBankName"`
// SellerName 销方名称
SellerName string `json:"sellerName"`
// CheckCode 校验码
CheckCode string `json:"checkCode"`
// CipherText 密码区
CipherText string `json:"cipherText"`
// DrewDate 开票日期格式yyyy-MM-dd HH:mm:ss
DrewDate string `json:"drewDate,omitempty"`
// InvoiceCode 发票代码
InvoiceCode string `json:"invoiceCode"`
// InvoiceNo 发票号码
InvoiceNo string `json:"invoiceNo"`
// InvoiceStatus 发票状态1-正常2-已红冲3-已作废
InvoiceStatus string `json:"invoiceStatus"`
// LayoutFileURL 电子发票地址PDF/OFD
LayoutFileURL string `json:"layoutFileUrl,omitempty"`
// PDFURL 电子发票PDF地址
PDFURL string `json:"pdfUrl,omitempty"`
// OFDURL 电子发票OFD地址
OFDURL string `json:"ofdUrl,omitempty"`
// XMLURL 电子发票XML数据地址
XMLURL string `json:"xmlUrl,omitempty"`
// TotalExcludeTax 合计金额(不含税)
TotalExcludeTax string `json:"totalExcludeTax"`
// TotalIncludeTax 合计金额(含税)
TotalIncludeTax string `json:"totalIncludeTax"`
// TotalTaxAmount 合计税额
TotalTaxAmount string `json:"totalTaxAmount"`
// LevyingType 征税方式
LevyingType string `json:"levyingType"`
// Details 商品明细列表
Details []InvoiceDetail `json:"details"`
}
// InvoiceDetail 发票商品明细
type InvoiceDetail struct {
// Amount 金额
Amount string `json:"amount,omitempty"`
// Quantity 数量
Quantity string `json:"quantity,omitempty"`
// DeductionAmount 扣除金额
DeductionAmount string `json:"deductionAmount,omitempty"`
// TaxAmount 税额
TaxAmount string `json:"taxAmount,omitempty"`
// ItemTitle 商品合并显示名称
ItemTitle string `json:"itemTitle"`
// TaxCode 税收分类编码19位
TaxCode string `json:"taxCode"`
// ItemType 商品行性质0-正常行1-折扣行2-被折扣行
ItemType string `json:"itemType"`
// ItemName 商品简称
ItemName string `json:"itemName"`
// Specs 商品规格型号
Specs string `json:"specs,omitempty"`
// TaxFreePolicy 免税政策1-免税2-不征税3-普通零税率
TaxFreePolicy string `json:"taxFreePolicy"`
// PreferentialPolicy 优惠政策类型
PreferentialPolicy string `json:"preferentialPolicy"`
// TaxRate 税率小数形式如0.13
TaxRate string `json:"taxRate"`
// TaxSign 是否含税0-否1-是
TaxSign string `json:"taxSign"`
// Unit 计量单位(如:台、个、次)
Unit string `json:"unit,omitempty"`
// UnitPrice 单价
UnitPrice string `json:"unitPrice,omitempty"`
}
// ============================================================================
// 开票状态查询(接口 2
// ============================================================================
// InvoiceStatusQueryRequest 开票状态查询请求参数
type InvoiceStatusQueryRequest struct {
// OrderID 订单唯一标识(需保证在贵方系统内唯一)
OrderID string `json:"orderId"`
}
// InvoiceStatusQueryResponse 开票状态查询响应数据
type InvoiceStatusQueryResponse struct {
// Status 开票状态0-未开票3-成功4-失败6-未配置数电账号7-未配置自动开票
Status int `json:"status"`
// Message 状态描述(如"开票成功"
Message string `json:"message"`
// Data 发票详细列表
Data []InvoiceData `json:"data"`
}
// ============================================================================
// 创建付款单据(接口 3
// ============================================================================
// PaymentDocumentRequest 创建付款单据请求参数
type PaymentDocumentRequest struct {
// Code 单据编码
Code string `json:"code"`
// YidaAppType 宜搭应用类型
YidaAppType string `json:"yidaAppType,omitempty"`
// EmpAccountUserID 员工账号用户ID
EmpAccountUserID string `json:"empAccountUserId,omitempty"`
// Department 部门信息
Department *Department `json:"department,omitempty"`
// Usage 用途
Usage string `json:"usage,omitempty"`
// PaymentUserID 付款人用户ID
PaymentUserID string `json:"paymentUserId,omitempty"`
// Customer 客户信息
Customer *Customer `json:"customer,omitempty"`
// PrincipalID 负责人ID
PrincipalID string `json:"principalId,omitempty"`
// Remark 备注
Remark string `json:"remark,omitempty"`
// Supplier 供应商信息
Supplier *Supplier `json:"supplier,omitempty"`
// Title 标题
Title string `json:"title,omitempty"`
// Project 项目信息
Project *Project `json:"project,omitempty"`
// PaymentUserIDListStr 付款人用户ID列表字符串
PaymentUserIDListStr string `json:"paymentUserIdListStr,omitempty"`
// NeedPayment 是否需要付款
NeedPayment *bool `json:"needPayment,omitempty"`
// PaymentDetailListJSONStr 付款明细列表JSON字符串
PaymentDetailListJSONStr string `json:"paymentDetailListJsonStr,omitempty"`
// PaymentDetailList 付款明细列表
PaymentDetailList []PaymentDetail `json:"paymentDetailList,omitempty"`
// Company 企业主体信息
Company *Company `json:"company,omitempty"`
// Amount 金额
Amount string `json:"amount,omitempty"`
// RecipientAccountInfo 收款账户信息
RecipientAccountInfo *RecipientAccount `json:"recipientAccountInfo,omitempty"`
// EnterpriseAccount 企业账号信息
EnterpriseAccount *EnterpriseAccount `json:"enterpriseAccount,omitempty"`
// Category 收支类别
Category []Category `json:"category,omitempty"`
// UserID 用户ID
UserID string `json:"userId"`
// OccurDate 发生日期(时间戳,毫秒)
OccurDate *int64 `json:"occurDate,omitempty"`
// Product 商品信息
Product *Product `json:"product,omitempty"`
// YidaFormUUID 宜搭表单UUID
YidaFormUUID string `json:"yidaFormUuid,omitempty"`
// CanEditPaymentInfo 是否可编辑付款信息
CanEditPaymentInfo *bool `json:"canEditPaymentInfo,omitempty"`
// PaymentUserIDList 付款人用户ID列表
PaymentUserIDList []string `json:"paymentUserIdList,omitempty"`
// YidaProcInsID 宜搭流程实例ID
YidaProcInsID string `json:"yidaProcInsId,omitempty"`
// SyncPaymentOrder 是否同步付款单
SyncPaymentOrder *bool `json:"syncPaymentOrder,omitempty"`
}
// Department 部门信息
type Department struct {
Code string `json:"code,omitempty"`
Name string `json:"name"`
}
// Customer 客户信息
type Customer struct {
Code string `json:"code,omitempty"`
Name string `json:"name"`
}
// Supplier 供应商信息
type Supplier struct {
Code string `json:"code,omitempty"`
Name string `json:"name"`
}
// Project 项目信息
type Project struct {
Code string `json:"code,omitempty"`
Name string `json:"name"`
}
// Category 收支类别信息
type Category struct {
Code string `json:"code,omitempty"`
Name string `json:"name"`
}
// Product 商品信息
type Product struct {
Code string `json:"code,omitempty"`
Name string `json:"name"`
}
// Company 企业主体信息
type Company struct {
Code string `json:"code,omitempty"`
Name string `json:"name"`
}
// EnterpriseAccount 企业账号信息
type EnterpriseAccount struct {
EnterpriseAccountCode string `json:"enterpriseAccountCode,omitempty"`
AccountCategory string `json:"accountCategory"`
AccountType string `json:"accountType,omitempty"`
CardNo string `json:"cardNo,omitempty"`
AccountName string `json:"accountName,omitempty"`
OfficialNumber string `json:"officialNumber,omitempty"`
OfficialName string `json:"officialName,omitempty"`
Name string `json:"name,omitempty"`
Code string `json:"code,omitempty"`
City string `json:"city,omitempty"`
Province string `json:"province,omitempty"`
}
// RecipientAccount 收款账户信息
type RecipientAccount struct {
AccountCategory string `json:"accountCategory"`
AccountType string `json:"accountType,omitempty"`
CardNo string `json:"cardNo,omitempty"`
AccountName string `json:"accountName,omitempty"`
}
// PaymentDetail 付款明细
type PaymentDetail struct {
Amount string `json:"amount,omitempty"`
InvoiceInfo *InvoiceInfo `json:"invoiceInfo,omitempty"`
ProductCode string `json:"productCode,omitempty"`
ProjectCode string `json:"projectCode,omitempty"`
Remark string `json:"remark,omitempty"`
PrincipalID string `json:"principalId,omitempty"`
Tax string `json:"tax,omitempty"`
}
// InvoiceInfo 付款明细发票信息
type InvoiceInfo struct {
InvoiceNo string `json:"invoiceNo,omitempty"`
InvoiceCode string `json:"invoiceCode,omitempty"`
}
// PaymentDocumentResponse 创建付款单据响应数据
type PaymentDocumentResponse struct {
// Code 单据唯一标识
Code string `json:"code"`
}
// ============================================================================
// 支付完成通知(接口 4- 平台回调客户
// ============================================================================
// PaymentNotification 支付完成通知数据
type PaymentNotification struct {
// Code 单据编码
Code string `json:"code"`
// InstanceID 实例ID
InstanceID string `json:"instanceId"`
// CorpID 企业ID
CorpID string `json:"corpId"`
// PaymentStatus 支付状态
PaymentStatus string `json:"paymentStatus"`
// PaymentTime 支付时间
PaymentTime string `json:"paymentTime"`
// UserID 用户ID
UserID string `json:"userId"`
// FailReason 失败原因
FailReason string `json:"failReason,omitempty"`
// PayerAccountInfo 付款账户信息
PayerAccountInfo *PayerAccountInfo `json:"payerAccountInfo,omitempty"`
// PayeeAccountInfo 收款账户信息
PayeeAccountInfo *PayeeAccountInfo `json:"payeeAccountInfo,omitempty"`
// RelatedRowNumberList 关联行号列表
RelatedRowNumberList []string `json:"relatedRowNumberList,omitempty"`
// Source 来源
Source string `json:"source,omitempty"`
// Template 模板
Template string `json:"template,omitempty"`
// Amount 金额
Amount string `json:"amount,omitempty"`
}
// PayeeAccountInfo 收款账户信息
type PayeeAccountInfo struct {
BankOpenDTO *BankOpenDTO `json:"bankOpenDTO,omitempty"`
}
// PayerAccountInfo 付款账户信息
type PayerAccountInfo struct {
BankOpenDTO *BankOpenDTO `json:"bankOpenDTO,omitempty"`
EnterpriseAccountCode string `json:"enterpriseAccountCode,omitempty"`
AccountType string `json:"accountType,omitempty"`
}
// BankOpenDTO 银行信息
type BankOpenDTO struct {
BankCode string `json:"bankCode,omitempty"`
BankName string `json:"bankName,omitempty"`
BankBranchCode string `json:"bankBranchCode,omitempty"`
BankBranchName string `json:"bankBranchName,omitempty"`
AccountName string `json:"accountName,omitempty"`
BankCardNo string `json:"bankCardNo,omitempty"`
Type string `json:"type,omitempty"`
}
// ============================================================================
// 支付状态查询(接口 5
// ============================================================================
// PaymentStatusQueryRequest 支付状态查询请求参数
type PaymentStatusQueryRequest struct {
// Code 单据编码
Code string `json:"code"`
// UserID 用户ID
UserID string `json:"userId"`
}
// PaymentStatusQueryResponse 支付状态查询响应(与支付通知数据结构一致)
type PaymentStatusQueryResponse = PaymentNotification
// ============================================================================
// 通用通知(回调)
// ============================================================================
// GeneralNotification 通用通知数据
type GeneralNotification struct {
// BizType 业务类型
BizType string `json:"bizType"`
// BizID 业务ID
BizID string `json:"bizId"`
// Data 通知数据
Data string `json:"data,omitempty"`
}