sample code configurations

prasadjc
Regular Visitor

sample code configurations

where do I get the following parameters to make it success the test case execution.

// Configure HTTP basic authorization: basicAuth
apiClient.setUsername("YOUR USERNAME"); // from Project Certificate & Credentials in credentials page

apiClient.setPassword("YOUR PASSWORD"); // from Project Certificate & Credentials in credentials page
apiClient.setKeystorePath("YOUR KEYSTORE PATH"); // where should I get it?
apiClient.setKeystorePassword("YOUR KEYSTORE PASSWORD");// where should I get it?
apiClient.setPrivateKeyPassword("YOUR PRIVATEKEY PASSWORD");// where should I get it?

4 REPLIES 4
API_Products
Visa Developer Support Specialist

Re: sample code configurations

Hi @prasadjc,

 

To setup your project, please follow the step by step instructions in Working with Visa APIs - https://developer.visa.com/pages/working-with-visa-apis

 

To learn what authentication code you need for your project based on the APIs you are using visit this link - https://developer.visa.com/pages/working-with-visa-apis/two-way-ssl

 

For username and password, you can access this information from your project Dashboard.

 

Credentials dashboard.png

 

Your keystore path will be where your keystore file is saved on your local machine.

 

Your keystore password and private key password was the password you created/provided during CSR creation.        

 

Don't forget to click on the Accept as Solution button once you've received assistance and your question has been answered.                    




Thanks,

Diana



Was your question answered? Don't forget to click on "Accept as Solution" to help other devs find the answer to the same question.

prasadjc
Regular Visitor

Re: sample code configurations

Hi Diana,

Thanks for the reply.

I am facing the problem while executing the test case  from payment_account_validation_api with the following error.

 

org.springframework.web.client.HttpClientErrorException: 400 Bad Request
at org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:63)
at org.springframework.web.client.RestTemplate.handleResponse(RestTemplate.java:700)
at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:653)
at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:628)
at org.springframework.web.client.RestTemplate.exchange(RestTemplate.java:602)
at com.visa.developer.sample.payment_account_validation_api.ApiClient.invokeAPI(ApiClient.java:735)
at com.visa.developer.sample.payment_account_validation_api.api.PavApi.postcardvalidation(PavApi.java:101)
at com.visa.developer.sample.payment_account_validation_api.api.PavApiTest.postcardvalidationTest(PavApiTest.java:86)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)

 

 

I have created the certificate using the keytool with the following commands (jmYYPA7uxlR5O520z823psih29  is the password from credential page, I have used the same password for creating client certificate). 

 

keytool -genkeypair -alias client -keyalg RSA -keysize 2048 -keystore clientkeystore.jks -storepass jmYYPA7uxlR5O520z823psih29 -keypass jmYYPA7uxlR5O520z823psih29 -dname "CN=PPWallet, OU=P2P, O=PP, L=Bangalore, ST=Karnataka, C=IN"

keytool -certreq -alias client -keystore clientkeystore.jks -storepass jmYYPA7uxlR5O520z823psih29 -keypass jmYYPA7uxlR5O520z823psih29 -file certreq.cer

keytool -import -alias ejbca -keystore clientkeystore.jks -file VDPCA-SBX.pem -storepass jmYYPA7uxlR5O520z823psih29 -keypass jmYYPA7uxlR5O520z823psih29

keytool -import -alias vptop -keystore clientkeystore.jks -file cert.pem -storepass jmYYPA7uxlR5O520z823psih29 -keypass jmYYPA7uxlR5O520z823psih29

keytool -import -alias cbproj -keystore clientkeystore.jks -file DigiCertGlobalRootCA.crt -storepass jmYYPA7uxlR5O520z823psih29 -keypass jmYYPA7uxlR5O520z823psih29

 

API_Products
Visa Developer Support Specialist

Re: sample code configurations

Hi prasadjc,

 

Keystore generation looks incorrect. Please follow the instructions given in the below link to create a key store. Once the key store is created, kindly test it using SOAPUI as per the instructions in the below link to make sure it is correct. Then validate the same using the code.

 

https://developer.visa.com/pages/working-with-visa-apis/two-way-ssl#configuring_a_twoway_ssl_keystor...

 

 




Thanks,

Diana



Was your question answered? Don't forget to click on "Accept as Solution" to help other devs find the answer to the same question.

API_Products
Visa Developer Support Specialist

Re: sample code configurations

Hi prasadjc,

 

Just checking in to see if your issue is resolved. Can you please confirm if you need further assistance?

 

 

 




Thanks,

Diana



Was your question answered? Don't forget to click on "Accept as Solution" to help other devs find the answer to the same question.