Project

General

Profile

Specification » History » Revision 8

Revision 7 (chin-yeh, 01/10/2011 04:48 PM) → Revision 8/19 (chin-yeh, 01/11/2011 10:24 AM)

{{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> 

 *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. Generate redirect URL 

 This 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. 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 through 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. h3. 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 and retry interval is 2 minutes. When reached the maximum retry attempt, the PSC posting will be disabled.