Skip to content

Commit eaa9e8f

Browse files
author
chengliangzhang
committed
新增:SplitProfit、SplitReceiver、ProfitTransaction、SubBank 相关接口
1 parent 5264c3a commit eaa9e8f

20 files changed

+490
-3
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
# ChangeLog
2+
### 1.6.0
3+
- 新增
4+
- 新增:SplitProfit、SplitReceiver、ProfitTransaction、SubBank 相关接口
5+
26
### 1.5.0
37
- 修改
48
- 修改目标框架为.NET Framework 4.6

Example/Entry.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ private static void Examples(string appId)
5656
CardInfoDemo.Example(appId);
5757
//批量退款示例
5858
BatchRefundDemo.Example(appId);
59+
SplitReceiverDemo.Example(appId);
60+
SplitProfitDemo.Example(appId);
61+
ProfitTransactionDemo.Example(appId);
62+
SubBankDemo.Example(appId);
5963
}
6064

6165
private static void AccountExamples(string appId)

Example/Example.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,14 @@
5959
<Compile Include="Example\BatchWithdrawalDemo.cs" />
6060
<Compile Include="Example\CardInfoDemo.cs" />
6161
<Compile Include="Example\ChannelDemo.cs" />
62+
<Compile Include="Example\ProfitTransactionDemo.cs" />
6263
<Compile Include="Example\RoyaltyDemo.cs" />
6364
<Compile Include="Example\RoyaltySettlementDemo.cs" />
6465
<Compile Include="Example\RoyaltyTemplateDemo.cs" />
6566
<Compile Include="Example\RoyaltyTransactionDemo.cs" />
6667
<Compile Include="Example\SettleAccountDemo.cs" />
68+
<Compile Include="Example\SplitProfitDemo.cs" />
69+
<Compile Include="Example\SplitReceiverDemo.cs" />
6770
<Compile Include="Example\SubAppDemo.cs" />
6871
<Compile Include="Example\BatchRefundDemo.cs" />
6972
<Compile Include="Example\BatchTransferDemo.cs" />
@@ -72,6 +75,7 @@
7275
<Compile Include="Example\CustomsDemo.cs" />
7376
<Compile Include="Example\IdentificationDemo.cs" />
7477
<Compile Include="Example\RechargeDemo.cs" />
78+
<Compile Include="Example\SubBankDemo.cs" />
7579
<Compile Include="Example\UserDemo.cs" />
7680
<Compile Include="Example\OrderDemo.cs" />
7781
<Compile Include="Example\OrderRefundDemo.cs" />
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using Pingpp;
4+
using Pingpp.Models;
5+
6+
namespace Example.Example
7+
{
8+
internal class ProfitTransactionDemo
9+
{
10+
public static void Example(string appId)
11+
{
12+
Console.WriteLine("****查询 profit_transaction 列表****");
13+
Dictionary<string,object> listParams = new Dictionary<string, object> {
14+
{"app", appId},
15+
{"page", 1}
16+
};
17+
Console.WriteLine(ProfitTransaction.List(listParams));
18+
Console.WriteLine();
19+
20+
Console.WriteLine("****查询 profit_transaction ****");
21+
Console.WriteLine(ProfitTransaction.Retrieve("ptxn_1m3xtoBMRqu2qC"));
22+
Console.WriteLine();
23+
}
24+
}
25+
}

Example/Example/SplitProfitDemo.cs

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using Pingpp;
4+
using Pingpp.Models;
5+
6+
namespace Example.Example
7+
{
8+
internal class SplitProfitDemo
9+
{
10+
public static void Example(string appId)
11+
{
12+
Console.WriteLine("****创建 split_profit 分账示例 ****");
13+
Dictionary<string, object> createParams = new Dictionary<string, object> {
14+
{"app", appId},
15+
{"charge", "ch_DqfvDSTSif1SjnTiP41KqbrH"},
16+
{"order_no", "190001001"},
17+
{"type", "split_normal"},
18+
{"recipients", new List<Dictionary<string,object>>{
19+
new Dictionary<string,object>{
20+
{"split_receiver", "recv_1fRbIszZftTGPa"}, //只有type为 split_normal 时支持填写
21+
{"amount", 6},
22+
//{"name", "示例商户全称"}, //可选参数;只有type为split_normal时支持填写;如果商家传递该字段则 Pingxx 需校验 name 与 split_receiver 是否对应
23+
{"description", "Your Description"}
24+
}
25+
}}
26+
};
27+
Console.WriteLine(SplitProfit.Create(createParams));
28+
Console.WriteLine();
29+
30+
Console.WriteLine("****查询 split_profit 列表****");
31+
Dictionary<string, object> listParams = new Dictionary<string, object> {
32+
{"app", appId},
33+
{"page", 1}
34+
};
35+
Console.WriteLine(SplitProfit.List(listParams));
36+
Console.WriteLine();
37+
38+
Console.WriteLine("****查询 split_profit ****");
39+
Console.WriteLine(SplitProfit.Retrieve("recv_1fRbIszF3tAuPy"));
40+
Console.WriteLine();
41+
}
42+
}
43+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using Pingpp;
4+
using Pingpp.Models;
5+
6+
namespace Example.Example
7+
{
8+
internal class SplitReceiverDemo
9+
{
10+
public static void Example(string appId)
11+
{
12+
Console.WriteLine("****创建 split_receiver ****");
13+
Dictionary<string, object> createParams = new Dictionary<string, object> {
14+
{"app", appId},
15+
{"type", "MERCHANT_ID"},
16+
{"account", "190001001"},
17+
{"name", "示例商户全称"},
18+
{"channel", "wx_pub_qr"}
19+
};
20+
Console.WriteLine(SplitReceiver.Create(createParams));
21+
Console.WriteLine();
22+
23+
Console.WriteLine("****查询 split_receiver 列表****");
24+
Dictionary<string, object> listParams = new Dictionary<string, object> {
25+
{"app", appId},
26+
{"page", 1}
27+
};
28+
Console.WriteLine(SplitReceiver.List(listParams));
29+
Console.WriteLine();
30+
31+
Console.WriteLine("****查询 split_receiver ****");
32+
Console.WriteLine(SplitReceiver.Retrieve("recv_1fRbIszF3tAuPy"));
33+
Console.WriteLine();
34+
35+
Console.WriteLine("****删除 split_receiver ****");
36+
Console.WriteLine(SplitReceiver.Delete("recv_1fRbIszF3tAuPy"));
37+
Console.WriteLine();
38+
}
39+
}
40+
}

Example/Example/SubBankDemo.cs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
using System;
2+
using Pingpp;
3+
using Pingpp.Models;
4+
using System.Collections.Generic;
5+
6+
namespace Example.Example
7+
{
8+
internal class SubBankDemo
9+
{
10+
public static void Example(string appId)
11+
{
12+
var listParams = new Dictionary<string, object> {
13+
{"app", appId},
14+
{"channel", "chanpay"},
15+
{"open_bank_code", "0308"},
16+
{"prov", "浙江省"},
17+
{"city","宁波市"}
18+
};
19+
20+
Console.WriteLine("**** 银行支行列表查询 ****");
21+
Console.WriteLine(SubBank.List(listParams));
22+
Console.WriteLine();
23+
}
24+
}
25+
}

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.5.0
1+
1.6.0

libs/pingpp.dll

13 KB
Binary file not shown.

pingpp/Models/ProfitTransaction.cs

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using Newtonsoft.Json;
4+
using Pingpp.Net;
5+
using Pingpp.Exception;
6+
7+
namespace Pingpp.Models
8+
{
9+
/// <summary>
10+
/// 分账明细
11+
/// </summary>
12+
public class ProfitTransaction:Pingpp
13+
{
14+
[JsonProperty("id")]
15+
public string Id { get; set; }
16+
[JsonProperty("object")]
17+
public string Object { get; set; }
18+
[JsonProperty("livemode")]
19+
public bool Livemode { get; set; }
20+
[JsonProperty("app")]
21+
public string App { get; set; }
22+
[JsonProperty("amount")]
23+
public int? Amount { get; set; }
24+
[JsonProperty("name")]
25+
public string Name { get; set; }
26+
[JsonProperty("status")]
27+
public string Status { get; set; }
28+
[JsonProperty("description")]
29+
public string Description { get; set; }
30+
[JsonProperty("split_receiver")]
31+
public string SplitReceiver { get; set; }
32+
[JsonProperty("split_profit")]
33+
public string SplitProfit { get; set; }
34+
[JsonProperty("created")]
35+
public int? Created { get; set; }
36+
[JsonProperty("time_finished")]
37+
public int? TimeFinished { get; set; }
38+
[JsonProperty("failure_msg")]
39+
public string FailureMsg { get; set; }
40+
41+
[JsonProperty("currency")]
42+
public string Currency { get; set; }
43+
44+
private const string BaseUrl = "/v1/profit_transactions";
45+
/// <summary>
46+
/// 分账明细查询
47+
/// </summary>
48+
/// <param name="ptxnId"></param>
49+
/// <returns></returns>
50+
public static ProfitTransaction Retrieve(string ptxnId)
51+
{
52+
var ptxn = Requestor.DoRequest(string.Format("{0}/{1}", BaseUrl, ptxnId), "GET");
53+
return Mapper<ProfitTransaction>.MapFromJson(ptxn);
54+
}
55+
56+
/// <summary>
57+
/// 分账明细列表查询
58+
/// </summary>
59+
/// <param name="listParams"></param>
60+
/// <returns></returns>
61+
public static ProfitTransactionList List(Dictionary<string, object> listParams)
62+
{
63+
var ptxns = Requestor.DoRequest(Requestor.FormatUrl(BaseUrl, Requestor.CreateQuery(listParams)), "GET");
64+
return Mapper<ProfitTransactionList>.MapFromJson(ptxns);
65+
}
66+
}
67+
}

0 commit comments

Comments
 (0)