Skip to content

Commit

Permalink
feat: 补齐资金流水相关API
Browse files Browse the repository at this point in the history
  • Loading branch information
bububa committed Dec 27, 2024
1 parent 203150a commit d174faf
Show file tree
Hide file tree
Showing 58 changed files with 2,646 additions and 104 deletions.
21 changes: 20 additions & 1 deletion marketing-api/OCEANENGINE.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,13 @@
- 查询账号流水明细 [ advertiser.FundTransactionGet(clt *core.SDKClient, accessToken string, req *advertiser.FundTransactionGetRequest) ([]advertiser.FundTransactionGetResponseList, error) ]
- 代理商转账 [ agent.AdvertiserRecharge(clt *core.SDKClient, accessToken string, req *agent.AdvertiserRechargeRequest) (string, error) ]
- 代理商退款 [ agent.AdvertiserRefund(clt *core.SDKClient, accessToken string, req *agent.AdvertiserRefundRequest) (string, error) ]
- 获取共享钱包余额 [ fund.SharedWalletFundGet(clt \*core.SDKClient, accessToken string, advertiserIDs []uint64) ([]fund.SharedWalletBalance, error) ]
- 获取共享钱包余额 [ sharedwallet.BalanceGet(clt core.SDKClient, accessToken string, advertiserIDs []uint64) ([]sharedwallet.BalanceInfo, error) ]
- 查询账户可转余额 [ advertiser.TransferableFundGet(clt *core.SDKClient, accessToken string, advertiserID uint64) (*advertiser.TransferableFund, error) ]
- 获取可转账户列表(客户中心&广告主) [ customercenter.AdvertiserTransferableList(clt *core.SDKClient, accessToken string, req *customercenter.AdvertiserTransferableListRequest) (*customercenter.AdvertiserTransferableListData, error) ]
- 创建转账交易号 [ customercenter.FundTransferSeqCreate(clt *core.SDKClient, accessToken string, req *customercenter.FundTransferSeqCreateRequest) (uint64, error) ]
- 提交转账交易号 [ customercenter.FundTransferSeqCommit(clt *core.SDKClient, accessToken string, req *customercenter.FundTransferSeqCommitRequest) (uint64, error) ]
- 查询项目关联结算单信息 [ agent.QueryStatement(ctx context.Context, clt *core.SDKClient, accessToken string, req *agent.QueryStatementRequest) ([]agent.ProjectRefStatement, error) ]
- 查询项目信息 [ QueryProject(ctx context.Context, clt *core.SDKClient, accessToken string, req *agent.QueryProjectRequest) (*agent.QueryProjectResult, error) ]
- 创建转账交易号(方舟)[ agent.FundTransferSeqCreate(clt *core.SDKClient, accessToken string, req *agent.FundTransferSeqCreateRequest) (string, error) ]
- 提交转账交易号(方舟)[ agent.FundTransferSeqCommit(clt *core.SDKClient, accessToken string, req *agent.FundTransferSeqCommitRequest) (string, error) ]
- 创建退款交易号(方舟)[ agent.RefundTransferSeqCreate(clt *core.SDKClient, accessToken string, req *agent.FundTransferSeqCreateRequest) (string, error) ]
Expand All @@ -65,6 +67,23 @@
- 转账-获取最大可转余额(代理) [ agent.QueryCanTransferBalance(clt *core.SDKClient, accessToken string, req *agent.QueryCanTransferBalanceRequest) ([]agent.CanTransferDetail, error) ]
- 转账-发起转账(代理) [ agent.CreateTransfer(clt *core.SDKClient, accessToken string, req *agent.CreateTransferRequest) (string, error) ]
- 转账-查询转账单信息(代理) [ agent.QueryTransferDetail(clt *core.SDKClient, accessToken string, req *agent.QueryTransferDetailRequest) (*agent.TransferDetail, error) ]
- 资金共享-批量查询钱包余额 [ WalletBalanceGet(ctx context.Context, clt *core.SDKClient, accessToken string, req *sharedwallet.WalletBalanceGetRequest) (*sharedwallet.WalletBalanceInfo, error) ]
- 资金共享-查询共享钱包流水明细 [ TransactionDetailGet(ctx context.Context, clt *core.SDKClient, accessToken string, req *sharedwallet.TransactionDetailGetRequest) (*sharedwallet.TransactionDetailGetResult, error) ]
- 资金共享-查询共享钱包日流水 [ DailyStatGet(ctx context.Context, clt *core.SDKClient, accessToken string, req *sharedwallet.DailyStatGetRequest) (*sharedwallet.DailyStatGetResult, error) ]
- 资金共享-共享钱包信息查询 [ MainWalletGet(ctx context.Context, clt *core.SDKClient, accessToken string, req *sharedwallet.MainWalletGetRequest) (*sharedwallet.MainWalletInfo, error) ]
- 资金共享-批量查询钱包信息 [ WalletInfoGet(ctx context.Context, clt *core.SDKClient, accessToken string, req *sharedwallet.WalletInfoGetRequest) ([]sharedwallet.WalletInfo, error) ]
- 资金共享-查询子钱包下绑定的adv列表 [ WalletRelationGet(ctx context.Context, clt *core.SDKClient, accessToken string, req *sharedwallet.WalletRelationGetRequest) (*sharedwallet.WalletRelationGetResult, error) ]
- 共享钱包-查询账户对应公司下的钱包关系 [ AccountRelationGet(ctx context.Context, clt *core.SDKClient, accessToken string, req *sharedwallet.AccountRelationGetRequest) (*sharedwallet.AccountRelationGetResult, error) ]
- 资金共享-最大可转余额查询 [ CanTransferBalance(ctx context.Context, clt *core.SDKClient, accessToken string, req *sharedwallet.CanTransferBalanceRequest) ([]sharedwallet.CanTransferDetail, error) ]
- 资金共享-发起转账 [ TransferCreate(ctx context.Context, clt *core.SDKClient, accessToken string, req *sharedwallet.TransferCreateRequest) (string, error) ]
- 资金共享-查询转账列表 [ TransferList(ctx context.Context, clt *core.SDKClient, accessToken string, req *sharedwallet.TransferListRequest) ([]sharedwallet.TransferRecord, error) ]
- 资金共享-查询转账单信息 [ TransferDetail(ctx context.Context, clt *core.SDKClient, accessToken string, req *sharedwallet.TransferDetailRequest) (*sharedwallet.TransferDetail, error) ]
- 返点-查询返点核算流水 [ QueryRebateAccountingInfo(ctx context.Context, clt *core.SDKClient, accessToken string, req *agent.QueryRebateAccountingInfoRequest) (*agent.QueryRebateAccountingInfoResult, error) ]
- 返点-查询返点流水 [ QueryRebateBalance(ctx context.Context, clt *core.SDKClient, accessToken string, req *agent.QueryRebateBalanceRequest) (*agent.QueryRebateBalanceResult, error) ]
- 排期—查询业务实体ID [ QueryBookingBusinessEntityIDGet(ctx context.Context, clt *core.SDKClient, accessToken string, req *agent.QueryBookingBusinessEntityIDGetRequest) ([]agent.BusinessEntityIDInfo, error) ]
- 开票-新建开票申请单(代理商版) [ CreateStatementInvoice(ctx context.Context, clt *core.SDKClient, accessToken string, req *agent.CreateStatementInvoiceRequest) (string, error) ]
- 开票-查询开票单数据(代理商版) [ QueryInvoice(ctx context.Context, clt *core.SDKClient, accessToken string, req *agent.QueryInvoiceRequest) (*agent.QueryInvoiceResult, error) ]
- 开票-获取电子发票文件接口(代理商版) [ QueryInvoiceElectronicURL(ctx context.Context, clt *core.SDKClient, accessToken string, req *agent.QueryInvoiceElectronicURLRequest) ([]agent.InvoiceElectronicURL, error) ]
- 广告投放
- 广告账户预算 (api)
- 获取账户日预算 [ advertiser.BudgetGet(clt *core.SDKClient, accessToken string, req *advertiser.BudgetGetRequest) ([]advertiser.BudgetGetResponseList, error) ]
Expand Down
7 changes: 6 additions & 1 deletion marketing-api/STAR.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,15 @@
- 广告主列表 [ AdvertiserSelect(clt *core.SDKClient, accessToken string, req *agent.AdvertiserSelectRequest) (*agent.AdvertiserSelectResponseData, error) ]
- 二级代理商列表 [ ChildAgentSelect(clt *core.SDKClient, accessToken string, req *agent.ChildAgentSelectRequest) ([]uint64, error) ]
- 获取代理商信息 [ Info(clt *core.SDKClient, accessToken string, req *agent.InfoRequest) ([]agent.Info, error) ]
- 资金和流水管理
- 批量查询账户余额 [ advertiser.AccountFundGet(clt *core.SDKClient, accessToken string, req *advertiser.AccountFundGetRequest) ([]advertiser.AccountFund, error) ]
- 查询账号日流水 [ advertiser.FundDailyStat(clt *core.SDKClient, accessToken string, req *advertiser.FundDailyStatRequest) (*advertiser.FundDailyStatResponseData, error) ]
- 查询代理商转账记录 [ agent.TransferTransactionRecord(clt *core.SDKClient, accessToken string, req *agent.TransferTransactionRecordRequest) (*agent.TransferTransactionRecordResult, error) ]
- 查询账号流水明细 [ advertiser.FundTransactionGet(clt *core.SDKClient, accessToken string, req *advertiser.FundTransactionGetRequest) ([]advertiser.FundTransactionGetResponseList, error) ]
- 巨量星图 (api/star)
- 获取星广联投(星图版)任务列表 [ task.List(ctx context.Context, clt *core.SDKClient, accessToken string, req *task.ListRequest) (*task.ListResult, error) ]
- 获取星广联投(星图版)任务维度数据 [ task.Detail(ctx context.Context, clt *core.SDKClient, accessToken string, req *task.DetailRequest) (*task.Demand, error) ]
- 获取星广联投(星图版)视频维度数据 [ task.ItemList(ctx context.Context, clt *core.SDKClient, accessToken string, req *task.ItemListRequest) ([]task.ItemStatInfo, error) ]
- 获取星广联投(星图版)视频维度数据 [ task.ItemList(ctx context.Context, clt *core.SDKClient, accessToken string, req *task.ItemListRequest) ([]task.ItemStatInfo, error) ]
- 获取星图客户任务列表 [ DemandList(clt *core.SDKClient, accessToken string, req *star.DemandListRequest) (*star.DemandListResult, error) ]
- 获取星图客户任务订单列表 [ DemandOrderList(clt *core.SDKClient, accessToken string, req *star.DemandOrderListRequest) (*star.DemandOrderListResult, error) ]
- 获取订单投后分析报表 [ ReportOrderOverviewGet(clt *core.SDKClient, accessToken string, req *star.ReportOrderOverviewGetRequest) (*star.ReportOrderOverviewGetResult, error) ]
Expand Down
18 changes: 18 additions & 0 deletions marketing-api/api/agent/create_statement_invoice.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package agent

import (
"context"

"github.com/bububa/oceanengine/marketing-api/core"
"github.com/bububa/oceanengine/marketing-api/model/agent"
)

// CreateStatementInvoice 开票-新建开票申请单(代理商版)
// 创建结算单开票接口,支持差额开票
func CreateStatementInvoice(ctx context.Context, clt *core.SDKClient, accessToken string, req *agent.CreateStatementInvoiceRequest) (string, error) {
var resp agent.CreateStatementInvoiceResponse
if err := clt.PostAPI(ctx, "2/create/statement_invoice/", req, &resp, accessToken); err != nil {
return "", err
}
return resp.Data.InvoiceSerial, nil
}
17 changes: 17 additions & 0 deletions marketing-api/api/agent/query_booking_business_entity_id_get.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package agent

import (
"context"

"github.com/bububa/oceanengine/marketing-api/core"
"github.com/bububa/oceanengine/marketing-api/model/agent"
)

// QueryBookingBusinessEntityIDGet 排期—查询业务实体ID
func QueryBookingBusinessEntityIDGet(ctx context.Context, clt *core.SDKClient, accessToken string, req *agent.QueryBookingBusinessEntityIDGetRequest) ([]agent.BusinessEntityIDInfo, error) {
var resp agent.QueryBookingBusinessEntityIDGetResponse
if err := clt.GetAPI(ctx, "2/query/booking/business_entity_id/get/", req, &resp, accessToken); err != nil {
return nil, err
}
return resp.Data.BusinessEntityIDInfos, nil
}
18 changes: 18 additions & 0 deletions marketing-api/api/agent/query_invoice.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package agent

import (
"context"

"github.com/bububa/oceanengine/marketing-api/core"
"github.com/bububa/oceanengine/marketing-api/model/agent"
)

// QueryInvoice 开票-查询开票单数据(代理商版)
// 通过结算单/项目查询开票单数据
func QueryInvoice(ctx context.Context, clt *core.SDKClient, accessToken string, req *agent.QueryInvoiceRequest) (*agent.QueryInvoiceResult, error) {
var resp agent.QueryInvoiceResponse
if err := clt.GetAPI(ctx, "2/query/invoice/", req, &resp, accessToken); err != nil {
return nil, err
}
return resp.Data, nil
}
18 changes: 18 additions & 0 deletions marketing-api/api/agent/query_invoice_electronic_url.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package agent

import (
"context"

"github.com/bububa/oceanengine/marketing-api/core"
"github.com/bububa/oceanengine/marketing-api/model/agent"
)

// QueryInvoiceElectronicURL 开票-获取电子发票文件接口(代理商版)
// 开票-获取电票/数电票发票文件下载链接接口
func QueryInvoiceElectronicURL(ctx context.Context, clt *core.SDKClient, accessToken string, req *agent.QueryInvoiceElectronicURLRequest) ([]agent.InvoiceElectronicURL, error) {
var resp agent.QueryInvoiceElectronicURLResponse
if err := clt.GetAPI(ctx, "2/query/invoice_electronic_url/", req, &resp, accessToken); err != nil {
return nil, err
}
return resp.Data.URLList, nil
}
17 changes: 17 additions & 0 deletions marketing-api/api/agent/query_project.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package agent

import (
"context"

"github.com/bububa/oceanengine/marketing-api/core"
"github.com/bububa/oceanengine/marketing-api/model/agent"
)

// QueryProject 查询项目信息
func QueryProject(ctx context.Context, clt *core.SDKClient, accessToken string, req *agent.QueryProjectRequest) (*agent.QueryProjectResult, error) {
var resp agent.QueryProjectResponse
if err := clt.GetAPI(ctx, "2/query/project/", req, &resp, accessToken); err != nil {
return nil, err
}
return resp.Data, nil
}
18 changes: 18 additions & 0 deletions marketing-api/api/agent/query_rebate_accounting_info.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package agent

import (
"context"

"github.com/bububa/oceanengine/marketing-api/core"
"github.com/bububa/oceanengine/marketing-api/model/agent"
)

// QueryRebateAccountingInfo 返点-查询返点核算流水
// 结算-查询返点核算信息
func QueryRebateAccountingInfo(ctx context.Context, clt *core.SDKClient, accessToken string, req *agent.QueryRebateAccountingInfoRequest) (*agent.QueryRebateAccountingInfoResult, error) {
var resp agent.QueryRebateAccountingInfoResponse
if err := clt.GetAPI(ctx, "2/query/rebate_accounting_info/", req, &resp, accessToken); err != nil {
return nil, err
}
return resp.Data, nil
}
18 changes: 18 additions & 0 deletions marketing-api/api/agent/query_rebate_balance.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package agent

import (
"context"

"github.com/bububa/oceanengine/marketing-api/core"
"github.com/bububa/oceanengine/marketing-api/model/agent"
)

// QueryRebateBalance 返点-查询返点流水
// 结算-查询返点流水信息
func QueryRebateBalance(ctx context.Context, clt *core.SDKClient, accessToken string, req *agent.QueryRebateBalanceRequest) (*agent.QueryRebateBalanceResult, error) {
var resp agent.QueryRebateBalanceResponse
if err := clt.GetAPI(ctx, "2/query/rebate_balance/", req, &resp, accessToken); err != nil {
return nil, err
}
return resp.Data, nil
}
18 changes: 18 additions & 0 deletions marketing-api/api/agent/query_statement.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package agent

import (
"context"

"github.com/bububa/oceanengine/marketing-api/core"
"github.com/bububa/oceanengine/marketing-api/model/agent"
)

// QueryStatement 查询项目关联结算单信息
// 代理商查询项目关联结算单信息
func QueryStatement(ctx context.Context, clt *core.SDKClient, accessToken string, req *agent.QueryStatementRequest) ([]agent.ProjectRefStatement, error) {
var resp agent.QueryStatementResponse
if err := clt.GetAPI(ctx, "2/query/statement/", req, &resp, accessToken); err != nil {
return nil, err
}
return resp.Data.ProjectRefStatmentList, nil
}
22 changes: 0 additions & 22 deletions marketing-api/api/fund/shared_wallet_balance_get.go

This file was deleted.

17 changes: 17 additions & 0 deletions marketing-api/api/sharedwallet/account_relation_get.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package sharedwallet

import (
"context"

"github.com/bububa/oceanengine/marketing-api/core"
"github.com/bububa/oceanengine/marketing-api/model/sharedwallet"
)

// AccountRelationGet 共享钱包-查询账户对应公司下的钱包关系
func AccountRelationGet(ctx context.Context, clt *core.SDKClient, accessToken string, req *sharedwallet.AccountRelationGetRequest) (*sharedwallet.AccountRelationGetResult, error) {
var resp sharedwallet.AccountRelationGetResponse
if err := clt.GetAPI(ctx, "v3.0/shared_wallet/account_relation/get/", req, &resp, accessToken); err != nil {
return nil, err
}
return resp.Data, nil
}
21 changes: 21 additions & 0 deletions marketing-api/api/sharedwallet/balance_get.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package sharedwallet

import (
"context"

"github.com/bububa/oceanengine/marketing-api/core"
"github.com/bububa/oceanengine/marketing-api/model/sharedwallet"
)

// BalanceGet 获取共享钱包余额
// 返货相关需要咨询相关的运营和销售同学对接,具备返货相关前置条件下,相关返货资金信息可以通过本接口获得
func BalanceGet(ctx context.Context, clt *core.SDKClient, accessToken string, advertiserIDs []uint64) ([]sharedwallet.BalanceInfo, error) {
req := &sharedwallet.BalanceGetRequest{
AdvertiserIDs: advertiserIDs,
}
var resp sharedwallet.BalanceGetResponse
if err := clt.GetAPI(ctx, "2/fund/shared_wallet_balance/get", req, &resp, accessToken); err != nil {
return nil, err
}
return resp.Data.List, nil
}
23 changes: 23 additions & 0 deletions marketing-api/api/sharedwallet/can_transfer_balance.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package sharedwallet

import (
"context"

"github.com/bububa/oceanengine/marketing-api/core"
"github.com/bububa/oceanengine/marketing-api/model/sharedwallet"
)

// CanTransferBalance 资金共享-最大可转余额查询
// 支持查询减款方与加款方之间最大可转金额、减款方非品牌最大可转出金额、加款方非品牌最小转入金额,
// 为了最大限度保证转账申请成功率,在发起转账申请之前,建议调用方做以下校验:
// - 减款钱包非品牌资金申请转账金额 <= 减款钱包非品牌资金最大可转出金额(non_brand_max_transfer_balance)
// - 减款钱包资金-业务线维度申请转账金额 <= 减款钱包资金-业务线维度可转金额(remitter_capital_detail_list)
// - 加款钱包非品牌资金申请转账金额 >= 加款钱包非品牌资金最小转入金额(non_brand_min_transfer_balance)
// - 加款钱包资金-业务线维度申请转账金额 <= 加款钱包资金-业务线维度可转金额(payee_transfer_amount_detail_list.capital_detail_list)
func CanTransferBalance(ctx context.Context, clt *core.SDKClient, accessToken string, req *sharedwallet.CanTransferBalanceRequest) ([]sharedwallet.CanTransferDetail, error) {
var resp sharedwallet.CanTransferBalanceResponse
if err := clt.GetAPI(ctx, "v3.0/cg_transfer/wallet/transfer/can_transfer_balance/", req, &resp, accessToken); err != nil {
return nil, err
}
return resp.Data.CanTransferDetailList, nil
}
18 changes: 18 additions & 0 deletions marketing-api/api/sharedwallet/daily_stat_get.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package sharedwallet

import (
"context"

"github.com/bububa/oceanengine/marketing-api/core"
"github.com/bububa/oceanengine/marketing-api/model/sharedwallet"
)

// DailyStatGet 资金共享-查询共享钱包日流水
// 资金共享-查询共享钱包日流水信息,一般每天8点会出来前一天的数据,如果当天存在数据延迟可往后再尝试。
func DailyStatGet(ctx context.Context, clt *core.SDKClient, accessToken string, req *sharedwallet.DailyStatGetRequest) (*sharedwallet.DailyStatGetResult, error) {
var resp sharedwallet.DailyStatGetResponse
if err := clt.GetAPI(ctx, "v3.0/shared_wallet/daily_stat/get/", req, &resp, accessToken); err != nil {
return nil, err
}
return resp.Data, nil
}
2 changes: 2 additions & 0 deletions marketing-api/api/sharedwallet/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// Package sharedwallet 资金共享
package sharedwallet
18 changes: 18 additions & 0 deletions marketing-api/api/sharedwallet/main_wallet_get.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package sharedwallet

import (
"context"

"github.com/bububa/oceanengine/marketing-api/core"
"github.com/bububa/oceanengine/marketing-api/model/sharedwallet"
)

// MainWalletGet 资金共享-共享钱包信息查询
// 查询当前共享钱包(大钱包)的信息
func MainWalletGet(ctx context.Context, clt *core.SDKClient, accessToken string, req *sharedwallet.MainWalletGetRequest) (*sharedwallet.MainWalletInfo, error) {
var resp sharedwallet.MainWalletGetResponse
if err := clt.GetAPI(ctx, "v3.0/shared_wallet/main_wallet/get/", req, &resp, accessToken); err != nil {
return nil, err
}
return resp.Data, nil
}
Loading

0 comments on commit d174faf

Please sign in to comment.