Specification » History » Version 12
chin-yeh, 07/18/2011 11:02 AM
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 | h2. Table Schema Used |
||
52 | |||
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 | "REVERSE_FLAG" CHAR(1) ) |
||
70 | IN "USERSPACE1" ; |
||
71 | |||
72 | ALTER TABLE ecos.migs_interface |
||
73 | ADD PRIMARY KEY |
||
74 | ("CCORNBR"); |
||
75 | </code> |
||
76 | </pre> |
||
77 | |||
78 | |||
79 | 11 | chin-yeh | h2. How To Integrate |
80 | |||
81 | To integrate with the MiGS, one must: |
||
82 | * *Redirect* the customer to the MiGS payment page |
||
83 | * *Capture* the payment response which returned by MiGS, after the customer submitted the payment |
||
84 | |||
85 | 12 | chin-yeh | One could refer to the following page for demo: |
86 | > http://192.168.2.68/ecosway/migs-sample/migs_test.html |
||
87 | |||
88 | 1 | chin-yeh | *To generate the redirect URL*: |
89 | 12 | chin-yeh | * *Example:* |
90 | 11 | chin-yeh | <pre> |
91 | <code class="java"> |
||
92 | String redirectUrl = MigsPaymentUtils.genRedirectUrl(MigsCurrency.HKD, |
||
93 | locale, |
||
94 | orderNo, |
||
95 | amount, |
||
96 | returnUrl); |
||
97 | </code> |
||
98 | 1 | chin-yeh | </pre> |
99 | 12 | chin-yeh | ** *redirectUrl* - redirect the user/customer to this URL to make payment |
100 | 11 | chin-yeh | ** *MigsCurrency.HKD* - the currency of the payment |
101 | ** *locale* - the display language of the MiGS payment page, e.g. en_US |
||
102 | *** *English* - en, en_US |
||
103 | *** *Simplified Chinese* - zh_CN |
||
104 | 1 | chin-yeh | *** *Traditional Chinese* - zh_TW |
105 | 12 | chin-yeh | ** *orderNo* - the unique order number (1-40 alphanumeric) |
106 | ** *amount* - the amount of the payment in cents (1-12 numeric) |
||
107 | ** *returnUrl* - MiGS will redirect the user to this page after made the payment (1-255 alphanumeric) |
||
108 | |||
109 | *To capture the payment:* |
||
110 | * *Example:* |
||
111 | <pre> |
||
112 | <code class="java"> |
||
113 | String orderNo = MigsPaymentUtils.persistPaymentStatus(connection, request); |
||
114 | </code> |
||
115 | </pre> |
||
116 | ** *orderNo* - the order number of the payment |
||
117 | ** *connection* - an established database connection where the payment interface table resides, e.g. MIGS_INTERFACE |
||
118 | ** *request* - the *HTTPServletRequest* object |