微信接口的RPC包
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

63 lines
1.4 KiB

package weixinrpc
import (
"encoding/json"
)
/**
* 订单号,子单号,总金额,退款金额,微信商户id,微信商户平台API私钥,平台证书,商户平台证书序列号,商品名,退款原因,商品id,回调地址
*/
func PayRefund(order_sn, sn, total, refund, wx_mp_mch_id, wx_mch_apiclient_key,
wx_pay_cert, mch_serial_no, title, uuid, reason, notify_url string,
url ...string) (map[string]string, error) {
conn, err := rpc_server_conn(url...)
if err != nil {
return nil, err
}
defer conn.Close()
data := map[string]string{
"order_sn": order_sn,
"sn": sn,
"total": total,
"refund": refund,
"wx_mp_mch_id": wx_mp_mch_id,
"wx_mch_apiclient_key": wx_mch_apiclient_key,
"wx_pay_cert": wx_pay_cert,
"mch_serial_no": mch_serial_no,
"reason": reason,
"uuid": uuid,
"title": title,
"notify_url": notify_url,
}
req, err := SetReqData(data)
if err != nil {
return nil, err
}
res := &Response{}
err = conn.PayRefund(req, res)
if err != nil {
return nil, err
}
res_data_de, err := GetResData(res)
if err != nil {
return nil, err
}
if res_data_de == "" {
return nil, nil
}
var res_arr map[string]string
err = json.Unmarshal([]byte(res_data_de), &res_arr)
if err != nil {
return nil, err
}
return res_arr, nil
}