Skip to content

Commit fe0d41b

Browse files
Ryder HsiehRyder Hsieh
Ryder Hsieh
authored and
Ryder Hsieh
committed
增加aftee邏輯及範例
1 parent 65cf7c1 commit fe0d41b

38 files changed

+467
-42
lines changed

PayuniSDK/Models/EncryptInfoModel.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,6 @@ public class EncryptInfoModel
5151

5252
//credit_bind_cancel
5353
public string BindVal { get; set; }
54+
public string IsPlatForm { get; set; }
5455
}
5556
}

PayuniSDK/Models/ParameterModel.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ public class ParameterModel
1111
public string EncryptInfo { get; set; }
1212
public string HashInfo { get; set; }
1313
public string Status { get; set; }
14+
public string isPlatForm { get; set; }
1415

1516
}
1617
}

PayuniSDK/bin/Debug/payuniSDK.dll

1 KB
Binary file not shown.

PayuniSDK/bin/Debug/payuniSDK.pdb

0 Bytes
Binary file not shown.
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
34e67fe14f657620f67afb88792f22ae55f3d8c7
1+
adcea7554a8a72d2a0f189525feed10c8fd57000

PayuniSDK/obj/Debug/payuniSDK.csproj.FileListAbsolute.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,14 @@ C:\Users\Wistronits.1302134-NB\source\repos\payuni\payuniSDK\obj\Debug\payuniSDK
99
C:\Users\Wistronits.1302134-NB\source\repos\payuni\payuniSDK\obj\Debug\payuniSDK.csproj.CopyComplete
1010
C:\Users\Wistronits.1302134-NB\source\repos\payuni\payuniSDK\obj\Debug\payuniSDK.dll
1111
C:\Users\Wistronits.1302134-NB\source\repos\payuni\payuniSDK\obj\Debug\payuniSDK.pdb
12+
D:\payuni\payuniSDK\bin\Debug\payuniSDK.dll
13+
D:\payuni\payuniSDK\bin\Debug\payuniSDK.pdb
14+
D:\payuni\payuniSDK\bin\Debug\BouncyCastle.Crypto.dll
15+
D:\payuni\payuniSDK\bin\Debug\Newtonsoft.Json.dll
16+
D:\payuni\payuniSDK\bin\Debug\BouncyCastle.Crypto.xml
17+
D:\payuni\payuniSDK\bin\Debug\Newtonsoft.Json.xml
18+
D:\payuni\payuniSDK\obj\Debug\payuniSDK.csproj.AssemblyReference.cache
19+
D:\payuni\payuniSDK\obj\Debug\payuniSDK.csproj.CoreCompileInputs.cache
20+
D:\payuni\payuniSDK\obj\Debug\payuniSDK.csproj.CopyComplete
21+
D:\payuni\payuniSDK\obj\Debug\payuniSDK.dll
22+
D:\payuni\payuniSDK\obj\Debug\payuniSDK.pdb

PayuniSDK/obj/Debug/payuniSDK.dll

1 KB
Binary file not shown.

PayuniSDK/obj/Debug/payuniSDK.pdb

0 Bytes
Binary file not shown.

PayuniSDK/payuniAPI.cs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,7 @@ public string UniversalTrade(EncryptInfoModel EnInfo, string tradeType)
8686
switch (tradeType)
8787
{
8888
case "upp":// 交易建立 整合式支付頁
89-
break;
9089
case "atm":// 交易建立 虛擬帳號幕後
91-
break;
9290
case "cvs":// 交易建立 超商代碼幕後
9391
if (string.IsNullOrEmpty(EncryptInfo.MerTradeNo))
9492
{
@@ -150,6 +148,7 @@ public string UniversalTrade(EncryptInfoModel EnInfo, string tradeType)
150148
}
151149
break;
152150
case "trade_refund_icash":// 愛金卡退款(ICASH)
151+
case "trade_refund_aftee":// 後支付退款(AFTEE)
153152
if (string.IsNullOrEmpty(EncryptInfo.TradeNo))
154153
{
155154
Result.Message = "TradeNo is not setting";
@@ -160,7 +159,6 @@ public string UniversalTrade(EncryptInfoModel EnInfo, string tradeType)
160159
}
161160
break;
162161
case "trade_query":// 交易查詢
163-
break;
164162
case "credit_bind_query":// 信用卡token查詢(約定)
165163
break;
166164
default:
@@ -320,6 +318,9 @@ private string contrast(string tradeType)
320318
case "trade_refund_icash":
321319
tradeType = "trade/common/refund/icash";
322320
break;
321+
case "trade_refund_aftee":
322+
tradeType = "trade/common/refund/aftee";
323+
break;
323324
}
324325
return tradeType;
325326
}
@@ -329,11 +330,17 @@ private string contrast(string tradeType)
329330
/// <param name="type"></param>
330331
private void SetParams(string type = "")
331332
{
333+
string isPlatForm = string.Empty;
334+
if (!string.IsNullOrEmpty(EncryptInfo.IsPlatForm)) {
335+
isPlatForm = EncryptInfo.IsPlatForm;
336+
EncryptInfo.IsPlatForm = string.Empty;
337+
}
332338
Plain = GetQueryString(EncryptInfo);
333339
Parameter.MerID = EncryptInfo.MerID;
334340
Parameter.Version = "1.0";
335341
Parameter.EncryptInfo = Encrypt();
336342
Parameter.HashInfo = Hash(Parameter.EncryptInfo);
343+
Parameter.isPlatForm = isPlatForm;
337344

338345
ApiUrl = ApiUrl + type;
339346
}

example/Properties/AssemblyInfo.cs

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
using System.Reflection;
2+
using System.Runtime.CompilerServices;
3+
using System.Runtime.InteropServices;
4+
5+
// 組件的一般資訊是由下列的屬性集控制。
6+
// 變更這些屬性的值即可修改組件的相關
7+
// 資訊。
8+
[assembly: AssemblyTitle("example")]
9+
[assembly: AssemblyDescription("")]
10+
[assembly: AssemblyConfiguration("")]
11+
[assembly: AssemblyCompany("")]
12+
[assembly: AssemblyProduct("example")]
13+
[assembly: AssemblyCopyright("Copyright © 2022")]
14+
[assembly: AssemblyTrademark("")]
15+
[assembly: AssemblyCulture("")]
16+
17+
// 將 ComVisible 設為 false 可對 COM 元件隱藏
18+
// 組件中的類型。若必須從 COM 存取此組件中的類型,
19+
// 的類型,請在該類型上將 ComVisible 屬性設定為 true。
20+
[assembly: ComVisible(false)]
21+
22+
// 下列 GUID 為專案公開 (Expose) 至 COM 時所要使用的 typelib ID
23+
[assembly: Guid("166c222f-3922-4b49-b558-952709f1790a")]
24+
25+
// 組件的版本資訊由下列四個值所組成:
26+
//
27+
// 主要版本
28+
// 次要版本
29+
// 組建編號
30+
// 修訂編號
31+
//
32+
// 您可以指定所有的值,也可以使用 '*' 將組建和修訂編號
33+
// 設為預設,如下所示:
34+
// [assembly: AssemblyVersion("1.0.*")]
35+
[assembly: AssemblyVersion("1.0.0.0")]
36+
[assembly: AssemblyFileVersion("1.0.0.0")]

example/example.csproj

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4+
<PropertyGroup>
5+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7+
<ProjectGuid>{166C222F-3922-4B49-B558-952709F1790A}</ProjectGuid>
8+
<OutputType>Library</OutputType>
9+
<AppDesignerFolder>Properties</AppDesignerFolder>
10+
<RootNamespace>example</RootNamespace>
11+
<AssemblyName>example</AssemblyName>
12+
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
13+
<FileAlignment>512</FileAlignment>
14+
<Deterministic>true</Deterministic>
15+
</PropertyGroup>
16+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
17+
<DebugSymbols>true</DebugSymbols>
18+
<DebugType>full</DebugType>
19+
<Optimize>false</Optimize>
20+
<OutputPath>bin\Debug\</OutputPath>
21+
<DefineConstants>DEBUG;TRACE</DefineConstants>
22+
<ErrorReport>prompt</ErrorReport>
23+
<WarningLevel>4</WarningLevel>
24+
</PropertyGroup>
25+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
26+
<DebugType>pdbonly</DebugType>
27+
<Optimize>true</Optimize>
28+
<OutputPath>bin\Release\</OutputPath>
29+
<DefineConstants>TRACE</DefineConstants>
30+
<ErrorReport>prompt</ErrorReport>
31+
<WarningLevel>4</WarningLevel>
32+
</PropertyGroup>
33+
<ItemGroup>
34+
<Reference Include="System" />
35+
<Reference Include="System.Core" />
36+
<Reference Include="System.Xml.Linq" />
37+
<Reference Include="System.Data.DataSetExtensions" />
38+
<Reference Include="Microsoft.CSharp" />
39+
<Reference Include="System.Data" />
40+
<Reference Include="System.Net.Http" />
41+
<Reference Include="System.Xml" />
42+
</ItemGroup>
43+
<ItemGroup>
44+
<Compile Include="examples\cardit_bind\CardBind.cs" />
45+
<Compile Include="examples\payment\Payment.cs" />
46+
<Compile Include="examples\trade\Trade.cs" />
47+
<Compile Include="Properties\AssemblyInfo.cs" />
48+
</ItemGroup>
49+
<ItemGroup>
50+
<ProjectReference Include="..\payuniSDK\payuniSDK.csproj">
51+
<Project>{72974FC0-6CD1-43AA-AF45-D53107963BEF}</Project>
52+
<Name>payuniSDK</Name>
53+
</ProjectReference>
54+
</ItemGroup>
55+
<ItemGroup />
56+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
57+
</Project>
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
using payuniSDK;
2+
using System;
3+
using System.Collections.Generic;
4+
using System.Linq;
5+
using System.Text;
6+
using System.Threading.Tasks;
7+
8+
namespace example.examples.cardit_bind
9+
{
10+
public class CardBind
11+
{
12+
/// <summary>
13+
/// api宣告
14+
/// </summary>
15+
public payuniAPI payuniapi;
16+
/// <summary>
17+
/// 加密資訊宣告
18+
/// </summary>
19+
public EncryptInfoModel info;
20+
public CardBind(string request) {
21+
string key = "12345678901234567890123456789012";
22+
string iv = "1234567890123456";
23+
payuniapi = new payuniAPI(key, iv);
24+
}
25+
/// <summary>
26+
/// trade bind query sample code
27+
/// </summary>
28+
public void tradeBindQuery()
29+
{
30+
info = new EncryptInfoModel();
31+
info.MerID = "abc";
32+
info.Timestamp = DateTimeOffset.UtcNow.ToUnixTimeSeconds().ToString();
33+
string result = payuniapi.UniversalTrade(info, "credit_bind_query");
34+
}
35+
/// <summary>
36+
/// treade bind cancel sample code
37+
/// </summary>
38+
public void tradeBindCancel()
39+
{
40+
info = new EncryptInfoModel();
41+
info.MerID = "abc";
42+
info.Timestamp = DateTimeOffset.UtcNow.ToUnixTimeSeconds().ToString();
43+
info.UseTokenType = "1";
44+
info.BindVal = "1";
45+
string result = payuniapi.UniversalTrade(info, "credit_bind_cancel");
46+
}
47+
}
48+
49+
50+
}

example/examples/payment/Payment.cs

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
using payuniSDK;
2+
using System;
3+
using System.Collections.Generic;
4+
using System.Linq;
5+
using System.Text;
6+
using System.Threading.Tasks;
7+
8+
namespace example.examples.payment
9+
{
10+
public class Payment
11+
{
12+
/// <summary>
13+
/// api宣告
14+
/// </summary>
15+
public payuniAPI payuniapi;
16+
/// <summary>
17+
/// 加密資訊宣告
18+
/// </summary>
19+
public EncryptInfoModel info;
20+
public Payment(string request)
21+
{
22+
string key = "12345678901234567890123456789012";
23+
string iv = "1234567890123456";
24+
payuniapi = new payuniAPI(key, iv);
25+
}
26+
27+
/// <summary>
28+
/// upp sample code
29+
/// </summary>
30+
public void upp() {
31+
info = new EncryptInfoModel();
32+
info.MerID = "abc";
33+
info.MerTradeNo = "test"+DateTime.Now.ToString("yyyyMMddHHmmss");
34+
info.TradeAmt = "100";
35+
info.Timestamp = DateTimeOffset.UtcNow.ToUnixTimeSeconds().ToString();
36+
info.ReturnURL = "http://www.test.com.tw/api/return";
37+
info.NotifyURL = "http://www.test.com.tw/api/notify";
38+
string result = payuniapi.UniversalTrade(info, "upp");
39+
}
40+
41+
/// <summary>
42+
/// returnURL sample code
43+
/// </summary>
44+
/// <param name="request"></param>
45+
public void returnURL(string request) {
46+
ResultModel result = new ResultModel();
47+
result = payuniapi.ResultProcess(request);
48+
}
49+
50+
/// <summary>
51+
/// notifyURL sample code
52+
/// </summary>
53+
/// <param name="request"></param>
54+
public void notifyURL(string request)
55+
{
56+
ResultModel result = new ResultModel();
57+
result = payuniapi.ResultProcess(request);
58+
}
59+
60+
/// <summary>
61+
/// credit sample code
62+
/// </summary>
63+
public void credit()
64+
{
65+
info = new EncryptInfoModel();
66+
info.MerID = "abc";
67+
info.MerTradeNo = "test" + DateTime.Now.ToString("yyyyMMddHHmmss");
68+
info.TradeAmt = "100";
69+
info.CardNo = "1234567890123456";
70+
info.CardCVC = "123";
71+
info.CardExpired = "1230";
72+
info.Timestamp = DateTimeOffset.UtcNow.ToUnixTimeSeconds().ToString();
73+
74+
string result = payuniapi.UniversalTrade(info, "credit");
75+
}
76+
77+
/// <summary>
78+
/// atm sample code
79+
/// </summary>
80+
public void atm()
81+
{
82+
info = new EncryptInfoModel();
83+
info.MerID = "abc";
84+
info.MerTradeNo = "test" + DateTime.Now.ToString("yyyyMMddHHmmss");
85+
info.TradeAmt = "100";
86+
info.BankType = "822";
87+
info.Timestamp = DateTimeOffset.UtcNow.ToUnixTimeSeconds().ToString();
88+
89+
string result = payuniapi.UniversalTrade(info, "atm");
90+
}
91+
92+
/// <summary>
93+
/// cvs sample code
94+
/// </summary>
95+
public void cvs()
96+
{
97+
info = new EncryptInfoModel();
98+
info.MerID = "abc";
99+
info.MerTradeNo = "test" + DateTime.Now.ToString("yyyyMMddHHmmss");
100+
info.TradeAmt = "100";
101+
info.Timestamp = DateTimeOffset.UtcNow.ToUnixTimeSeconds().ToString();
102+
103+
string result = payuniapi.UniversalTrade(info, "cvs");
104+
}
105+
}
106+
}

0 commit comments

Comments
 (0)