Project

General

Profile

Specification » History » Version 13

chin-yeh, 03/24/2011 06:29 PM

1 2 chin-yeh
{{toc}}
2
3 1 chin-yeh
h1. Specification
4 2 chin-yeh
5 5 chin-yeh
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).
6
7 6 chin-yeh
h2. Introduction
8 1 chin-yeh
9 6 chin-yeh
*Payment Flow*:
10 1 chin-yeh
!flow_diagram.jpg!
11 6 chin-yeh
12
13
h3. Java Package Name
14
15
Package name:
16
<pre>
17
my.com.eCosway.globalcollect
18
</pre>
19
20
h3. Table(s) used
21
22
<pre>
23
GLOBALCOLLECT_INTERFACE
24
</pre>
25
26
h2. Configuration
27
28
The GlobalCollect's *Customer Link* requires the merchant to provide the following URL:
29
* *Return URL* - A link to be displayed on GlobalCollect's payment pages. 
30
* *PSC URL* - GlobalCollect sends the payment information to this URL after the consumer has completed a payment attempt successfully.
31
32
h3. globalcollect.properties
33
34
This properties file is located at:
35
<pre>
36
resources/properties/uk/globalcollect.properties
37
</pre>
38 11 chin-yeh
> The properties file for development environment:
39
> <pre>resources/properties/uk/globalcollect-dev.properties</pre>
40 6 chin-yeh
41
*Properties Description*:
42
|_.Property Name|_.Description|
43
|cl.url|The API URL for Customer Link|
44
|merchant.id|The merchant ID (provided by GlobalCollect)|
45
|merchant.ip|The merchant's public IP address|
46
|order.api.version|The API version of INSERT_ORDER|
47
|order.status.api.version|The API version of GET_ORDERSTATUS|
48
|currency.code|3 letter currency code (ISO-4217)|
49
|country.code|2 letter country code|
50
|language.code|2 letter language code (ISO-639)|
51
52
h2. Programming
53
54
This section contains 3 parts:
55
* Generate redirect URL - describes how to generate the redirect URL
56
* Back URL - describes how to handle the returned consumer
57
* PSC URL - describes how to capture the payment information
58
59 9 chin-yeh
h3. Required libraries
60
61
Apache HttpClient:
62
* httpclient-4.0.3.jar 
63
* httpcore-4.0.1.jar
64
* httpmime-4.0.3.jar
65
66
Download link:  http://hc.apache.org/downloads.cgi
67
68 6 chin-yeh
h3. Generate redirect URL
69
70 12 chin-yeh
The generated URL will be used to redirect the consumer to GlobalCollect's payment pages. 
71 6 chin-yeh
72
*Step-by-Step:*
73
# Prepare  the following parameters:
74
** *connection* - an established database connection
75
** *orderId* - the unique order ID, 20 alphanumeric characters
76
** *amount* - the order amount in cents, and integer values only
77
# Pass the above parameters to the following interface:
78
<pre>
79
String redirectUrl = PaymentUtils.genRedirectPaymentUrl(connection, orderId, amount);
80
</pre>
81
# Insert the order ID information into session.
82 1 chin-yeh
# Redirect the consumer to the generated URL using *JavaScript* or *HttpServletResponse.sendRedirect*. 
83 12 chin-yeh
84
h3. Generate redirect URL with address info and email
85
86
The generated URL URL will be used to redirect the consumer to GlobalCollect's payment pages. 
87
88
*Step-by-Step:*
89
# Prepare  the following parameters:
90 13 chin-yeh
** *transactionType* - the transaction type, e.g. PURCHASE, REGISTRATION
91 12 chin-yeh
** *connection* - an established database connection
92
** *orderId* - the unique order ID, 20 alphanumeric characters
93
** *amount* - the order amount in cents, and integer values only
94
** *email* - the email of the customer
95
** *profileAddress* - the address of the customer
96
** *shippingAddress* - the shipping address of the customer
97
# Pass the above parameters to the following interface:
98 1 chin-yeh
<pre>
99 13 chin-yeh
String redirectUrl = PaymentUtils.genRedirectPaymentUrl(transactionType, connection, orderId, amount, email, profileAddress, shippingAddress);
100 12 chin-yeh
</pre>
101
# Insert the order ID information into session.
102
# Redirect the consumer to the generated URL using *JavaScript* or *HttpServletResponse.sendRedirect*. 
103
104
105 6 chin-yeh
106
h3. Back URL
107
108
The back URL acts as receipt URL also. This is where the consumer will be redirected to after completed the payment.
109
110 8 chin-yeh
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.
111 6 chin-yeh
112
*Step-by-Step:*
113
# Prepare the following parameters:
114
** *connection* - an established database connection
115
** *orderId* - the unique order ID, 20 alphanumeric characters
116
# Pass the above parameters to the following interface:
117
<pre>
118
String orderId = (String) session.getAttribute("test_ord_id");
119
PaymentUtils.persistPaymentStatusForReceipt(connection, orderId);
120 1 chin-yeh
</pre>
121 8 chin-yeh
# And then, one can obtain the payment status in the interface table (see [[Specification#Table-used|Table Name]]);
122 6 chin-yeh
123
h3. PSC URL
124
125
For every payment transaction with the status 500 and above, GlobalCollect will post the payment information to the PSC URL.
126
127
*Step-by-Step*:
128
# Prepare the following parameters:
129
** *connection* - an established database connection
130
** *request* - the HttpServletRequest object
131
# Pass the above parameters to:
132
<pre>
133
PaymentUtils.persistPaymentStatusForPsc(dataBean.getConnection(), request);
134
</pre>
135
# *[Important]* The PSC must not contains any HTML element except a *'OK'* string e.g., 
136
<pre>
137
out.print("OK");
138 1 chin-yeh
</pre>
139 6 chin-yeh
 
140 8 chin-yeh
h2. FAQ
141 7 chin-yeh
142
*PSC:*
143
* GlobalCollect post the payment result within 2 minutes after completed payment
144
* The PSC URL must be a HTTPS URL
145
* Only those payment result with status 500 or above will be posted to PSC URL.
146 10 chin-yeh
* The number of retry attempt is 10. If reached the maximum retry attempt, the PSC posting will be disabled.
147
* The retry interval is 2-minutes for the first attempt and 1-minute for the subsequence attempts.