Aug 29, 2014 12:28 PM|gerrylowry|LINK
for my c# ASP.NET MVC5 website, Paradigm Mentors, i decided to use PayPal's new-ish REST API.
as Rob Conery pointed out in 2009, one should at least learn ASP.NET MVC (1).
Rob Conery and others discussed the RESTful nature of ASP.NET MVC in a number of articles (2).
although the PayPal documentation for its REST API imho leaves much to be desired, i was able to get it working. (notes, 3)
one of my core values: "Learning only has true value when it’s shared."
i created five free videos, notes, and a free sample demo (c#, ASP.NET MVC5, EF 6 Code First).
While testing the sample demo, i discovered a number of api design flaws ... most of these are related to throwing exceptions when imho exceptions should not be thrown.
FWIW, i suspect that part of this weakness is that PayPal's REST API architect(s) want to leverage the same code base over multiple platforms; imho, for a gazillion dollar company like PayPal, that's unnecessary frugality.
(a) for a PayPal transaction to be successful, the ASP.NET MVC needs to get an access token; in fact, the best practice is to get two access tokens per single transaction cycle; unfortunately, whenever the PayPal library fails to retrieve an access token,
it clumsily throws an a exception.
(b) the PayPal documentation defines an amount as "digits" or "digits.cents" but fails to clairify that 1234.56 is valid while for 01234.56 it throws an exception; hmmm ... seems to me that zero is also a digit.
instead of throwing unnecessary exceptions which can kill a production application, imho PayPal needs methods with signatures like this:
public Int32 PayPalRESTapiMethodX(p1, p2, ... , out List<String> errorList); // return zero for success; else error code
From my point of view, the best generic design principle is "NEVER, if at all possible, throw an exception".
imho, throwing unnecessary exceptions is an absence of grace.
2. "asp.net mcv restful" http://lmgtfy.com/?q=asp.net+mcv+restful
3. notes&links: https://g47.org/cash