Project

General

Profile

Specification » History » Revision 13

Revision 12 (chin-yeh, 03/24/2011 03:48 PM) → Revision 13/19 (chin-yeh, 03/24/2011 06:29 PM)

{{toc}} 

 h1. Specification 

 The chosen integration method is *Customer Link*. The consumer enters payment information on GlobalCollect's hosted payment pages and GlobalCollect will forward the payment result to the merchant through *Payment Status Communicator* (PSC). 

 h2. Introduction 

 *Payment Flow*: 
 !flow_diagram.jpg! 


 h3. Java Package Name 

 Package name: 
 <pre> 
 my.com.eCosway.globalcollect 
 </pre> 

 h3. Table(s) used 

 <pre> 
 GLOBALCOLLECT_INTERFACE 
 </pre> 

 h2. Configuration 

 The GlobalCollect's *Customer Link* requires the merchant to provide the following URL: 
 * *Return URL* - A link to be displayed on GlobalCollect's payment pages.  
 * *PSC URL* - GlobalCollect sends the payment information to this URL after the consumer has completed a payment attempt successfully. 

 h3. globalcollect.properties 

 This properties file is located at: 
 <pre> 
 resources/properties/uk/globalcollect.properties 
 </pre> 
 > The properties file for development environment: 
 > <pre>resources/properties/uk/globalcollect-dev.properties</pre> 

 *Properties Description*: 
 |_.Property Name|_.Description| 
 |cl.url|The API URL for Customer Link| 
 |merchant.id|The merchant ID (provided by GlobalCollect)| 
 |merchant.ip|The merchant's public IP address| 
 |order.api.version|The API version of INSERT_ORDER| 
 |order.status.api.version|The API version of GET_ORDERSTATUS| 
 |currency.code|3 letter currency code (ISO-4217)| 
 |country.code|2 letter country code| 
 |language.code|2 letter language code (ISO-639)| 

 h2. Programming 

 This section contains 3 parts: 
 * Generate redirect URL - describes how to generate the redirect URL 
 * Back URL - describes how to handle the returned consumer 
 * PSC URL - describes how to capture the payment information 

 h3. Required libraries 

 Apache HttpClient: 
 * httpclient-4.0.3.jar  
 * httpcore-4.0.1.jar 
 * httpmime-4.0.3.jar 

 Download link:    http://hc.apache.org/downloads.cgi 

 h3. Generate redirect URL 

 The generated URL will be used to redirect the consumer to GlobalCollect's payment pages.  

 *Step-by-Step:* 
 # Prepare    the following parameters: 
 ** *connection* - an established database connection 
 ** *orderId* - the unique order ID, 20 alphanumeric characters 
 ** *amount* - the order amount in cents, and integer values only 
 # Pass the above parameters to the following interface: 
 <pre> 
 String redirectUrl = PaymentUtils.genRedirectPaymentUrl(connection, orderId, amount); 
 </pre> 
 # Insert the order ID information into session. 
 # Redirect the consumer to the generated URL using *JavaScript* or *HttpServletResponse.sendRedirect*.  

 h3. Generate redirect URL with address info and email 

 The generated URL URL will be used to redirect the consumer to GlobalCollect's payment pages.  

 *Step-by-Step:* 
 # Prepare    the following parameters: 
 ** *transactionType* - the transaction type, e.g. PURCHASE, REGISTRATION 
 ** *connection* - an established database connection 
 ** *orderId* - the unique order ID, 20 alphanumeric characters 
 ** *amount* - the order amount in cents, and integer values only 
 ** *email* - the email of the customer 
 ** *profileAddress* - the address of the customer 
 ** *shippingAddress* - the shipping address of the customer 
 # Pass the above parameters to the following interface: 
 <pre> 
 String redirectUrl = PaymentUtils.genRedirectPaymentUrl(transactionType, connection, PaymentUtils.genRedirectPaymentUrl(connection, orderId, amount, email, profileAddress, shippingAddress); 
 </pre> 
 # Insert the order ID information into session. 
 # Redirect the consumer to the generated URL using *JavaScript* or *HttpServletResponse.sendRedirect*.  



 h3. Back URL 

 The back URL acts as receipt URL also. This is where the consumer will be redirected to after completed the payment. 

 As GlobalCollect will not forward payment information to the URL, one has to obtain the order details via the active session. The following guide assumes the order ID is stored in the session. 

 *Step-by-Step:* 
 # Prepare the following parameters: 
 ** *connection* - an established database connection 
 ** *orderId* - the unique order ID, 20 alphanumeric characters 
 # Pass the above parameters to the following interface: 
 <pre> 
 String orderId = (String) session.getAttribute("test_ord_id"); 
 PaymentUtils.persistPaymentStatusForReceipt(connection, orderId); 
 </pre> 
 # And then, one can obtain the payment status in the interface table (see [[Specification#Table-used|Table Name]]); 

 h3. PSC URL 

 For every payment transaction with the status 500 and above, GlobalCollect will post the payment information to the PSC URL. 

 *Step-by-Step*: 
 # Prepare the following parameters: 
 ** *connection* - an established database connection 
 ** *request* - the HttpServletRequest object 
 # Pass the above parameters to: 
 <pre> 
 PaymentUtils.persistPaymentStatusForPsc(dataBean.getConnection(), request); 
 </pre> 
 # *[Important]* The PSC must not contains any HTML element except a *'OK'* string e.g.,  
 <pre> 
 out.print("OK"); 
 </pre> 
 
 h2. FAQ 

 *PSC:* 
 * GlobalCollect post the payment result within 2 minutes after completed payment 
 * The PSC URL must be a HTTPS URL 
 * Only those payment result with status 500 or above will be posted to PSC URL. 
 * The number of retry attempt is 10. If reached the maximum retry attempt, the PSC posting will be disabled. 
 * The retry interval is 2-minutes for the first attempt and 1-minute for the subsequence attempts.