Skip to main content

Posts

Integrating Paypal Payment Pro (Direct Payment)

I've recently had need to integrate PayPal payments on a website, using their Payments Pro interface. It's actually very straightforward, although initally didn't appear so as the information they provide on their website and forums is rather confusing. This is primarily due to the different versions of their API that have been provided historically, plus there are a number of different techniques to access it. All I need was a simple request to authorise a set of card details, getting back a response to allow the order to either be processed appropriately. Pulling together with my own code a few different examples online, the Paypal documentation and some advice from their technical support led me to this function - which I'll post in the hope of helping rather than hindering someone else in the same position!     1   private void makePayPalPayment()     2  {     3    //Open log file    ...

MVC/Jquery Calendar

One of the main pluses of working with the ASP.Net MVC framework is of course the separation of concerns it promotes with the split between the controller and the view in the UI. This is not only apparent in the standard method of having the controller obtain the data required for display, and passing this to a view for display as XHTML. The same clear separation of purpose can be made use of when the output of the view is other formats too. In a recent project I've had need to represent a calendar of events - a simple side bar to the website that displays a calendar view with days that have events associated with them highlighted. Clicking on the day displays the list of events below. In implementing this feature I made use of the controller and view pattern in three distinct ways. Having a controller render an XHTML page view Having a controller render JSON data for use from an AJAX request . Having a controller render a partial view to support an AJAX page update . Applicat...

Validation Framework with MVC Support (Part 2) - Tests

Following on from the previous post describing a validation framework I'm planning to use on MVC projects, this post extends the development to incorporate a range of tests. To recap, I've set up a domain model structure that consists of: Entities - simple classes representing the fields and relationships of my business objects. They consist of properties and methods that act only on those properties (i.e. they have no external dependencies. Repository layer - a number of data access methods that provide CRUD methods for retrieving and data from the database and instantiating the entities, and persisting their changes back. Service layer - a layer consisting of methods that sit between the UI and repository layer, passing method calls and objects in between. These classes combine to provide validation at three levels: Entity validation - these are C# methods defined on the entity object itself to internally validate its fields. They will consist of checks for required fields...

Validation Framework with MVC support

The most recent project I've started to work on is going to require a number of web front-ends for a business. There will be a single database, from which information will be drawn and written to in various ways on the different websites. This situation suggests a robust means of applying and enforcing business rules and validation within a common business logic layer ; promoting code re-use across the sites and avoiding the maintenance headache of having rules in the UI layer. Due to a delayed start of the project, I've had a bit of time to investigate some different options to solve this - and to have a hard look at some of the techniques that have been used in the past where, if I'm honest, this wasn't always best achieved. CSLA.Net Firstly, I spent a bit of time with CSLA.Net . This is a robust, tried-and-tested framework for implementing your business objects. It's very powerful and I'm sure would prove a good solution. However in the end I decided aga...