From 78fce20c2e68712fe75c2b1442f21f85d116893d Mon Sep 17 00:00:00 2001 From: renzhiyuan <465386466@qq.com> Date: Mon, 17 Aug 2026 15:48:48 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=96=87=E4=BB=B6:=20intelli?= =?UTF-8?q?gence=5Ffinance=5Fv1/types.go?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- intelligence_finance_v1/types.go | 466 +++++++++++++++++++++++++++++++ 1 file changed, 466 insertions(+) create mode 100644 intelligence_finance_v1/types.go diff --git a/intelligence_finance_v1/types.go b/intelligence_finance_v1/types.go new file mode 100644 index 0000000..e28e383 --- /dev/null +++ b/intelligence_finance_v1/types.go @@ -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"` +} \ No newline at end of file