Project

General

Profile

Programming Guide » History » Version 5

chin-yeh, 10/18/2011 02:58 PM

1 1 chin-yeh
{{toc}}
2
3
h1. Programming Guide
4 2 chin-yeh
5
This guide describes how to make use of the NMI APIs for payment related transaction and it consists of 2 main parts:
6
* [[programming guide#Step-By-Step|Step-By-Step]] - describes the 
7
* API Reference - the detailed description of all the APIs mentioned in [[programming guide#Step-By-Step|Step-By-Step]]
8
9 3 chin-yeh
The demo application can be found here:
10 5 chin-yeh
> http://192.168.2.68/ukstore/nmi-sample/orders.jsp
11 3 chin-yeh
12 2 chin-yeh
h2. Step-By-Step
13
14
Before begin, install the following libraries into your development environment *_(remove the old versions if exists)_*:
15
* "HttpCore 4.1.2":http://192.168.2.13:8081/nexus/service/local/artifact/maven/redirect?r=central&g=org.apache.httpcomponents&a=httpcore&v=4.1.2&e=jar
16
* "HttpClient 4.1.2":http://192.168.2.13:8081/nexus/service/local/artifact/maven/redirect?r=central&g=org.apache.httpcomponents&a=httpclient&v=4.1.2&e=jar
17 3 chin-yeh
18
!ssd.png!
19
20
*Steps:*
21
# gather the 
22 5 chin-yeh
23
h2. Generate the form action URL
24
25
Generates the <code>form</code> action URL which is needed in the self-hosted payment form.
26
27
_Method Signature:_
28
<pre>
29
<code class="JAVA">
30
public static String getFormActionUrl(String orderId, String orderDescription, BigDecimal orderAmount, String returnUrl)
31
</code>
32
</pre>
33
34
h3. Input Parameters
35
36
* _orderId_ - the unique ID for the order
37
* _orderDescription_ - a simple description of the order
38
* _orderAmount_ - the settlement amount of the order in 2 decimal places, e.g. 12.34
39
* _returnUrl_ - the receipt URL
40
41
h3. Output Parameters
42
43
Returns a <code>form</code> action URL
44
45
h3. Code Snippets
46
47
<pre>
48
<code class="JAVA">
49
	String orderId = request.getParameter("order-id");
50
	String orderDescription = request.getParameter("order-description");
51
	BigDecimal orderAmount = new BigDecimal(request.getParameter("order-amount"));
52
	String returnUrl = request.getParameter("return-url");
53
	
54
	String formUrl = PaymentUtils.getFormActionUrl(orderId, 
55
			orderDescription, 
56
			orderAmount, 
57
			returnUrl);
58
</code>
59
</pre>