ConfirmRidderCancel
This commit is contained in:
@@ -14,10 +14,15 @@ type RidderCancelNotify struct {
|
||||
|
||||
type RidderCancelConfirm struct {
|
||||
OrderID string `json:"orderId"`
|
||||
DadaOrderID int64 `json:"dadaOrderId"`
|
||||
DadaOrderID int64 `json:"dadaOrderId,omitempty"`
|
||||
IsConfirm int `json:"isConfirm"`
|
||||
}
|
||||
|
||||
type ConfirmMsg struct {
|
||||
MessageType int `json:"messageType"`
|
||||
MessageBody string `json:"messageBody"`
|
||||
}
|
||||
|
||||
type NotifyMsg struct {
|
||||
MessageType int `json:"messageType"`
|
||||
MessageBody string `json:"messageBody"`
|
||||
@@ -49,10 +54,13 @@ func (a *API) GetNotifyMsg(data []byte) (msg *NotifyMsg, notifyResponse *NotifyR
|
||||
// 消息确认
|
||||
// http://newopen.imdada.cn/#/development/file/merchantConfirm?_k=gqkja3
|
||||
func (a *API) ConfirmRidderCancel(orderID string, dadaOrderID int64, isConfirm bool) (err error) {
|
||||
_, err = a.AccessAPI("message/confirm", utils.Struct2FlatMap(&RidderCancelConfirm{
|
||||
OrderID: orderID,
|
||||
DadaOrderID: dadaOrderID,
|
||||
IsConfirm: utils.Bool2Int(isConfirm),
|
||||
_, err = a.AccessAPI("api/message/confirm", utils.Struct2FlatMap(&ConfirmMsg{
|
||||
MessageType: MessageTypeRidderCancel,
|
||||
MessageBody: string(utils.MustMarshal(&RidderCancelConfirm{
|
||||
OrderID: orderID,
|
||||
DadaOrderID: dadaOrderID,
|
||||
IsConfirm: utils.Bool2Int(isConfirm),
|
||||
})),
|
||||
}))
|
||||
return err
|
||||
}
|
||||
|
||||
12
platformapi/dadaapi/notify_test.go
Normal file
12
platformapi/dadaapi/notify_test.go
Normal file
@@ -0,0 +1,12 @@
|
||||
package dadaapi
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestConfirmRidderCancel(t *testing.T) {
|
||||
err := dadaapi.ConfirmRidderCancel("2123286796685127885", 0, true)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user