Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

新增Maven的支援 + 漏洞修復 (Issue #1) #5

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
112 changes: 112 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
### JetBrains template
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf

# Generated files
.idea/**/contentModel.xml

# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml

# Gradle
.idea/**/gradle.xml
.idea/**/libraries

# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
.idea/artifacts
.idea/compiler.xml
.idea/jarRepositories.xml
.idea/modules.xml
.idea/*.iml
.idea/modules
*.iml
*.ipr

# CMake
cmake-build-*/

# Mongo Explorer plugin
.idea/**/mongoSettings.xml

# File-based project format
*.iws

# IntelliJ
out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Cursive Clojure plugin
.idea/replstate.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

# Editor-based Rest Client
.idea/httpRequests

# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser

### Maven template
target/
pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
pom.xml.next
release.properties
dependency-reduced-pom.xml
buildNumber.properties
.mvn/timing.properties
# https://github.com/takari/maven-wrapper#usage-without-binary-jar
.mvn/wrapper/maven-wrapper.jar

### Java template
# Compiled class file
*.class

# Log file
*.log

# BlueJ files
*.ctxt

# Mobile Tools for Java (J2ME)
.mtj.tmp/

# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*

/ECPayAIO_Java.iml
88 changes: 54 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,54 @@
# 綠界 全方位(All In One)金流介接Java版
---

## 1. 介紹

- 綠界對於有收款需求的會員,提供完整的交易介接API,並有多種收款方式(All In One)可選擇使用。 本套件為Java版,可使用作建立訂單,接受付款通知,查詢訂單等金流交易的應用。
- 收款方式清單:
- 信用卡(一次付清、分期付款、定期定額)
- 網路ATM
- ATM櫃員機
- 超商代碼
- Apple Pay
- Google Pay (須特別申請才能使用)(原Android Pay)


## 2. 安裝環境
- _jdk 1.6以上_
- SDK元件限制在伺服器上使用,嚴禁使用於手機環境,已避免商家金鑰資訊外流


## 3. 使用教學
- 使用者文件放置於Doc資料夾內,可供參閱


## 4. 聯絡我們
- 綠界技術服務工程師信箱: [email protected]

## 5.版權宣告

* License: GPLv2 or later
* License URI: https://www.gnu.org/licenses/gpl-2.0.html


[//]: # (These are reference links used in the body of this note and get stripped out when the markdown processor does its job. There is no need to format nicely because it shouldn't be seen. Thanks SO - http://stackoverflow.com/questions/4823468/store-comments-in-markdown-syntax)
# 綠界 全方位(All In One)金流介接Java版
---

## 1. 介紹
- 綠界對於有收款需求的會員,提供完整的交易介接API,並有多種收款方式(All In One)可選擇使用。 本套件為Java版,可使用作建立訂單,接受付款通知,查詢訂單等金流交易的應用。
- 收款方式清單:
- 信用卡(一次付清、分期付款、定期定額)
- 網路ATM
- ATM櫃員機
- 超商代碼
- Apple Pay
- Google Pay (須特別申請才能使用)(原Android Pay)


## 2. 安裝環境
- _jdk 1.6以上_
- SDK元件限制在伺服器上使用,嚴禁使用於手機環境,已避免商家金鑰資訊外流


## 3. 使用教學
- 使用者文件放置於Doc資料夾內,可供參閱
- 範例放在example資料夾,可供參閱
- JavaDoc 在建置完成後將出現在target資料夾 (ECPayAIO_Java-<version>-javadoc.jar),解除壓縮後並打開index.html,就會有完整的JavaDoc (Parameters, Examples WIP)


## 4. Maven 使用
目前並未放在任何Maven Repository,必須自行建置,其指令如下,這將會建置並安裝到你的Local Maven Repository (~/.m2/repository) (照理來說能夠在Windows, MacOS和Linux運作,但是需要安裝Git和Maven):
```shell
git clone https://github.com/ECPay/ECPayAIO_Java.git
cd ECPayAIO_Java
mvn clean package install
```
使用方法: <br>
```xml
<dependencies>
<dependency>
<groupId>tw.com.ecpay</groupId>
<artifactId>ECPayAIO_Java</artifactId>
<version>版本 (請見pom.xml)</version>
<scope>compile</scope>
<!-- 可以改成其他的Scope,這裡只是範例-->
</dependency>
</dependencies>
```


## 5. 聯絡我們
- 綠界技術服務工程師信箱: [email protected]

## 6.版權宣告
* License: GPLv2 or later
* License URI: https://www.gnu.org/licenses/gpl-2.0.html


Binary file removed jars/javax.servlet-3.0.0.v201112011016.jar
Binary file not shown.
Binary file removed jars/log4j.jar
Binary file not shown.
68 changes: 68 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>tw.com.ecpay</groupId>
<artifactId>ECPayAIO_Java</artifactId>
<version>2.0.1</version>

<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
</properties>

<dependencies>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>4.0.1</version>
<scope>compile</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>3.0.0-M1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.2.1</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.3.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,6 @@ public AllInOne(String log4jPropertiesPath){

/**
* 檢查Hashtable中的檢查碼是否正確(確保資料未被竄改)
* @param Hashtable params
* @return boolean
*/
public boolean compareCheckMacValue(Hashtable<String, String> params){
String checkMacValue = "";
Expand All @@ -93,8 +91,6 @@ public boolean compareCheckMacValue(Hashtable<String, String> params){

/**
* Apple Pay信用卡授權作業
* @param CreateServerOrderobj
* @return
*/
public String createServerOrder(CreateServerOrderObj obj){
obj.setPlatformID(PlatformID);
Expand Down Expand Up @@ -130,8 +126,6 @@ public String createServerOrder(CreateServerOrderObj obj){

/**
* 下載信用卡撥款對帳資料檔的方法
* @param fundingReconDetailObj
* @return response string
*/
public String fundingReconDetail(FundingReconDetailObj fundingReconDetailObj){
fundingReconDetailObj.setMerchantID(MerchantID);
Expand Down Expand Up @@ -185,8 +179,6 @@ public String fundingReconDetail(FundingReconDetailObj fundingReconDetailObj){

/**
* 查詢信用卡單筆明細記錄的方法
* @param queryTradeObj
* @return response string
*/
public String queryTrade(QueryTradeObj queryTradeObj){
queryTradeObj.setMerchantID(MerchantID);
Expand All @@ -212,8 +204,6 @@ public String queryTrade(QueryTradeObj queryTradeObj){

/**
* 下載會員對帳媒體檔的方法
* @param tradeNoAioObj
* @return response string
*/
public String tradeNoAio(TradeNoAioObj tradeNoAioObj){
tradeNoAioObj.setMerchantID(MerchantID);
Expand Down Expand Up @@ -260,8 +250,6 @@ public String tradeNoAio(TradeNoAioObj tradeNoAioObj){

/**
* 信用卡關帳/退刷/取消/放棄的方法
* @param doActionObj
* @return response string
*/
public String doAction(DoActionObj doActionObj){
doActionObj.setPlatformID(PlatformID);
Expand Down Expand Up @@ -292,8 +280,6 @@ public String doAction(DoActionObj doActionObj){

/**
* 查詢訂單資料的方法
* @param queryTradeInfoObj
* @return response string
*/
public String queryTradeInfo(QueryTradeInfoObj queryTradeInfoObj){
queryTradeInfoObj.setPlatformID(PlatformID);
Expand Down Expand Up @@ -325,7 +311,6 @@ public String queryTradeInfo(QueryTradeInfoObj queryTradeInfoObj){

/**
* 信用卡定期定額訂單查詢
* @param queryCreditCardPeriodInfoObj
* @return response JSON string
*/
public String queryCreditCardPeriodInfo(QueryCreditCardPeriodInfoObj queryCreditCardPeriodInfoObj) {
Expand Down Expand Up @@ -353,9 +338,6 @@ public String queryCreditCardPeriodInfo(QueryCreditCardPeriodInfoObj queryCredit

/**
* 產生訂單Html form的方法
* @param aioCheckOutObj
* @param invoice
* @param String
*/
public String aioCheckOut(Object obj, InvoiceObj invoice){
StringBuilder out = new StringBuilder();
Expand Down Expand Up @@ -475,8 +457,6 @@ public String aioCheckOut(Object obj, InvoiceObj invoice){

/**
* ATM、CVS或BARCODE的取號結果通知方法。接收傳送至PaymentInfoURL的資料。回傳物件分為ATMRequestObj, CVSOrBARCODERequestObj二種,請用適當的物件承接以免出錯
* @param req
* @return obj
*/
public Object aioCheckOutFeedback(HttpServletRequest req){
List<String> parameterNames = new ArrayList<String>(req.getParameterMap().keySet());
Expand All @@ -485,7 +465,7 @@ public Object aioCheckOutFeedback(HttpServletRequest req){
for(String name: parameterNames){
Method method;
try {
method = obj.getClass().getMethod("set"+name, null);
method = obj.getClass().getMethod("set"+name, String.class);
method.invoke(obj, req.getParameter(name));
} catch(Exception e){
throw new EcpayException(ErrorMessage.OBJ_MISSING_FIELD);
Expand All @@ -504,7 +484,7 @@ public Object aioCheckOutFeedback(HttpServletRequest req){
for(String name: parameterNames){
Method method;
try {
method = obj.getClass().getMethod("set"+name, null);
method = obj.getClass().getMethod("set"+name, String.class);
method.invoke(obj, req.getParameter(name));
} catch(Exception e){
throw new EcpayException(ErrorMessage.OBJ_MISSING_FIELD);
Expand All @@ -523,9 +503,6 @@ public Object aioCheckOutFeedback(HttpServletRequest req){

/**
* 產生HTML code
* @param aio object
* @param invoice obj
* @return string
*/
private String genCheckOutHtmlCode(Object aio, InvoiceObj invoice){
StringBuilder builder = new StringBuilder();
Expand Down
Loading