Project

General

Profile

Specification » History » Version 9

Soh Keong, 03/23/2023 03:52 PM

1 1 Soh Keong
{{toc}}
2
3
h1. Specification
4
5
h1. Activity Diagram
6
7 2 Soh Keong
h3. 3D
8
9 1 Soh Keong
!3DflowChart.png!
10
11 2 Soh Keong
h3. Non-3D
12
13 1 Soh Keong
!Non3DflowChart.png!
14
15
h1. Programming Guide
16
17
h2. Jar version 
18
19
|_. version |_. Description                                |
20
| 1.0       | Init                                         |
21 2 Soh Keong
22
h2. Jar File Download
23
24 8 Soh Keong
"Jar":/redmine/attachments/download/738/ecPay-1.0.jar
25 6 Soh Keong
"Properties":/redmine/attachments/download/733/ecPay.properties
26
"JSP CreatePayment":/redmine/attachments/download/734/EcPayCreatePayment.jsp
27 2 Soh Keong
28
h3. Classes
29
30
* *com.ecpay.bean.aces* - AcesRequestBean, AcesResponseBean
31
* *com.ecpay.common*    - CommonConstant, CommonProperties, PaymentTypeEnum
32
* *com.ecpay.dao*       - EcPayInterface
33
* *com.ecpay.service*   - EcPayService
34
* *com.ecpay.utils*     - CommonUtils, HashUtil, HttpUtil
35
36
h3. properties file
37
38
* *ecPay.properties*
39
40
# *merchant.id*               - Merchant login name given by EcPay
41
# *hash.key*                  - From portal
42
# *hash.iv*                   - From portal
43
# *payment.url*               - by EcPay
44
# *query.trade.url*           - by EcPay
45
# *url.token*                 - by EcPay
46
# *url.create*                - by EcPay
47
# *local.create.payment.page* - Mall Page
48
# *local.non.3d.result.page*  - Mall Page
49
# *CONNECTION_TIMEOUT*        - 5000  ms
50
# *READ_TIMEOUT*              - 30000 ms
51
52
53
h2. Database Table
54
55
<pre>
56
CREATE TABLE ECPAY_INTERFACE (
57
	ORDER_ID VARCHAR(15) NOT NULL, 
58
	TRX_TYPE VARCHAR(5),
59
	SHOPPER_REF_NO INTEGER,
60
	CURRENCY VARCHAR(3),
61
	CHARGE_AMT DECIMAL(15,2), 
62
	ORDER_DATETIME TIMESTAMP NOT NULL,
63
	STEPS VARCHAR(10),
64
	TRANS_CODE INTEGER, 
65
	TRANS_MESSAGE VARCHAR(200), 
66
	RTN_CODE INTEGER,
67
	RTN_MESSAGE VARCHAR(210),
68
	TRADE_NO VARCHAR(20),
69
	TRADE_DATE TIMESTAMP,
70
	TRADE_STATUS VARCHAR(8),
71
	PAYMENT_TYPE VARCHAR(20),
72
	INST_PERIOD INTEGER,
73
	INST_DOWN_PAY INTEGER,
74
	INST_MONTH_PAY INTEGER,	
75 9 Soh Keong
        CHARGE_FEE DECIMAL(15,2), 
76 2 Soh Keong
	CARD_AUTH_CODE VARCHAR(6),
77
	CARD_BANK VARCHAR(30),
78
	IS_VALID CHARACTER NOT NULL DEFAULT 'N', 
79
	PAY_DATE TIMESTAMP,
80
	CREATE_DATETIME TIMESTAMP NOT NULL DEFAULT CURRENT TIMESTAMP,
81
	MODIFY_DATETIME TIMESTAMP, 
82
	PRIMARY KEY (ORDER_ID))
83
</pre>
84
85
h2. EcPay Service
86
87
<pre>
88
com.ecpay.service.EcPayService service = new com.ecpay.service.EcPayService();
89
</pre>
90
91
h3. getUrl
92
93
<pre>
94
String url = service.getUrl(Connection conn, AcesRequestBean bean)
95
</pre>
96
97
# *conn*                      - Database connection.
98
# *payment*                   - PaymentMOL object.
99
> * *orderId*                 - Order ID.
100
> * *totalAmount*             - Transaction amount. (Integer)
101
> * *orderDatetime*           - LocalDateTime
102
> * *trxType*                 - Transaction Type.
103
> * *shopperRefNo*            - Shopper Reference Number.
104
> * *currency*                - CommonConstant.CURRENCY_TAIWAN
105
> * *CreditInstallment*       - Support multiple period with comma delimiter. Example (6,12,24)
106
> * *returnUrl*               - Backend Response
107
> * *orderResultUrl*          - Frontend Response
108
> * *transactionDescription*  - Example : Aces Sales
109
> * *ItemName*                - Example : Aces Product
110
111
# *url*         - CreatePaymentPage's URL
112
# *Parameter*   - in URL
113
> * *orderId*   - 
114
> * *token*     - 
115
> * *language*  - Will display in Payment Page
116
117
h3. createPaymentPage (Web JS)
118
119
Refer                           : https://developers.ecpay.com.tw/?p=8989
120
Sample Page (JSP CreatePayment) : /redmine/projects/ecpay/wiki/Specification/edit#Jar-File-Download
121
122
<pre>
123
String url = service.getUrl(Connection conn, String orderId, String token);
124
</pre>
125
126
For 
127
1. 3D     : Redirect to 3D page
128
2. Non-3D : Redirect to Receipt Page
129
130
131
h3. updateTransaction
132
133 3 Soh Keong
<pre>
134
AcesResponseBean bean = updateTransaction(Connection conn, HttpServletRequest request)
135
</pre>
136
137
# *conn*                      - Database connection.
138
# *bean*                   - AcesResponseBean object.
139
> * *orderId*                 - Order ID.
140
> * *transactionCode*         -
141
> * *transactionMessage*      -
142
> * *returnCode*              -
143
> * *returnMessage*           -
144
> * *ecPayOrderId*            -
145
> * *ecPayOrderDate*          -
146 4 Soh Keong
> * *transactionStatus*       - com.ecpay.common.CommonConstant.TRANS_CODE_SUCCESS
147 5 Soh Keong
> * *isValid*                 - com.ecpay.common.CommonConstant.IS_VALID_YES
148 3 Soh Keong
> * *paymentType*             -
149
> * *payDate*                 -
150
> * *installmentPeriod*       -
151
> * *downPayment*             -
152
> * *monthlyPayment*          -
153
> * *cardAuthCode*            -
154
> * *cardBank*                -