Project

General

Profile

Specification » History » Revision 8

Revision 7 (Soh Keong, 03/08/2023 11:34 AM) → Revision 8/10 (Soh Keong, 03/08/2023 04:59 PM)

{{toc}} 

 h1. Specification 

 h1. Activity Diagram 

 h3. 3D 

 !3DflowChart.png! 

 h3. Non-3D 

 !Non3DflowChart.png! 

 h1. Programming Guide 

 h2. Jar version  

 |_. version |_. Description                                  | 
 | 1.0         | Init                                           | 

 h2. Jar File Download 

 "Jar":/redmine/attachments/download/738/ecPay-1.0.jar "Jar":/redmine/attachments/download/737/ecPay-1.0.jar 
 "Properties":/redmine/attachments/download/733/ecPay.properties 
 "JSP CreatePayment":/redmine/attachments/download/734/EcPayCreatePayment.jsp 

 h3. Classes 

 * *com.ecpay.bean.aces* - AcesRequestBean, AcesResponseBean 
 * *com.ecpay.common*      - CommonConstant, CommonProperties, PaymentTypeEnum 
 * *com.ecpay.dao*         - EcPayInterface 
 * *com.ecpay.service*     - EcPayService 
 * *com.ecpay.utils*       - CommonUtils, HashUtil, HttpUtil 

 h3. properties file 

 * *ecPay.properties* 

 # *merchant.id*                 - Merchant login name given by EcPay 
 # *hash.key*                    - From portal 
 # *hash.iv*                     - From portal 
 # *payment.url*                 - by EcPay 
 # *query.trade.url*             - by EcPay 
 # *url.token*                   - by EcPay 
 # *url.create*                  - by EcPay 
 # *local.create.payment.page* - Mall Page 
 # *local.non.3d.result.page*    - Mall Page 
 # *CONNECTION_TIMEOUT*          - 5000    ms 
 # *READ_TIMEOUT*                - 30000 ms 


 h2. Database Table 

 <pre> 
 CREATE TABLE ECPAY_INTERFACE ( 
	 ORDER_ID VARCHAR(15) NOT NULL,  
	 TRX_TYPE VARCHAR(5), 
	 SHOPPER_REF_NO INTEGER, 
	 CURRENCY VARCHAR(3), 
	 CHARGE_AMT DECIMAL(15,2),  
	 ORDER_DATETIME TIMESTAMP NOT NULL, 
	 STEPS VARCHAR(10), 
	 TRANS_CODE INTEGER,  
	 TRANS_MESSAGE VARCHAR(200),  
	 RTN_CODE INTEGER, 
	 RTN_MESSAGE VARCHAR(210), 
	 TRADE_NO VARCHAR(20), 
	 TRADE_DATE TIMESTAMP, 
	 TRADE_STATUS VARCHAR(8), 
	 PAYMENT_TYPE VARCHAR(20), 
	 INST_PERIOD INTEGER, 
	 INST_DOWN_PAY INTEGER, 
	 INST_MONTH_PAY INTEGER, 	
	 CARD_AUTH_CODE VARCHAR(6), 
	 CARD_BANK VARCHAR(30), 
	 IS_VALID CHARACTER NOT NULL DEFAULT 'N',  
	 PAY_DATE TIMESTAMP, 
	 CREATE_DATETIME TIMESTAMP NOT NULL DEFAULT CURRENT TIMESTAMP, 
	 MODIFY_DATETIME TIMESTAMP,  
	 PRIMARY KEY (ORDER_ID)) 
 </pre> 

 h2. EcPay Service 

 <pre> 
 com.ecpay.service.EcPayService service = new com.ecpay.service.EcPayService(); 
 </pre> 

 h3. getUrl 

 <pre> 
 String url = service.getUrl(Connection conn, AcesRequestBean bean) 
 </pre> 

 # *conn*                        - Database connection. 
 # *payment*                     - PaymentMOL object. 
 > * *orderId*                   - Order ID. 
 > * *totalAmount*               - Transaction amount. (Integer) 
 > * *orderDatetime*             - LocalDateTime 
 > * *trxType*                   - Transaction Type. 
 > * *shopperRefNo*              - Shopper Reference Number. 
 > * *currency*                  - CommonConstant.CURRENCY_TAIWAN 
 > * *CreditInstallment*         - Support multiple period with comma delimiter. Example (6,12,24) 
 > * *returnUrl*                 - Backend Response 
 > * *orderResultUrl*            - Frontend Response 
 > * *transactionDescription*    - Example : Aces Sales 
 > * *ItemName*                  - Example : Aces Product 

 # *url*           - CreatePaymentPage's URL 
 # *Parameter*     - in URL 
 > * *orderId*     -  
 > * *token*       -  
 > * *language*    - Will display in Payment Page 

 h3. createPaymentPage (Web JS) 

 Refer                             : https://developers.ecpay.com.tw/?p=8989 
 Sample Page (JSP CreatePayment) : /redmine/projects/ecpay/wiki/Specification/edit#Jar-File-Download 

 <pre> 
 String url = service.getUrl(Connection conn, String orderId, String token); 
 </pre> 

 For  
 1. 3D       : Redirect to 3D page 
 2. Non-3D : Redirect to Receipt Page 


 h3. updateTransaction 

 <pre> 
 AcesResponseBean bean = updateTransaction(Connection conn, HttpServletRequest request) 
 </pre> 

 # *conn*                        - Database connection. 
 # *bean*                     - AcesResponseBean object. 
 > * *orderId*                   - Order ID. 
 > * *transactionCode*           - 
 > * *transactionMessage*        - 
 > * *returnCode*                - 
 > * *returnMessage*             - 
 > * *ecPayOrderId*              - 
 > * *ecPayOrderDate*            - 
 > * *transactionStatus*         - com.ecpay.common.CommonConstant.TRANS_CODE_SUCCESS 
 > * *isValid*                   - com.ecpay.common.CommonConstant.IS_VALID_YES 
 > * *paymentType*               - 
 > * *payDate*                   - 
 > * *installmentPeriod*         - 
 > * *downPayment*               - 
 > * *monthlyPayment*            - 
 > * *cardAuthCode*              - 
 > * *cardBank*                  -