package weimobapi

import (
	"testing"

	"git.rosy.net.cn/baseapi"
	"git.rosy.net.cn/baseapi/utils"
)

func TestGetCallbackMsg(t *testing.T) {
	rawMsg := `
	{
		"id": "91bae15f-2f8f-4eca-9f4d-793de40c74cf",
		"topic": "ec_order",
		"event": "createOrder",
		"version": 1,
		"sign": "e46b607913c93bd4c31a6e483785ef52",
		"msgSignature": "b7a975d07a7b0b507ab01f862c4f7fec",
		"test": false,
		"business_id": "1224609670",
		"public_account_id": "100000386048",
		"msg_body": "{\"createTime\":\"2019-01-19 15:23:59\",\"channelType\":1,\"orderNo\":5330003015048}"
	  }
	`
	msg, response := api.GetCallbackMsg([]byte(rawMsg))
	if response != nil {
		t.Fatal("GetCallbackMsg failed")
	}
	baseapi.SugarLogger.Debug(utils.Format4Output(msg, false))
}
