Project

General

Profile

Specification » History » Version 17

chin-yeh, 09/20/2011 03:56 PM

1 3 chin-yeh
{{toc}}
2
3 4 chin-yeh
h1. Introduction
4 2 chin-yeh
5 6 chin-yeh
High level view of the payment flow:
6 3 chin-yeh
7 7 chin-yeh
!payment_flow.png!
8 4 chin-yeh
9 5 chin-yeh
h1. Programming Guide
10 8 chin-yeh
11
h2. Resources
12
13 9 chin-yeh
h3. SCM
14
15 1 chin-yeh
> see [[wiki#SCM]]
16
17 10 chin-yeh
h3. Classes
18 1 chin-yeh
19 10 chin-yeh
* *my.com.eCosway.migs.Commons* - Commons Constant
20
* *my.com.eCosway.migs.MigsInterface* - Data Persistence's Interface
21
* *my.com.eCosway.migs.MigsPaymentUtils* - Utility class
22
* *my.com.eCosway.migs.MigsProperties* - Data model of MiGS properties
23
* *my.com.eCosway.migs.PaymentResponse* - Data model of MiGS's payment response
24 8 chin-yeh
25
26 10 chin-yeh
h3. Properties files
27 1 chin-yeh
28 10 chin-yeh
* */resources/properties/migs-hkd.properties* - MiGS's properties file (HKD currency)
29
** *account.accessCode* - VPC API's access code
30
** *account.hashSecret* - VPC API's hash secret code
31
** *account.merchantId* - MIGS merchant ID
32
** *vpc.twoParty.url* - the posting URL for the 2-party integration model
33
** *vpc.threeParty.url* - the posting URL for the 3-party integration model
34
** *vpc.version* - the VPC version
35
36 9 chin-yeh
h3. Test Pages
37 1 chin-yeh
38
<pre>
39
/migs-sample/migs_debug.jsp - to debug the payment response which returned by MiGS
40
/migs-sample/migs_receipt.jsp - a very simple receipt page
41
/migs-sample/migs_test.html - a payment test page
42
/migs-sample/migs_test.jsp - controller for the payment test page
43
</pre>
44
45
46
h3. Third-Party Library
47
48
* *log4j* - for logging purpose; bundled with Jboss AS
49 10 chin-yeh
50
51 15 chin-yeh
h2. Tables Used
52 10 chin-yeh
53
* *ECOS.MIGS_INTERFACE* - This table schema is identical to *ECOS.EASYPAY_INTERFACE*.
54
<pre>
55
<code class="SQL">
56
CREATE TABLE ecos.migs_interface  (
57
                  "CCORNBR" VARCHAR(15) NOT NULL ,
58
                  "TRX_TYPE" VARCHAR(5) ,
59
                  "SHRFNBR" INTEGER ,
60
                  "CARD_TYPE" VARCHAR(10) ,
61
                  "CURRENCY" VARCHAR(3) ,
62
                  "CHARGE_AMT" DECIMAL(15,2) ,
63
                  "STATUS" VARCHAR(5) ,
64
                  "BANK_APPRCODE" VARCHAR(8) ,
65
                  "MALL_IND" CHAR(1) ,
66
                  "DATETIME" TIMESTAMP ,
67
                  "ERROR_MSG" VARCHAR(155) ,
68
                  "UXID" VARCHAR(30) ,
69 17 chin-yeh
                  "REVERSE_FLAG" CHAR(1) );
70 10 chin-yeh
71
ALTER TABLE ecos.migs_interface
72
        ADD PRIMARY KEY
73
                ("CCORNBR");
74
</code>
75
</pre>
76
77
78 11 chin-yeh
h2. How To Integrate
79
80
To integrate with the MiGS, one must:
81
* *Redirect* the customer to the MiGS payment page
82
* *Capture* the payment response which returned by MiGS, after the customer submitted the payment
83
84 12 chin-yeh
One could refer to the following page for demo:
85
> http://192.168.2.68/ecosway/migs-sample/migs_test.html
86
87 1 chin-yeh
*To generate the redirect URL*:
88 12 chin-yeh
* *Example:* 
89 11 chin-yeh
<pre>
90
<code class="java">
91
String redirectUrl = MigsPaymentUtils.genRedirectUrl(MigsCurrency.HKD,
92
				locale,
93
				orderNo,
94
				amount, 
95
				returnUrl);
96
</code>
97 1 chin-yeh
</pre>
98 12 chin-yeh
** *redirectUrl* - redirect the user/customer to this URL to make payment
99 11 chin-yeh
** *MigsCurrency.HKD* - the currency of the payment
100
** *locale* - the display language of the MiGS payment page, e.g. en_US
101
*** *English* - en, en_US
102
*** *Simplified Chinese* - zh_CN
103 1 chin-yeh
*** *Traditional Chinese* - zh_TW
104 12 chin-yeh
** *orderNo* - the unique order number (1-40 alphanumeric)
105
** *amount* - the amount of the payment in cents (1-12 numeric)
106
** *returnUrl* - MiGS will redirect the user to this page after made the payment (1-255 alphanumeric)
107
108 16 chin-yeh
*To capture the payment result:*
109 12 chin-yeh
* *Example:*
110
<pre>
111
<code class="java">
112
String orderNo = MigsPaymentUtils.persistPaymentStatus(connection, request);
113
</code>
114
</pre>
115
** *orderNo* - the order number of the payment
116
** *connection* - an established database connection where the payment interface table resides, e.g. MIGS_INTERFACE
117
** *request* - the *HTTPServletRequest* object
118 13 chin-yeh
* Refer to the *STATUS* column in the interface table to check if the payment is success
119
** *YES* - success
120
** *NO* - failed
121
*** _refer to *ERROR_MSG* column in the interface table for more details_