Project

General

Profile

Specification » History » Version 7

Soh Keong, 03/08/2023 11:34 AM

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 7 Soh Keong
"Jar":/redmine/attachments/download/737/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
	CARD_AUTH_CODE VARCHAR(6),
76
	CARD_BANK VARCHAR(30),
77
	IS_VALID CHARACTER NOT NULL DEFAULT 'N', 
78
	PAY_DATE TIMESTAMP,
79
	CREATE_DATETIME TIMESTAMP NOT NULL DEFAULT CURRENT TIMESTAMP,
80
	MODIFY_DATETIME TIMESTAMP, 
81
	PRIMARY KEY (ORDER_ID))
82
</pre>
83
84
h2. EcPay Service
85
86
<pre>
87
com.ecpay.service.EcPayService service = new com.ecpay.service.EcPayService();
88
</pre>
89
90
h3. getUrl
91
92
<pre>
93
String url = service.getUrl(Connection conn, AcesRequestBean bean)
94
</pre>
95
96
# *conn*                      - Database connection.
97
# *payment*                   - PaymentMOL object.
98
> * *orderId*                 - Order ID.
99
> * *totalAmount*             - Transaction amount. (Integer)
100
> * *orderDatetime*           - LocalDateTime
101
> * *trxType*                 - Transaction Type.
102
> * *shopperRefNo*            - Shopper Reference Number.
103
> * *currency*                - CommonConstant.CURRENCY_TAIWAN
104
> * *CreditInstallment*       - Support multiple period with comma delimiter. Example (6,12,24)
105
> * *returnUrl*               - Backend Response
106
> * *orderResultUrl*          - Frontend Response
107
> * *transactionDescription*  - Example : Aces Sales
108
> * *ItemName*                - Example : Aces Product
109
110
# *url*         - CreatePaymentPage's URL
111
# *Parameter*   - in URL
112
> * *orderId*   - 
113
> * *token*     - 
114
> * *language*  - Will display in Payment Page
115
116
h3. createPaymentPage (Web JS)
117
118
Refer                           : https://developers.ecpay.com.tw/?p=8989
119
Sample Page (JSP CreatePayment) : /redmine/projects/ecpay/wiki/Specification/edit#Jar-File-Download
120
121
<pre>
122
String url = service.getUrl(Connection conn, String orderId, String token);
123
</pre>
124
125
For 
126
1. 3D     : Redirect to 3D page
127
2. Non-3D : Redirect to Receipt Page
128
129
130
h3. updateTransaction
131
132 3 Soh Keong
<pre>
133
AcesResponseBean bean = updateTransaction(Connection conn, HttpServletRequest request)
134
</pre>
135
136
# *conn*                      - Database connection.
137
# *bean*                   - AcesResponseBean object.
138
> * *orderId*                 - Order ID.
139
> * *transactionCode*         -
140
> * *transactionMessage*      -
141
> * *returnCode*              -
142
> * *returnMessage*           -
143
> * *ecPayOrderId*            -
144
> * *ecPayOrderDate*          -
145 4 Soh Keong
> * *transactionStatus*       - com.ecpay.common.CommonConstant.TRANS_CODE_SUCCESS
146 5 Soh Keong
> * *isValid*                 - com.ecpay.common.CommonConstant.IS_VALID_YES
147 3 Soh Keong
> * *paymentType*             -
148
> * *payDate*                 -
149
> * *installmentPeriod*       -
150
> * *downPayment*             -
151
> * *monthlyPayment*          -
152
> * *cardAuthCode*            -
153
> * *cardBank*                -