UnionPay Online Payment---Simulate payment application Using test case code (modification)

Source: Internet
Author: User
first, the constructionCreate a new Web project, named Payonline, and copy your downloaded case code to your project, my Code directory is as follows:

The acp_sdk.properties configuration file needs to be placed under the root of the classpath, where the parameter configuration information, below is the case provided by the configuration hint:
0. Note: 1 Depending on the package and the Upacp_sdk-1.0.0.jar must be added to the BuildPath. 2) Acp_sdk.properties placed in the SRC root directory.

In addition, if the use of eclipse/myeclipse may not be copied by default to the classes directory, resulting in the loading of this file, please note that modify the settings or manually copy the file.

1. Modify Acp_sdk.properties, 1 certificate to change their local path, the certificate Password test environment is 000000, the production of their own changes. 2.1 wap/Gateway consumption: Call Form_6_2_frontconsume, merchant number please change to its own merchant number, will generate a section of HTML, print it to the browser can jump payment page.

For example, you can write a servlet to print the page directly, or copy the HTML to a Notepad to change the HTML and open the browser.

2.2 Control consumption: Call Form_6_2_appconsume, merchant number please change to own merchant number, will visit the background to obtain TN, TN to your mobile phone app. Payment Cards: Ping Bank Debit card: 6216261000000000018 Certificate No.: 341126197709218366 Mobile: 13552535506 Password: 123456 name: Full Channel SMS Authentication code: 123456 (wap/ Control) 111111 (PC) (SMS Verification code Remember to click to get the verification code before entering) 3.

Form_6_5_query for query interface, merchant number please change to own merchant number, pay attention to modify txntime and OrderID for the Txntime and OrderID of the transaction being queried.

4. Form_6_3_consumeundo and Form_6_4_refund respectively for the consumer revocation interface, return interface, merchant number please change to their own merchant number, pay attention to modify the Origqryid for their own need to refund the consumption of the Queryid. 5. Frontrcvresponse and Backrcvresponse for front and rear notification interface, 2 servlet, please note that configure Web.xml, and Frontrcvresponse will use "other file/utf8_result.jsp".

The transaction completion invokes the notification interface.
6. Form_6_6_filetransfer for file download interface. File Download Interface Note point: 1 Please use your own "real merchant number" test. Development package merchant number, self-service test platform for the application of the merchant number is not test file download, will be anti-HTTP status 500, content is empty. If the real merchant number download prompts noDocuments but determined that there is a transaction, is generally the merchant number does not have the file Transfer class transaction permission, if need to open contact Business Operation Center Operation@unionpay.com.

2 Create a folder and make sure that you have file write permission.

7. If you need to use the GBK encoding, please modify the code written in the codes and the code file itself to GBK.
8. About the configuration file loading problem: Sdkconfig.getconfig (). LOADPROPERTIESFROMSRC () This sentence is executed once the whole project is enabled, and the rest can be deleted. For example, you can build a servlet, call it when initialized, and load this servlet:InitServlet.java:public class Initservlet extends httpservlet{@ when it is set to start in Web.xml. Override public void Init () throws Servletexception {Sdkconfig.getconfig (). LOADPROPERTIESFROMSRC ()//load ACP from Classpath
	_sdk.properties file Super.init (); }} web.xml: <servlet> <servlet-name>InitServlet</servlet-name> <servlet-class>com.unionp


Ay.acp.demo.initservlet</servlet-class> <load-on-startup>0</load-on-startup> </servlet>

9. Log file path problem: Can rar open Upacp_sdk-1.0.0.jar, modify inside log4j.properties configuration path.



 10. Switch production, please be sure to look at the problem in the Https://open.unionpay.com/ajweb/help/faq/listByType?faqType=prod, especially the "switch production has to change the place" of this FAQ.

The project is completed.
Form_6_2_frontconsume.java is the corresponding gateway payment case code, change the following three lines of code can be used.




Run directly, you can see the last line of the console, print out the HTML code, copy it out, and put it in an empty HTML file.
 

In IE browser, you can see after running:



Enter the test card number mentioned in the previous article and click Next:


Input the parameters of the test information, you can complete the payment of 0.01 yuan, how it feels, is so simple.


For convenience, I provide the next gateway payment case Code link for everyone to download. Case code


problems encountered in testing1. Run the Java Code console error, please confirm that your test certificate is configured. ######################## #签名证书配置 ################################
###### (The following configuration for the test environment: network test environment, production environment configuration see the following document description)) #######
# #签名证书路径
Acpsdk.signcert.path=d\:\\certs\\pm_700000000000001_acp.pfx
# #签名证书密码
acpsdk.signcert.pwd=000000
# #签名证书类型
Acpsdk.signcert.type=pkcs12

There must be a corresponding certificate file in the path configured above. The certificate can be downloaded in the case code on the official website.

2. Java run after the resulting HTML browser opened after the following error prompts:


The answer code on the online search is as follows: List of answer codes

"Affiliated system:" Full channel

"Answer code:" 5131008

Answer code Description: No permission for this transaction

Solution:

WAP and gateway payment will be reported this error, for not open permissions. If you are using a real merchant number, please contact the contracted business or business operations Center to apply for open access. If you are using a self-service platform merchant number, you need to choose to test this product, the method is: the upper right corner-my product-not tested, in the Jump Gateway Payment/Mobile Web page payment point to start testing, click 10 minutes after the entry into force.

Action steps are as follows:

Click Start Test.







Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.