2020
2121/**
2222 * Created by sunkai on 15/5/11.
23+ *
24+ * 该实例演示如何使用 ping++ 进行企业转账。
25+ *
26+ * 开发者需要填写 apiKey ,openId 和 appId , apiKey 可以在 ping++ 管理平台【应用信息里面查看】
27+ *
28+ * apiKey 有 TestKey 和 LiveKey 两种。
29+ *
30+ * TestKey 模式下不会产生真实的交易。
31+ *
32+ * openId 是发送红包的对象在公共平台下的openId ,获得 openId 的方法可以参考微信文档:http://mp.weixin.qq.com/wiki/17/c0f37d5704f0b64713d5d2c37b468d75.html
33+ *
2334 */
2435public class TransferExample {
2536
@@ -31,6 +42,11 @@ public class TransferExample {
3142 * pingpp 管理平台对应的应用ID
3243 */
3344 public static String appId = "YOUR-APPID" ;
45+
46+ /**
47+ * 接收者的 openId
48+ */
49+ public static String openId ="OPEN_ID" ;
3450
3551 public static void main (String args []) {
3652
@@ -47,6 +63,10 @@ public static void main(String args[]) {
4763
4864 /**
4965 * 创建企业转账
66+ *
67+ * 创建企业转账需要传递一个 map 给 Transfer.create();
68+ * map 填写的具体介绍可以参考:https://pingxx.com/document/api#api-t-new
69+ *
5070 * @return
5171 */
5272 public Transfer transfer () {
@@ -58,7 +78,7 @@ public Transfer transfer() {
5878 transferMap .put ("amount" , "10" );
5979 transferMap .put ("type" , "b2c" );
6080 transferMap .put ("currency" , "cny" );
61- transferMap .put ("recipient" , "o9zpMs5MW2-62GAy5hRrjdYVCktU" );
81+ transferMap .put ("recipient" , openId );
6282 transferMap .put ("description" , "your description" );
6383 Map <String , String > app = new HashMap <String , String >();
6484 app .put ("id" , appId );
@@ -81,6 +101,9 @@ public Transfer transfer() {
81101
82102 /**
83103 * 根据 ID 查询
104+ *
105+ * 根据 ID 查询企业转账记录。
106+ * 参考文档:https://pingxx.com/document/api#api-t-inquiry
84107 * @param id
85108 */
86109 public void retrieve (String id ) {
@@ -113,6 +136,8 @@ public void retrieve(String id) {
113136
114137 /**
115138 *批量查询
139+ *
140+ *批量查询企业转账记录,默认一次查询 10 条,用户可以使用 limit 自定义查询数目,但是最多不超过 100 条。
116141 */
117142 public void all () {
118143 Map <String , Object > parm = new HashMap <String , Object >();
0 commit comments