Integrating Paypal with .Net Core 3 - .net-core

I have a .Net Core 3 project and I want to integrate Paypal.
In past projects I was using Paypal package, but now I was reading their documentation and they recommend to use version 2 of their API. (Previously I was using version 1 with Paypal SDK). If I go to the nuget.com and check the Paypal package I see that version 2 of this package is still rc:
Version Downloads Last updated
2.0.0-rc2 143,570 2018-04-12T18:17:40Z
Now it has been almost 2 years in this, so it doesn't look promising. If I check their docs again I find that they recommend using following package: PayPalCheckoutSdk. Link to their docs. If I try to copy-paste an exampe it doesn't even compile (mainly due to some properties renamed). This really doesn't give a lot of confidence in using this package at all. My last resort would be just to call paypal API directly without using their provided SDK.
What is the best way to integrate paypal with my server running on .Net Core 3.1?
Options:
Use paypal 2.0.0-rc2
Use PayPalCheckoutSdk
Call API directly

Call the v2/orders API directly.
Server-side create: https://developer.paypal.com/docs/api/orders/v2/#orders_create
Server-side capture: https://developer.paypal.com/docs/api/orders/v2/#orders_capture
Follow the PayPal Checkout integration guide and make 2 routes on your server, one for the 'Create Order' and one for 'Capture Order' (see the optional step 5 in 'Add and modify the code'). Both of these routes should return only JSON data (no HTML or text). Inside the 2nd route, when the capture API is successful you should store its resulting payment details in your database (particularly purchase_units[0].payments.captures[0].id, which is the PayPal transaction ID) and perform any necessary business logic (such as sending confirmation emails or reserving product) immediately before forwarding your return JSON to the frontend caller.
Pair those 2 routes with the frontend approval flow: https://developer.paypal.com/demo/checkout/#/pattern/server

Related

Workflow for Pact Testing in Feature Branches

I'm currently experimenting with Pact and stumbled over a problem with the workflow and can't find a satisfying solution. So hopefully someone can help me. :-)
First of all, that's my current workflow for changes on the consumer side:
The consumer changes are uploaded to Github in a feature branch
Pact tests are run on the CI system and the resulting pact is uploaded to the pact broker with the tags [feature-branch-name] and verify_feature (currently I only use the latter one)
The consumer waits for the verification (using the can-i-deploy tool)
The pact broker triggers the provider via webhook (trigger: contract_content_changed)
The provider runs pact-verify for the latest version tagged verify_feature and uploads the result
The consumer checks the result, if verification was successful the branch can be merged
So far so good. The problem arises when the consumer introduces breaking changes:
After the consumer uploads the changes to Github, the process described above is executed and the provider verification fails which in turn causes the consumer build to fail as expected.
Now the necessary changes are made on the provider side. The provider runs pact-verify against the consumer version of the testing stage and - if successful - the new version is then merged and deployed.
Now the new consumer version should be able to be merged as well. Alas, it does not work, because this version has not been verified again. And when I restart the CI job, the pact is re-uploaded to the pact broker, but since the pact content does not change no webhook is triggered. The consumer version is never verified.
So, what am I doing wrong?
You need the new WIP pacts feature. It's currently under development, and could be available for beta testing in pact-js (and other languages that wrap the pact-ruby-standalone) within days if you wanted to try it out. If you're using pact-jvm, you'll have to wait a little longer, but we may be able to provide a work around. I've written a blog post on WIP pacts, but haven't published it yet because the feature is not ready for public release. You can find the post here http://blog.pact.io/p/51906e22-ccce-486b-9993-c21794e557d4/ I'd love to get your feedback on it.
Hop on to slack.pact.io and # me if you'd like to chat further about this.

OSB Proxy Based Logging

Is there any way to create separate log files based on Proxy services?
http://carlgira.blogspot.in/2014/07/osb-custom-proxy-logging.html
The above url provides some info. But that seems not working. We require something as in what is described in url.
The report is a way to do it, but if you are going to use that option i would recommend to create a custom report provider.
The solution on the blog (the blog entry is mine) tries to use a startup-class of weblogic to modify the order of the loggers so you can add a custom one, before the real one.
There is a second blog entry with more detail and the complete maven sources in github.
The blog entry http://carlgira.blogspot.com.es/2015/05/weblogic-filter-logs.html
The github sources https://github.com/carlgira/soa-utils/tree/master/weblogic-custom-logging
If you want to log the request and the response for single proxy service , then you can go for Report Action.
Here , you can do reporting for single operations and proxy service.

Methods to AutoRefersh RSS on Android?

Hello I'm currently new to android and I'm trying to make a simple RSS application on android.
I've put a together all basic aspects of the application as the parser and fetching the RSS through Http connection through ASyncTask as well as displaying the data in a listView.
How can I refresh the RSS feed (Google News) without starting the application ?? What is the best method for it (Push/Pull) and a simple explanation on implementing?? Thanks.
Option 1:
Implement AlarmManager which will start background service every specific time, complete action and go to sleep until further call.
https://developer.android.com/training/scheduling/alarms.html
Option 2:
Use Google Cloud Messaging (server sends your phone data which triggers app/service to start) and do action. However I don't think this is required unless you want it to get new data when it's available rather than every specific interval.

pubsubhubbub - What is the difference between sync and async when sucribing to a feed?

I am trying to implement pubsubhubbub as a subscriber to https://pubsubhubbub.appspot.com/
When it comes time to subscribe via the debuger the field verify type offers 2 possibilities:
asynchronous
synchronous
Unfortunately the section 5.2 subscription validation from PubSubHubbub Core 0.4 -- Working Draft doesn't give details about the verify type.
Does sync/async make any difference for the callback script when sucribing to a feed via pubsubhubbub ?
PubSubHubbub 0.4 brings many updates and enhancements.
Among them:
Breaking change: “sync” mode of subscription verification has been removed.
Anf for information:
*hub.verify_token, permanent subscriptions and Hub-initiated subscription renewals have been also removed.*
from: https://groups.google.com/forum/#!msg/pubsubhubbub/7RPlYMds4RI/2mIHQTdV3aoJ
Answer: It makes no more difference now, just use async as verify type.

Post to another site with Java EE

We are implementing support for punchout/oci which follows this basic flow:
Our procurment system opens a new tab/window to an external webshop and in our request we append a parameter called HOOK_URL. When the user finishes the external site will redirect to the hook_url and perform a post. example here:
http://help.sap.com/saphelp_crm20c/helpdata/en/30/67483936dd7607e10000000a11402f/content.htm
That system is a black box for us and we are basically just supposed to retrieve the post then process the form data into whatever information we need and send it on its way through our business logic.
So I need to build a simple Test application that can play the role of an external webshop and I need our system to send and receive.
We are using servlet 2.5, JSF 2.0, and CDI. But I'm guessing that I'll be needing a good old servlet or two for this purpose.
So far what I've got is:
procurment system perform window.open and send to test system
Test system presents a very basic html page and posts to a simple servlet that redirects to hook_url
procurment system get's the response
But what I can't figure out how to do nicely is to actually perform the post? When I recieve the response from the test system it's a totally new request. And must I use servlets?
I have tried to follow some guides but the examples map to poorly. It must be a Post by specification.
cheers
Solved by using apache http and url connections

Resources