diff --git a/alipay/data_api.go b/alipay/data_api.go index 3d5b2730..69c5090f 100644 --- a/alipay/data_api.go +++ b/alipay/data_api.go @@ -8,10 +8,8 @@ import ( "github.com/go-pay/gopay" ) -// Deprecated -// 支付宝已不再支持 // alipay.data.bill.balance.query(支付宝商家账户当前余额查询) -// 文档地址:https://opendocs.alipay.com/apis/api_15/alipay.data.bill.balance.query +// 文档地址:https://opendocs.alipay.com/open/2acb3c34_alipay.data.bill.balance.query func (a *Client) DataBillBalanceQuery(ctx context.Context, bm gopay.BodyMap) (aliRsp *DataBillBalanceQueryResponse, err error) { var bs []byte if bs, err = a.doAliPay(ctx, bm, "alipay.data.bill.balance.query"); err != nil { @@ -29,6 +27,25 @@ func (a *Client) DataBillBalanceQuery(ctx context.Context, bm gopay.BodyMap) (al return aliRsp, a.autoVerifySignByCert(aliRsp.Sign, signData, signDataErr) } +// alipay.data.bill.accountlog.query(支付宝商家账户账务明细查询) +// 文档地址:https://opendocs.alipay.com/open/dae3ac99_alipay.data.bill.accountlog.query +func (a *Client) DataBillAccountLogQuery(ctx context.Context, bm gopay.BodyMap) (aliRsp *DataBillAccountLogQueryResponse, err error) { + var bs []byte + if bs, err = a.doAliPay(ctx, bm, "alipay.data.bill.accountlog.query"); err != nil { + return nil, err + } + aliRsp = new(DataBillAccountLogQueryResponse) + if err = json.Unmarshal(bs, aliRsp); err != nil || aliRsp.Response == nil { + return nil, fmt.Errorf("[%w], bytes: %s", gopay.UnmarshalErr, string(bs)) + } + if err = bizErrCheck(aliRsp.Response.ErrorResponse); err != nil { + return aliRsp, err + } + signData, signDataErr := a.getSignData(bs, aliRsp.AlipayCertSn) + aliRsp.SignData = signData + return aliRsp, a.autoVerifySignByCert(aliRsp.Sign, signData, signDataErr) +} + // alipay.data.dataservice.bill.downloadurl.query(查询对账单下载地址) // 文档地址:https://opendocs.alipay.com/open/02e7gr func (a *Client) DataBillDownloadUrlQuery(ctx context.Context, bm gopay.BodyMap) (aliRsp *DataBillDownloadUrlQueryResponse, err error) { diff --git a/alipay/model.go b/alipay/model.go index e0b9d595..8f64dc55 100644 --- a/alipay/model.go +++ b/alipay/model.go @@ -200,6 +200,43 @@ type DataBillBalanceQuery struct { TotalAmount string `json:"total_amount,omitempty"` AvailableAmount string `json:"available_amount,omitempty"` FreezeAmount string `json:"freeze_amount,omitempty"` + SettleAmount string `json:"settle_amount,omitempty"` +} + +// =================================================== +type DataBillAccountLogQueryResponse struct { + Response *DataBillAccountLogQuery `json:"alipay_data_bill_accountlog_query_response"` + AlipayCertSn string `json:"alipay_cert_sn,omitempty"` + SignData string `json:"-"` + Sign string `json:"sign"` +} + +type DataBillAccountLogQuery struct { + ErrorResponse + PageNo string `json:"page_no,omitempty"` + PageSize string `json:"page_size,omitempty"` + TotalSize string `json:"total_size,omitempty"` + DetailList []AccountLogItemResult `json:"detail_list,omitempty"` +} + +type AccountLogItemResult struct { + TransDt string `json:"trans_dt,omitempty"` + AccountLogId string `json:"account_log_id,omitempty"` + AlipayOrderNo string `json:"alipay_order_no,omitempty"` + MerchantOrderNo string `json:"merchant_order_no,omitempty"` + TransAmount string `json:"trans_amount,omitempty"` + Balance string `json:"balance,omitempty"` + Type string `json:"type,omitempty"` + OtherAccount string `json:"other_account,omitempty"` + TransMemo string `json:"trans_memo,omitempty"` + Direction string `json:"direction,omitempty"` + BillSource string `json:"bill_source,omitempty"` + BizNos string `json:"biz_nos,omitempty"` + BizOrigNo string `json:"biz_orig_no,omitempty"` + BizDesc string `json:"biz_desc,omitempty"` + MerchantOutRefundNo string `json:"merchant_out_refund_no,omitempty"` + ComplementInfo string `json:"complement_info,omitempty"` + StoreName string `json:"store_name,omitempty"` } // ===================================================