-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
476 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
marketing-api/api/customercenter/can_transfer_balance_get.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package customercenter | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/bububa/oceanengine/marketing-api/core" | ||
"github.com/bububa/oceanengine/marketing-api/model/customercenter" | ||
) | ||
|
||
// CanTransferBalanceGet 工作台转账-获取最大可转余额 | ||
// 查询转出方与转入方之间最大可转金额,接口内已自动扣除需要预留的竞价消耗保证金,支持查询1:N转账的最大可转金额 | ||
func CanTransferBalanceGet(ctx context.Context, clt *core.SDKClient, accessToken string, req *customercenter.CanTransferBalanceGetRequest) ([]customercenter.CanTransferDetail, error) { | ||
var resp customercenter.CanTransferBalanceGetResponse | ||
if err := clt.GetAPI(ctx, "v3.0/cg_transfer/can_transfer_balance/get/", req, &resp, accessToken); err != nil { | ||
return nil, err | ||
} | ||
return resp.Data.CanTransferDetailList, nil | ||
} |
18 changes: 18 additions & 0 deletions
18
marketing-api/api/customercenter/can_transfer_target_list.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package customercenter | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/bububa/oceanengine/marketing-api/core" | ||
"github.com/bububa/oceanengine/marketing-api/model/customercenter" | ||
) | ||
|
||
// CanTransferTargetList 工作台转账-获取可转列表 | ||
// 查询当前账户(锚定账户)可以互相转账的账户列表 | ||
func CanTransferTargetList(ctx context.Context, clt *core.SDKClient, accessToken string, req *customercenter.CanTransferTargetListRequest) (*customercenter.CanTransferTargetListResult, error) { | ||
var resp customercenter.CanTransferTargetListResponse | ||
if err := clt.GetAPI(ctx, "v3.0/cg_transfer/can_transfer_target/list/", req, &resp, accessToken); err != nil { | ||
return nil, err | ||
} | ||
return resp.Data, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package customercenter | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/bububa/oceanengine/marketing-api/core" | ||
"github.com/bububa/oceanengine/marketing-api/model/customercenter" | ||
) | ||
|
||
// TransferBalanceGet 工作台转账-查询账户转账余额 | ||
// 查询账户自身转账余额、作为转出方需要预留的竞价消耗保证金 | ||
func TransferBalanceGet(ctx context.Context, clt *core.SDKClient, accessToken string, req *customercenter.TransferBalanceGetRequest) ([]customercenter.TargetAmountDetail, error) { | ||
var resp customercenter.TransferBalanceGetResponse | ||
if err := clt.GetAPI(ctx, "v3.0/cg_transfer/transfer_balance/get/", req, &resp, accessToken); err != nil { | ||
return nil, err | ||
} | ||
return resp.Data.TargetAmountDetailList, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package customercenter | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/bububa/oceanengine/marketing-api/core" | ||
"github.com/bububa/oceanengine/marketing-api/model/customercenter" | ||
) | ||
|
||
// TransferCreate 工作台转账-发起转账 | ||
// 发起转账,支持1:N转账、不停投转账 | ||
func TransferCreate(ctx context.Context, clt *core.SDKClient, accessToken string, req *customercenter.TransferCreateRequest) (string, error) { | ||
var resp customercenter.TransferCreateResponse | ||
if err := clt.PostAPI(ctx, "v3.0/cg_transfer/transfer/create/", req, &resp, accessToken); err != nil { | ||
return "", err | ||
} | ||
return resp.Data.TransferSerial, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package customercenter | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/bububa/oceanengine/marketing-api/core" | ||
"github.com/bububa/oceanengine/marketing-api/model/customercenter" | ||
) | ||
|
||
// TransferDetailGet 工作台转账-查询转账单信息 | ||
// 转账单信息,包括状态、双方账户、转账金额 | ||
func TransferDetailGet(ctx context.Context, clt *core.SDKClient, accessToken string, req *customercenter.TransferDetailGetRequest) (*customercenter.TransferDetail, error) { | ||
var resp customercenter.TransferDetailGetResponse | ||
if err := clt.GetAPI(ctx, "v3.0/cg_transfer/transfer_detail/get/", req, &resp, accessToken); err != nil { | ||
return nil, err | ||
} | ||
return resp.Data, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
88 changes: 88 additions & 0 deletions
88
marketing-api/model/customercenter/can_transfer_balance_get.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
package customercenter | ||
|
||
import ( | ||
"strconv" | ||
|
||
"github.com/bububa/oceanengine/marketing-api/enum" | ||
"github.com/bububa/oceanengine/marketing-api/model" | ||
"github.com/bububa/oceanengine/marketing-api/util" | ||
) | ||
|
||
// CanTransferBalanceGetRequest 工作台转账-获取最大可转余额 API Request | ||
type CanTransferBalanceGetRequest struct { | ||
// OrganizationID 组织id | ||
OrganizationID uint64 `json:"organization_id,omitempty"` | ||
// BizRequestNo 请求id,推荐uuid,方便请求链路对齐 | ||
BizRequestNo string `json:"biz_request_no,omitempty"` | ||
// OpponentTargetID 锚定账户id,查询该账户的可转账账户列表 | ||
OpponentTargetID uint64 `json:"opponent_target_id,omitempty"` | ||
// TargetIDs 目标账户id列表,1:N的N,最多支持100个 | ||
TargetIDs []uint64 `json:"target_ids,omitempty"` | ||
// TransferDirection 转账方向,以可转列表视角确定 可选值: | ||
// TRANSFER_IN 转入 | ||
// TRANSFER_OUT 转出 | ||
TransferDirection enum.TransferDirection `json:"transfer_direction,omitempty"` | ||
// Platform 业务线 可选值: | ||
// AD 广告 | ||
// BENDITUI 本地推 | ||
Platform string `json:"platform,omitempty"` | ||
} | ||
|
||
// Encode implements GetRequest interface | ||
func (r CanTransferBalanceGetRequest) Encode() string { | ||
values := util.GetUrlValues() | ||
values.Set("organization_id", strconv.FormatUint(r.OrganizationID, 10)) | ||
values.Set("biz_request_no", r.BizRequestNo) | ||
values.Set("opponent_target_id", strconv.FormatUint(r.OpponentTargetID, 10)) | ||
values.Set("target_ids", string(util.JSONMarshal(r.TargetIDs))) | ||
values.Set("transfer_direction", string(r.TransferDirection)) | ||
values.Set("platform", r.Platform) | ||
ret := values.Encode() | ||
util.PutUrlValues(values) | ||
return ret | ||
} | ||
|
||
// CanTransferBalanceGetResponse 工作台转账-获取最大可转余额 API Response | ||
type CanTransferBalanceGetResponse struct { | ||
model.BaseResponse | ||
Data struct { | ||
// CanTransferDetailList 可转余额信息列表 | ||
CanTransferDetailList []CanTransferDetail `json:"can_transfer_detail_list,omitempty"` | ||
} `json:"data,omitempty"` | ||
} | ||
|
||
// CanTransferDetail 可转余额信息 | ||
type CanTransferDetail struct { | ||
// RemitterTargetID 转出方账户id | ||
RemitterTargetID uint64 `json:"remitter_target_id,omitempty"` | ||
// PayeeTransferAmountDetailList 转入方可转余额信息列表 | ||
PayeeTransferAmountDetailList []PayeeTransferAmountDetail `json:"payee_transfer_amount_detail_list,omitempty"` | ||
// CapitalDetailList 转出方可转资金列表 | ||
CapitalDetailList []CapitalDetail `json:"capital_detail_list,omitempty"` | ||
} | ||
|
||
// PayeeTransferAmountDetail 转入方可转余额信息 | ||
type PayeeTransferAmountDetail struct { | ||
// PayeeTargetID 转入方账户id | ||
PayeeTargetID uint64 `json:"payee_target_id,omitempty"` | ||
// CapitalDetailList 转入方可转资金列表 | ||
CapitalDetailList []CapitalDetail `json:"capital_detail_list,omitempty"` | ||
} | ||
|
||
// CapitalDetail 转入方可转资金 | ||
type CapitalDetail struct { | ||
// CapitalType 转入方可转资金类型 可选值: | ||
// CREDIT_BIDDING 授信竞价 | ||
// CREDIT_BRAND 授信品牌 | ||
// CREDIT_GENERAL 授信通用 | ||
// GRANT_COMMON 信息流赠款 | ||
// GRANT_DEFAULT 通用赠款 | ||
// GRANT_SEARCH 搜索赠款 | ||
// GRANT_UNION 穿山甲赠款 | ||
// PREPAY_BIDDING 预付竞价 | ||
// PREPAY_BRAND 预付品牌 | ||
// PREPAY_GENERAL 预付通用 | ||
CapitalType enum.CapitalType `json:"capital_type,omitempty"` | ||
// TransferBalance 转入方可转资金余额(单位:分) | ||
TrainsferBalance int64 `json:"transfer_balance,omitempty"` | ||
} |
71 changes: 71 additions & 0 deletions
71
marketing-api/model/customercenter/can_transfer_target_list.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
package customercenter | ||
|
||
import ( | ||
"strconv" | ||
|
||
"github.com/bububa/oceanengine/marketing-api/enum" | ||
"github.com/bububa/oceanengine/marketing-api/model" | ||
"github.com/bububa/oceanengine/marketing-api/util" | ||
) | ||
|
||
// CanTransferTargetListRequest 工作台转账-获取可转列表 API Request | ||
type CanTransferTargetListRequest struct { | ||
// OrganizationID 组织id | ||
OrganizationID uint64 `json:"organization_id,omitempty"` | ||
// BizRequestNo 请求id,推荐uuid,方便请求链路对齐 | ||
BizRequestNo string `json:"biz_request_no,omitempty"` | ||
// OpponentTargetID 锚定账户id,查询该账户的可转账账户列表 | ||
OpponentTargetID uint64 `json:"opponent_target_id,omitempty"` | ||
// TransferDirection 转账方向,以可转列表视角确定 可选值: | ||
// TRANSFER_IN 转入 | ||
// TRANSFER_OUT 转出 | ||
TransferDirection enum.TransferDirection `json:"transfer_direction,omitempty"` | ||
// Platform 业务线 可选值: | ||
// AD 广告 | ||
// BENDITUI 本地推 | ||
Platform string `json:"platform,omitempty"` | ||
// Page 页码,从1开始 | ||
Page int `json:"page,omitempty"` | ||
// PageSize 每页最多100 | ||
PageSize int `json:"page_size,omitempty"` | ||
} | ||
|
||
// Encode implements GetRequest interface | ||
func (r CanTransferTargetListRequest) Encode() string { | ||
values := util.GetUrlValues() | ||
values.Set("organization_id", strconv.FormatUint(r.OrganizationID, 10)) | ||
values.Set("biz_request_no", r.BizRequestNo) | ||
values.Set("opponent_target_id", strconv.FormatUint(r.OpponentTargetID, 10)) | ||
values.Set("transfer_direction", string(r.TransferDirection)) | ||
values.Set("platform", r.Platform) | ||
if r.Page > 0 { | ||
values.Set("page", strconv.Itoa(r.Page)) | ||
} | ||
if r.PageSize > 0 { | ||
values.Set("page_size", strconv.Itoa(r.PageSize)) | ||
} | ||
ret := values.Encode() | ||
util.PutUrlValues(values) | ||
return ret | ||
} | ||
|
||
// CanTransferTargetListResponse 工作台转账-获取可转列表 API Response | ||
type CanTransferTargetListResponse struct { | ||
model.BaseResponse | ||
Data *CanTransferTargetListResult `json:"data,omitempty"` | ||
} | ||
|
||
type CanTransferTargetListResult struct { | ||
// PageInfo 分页信息 | ||
PageInfo *model.PageInfo `json:"page_info,omitempty"` | ||
// CanTransferTargetList 可转账户列表 | ||
CanTransferTargetList []TransferTarget `json:"can_transfer_target_list,omitempty"` | ||
} | ||
|
||
// TransferTarget 可转账户 | ||
type TransferTarget struct { | ||
// TargetID 可转账户id | ||
TargetID uint64 `json:"target_id,omitempty"` | ||
// TransferCaptialDetailList 锚定账户与目标账户转账资金列表 | ||
TransferCaptialDetailList []CapitalDetail `json:"transfer_captial_detail_list,omitempty"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
// Package customercenter 管家账号相关API models | ||
// Package customercenter 管家账号(工作台)相关API models | ||
package customercenter |
55 changes: 55 additions & 0 deletions
55
marketing-api/model/customercenter/transfer_balance_get.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package customercenter | ||
|
||
import ( | ||
"strconv" | ||
|
||
"github.com/bububa/oceanengine/marketing-api/model" | ||
"github.com/bububa/oceanengine/marketing-api/util" | ||
) | ||
|
||
// TransferBalanceGetRequest 工作台转账-查询账户转账余额 API Request | ||
type TransferBalanceGetRequest struct { | ||
// OrganizationID 组织id | ||
OrganizationID uint64 `json:"organization_id,omitempty"` | ||
// BizRequestNo 请求id,推荐uuid,方便请求链路对齐 | ||
BizRequestNo string `json:"biz_request_no,omitempty"` | ||
// TargetIDList 查询账户id列表(限制长度100) | ||
TargetIDList []uint64 `json:"target_id_list,omitempty"` | ||
// Platform 业务线 可选值: | ||
// AD 广告 | ||
// BENDITUI 本地推 | ||
Platform string `json:"platform,omitempty"` | ||
} | ||
|
||
// Encode implements GetRequest interface | ||
func (r TransferBalanceGetRequest) Encode() string { | ||
values := util.GetUrlValues() | ||
values.Set("organization_id", strconv.FormatUint(r.OrganizationID, 10)) | ||
values.Set("biz_request_no", r.BizRequestNo) | ||
values.Set("target_id_list", string(util.JSONMarshal(r.TargetIDList))) | ||
values.Set("platform", r.Platform) | ||
ret := values.Encode() | ||
util.PutUrlValues(values) | ||
return ret | ||
} | ||
|
||
// TransferBalanceGetResponse 工作台转账-查询账户转账余额 API Response | ||
type TransferBalanceGetResponse struct { | ||
model.BaseResponse | ||
Data struct { | ||
// TargetAmountDetailList 账户金额列表 | ||
TargetAmountDetailList []TargetAmountDetail `json:"target_amount_detail_list,omitempty"` | ||
} `json:"data,omitempty"` | ||
} | ||
|
||
// TargetAmountDetail 账户金额 | ||
type TargetAmountDetail struct { | ||
// TargetID 账户id | ||
TargetID uint64 `json:"target_id,omitempty"` | ||
// CapitalDetailList 可转资金列表 | ||
CapitalDetailList []CapitalDetail `json:"capital_detail_list,omitempty"` | ||
// DepositAmount 竞价消耗保证金金额(单位:分) | ||
DepositAmount int64 `json:"deposit_amount,omitempty"` | ||
// TotalTransferAmount 总可转金额(单位:分) | ||
TotalTransferAmount int64 `json:"total_transfer_amount,omitempty"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package customercenter | ||
|
||
import ( | ||
"github.com/bububa/oceanengine/marketing-api/enum" | ||
"github.com/bububa/oceanengine/marketing-api/model" | ||
"github.com/bububa/oceanengine/marketing-api/util" | ||
) | ||
|
||
// TransferCreateRequest 工作台转账-发起转账 API Request | ||
type TransferCreateRequest struct { | ||
// OrganizationID 组织id | ||
OrganizationID uint64 `json:"organization_id,omitempty"` | ||
// BizRequestNo 请求id,推荐uuid,方便请求链路对齐 | ||
BizRequestNo string `json:"biz_request_no,omitempty"` | ||
// OpponentTargetID 锚定账户id,1:N的1 | ||
OpponentTargetID uint64 `json:"opponent_target_id,omitempty"` | ||
// TargetDetailList 目标账户列表,1:N的N,需要列表内账户类型相同,最多支持100个 | ||
TargetDetailList []TransferTarget `json:"target_detail_list,omitempty"` | ||
// TransferDirection 转账方向,以目标账户视角确定 可选值: | ||
// TRANSFER_IN 转入 | ||
// TRANSFER_OUT 转出 | ||
TransferDirection enum.TransferDirection `json:"transfer_direction,omitempty"` | ||
// Remark 备注 | ||
Remark string `json:"remark,omitempty"` | ||
// Platform 转账业务线 可选值: | ||
// AD 广告 | ||
// BENDITUI 本地推 | ||
Platform string `json:"platform,omitempty"` | ||
} | ||
|
||
// Encode implements PostRequest interface | ||
func (r TransferCreateRequest) Encode() []byte { | ||
return util.JSONMarshal(r) | ||
} | ||
|
||
// TransferCreateResponse 工作台转账-发起转账 | ||
type TransferCreateResponse struct { | ||
model.BaseResponse | ||
Data struct { | ||
// TransferSerial 转账单号 | ||
TransferSerial string `json:"transfer_serial,omitempty"` | ||
} `json:"data,omitempty"` | ||
} |
Oops, something went wrong.