feat(osi): 实现通用 Call 与响应判码(T-004)
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
package contract
|
||||
|
||||
type Envelope struct {
|
||||
ServiceID string `json:"serviceId"`
|
||||
UploadInfo any `json:"uploadinfo,omitempty"`
|
||||
BaseInfo any `json:"baseInfo,omitempty"`
|
||||
}
|
||||
|
||||
type UploadInfo struct {
|
||||
BaseInfo any `json:"baseInfo,omitempty"`
|
||||
ManageInfo ManageInfo `json:"manageInfo"`
|
||||
}
|
||||
|
||||
type ManageInfo struct {
|
||||
DSFMC string `json:"DSFMC"`
|
||||
OperateUser string `json:"operateUser"`
|
||||
OperateUnit string `json:"operateUnit"`
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package contract
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestEnvelopeUsesUploadInfoWithBaseAndManageInfo(t *testing.T) {
|
||||
envelope := Envelope{
|
||||
ServiceID: "JKDA00002",
|
||||
UploadInfo: UploadInfo{
|
||||
BaseInfo: map[string]string{"idCard": "440100199001011234"},
|
||||
ManageInfo: ManageInfo{
|
||||
DSFMC: "dyytgw",
|
||||
OperateUser: "712041",
|
||||
OperateUnit: "12441625456962881G",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
raw, err := json.Marshal(envelope)
|
||||
if err != nil {
|
||||
t.Fatalf("Marshal: %v", err)
|
||||
}
|
||||
want := `{"serviceId":"JKDA00002","uploadinfo":{"baseInfo":{"idCard":"440100199001011234"},"manageInfo":{"DSFMC":"dyytgw","operateUser":"712041","operateUnit":"12441625456962881G"}}}`
|
||||
if string(raw) != want {
|
||||
t.Fatalf("envelope JSON = %s", raw)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user