Skip to content

Commit

Permalink
提供SDK SAMPLE CODE及文件說明
Browse files Browse the repository at this point in the history
  • Loading branch information
AllennChang committed Jan 4, 2018
1 parent 441eab9 commit d183c86
Show file tree
Hide file tree
Showing 230 changed files with 5,301 additions and 0 deletions.
Binary file modified ECPay.Payment.Integration.dll
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AioCheckOut", "AioCheckOut\AioCheckOut.csproj", "{B0129F2C-A615-49E4-B375-8EF6BDA96A66}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{B0129F2C-A615-49E4-B375-8EF6BDA96A66}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B0129F2C-A615-49E4-B375-8EF6BDA96A66}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B0129F2C-A615-49E4-B375-8EF6BDA96A66}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B0129F2C-A615-49E4-B375-8EF6BDA96A66}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="AioCheckOut.aspx.cs" Inherits="AioCheckOut.AioCheckOut" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>

</div>
</form>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ECPay.Payment.Integration;

//訂單產生含開立發票
namespace AioCheckOut
{
public partial class AioCheckOut : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{


List<string> enErrors = new List<string>();
try
{
using (AllInOne oPayment = new AllInOne())
{
/* 服務參數 */
oPayment.ServiceMethod = HttpMethod.HttpPOST;//介接服務時,呼叫 API 的方法
oPayment.ServiceURL = "https://payment-stage.ecpay.com.tw/Cashier/AioCheckOut/V5";//要呼叫介接服務的網址
oPayment.HashKey = "5294y06JbISpM5x9";//ECPay提供的Hash Key
oPayment.HashIV = "v77hoKGq4kWxNNIS";//ECPay提供的Hash IV
oPayment.MerchantID = "2000132";//ECPay提供的特店編號


/* 基本參數 */
oPayment.Send.ReturnURL = "http://example.com";//付款完成通知回傳的網址
oPayment.Send.ClientBackURL = "http://www.ecpay.com.tw/";//瀏覽器端返回的廠商網址
oPayment.Send.OrderResultURL = "";//瀏覽器端回傳付款結果網址
oPayment.Send.MerchantTradeNo = "ECPay" + new Random().Next(0, 99999).ToString();//廠商的交易編號
oPayment.Send.MerchantTradeDate = DateTime.Now;//廠商的交易時間。
oPayment.Send.TotalAmount = Decimal.Parse("50");//交易總金額
oPayment.Send.TradeDesc = "交易描述";//交易描述
oPayment.Send.ChoosePayment = PaymentMethod.ALL;//使用的付款方式
oPayment.Send.Remark = "";//備註欄位
oPayment.Send.ChooseSubPayment = PaymentMethodItem.None;//使用的付款子項目
oPayment.Send.NeedExtraPaidInfo = ExtraPaymentInfo.No;//是否需要額外的付款資訊
oPayment.Send.DeviceSource = DeviceType.PC;//來源裝置
oPayment.Send.IgnorePayment = "";//不顯示的付款方式
//oPayment.Send.PlatformID = "";//特約合作平台商代號
oPayment.Send.HoldTradeAMT = HoldTradeType.No; //是否延遲撥款

//訂單的商品資料
oPayment.Send.Items.Add(new Item()
{
Name = "蘋果",//商品名稱
Price = Decimal.Parse("50"),//商品單價
Currency = "新台幣",//幣別單位
Quantity = Int32.Parse("1"),//購買數量
URL = "http://google.com",//商品的說明網址
Unit = "",//商品單位
TaxType = TaxationType.Taxable //商品課稅別
});


/*************************非即時性付款:ATM、CVS 額外功能參數**************/

#region ATM 額外功能參數

//oPayment.SendExtend.ExpireDate = 3;//允許繳費的有效天數
//oPayment.SendExtend.PaymentInfoURL = "";//伺服器端回傳付款相關資訊
//oPayment.SendExtend.ClientRedirectURL = "";//Client 端回傳付款相關資訊

#endregion


#region CVS 額外功能參數

//oPayment.SendExtend.StoreExpireDate = 3; //超商繳費截止時間 CVS:以分鐘為單位 BARCODE:以天為單位
//oPayment.SendExtend.Desc_1 = "test1";//交易描述 1
//oPayment.SendExtend.Desc_2 = "test2";//交易描述 2
//oPayment.SendExtend.Desc_3 = "test3";//交易描述 3
//oPayment.SendExtend.Desc_4 = "";//交易描述 4
//oPayment.SendExtend.PaymentInfoURL = "";//伺服器端回傳付款相關資訊
//oPayment.SendExtend.ClientRedirectURL = "";///Client 端回傳付款相關資訊

#endregion

/***************************信用卡額外功能參數***************************/

#region Credit 功能參數

//oPayment.SendExtend.BindingCard = BindingCardType.No; //記憶卡號
//oPayment.SendExtend.MerchantMemberID = ""; //記憶卡號識別碼
//oPayment.SendExtend.Language = "ENG"; //語系設定

#endregion Credit 功能參數

#region 一次付清

//oPayment.SendExtend.Redeem = false; //是否使用紅利折抵
//oPayment.SendExtend.UnionPay = true; //是否為銀聯卡交易

#endregion

#region 分期付款

//oPayment.SendExtend.CreditInstallment = 3;//刷卡分期期數

#endregion 分期付款

#region 定期定額

//oPayment.SendExtend.PeriodAmount = 1000;//每次授權金額
//oPayment.SendExtend.PeriodType = PeriodType.Day;//週期種類
//oPayment.SendExtend.Frequency = 1;//執行頻率
//oPayment.SendExtend.ExecTimes = 2;//執行次數
//oPayment.SendExtend.PeriodReturnURL = "";//伺服器端回傳定期定額的執行結果網址。

#endregion


/********************* 電子發票開立延伸參數 ********************************/
oPayment.Send.InvoiceMark = InvoiceState.Yes; // 指定要開立電子發票
oPayment.SendExtend.RelateNumber = "ECPay" + new Random().Next(0, 99999).ToString();//廠商自訂編號
oPayment.SendExtend.CustomerID = "A12345678";//客戶代號
oPayment.SendExtend.CustomerIdentifier = "";//統一編號
oPayment.SendExtend.CustomerName = "客戶名稱";//客戶名稱
oPayment.SendExtend.CustomerAddr = "客戶地址";//客戶地址
oPayment.SendExtend.CustomerPhone = "0912345678";//客戶手機號碼
oPayment.SendExtend.CustomerEmail = "test1234560@gmail.com";//客戶電子郵件
oPayment.SendExtend.ClearanceMark = CustomsClearance.None;//通關方式
oPayment.SendExtend.TaxType = TaxationType.Taxable;//課稅類別
oPayment.SendExtend.CarruerType = InvoiceVehicleType.Member;//載具類別
oPayment.SendExtend.CarruerNum = "";//載具編號
oPayment.SendExtend.Donation = DonatedInvoice.No;//捐贈註記
oPayment.SendExtend.LoveCode = "";//愛心碼
oPayment.SendExtend.Print = PrintFlag.No;//列印註記
oPayment.SendExtend.InvoiceRemark = "";//備註
oPayment.SendExtend.DelayDay = Int32.Parse("0");//延遲開立天數
oPayment.SendExtend.InvType = TheWordType.General;//字軌類別


/* 產生訂單 */
enErrors.AddRange(oPayment.CheckOut());
}
}
catch (Exception ex)
{
// 例外錯誤處理。
enErrors.Add(ex.Message);
}
finally
{
// 顯示錯誤訊息。
if (enErrors.Count() > 0)
{
// string szErrorMessage = String.Join("\\r\\n", enErrors);
}
}




}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>
</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{B0129F2C-A615-49E4-B375-8EF6BDA96A66}</ProjectGuid>
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>AioCheckOut</RootNamespace>
<AssemblyName>AioCheckOut</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<UseIISExpress>false</UseIISExpress>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="ECPay.Payment.Integration">
<HintPath>..\..\..\SDK元件\ECPay.Payment.Integration.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Web.DynamicData" />
<Reference Include="System.Web.Entity" />
<Reference Include="System.Web.ApplicationServices" />
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Core" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Web.Extensions" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Drawing" />
<Reference Include="System.Web" />
<Reference Include="System.Xml" />
<Reference Include="System.Configuration" />
<Reference Include="System.Web.Services" />
<Reference Include="System.EnterpriseServices" />
</ItemGroup>
<ItemGroup>
<Content Include="AioCheckOut.aspx" />
<Content Include="Web.config" />
<Content Include="Web.Debug.config">
<DependentUpon>Web.config</DependentUpon>
</Content>
<Content Include="Web.Release.config">
<DependentUpon>Web.config</DependentUpon>
</Content>
</ItemGroup>
<ItemGroup>
<Compile Include="AioCheckOut.aspx.cs">
<DependentUpon>AioCheckOut.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="AioCheckOut.aspx.designer.cs">
<DependentUpon>AioCheckOut.aspx</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
<ProjectExtensions>
<VisualStudio>
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
<WebProjectProperties>
<UseIIS>False</UseIIS>
<AutoAssignPort>True</AutoAssignPort>
<DevelopmentServerPort>5906</DevelopmentServerPort>
<DevelopmentServerVPath>/</DevelopmentServerVPath>
<IISUrl>
</IISUrl>
<NTLMAuthentication>False</NTLMAuthentication>
<UseCustomServer>False</UseCustomServer>
<CustomServerUrl>
</CustomServerUrl>
<SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
</WebProjectProperties>
</FlavorProperties>
</VisualStudio>
</ProjectExtensions>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ProjectExtensions>
<VisualStudio>
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
<WebProjectProperties>
<StartPageUrl>AioCheckOut.aspx</StartPageUrl>
<StartAction>SpecificPage</StartAction>
<AspNetDebugging>True</AspNetDebugging>
<SilverlightDebugging>False</SilverlightDebugging>
<NativeDebugging>False</NativeDebugging>
<SQLDebugging>False</SQLDebugging>
<ExternalProgram>
</ExternalProgram>
<StartExternalURL>
</StartExternalURL>
<StartCmdLineArguments>
</StartCmdLineArguments>
<StartWorkingDirectory>
</StartWorkingDirectory>
<EnableENC>False</EnableENC>
<AlwaysStartWebServerOnDebug>True</AlwaysStartWebServerOnDebug>
</WebProjectProperties>
</FlavorProperties>
</VisualStudio>
</ProjectExtensions>
</Project>
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// 組件的一般資訊是由下列的屬性集
// 控制。變更這些屬性值可修改與組件關聯的
// 資訊。
[assembly: AssemblyTitle("AioCheckOut")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("AioCheckOut")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// 將 ComVisible 設定為 false 會使得這個組件中的型別
// 對 COM 元件而言為不可見。如果您需要從 COM 存取此組件中
// 的型別,請在該型別上將 ComVisible 屬性設定為 true。
[assembly: ComVisible(false)]

// 下列 GUID 為專案公開 (Expose) 至 COM 時所要使用的 typelib ID
[assembly: Guid("7899dc14-9db6-4798-8f91-60149aa2a4bf")]

// 組件的版本資訊是由下列四項值構成:
//
// 主要版本
// 次要版本
// 組建編號
// 修訂編號
//
// 您可以指定所有的值,也可以依照以下的方式,使用 '*' 將修訂和組建編號
// 指定為預設值:
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
Loading

0 comments on commit d183c86

Please sign in to comment.