From 6b411bca602fe23d0b1ca75196e7b4e730f82d3e Mon Sep 17 00:00:00 2001 From: Amamiya Miu Date: Mon, 8 Apr 2024 19:16:13 +0800 Subject: [PATCH] fix(payment): set notify url for transfer batch --- src/payment/transfer/batch.go | 7 +++++++ src/payment/transfer/request/requestBatch.go | 8 ++++++++ 2 files changed, 15 insertions(+) diff --git a/src/payment/transfer/batch.go b/src/payment/transfer/batch.go index 223f854b..68fe1030 100644 --- a/src/payment/transfer/batch.go +++ b/src/payment/transfer/batch.go @@ -31,6 +31,13 @@ func NewBatchClient(app *payment.ApplicationPaymentInterface) (*BatchClient, err // https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter4_3_1.shtml func (comp *BatchClient) Batch(ctx context.Context, param *request.RequestTransferBatch) (*response.ResponseTrasferBatch, error) { + config := (*comp.App).GetConfig() + + if param.GetNotifyUrl() == "" { + url := config.GetString("notify_url", "") + param.SetNotifyUrl(url) + } + result := &response.ResponseTrasferBatch{} options, err := object.StructToHashMap(param) diff --git a/src/payment/transfer/request/requestBatch.go b/src/payment/transfer/request/requestBatch.go index fb16545e..6e0f7660 100644 --- a/src/payment/transfer/request/requestBatch.go +++ b/src/payment/transfer/request/requestBatch.go @@ -19,4 +19,12 @@ type RequestTransferBatch struct { TotalNum int `json:"total_num"` TransferDetailList []*TransferDetail `json:"transfer_detail_list"` TransferSceneID string `json:"transfer_scene_id,omitempty"` + NotifyUrl string `json:"notify_url,omitempty"` +} + +func (requestTransferBatch *RequestTransferBatch) SetNotifyUrl(url string) { + requestTransferBatch.NotifyUrl = url +} +func (requestTransferBatch *RequestTransferBatch) GetNotifyUrl() string { + return requestTransferBatch.NotifyUrl }