微信退款開發 Java

2021-08-20 23:15:55 字數 3067 閱讀 3213

原文:

二、編寫**

/**

* 處理退款請求

}

初始化退款介面需要的資料,隱藏了get和set方法。

public class refundreqdata
mobimessage實現json資料型別和xml資料之間的轉換。

public class mobimessage 

inputstream.close();

return map;

}//訂單轉換成xml

public static string jsapireqdata2xml(jsapireqdata jsapireqdata)

public static string refundreqdata2xml(refundreqdata refundreqdata)

public static string class2xml(object object)

public static mappar***ml(string xml) throws exception

//擴充套件xstream,使其支援cdata塊

private static xstream xstream = new xstream(new xppdriver()

protected void writetext(quickwriter writer, string text) else }};

}});

}

refundrequest類中initcert方法載入證書到系統中,其中證書位址如下:

public static string certlocalpath = "/web-inf/cert/apiclient_cert.p12";

/**

* user: rizenguo

* date: 2014/10/29

* time: 14:36

*/public class refundrequest catch (certificateexception e) catch (nosuchalgorithmexception e) finally

// trust own ca and all self-signed certs

sslcontext sslcontext = sslcontexts.custom()

.loadkeymaterial(keystore, wxconfigure.mch_id.tochararray()) //載入證書密碼,預設為商戶id

//根據預設超時限制初始化requestconfig

requestconfig = requestconfig.custom().setsockettimeout(sockettimeout).setconnecttimeout(connecttimeout).build();

}/**

* 通過https往api post xml資料

* @param url api位址

* @param xmlobj 要提交的xml資料物件

* @param path 當前目錄,用於載入證書

微信退款開發過程

商戶號 mch id 隨機字串 nonce str 商戶訂單號 out trade no 商戶退單號 out refund no 退款總金額 refund fee 訂單總金額 total fee 操作員帳號 op user id 商戶平台中對應的key值 key 注意事項 1.訂單總金額和退款總金額...

微信退款開發過程

php view plain copy print?商戶號 mch id 隨機字串 nonce str 商戶訂單號 out trade no 商戶退單號 out refund no 退款總金額 refund fee 訂單總金額 total fee 操作員帳號 op user id 商戶平台中對應的k...

微信退款機制

處理退款 param out trade no param total fee param refund fee param from 1餘額 2未結算 return array throws exception 策略一 當天支付的錢,從未結算中退 非當天支付的錢,從餘額中退 結算的錢到餘額中有個緩...