package intelligence_finance // ============================================================ // General API Response // ============================================================ // APIResponse is the general response wrapper returned by the platform APIs. type APIResponse struct { Code int `json:"code"` Msg string `json:"msg,omitempty"` Data map[string]interface{} `json:"data,omitempty"` } // ============================================================ // Interface 1: 订单开票接口 (Invoice Create) // ============================================================ // InvoiceCreateRequest is the request for creating an invoice order. type InvoiceCreateRequest struct { CompanyCode string `json:"companyCode,omitempty"` OrderID string `json:"orderId"` InvoiceType int `json:"invoiceType"` Products []InvoiceProduct `json:"products"` Remark string `json:"remark,omitempty"` Purchaser string `json:"purchaser"` TaxNum string `json:"taxnum,omitempty"` PurchaserAddr string `json:"purchaserAddress,omitempty"` PurchaserTel string `json:"purchaserTel,omitempty"` BankName string `json:"bankName,omitempty"` BankAccount string `json:"bankAccount,omitempty"` Phone string `json:"phone,omitempty"` Email string `json:"email,omitempty"` ApplyPerson string `json:"applyPerson,omitempty"` Payee string `json:"payee,omitempty"` Reviewer string `json:"reviewer,omitempty"` InvoiceRemark string `json:"invoiceRemark,omitempty"` NaturalPerson string `json:"naturalPerson,omitempty"` AdditionInfo string `json:"additionInfo,omitempty"` } // InvoiceProduct represents a single product/service line item in an invoice. type InvoiceProduct struct { ProductName string `json:"productName"` RevenueCode string `json:"revenueCode"` AmountIncludeTax float64 `json:"amountIncludeTax"` Specs string `json:"specs,omitempty"` Unit string `json:"unit,omitempty"` Quantity float64 `json:"quantity"` Discount float64 `json:"discount,omitempty"` TaxSign int `json:"taxSign,omitempty"` TaxRate float64 `json:"taxRate,omitempty"` } // InvoiceCreateResponse is the response for creating an invoice order. type InvoiceCreateResponse struct { Status int `json:"status"` ErrorMsg string `json:"errorMsg,omitempty"` DataList []InvoiceData `json:"dataList"` } // InvoiceData contains detailed information about a single invoice. type InvoiceData struct { DeviceCode string `json:"deviceCode"` Drawer string `json:"drawer"` Email string `json:"email"` InvoiceType string `json:"invoiceType"` IssueType string `json:"issueType"` ListFlag string `json:"listFlag"` Mobile string `json:"mobile"` OriginalInvCode string `json:"originalInvCode,omitempty"` OriginalInvNo string `json:"originalInvNo,omitempty"` AdditionInfo string `json:"additionInfo,omitempty"` Payee string `json:"payee"` PurchaserAddress string `json:"purchaserAddress"` PurchaserBankAcct string `json:"purchaserBankAccount"` PurchaserBankName string `json:"purchaserBankName"` PurchaserName string `json:"purchaserName"` PurchaserTaxNo string `json:"purchaserTaxNo"` PurchaserTel string `json:"purchaserTel"` NaturalPerson string `json:"naturalPerson,omitempty"` Remark string `json:"remark"` Reviewer string `json:"reviewer"` SellerAddress string `json:"sellerAddress,omitempty"` SellerBankAcct string `json:"sellerBankAccount"` SellerBankName string `json:"sellerBankName"` SellerName string `json:"sellerName"` CheckCode string `json:"checkCode"` CipherText string `json:"cipherText"` DrewDate string `json:"drewDate,omitempty"` InvoiceCode string `json:"invoiceCode"` InvoiceNo string `json:"invoiceNo"` InvoiceStatus string `json:"invoiceStatus"` LayoutFileURL string `json:"layoutFileUrl,omitempty"` PDFURL string `json:"pdfUrl,omitempty"` OFDURL string `json:"ofdUrl,omitempty"` XMLURL string `json:"xmlUrl,omitempty"` TotalExcludeTax string `json:"totalExcludeTax"` TotalIncludeTax string `json:"totalIncludeTax"` TotalTaxAmount string `json:"totalTaxAmount"` LevyingType string `json:"levyingType"` Details []InvoiceDetail `json:"details"` } // InvoiceDetail represents a product detail line within an invoice. type InvoiceDetail struct { Amount string `json:"amount,omitempty"` Quantity string `json:"quantity,omitempty"` DeductionAmount string `json:"deductionAmount,omitempty"` TaxAmount string `json:"taxAmount,omitempty"` ItemTitle string `json:"itemTitle"` TaxCode string `json:"taxCode"` ItemType string `json:"itemType"` ItemName string `json:"itemName"` Specs string `json:"specs,omitempty"` TaxFreePolicy string `json:"taxFreePolicy"` PreferentialPolicy string `json:"preferentialPolicy"` TaxRate string `json:"taxRate"` TaxSign string `json:"taxSign"` Unit string `json:"unit,omitempty"` UnitPrice string `json:"unitPrice,omitempty"` } // ============================================================ // Interface 2: 开票状态查询 (Invoice Status Query) // ============================================================ // InvoiceStatusQueryRequest is the request for querying invoice status. type InvoiceStatusQueryRequest struct { OrderID string `json:"orderId"` } // InvoiceStatusQueryResponse is the response for querying invoice status. type InvoiceStatusQueryResponse struct { Status int `json:"status"` Message string `json:"message,omitempty"` Data []InvoiceData `json:"data"` } // ============================================================ // Interface 3: 创建付款单据 (Create Payment Order) // ============================================================ // CreatePaymentOrderRequest is the request for creating a payment order. type CreatePaymentOrderRequest struct { Code string `json:"code"` YidaAppType string `json:"yidaAppType,omitempty"` EmpAccountUserID string `json:"empAccountUserId,omitempty"` Department *Department `json:"department,omitempty"` Usage string `json:"usage,omitempty"` PaymentUserID string `json:"paymentUserId,omitempty"` Customer *Customer `json:"customer,omitempty"` PrincipalID string `json:"principalId,omitempty"` Remark string `json:"remark,omitempty"` Supplier *Supplier `json:"supplier,omitempty"` Title string `json:"title,omitempty"` Project *Project `json:"project,omitempty"` PaymentUserIDListStr string `json:"paymentUserIdListStr,omitempty"` NeedPayment bool `json:"needPayment,omitempty"` PaymentDetailListJSONStr string `json:"paymentDetailListJsonStr,omitempty"` PaymentDetailList []PaymentDetail `json:"paymentDetailList,omitempty"` Company *Company `json:"company,omitempty"` Amount string `json:"amount,omitempty"` RecipientAccountInfo *RecipientAccount `json:"recipientAccountInfo,omitempty"` EnterpriseAccount *EnterpriseAccount `json:"enterpriseAccount,omitempty"` Category []Category `json:"category,omitempty"` UserID string `json:"userId"` OccurDate int64 `json:"occurDate,omitempty"` Product *Product `json:"product,omitempty"` YidaFormUUID string `json:"yidaFormUuid,omitempty"` CanEditPaymentInfo bool `json:"canEditPaymentInfo,omitempty"` PaymentUserIDList []string `json:"paymentUserIdList,omitempty"` YidaProcInsID string `json:"yidaProcInsId,omitempty"` SyncPaymentOrder bool `json:"syncPaymentOrder,omitempty"` } // Department represents department information. type Department struct { Code string `json:"code,omitempty"` Name string `json:"name"` } // Customer represents customer information. type Customer struct { Code string `json:"code,omitempty"` Name string `json:"name"` } // Supplier represents supplier information. type Supplier struct { Code string `json:"code,omitempty"` Name string `json:"name"` } // Project represents project information. type Project struct { Code string `json:"code,omitempty"` Name string `json:"name"` } // Category represents income/expense category information. type Category struct { Code string `json:"code,omitempty"` Name string `json:"name"` } // Product represents product information. type Product struct { Code string `json:"code,omitempty"` Name string `json:"name"` } // Company represents enterprise entity information. type Company struct { Code string `json:"code,omitempty"` Name string `json:"name"` } // EnterpriseAccount represents enterprise account information. 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 represents recipient account information. type RecipientAccount struct { AccountCategory string `json:"accountCategory"` AccountType string `json:"accountType,omitempty"` CardNo string `json:"cardNo,omitempty"` AccountName string `json:"accountName,omitempty"` } // PaymentDetail represents a payment detail line item. 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 represents invoice information within a payment detail. type InvoiceInfo struct { InvoiceNo string `json:"invoiceNo,omitempty"` InvoiceCode string `json:"invoiceCode,omitempty"` } // CreatePaymentOrderResponse is the response for creating a payment order. type CreatePaymentOrderResponse struct { Code string `json:"code"` } // ============================================================ // Interface 4: 支付完成通知 (Payment Notification - Callback) // ============================================================ // PaymentNotificationData represents the payment notification data sent by the platform. type PaymentNotificationData struct { Code string `json:"code"` InstanceID string `json:"instanceId"` CorpID string `json:"corpId"` PaymentStatus string `json:"paymentStatus"` PaymentTime string `json:"paymentTime"` UserID string `json:"userId"` FailReason string `json:"failReason,omitempty"` PayerAccountInfo *PayerAccountInfo `json:"payerAccountInfo,omitempty"` PayeeAccountInfo *PayeeAccountInfo `json:"payeeAccountInfo,omitempty"` RelatedRowNumberList []string `json:"relatedRowNumberList,omitempty"` Source string `json:"source,omitempty"` Template string `json:"template,omitempty"` Amount string `json:"amount,omitempty"` } // PayerAccountInfo represents the payer's account information. type PayerAccountInfo struct { BankOpenDTO *BankOpenDTO `json:"bankOpenDTO,omitempty"` EnterpriseAccountCode string `json:"enterpriseAccountCode,omitempty"` AccountType string `json:"accountType,omitempty"` } // PayeeAccountInfo represents the payee's account information. type PayeeAccountInfo struct { BankOpenDTO *BankOpenDTO `json:"bankOpenDTO,omitempty"` } // BankOpenDTO represents bank account information. 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"` } // PaymentStatus constants. const ( PaymentStatusSuccess = "SUCCESS" PaymentStatusFail = "FAIL" PaymentStatusTerminate = "TERMINATE" PaymentStatusWaitPay = "WAIT_PAY" PaymentStatusPaying = "PAYING" PaymentStatusPartSucc = "PART_SUCCESS" PaymentStatusRefund = "REFUND" ) // Source constants for payment notifications. const ( SourceApproval = "approval" SourceOpenAPI = "openapi" ) // AccountType constants. const ( AccountTypeAlipay = "ALIPAY" AccountTypeBankCard = "BANKCARD" AccountTypeCorpBankCard = "CORP_BANK_CARD" AccountTypePersonalBankCard = "PERSONAL_BANK_CARD" ) // ============================================================ // Interface 5: 支付状态查询 (Payment Status Query) // ============================================================ // PaymentStatusQueryRequest is the request for querying payment status. type PaymentStatusQueryRequest struct { Code string `json:"code"` UserID string `json:"userId"` } // PaymentStatusQueryResponse is the response for querying payment status, // which has the same structure as PaymentNotificationData. type PaymentStatusQueryResponse struct { PaymentNotificationData } // ============================================================ // Generic Notification (Business Notification) // ============================================================ // NotificationRequest represents a generic notification request from the platform. type NotificationRequest struct { BizType string `json:"bizType"` BizID string `json:"bizId"` Data string `json:"data,omitempty"` }