Specification » History » Revision 18
Revision 17 (Chooi-Mey, 05/02/2012 02:21 PM) → Revision 18/19 (Chooi-Mey, 05/02/2012 02:24 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). Demo Application: * Without Address: > http://192.168.2.68/ukstore/sample/payment_form.jsp * With Address: > http://192.168.2.68/ukstore/sample/payment_form_with_address.jsp 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> > *important note:* rename to <code>globalcollect.properties</code> *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, 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. *SSL Certification:* * Global Collect has install a new SSL Cert installation which signed by Secure Trust on 11th April 2012:* * * Q1: How to check whether the cert is trusted by the system? * A1: By requesting the below https://ps.gcsip.nl/wdl/version.txt (for prod: https://ps.gcsip.com/wdl/version.txt) URL from the system that is connecting to Global Collect production platform the merchant can check that the root certificate of Secure_trust is be trusted by the system. <pre> Staging env: https://ps.gcsip.nl/wdl/version.txt Prod env: https://ps.gcsip.com/wdl/version.txt </pre> This should give a response like: 7.1.20110709.2 * * Q2: What is the action need to be taken by merchant? * A2: Action to be performed by Merchant, is to add/import the provided new SSL Cert keystore into production server by using the Java command as below: <pre> * ./keytool -import -trustcacerts -alias globalcollectSecureTrust -file Secure_trust.cer -keystore /usr/java/jdk1.5.0_15/jre/lib/security/cacerts * ./keytool -import -trustcacerts -alias globalcollectWildcardGcsipCom -file wildcard.gcsip.com.cer -keystore /usr/java/jdk1.5.0_15/jre/lib/security/cacerts * ./keytool -import -trustcacerts -alias globalcollectWildcardGcsipNl -file wildcard.gcsip.nl.cer -keystore /usr/java/jdk1.5.0_15/jre/lib/security/cacerts </pre>