So, here's my challenge: I have to build a webservice which handles payments using PayPal... The SOAP way! Since I'm a Node developer I'm very familiar with REST but the challenge is that I have to build it with Java, XML-schemas and SOAP using the Spring-framework.
Now I found this workflow when using REST: https://devtools-paypal.com/guide/pay_paypal/java?interactive=ON&env=sandbox.
That looks easy as pie to me! But what would this workflow look like when using SOAP and how would you implement this. As in: How do you handle redirects and responseURLs? Or is the workflow different?
P.S. I know PayPal has lots and lots of documentation but when it comes to SOAP, I just can't figure out the workflow or how to handle responseURLs..
Thnx in advance!
I'm going to assume you want to implement Express Checkout.
The flow is basically the same, different endpoints, but same steps. You can see the workflow here:
https://developer.paypal.com/docs/classic/express-checkout/ht_ec-singleItemPayment-curl-etc/
Just reference the diagram. Everything below isn't specific to SOAP.
In brief, the flow looks like this:
1: Call SetExpressCheckout to get back a token.
2: Redirect to PayPal using token obtained in step 1.
3. If user accepts checkout then call GetExpressCheckoutDetails to get transaction details.
4. Use Token and PayerID (obtained in step 3) in call to DoExpressCheckoutPayment to capture payment.
Here's a good place to start: https://developer.paypal.com/docs/classic/api/#ec
The first snag I ran into when implementing the SOAP API versus the REST API was that I couldn't find anywhere in the documentation where to find the redirect URL. The REST API will send it back, the SOAP does not. I had to dig through some of the SDK files to find it.
Redirect to here: https://www.sandbox.paypal.com/webscr?cmd=_express-checkout&token=
Related
How to find the correct json schema to post to the magento endpoint and create an account?
Am able to create account only from the front end, I need to be able to do from the backend using curl or Postman.
http://{ipaddress}/index.php/customer/account/create/
This is an external api , i need to consume.
I want to post to this end point from java, however am not able to find the correct request schema of the json endpoint.
Any help to find the swagger end point or schema would be great
I am assuming you are talking about magento 1? Have you tried the REST API by chance? It's well written out on how you should make a call to it here.
If you need more functionality than just creating an account, you can also take a look at the SOAP API which handles more things, but does not support JSON from the box. They did implement the WS-I complaint mode to support Java calls, so maybe that's something you'd be interested in as well.
Good luck!
I am trying to create a Java wrapper for Vtiger REST API. I want to avoid the use of vtwsclib library because I could not find its Maven artifact. I want to use Spring RestTemplate. Actually, I don't understand why I need some special library to access REST API of a webservice.
First a got into problem with login process. Even when I followed the instructions from this link, I was not be able to retrieve sessionName. Finally, I resolved it after some research of vtwsclib library.
Next problem is with the retrieve operation. Even when I had sessionName and tried to retrieve some object by id with request (a ticket I can see in client app)
GET .../webservice.php?operation=retrieve&sessionName=xxxxx&id=xxxxx
I got:
{"success":false,"error":{"code":"ACCESS_DENIED","message":"Permission to perform the operation is denied for id"}}
Last problem is documentation, even when I visited their wiki Vtiger WIKI I could not find attributes of Ticket entity to create fields map.
So the work with this API is a bit painful for me. My questions are:
Is there some tutorial how to obtain sessionName using only Spring RestTemplate?
Why retrieve operation failed? update: bad id format
This is the main question. Is there some better documentation (tutorial, blog, file, ect.) for Vtiger REST API and descriptions of objects like Ticket?
I am also using Spring RestTemplate for Vtiger rest api.
For Retrieving details of record using REST API we need to pass id as moduleId x recordID (2x1234) format, otherwise it will give ACCESS_DENIED Error
I have studied the java in app billing code snippet at
https://developers.google.com/in-app-payments/docs/tutorial
and I am unable to use it to make my application capable of doing in app payments.
My first question is how do I set up a servlet to handle payment requests. Do I put the getJWT() method in the servlet and call it from the doPost() method?
My second question is what do I do with the String that getJWT() returns? It should be the json object that holds the purchasing information, but I don't know how the jsp file I have should process it.
I have searched for example code using java servlets and jsps to study but found none. I have found python code, but I can't translate python into java yet. If anyone knows of an example (complete) of google in app billing using java servlets and jsps I would appreciate it if you could post a link also.
Thank you.
On the server you need an HttpServlet derived class that takes the order request (in doPost()), calls the JWT libraries together with the Seller Secret to generate the signed JWT string, then returns the result in the response.
On the client side in the HTML page you can use a templating system (e.g. AppEngine + JSPs) or Ajax calls to your servlet to get the generated JWT.
The generated JWT is one of the paramenters to the goog.payments.inapp.buy() JavaScript API.
Below is a simple AppEngine Python implementation of In-App Payments. You can re-use the client-side code and replace the server-side with the Java implementation:
https://code.google.com/p/iap-python/
So what I need is basically to create a java program that runs from command line and will continue to run until I decide to stop it. The goal of this program is to read email from a particular email address and create JIRA tickets using the contents of the email.
IE: subject of email will be title. Body will be description. Etc...
I am getting confused with how to go about with the design of how to do this. I know I can use JavaMail to gain access to the emails right? Then I just have to parse the email. But other than that I am a little stuck on how I should be making the JIRA Ticket
Thanks!
Your problem is an ideal use case for esb like mule or spring-integration. Basically these eip frameworks provide all building blocks you just need to connect.
First you need to define mail inbound. This component will automatically connect to an mail inbox and fetch all new messages.
Then define a transformation from e-mail message to json object. Finally POST that object using HTTP outbound. You can create ticket in JIRA using /rest/api/2/issue API method.
whole workflow can be implemented almost without coding. Of course you can do everything manually (using javamail and httpclient), but then threading, error handling and retrying is up to you.
For the future - if you're confused what requests are sent and so on - use Google Chrome.
Press Ctrl+Shift+I->Network and make request. If you need to login before etc. it is the same.
For handling HTTP requests (POST, GET, etc.) I recommend to use HttpClient or if you need to use JavaScript HtmlUnit.
So answer is this:
- Track what requests are made when you do certain things via web browser
- implements the same in Java code using HttpClient or HtmlUnit
I'm new to web services and I've been breaking my head trying to find a simple java SOAP client program on the Internet.
All I want to do is send a SOAP message and receive back some response.
There is a website which offers free web-services.
http://www.webservicex.net/ws/WSDetails.aspx?WSID=17&CATID=7
You feed in the country name and it gives you the country's ISD code. It's as simple as that.
I want to send the country name to the web service and get back its ISD code using only Javaand without any external jars.
Try SoapUI - it's quite awesome and covers almost all aspects of working w/ web-services..
If you're looking for a tool to test web-services, most people I know use Soap-UI: http://www.soapui.org/