Refactoring The iATS Drupal Commerce Module

Posted by Thinkshout Drupalgive on April 15, 2014 at 7:00am

Last month, we wrapped up a project for nonprofit-oriented payment processor, iATS Payments. iATS Payments wanted to invest in gaining wider adoption of their services and enlisted ThinkShout's help in building a PHP wrapper for their existing SOAP API.

Being a bunch of software engineers who have implemented our fair share of APIs (both good and bad), we knew we had to achieve certain goals if we were going to ease the adoption of iATS Payments within PHP applications:

  • Comprehensive: The wrapper handles all communication with the iATS Payments SOAP API, validation of API calls, and error handling.
  • Well documented: We made use of phpDocumentor to generate easily browsable documentation from our code comments.
  • Reliable: Via a comprehensive test suite covering every API call written in PHPUnit.

With the new PHP wrapper finished and unit tests passing, our attention shifted to the project we felt would most benefit from the work we'd done: the Commerce iATS Drupal module. This module leverages Drupal Commerce to facilitate payment processing via iATS Payments on any Drupal website.

We had already integrated Commerce iATS into some of our clients' websites, so we knew it was a great module, but it was written before there was a standard iATS Payments PHP wrapper and contained some unwieldy code that could be eliminated by using the new PHP wrapper. With support from the community and sponsorship from iATS, we rewrote the module, drastically reducing complexity, which any engineer can appreciate, and improved stability, which site owners love even more. We're excited to replicate the success of our partnership with MailChimp, which created a win for the community, the vendor, and, yes, ThinkShout.

Refactoring Commerce iATS

In refactoring Commerce iATS, we didn't just plug in the PHP wrapper and call it a day. While Commerce iATS was originally written with support for only credit card payments, our PHP wrapper supports all payment methods provided by iATS Payments and we wanted to make sure Commerce iATS had room to grow and take advantage of those payment methods.

Some of the problems

Looking through the code of the existing Commerce iATS module, we realized the current design would not scale well as we added additional payment methods.

As an example, take a look at the 2.x-dev release of Commerce iATS.

Here the function commerce_iats_soap_process_submit_form_submit() is being used to handle a lot more logic than a form submit handler ideally would. Breaking it down:

A lot of code in commerce_iats_soap_process_submit_form_submit() is later duplicated when commerce_iats_customer_code_charge_submit_form_submit() is called.

The refactor

We set out to redesign the module's architecture and rebuild it with modularity and expansion in mind. Here's what we did.

Created a new standard payment processing function

  • This function handles the API call, response handling, transaction creation and logging.
  • To handle multiple payment methods, the function accepts a callback function as a parameter. This callback function is the function that makes the API call via the PHP Wrapper and returns the response.

The first lines of commerce_iats_process_payment() demonstrate how the callback function is used:

<?php
function commerce_iats_process_payment($payment_method, $payment_data, $order, $charge, $payment_callback) {
  // Process the payment using the defined callback method.
  $response = $payment_callback($payment_method, $payment_data, $order, $charge);

Broke payment methods out into their own include files

As an example, here's the credit card payment method. Each payment method file contains these standard Commerce functions (where credit_card is the payment method:)

  • commerce_iats_credit_card_settings_form()
  • commerce_iats_credit_card_submit_form()
  • commerce_iats_credit_card_submit_form_validate()
  • commerce_iats_credit_card_submit_form_submit()

Then we added our own callback function, commerce_iats_process_credit_card_payment().

The callback function handles building the API request and getting a response from the API. To show how this works, here's a line from commerce_iats_credit_card_submit_form_submit():

<?php
return commerce_iats_process_payment($payment_method, $payment_data, $order, $charge, 'commerce_iats_process_credit_card_payment');

As you can see, all the payment information from the form submit handler is being passed into commerce_iats_process_payment(). That function then calls the callback function commerce_iats_process_credit_card_payment() to make the API call and get the response.

This design is very easy to extend and allows us to add as many additional payment methods as we need in a very clean way. We were able to use this design to implement Commerce Card on File as a submodule of Commerce iATS, eliminating that dependency from the base module.

Roadmap and next steps

All our work on Commerce iATS is currently available in the 2.0-beta1 release. Please take a look and let us know if you have any feedback.

We're already hard at work along with our partners at iATS Payments to integrate more of their payment processing facilities into the Commerce iATS module. While the module currently only supports credit card payments, ACH/EFT and Direct Debit payments will arive before DrupalCon Austin. Speaking of, both ThinkShout and iATS Payments will be attending and spending some time at the iATS booth, number 508. Come find us to say hello and talk some e-commerce.

Keep an eye on the Commerce iATS project page and this blog for more updates.

Keeping Open Source Open

Posted by Chapter Three (Drupalgive) on April 14, 2014 at 4:42pm
Presenter:  Mark Ferree Location:  OSCON Room Number:  E144 Date & Time:  July 23, 2014 - 10:40am Teaser: 

What happens to an open source community full of hobbyists when the project cleans up its pile of spaghetti and chooses to adopt widely held programming paradigms and systems?

It is assumed that to contribute to a piece of open source software the first thing you need to know is how to write code. The early contributors to the Drupal project were all developers and due to the incomplete nature of the software they all had to be able to contribute their own code to make the system fit their needs. This typical pattern continued until a rubicon was passed. Suddenly the tool had become complex and complete enough for someone without a programming background to set it up, configure it and create a non-trivial site with it. At this point the nature of the community changed forever. Suddenly there was a vocal group that wanted the system to work in a certain way, but didn’t have the skills themselves to make it do what they wanted on their own.

How did the Drupal community adapt to support a growing community of users who aren’t able to contribute directly to the software’s code?

I will examine the steps the Drupal community took to include these users in the project. Some efforts have failed, others have succeeded in unexpected ways. The end result has been a community that has historically included as many self-taught amateurs as it has professional developers.

I will also look at Drupal 8 and what it may mean for these efforts. Drupal 8 can be seen as a professionalization of the project. Spaghetti has been replaced with well-designed object oriented systems. Standards have been applied, outside projects included and more predictable and rigid systems have come to replace the easily hackable ones.

What does it mean for a community full of hobbyists when the system they rely on adopts paradigms that may be more difficult for them to understand? How has the Drupal community responded to the needs of the hobbyists? What does this mean for the future of Drupal?

Dropcamp 2014

Posted by Triquanta Drupal Give on April 14, 2014 at 8:04am

Triquanta is silver sponsor of Dropcamp 2014.

Events we've sponsored and helped organizie http://dropcamp.nl/

Don't Let Crappy Content Ruin Your New Site

Posted by Chapter Three (Drupalgive) on April 7, 2014 at 11:54pm
Presenter:  Nica Lorber Location:  SF Dug Date & Time:  May 12, 2014 - 6:00pm Teaser: 

Nothing is worse than delivering a sparkling new site full of promise and seeing it ruined with crappy content. The best designed sites can be wrecked with blurry imagery, TLDR* copy, and incorrect use of styles.

Nothing is worse than delivering a sparkling new site full of promise and seeing it ruined with crappy content. The best designed sites can be wrecked with blurry imagery, TLDR* copy, and incorrect use of styles.

In this session, I’ll cover factors that contribute to crappy content implementation and the steps we can take to avoid them. I will share deliverables that close the gap between site launch and maintenance.

I will cover:

  • Teaching clients to write for the web Improving usability through editing
  • Creating flexible layouts
  • Creating content guidelines unique to your Drupal site's architecture
  • Creating guidelines for responsive sites
  • Tools of the trade

This session will be hosted at: 

Pantheon Systems

717 California St, 3rd Floor, San Francisco, CA (map)

*Too Long Didn’t Read

Catalyze your creativity and save time and money with open tools and resources

Posted by Chapter Three (Drupalgive) on April 7, 2014 at 8:36pm
Presenter:  Darius Garza Location:  Stanford Drupal Camp 2014 Date & Time:  April 19, 2014 - 1:00pm Teaser: 

In an ideal world we would be able to get the things we want immediately, in perfect condition AND at just the right price (preferably free). Unfortunately the real world of business doesn’t work that way. We have to make some compromises and choose the project parameters we value most, while sacrificing others.

Can you have it all?

In an ideal world we would be able to get the things we want immediately, in perfect condition AND at just the right price (preferably free). Unfortunately the real world of business doesn’t work that way. We have to make some compromises and choose the project parameters we value most, while sacrificing others.

Because of time and budgetary restrictions, clients are normally forced to pick from only two of the following three project goals - Fast, Good and cheap, while sacraficing the latter. It doesn't have to be this way anymore. Discover how open tools and resources are helping designers do the impossible and create amazing work despite their limitations.

 

Make it work

Open source design tools and resources can help designers break out of the "pick two" paradigm. Open resources enable designers to work more quickly with smaller budgets, but still deliver professional results.
In this session, we will discuss:

  • Brief history and introduction to copyright and licensing
  • Ways designers are using open licensing in their work and to empower others
  • How to find open tools and resources

 

Join me and learn how sharing our collective creative resources can help us be better designers and create something that is greater than the sum of its parts.

Don't let Crappy Content Ruin Your New Site

Posted by Chapter Three (Drupalgive) on April 7, 2014 at 6:13pm
Presenter:  Nica Lorber Location:  Drupalcon Austin Date & Time:  June 4, 2014 (All day) Teaser: 

Nothing is worse than delivering a sparkling new site full of promise and seeing it ruined with crappy content. The best designed sites can be wrecked with blurry imagery, TLDR* copy, and incorrect use of styles.

Nothing is worse than delivering a sparkling new site full of promise and seeing it ruined with crappy content. The best designed sites can be wrecked with blurry imagery, TLDR* copy, and incorrect use of styles.

In this session, I’ll cover factors that contribute to crappy content implementation and the steps we can take to avoid them. I will share deliverables that close the gap between site launch and maintenance.

I will cover:

  • Teaching clients to write for the web Improving usability through editing
  • Creating flexible layouts
  • Creating content guidelines unique to your Drupal site's architecture
  • Creating guidelines for responsive sites
  • Tools of the trade

 

*Too Long Didn’t Read

Lean Site Building

Posted by Chapter Three (Drupalgive) on April 7, 2014 at 5:59pm
Presenter:  Mark Ferree Location:  Stanford Drupal Camp 2014 Room Number:  Huang 203 Date & Time:  April 19, 2014 - 11:00am Teaser: 

When a lot of Drupal developers first approach a site they often have a particular distribution, set of modules, or approach in mind. Every site starts to look like the perfect candidate for your particular variety of Swiss army knife.

With over twenty thousand modules and dozens of distributions to choose from the total number of possible solutions for a site approaches the exponential.

When a lot of Drupal developers first approach a site they often have a particular distribution, set of modules, or approach in mind. Every site starts to look like the perfect candidate for your particular variety of Swiss army knife.

With over twenty thousand modules and dozens of distributions to choose from the total number of possible solutions for a site approaches the exponential.

I propose we take a step back and approach projects with these type of questions:

1. Is Drupal a good fit for this project?
2. How can we meet our requirements in the simplest way possible?
3. What high quality existing solutions in Drupal already meet my needs?
4. How easy will our proposed solution be to maintain?

It is easy to fall into the trap of shopping for modules and seeing available modules as 'free' features for your site. We should start by looking for what we can cut rather than what we can add to a site.

This type of approach produces smaller more-maintainable sites that are still chugging along six months after launch.

Wireframing Smarter

Posted by Chapter Three (Drupalgive) on April 7, 2014 at 5:51pm
Presenter:  Garret Voorhees Location:  DrupalCon Austin 2014 Date & Time:  June 2, 2014 (All day) Teaser: 

As the sites we build get increasingly complicated, the wireframing phase is increasingly important. Solving high-level usability challenges early in the process is saves time and money for you and your clients!

In this talk, I'll share the techniques and tools we use at Chapter Three to quickly produce high-quality wireframes and maintain your UX sanity.

As the sites we build get increasingly complicated, the wireframing phase is increasingly important. Solving high-level usability challenges early in the process is saves time and money for you and your clients!

In this talk, I'll share the techniques and tools we use at Chapter Three to quickly produce high-quality wireframes and maintain your UX sanity.

We'll also discuss:

  • How wireframing can be a vacation from designing
  • Using wireframes to test the usability of your website
  • Creating wireframes for responsive websites
  • Why paper is the most important tool
  • How you can learn to stop worrying and love Helvetica (again)

Drupaljam 2014

Posted by Triquanta Drupal Give on March 18, 2014 at 9:21pm

Triquanta is gold sponsore of DrupalJam 2014, build the event website and helped organize the event.

Events we've sponsored and helped organizie http://www.drupaljam.nl

April 2014 Southern Colorado Drupal Meetup

Posted by Monarch Digital Drupalgive on March 6, 2014 at 3:41pm
Tuesday, April 1, 2014 - 17:45BombBomb Offices

This will be a hands on meeting to get you up and running with a local Drupal development environment.

  • Do you need to quickly spin up local Drupal development environments?
  • Are you tired of manually configuring the LAMP stack for local development?
  • Do you struggle to remember all the best practices for local development?

Bring your laptop and your learning cap as we dig into vagrant, virtualbox, and chef.

We will start with a short (30min max!) presentation to introduce the concepts and then proceed to the hands on implementation. There is a vast amount of information and detail regarding these topics but we will do our best to get everyone up and running with a new local Drupal 8 development environment.

The following tasks can be completed on your own to prepare for the hands on portion.

We convene to eat and socialize starting at 5:45. The actual meeting will start sometime after 6:30. Oxbow Labs is providing the pizza. Monarch is providing the sodas.

Many thanks to BombBomb, who allow us to meet in their great room with shuffle board, foosball and beer!

p.s. Mark your calendar. DrupalCamp Colorado 2014 will be at the King Center in downtown Denver the first weekend of August.

View on meetup.comView on drupal.orgEvent Type: SCUGTags: Drupalgive

Presented at DrupalCamp London

Posted by Acquia Drupalgive on March 3, 2014 at 11:05pm

BOM Weather Lite

Posted by Creative Contingencies on March 1, 2014 at 11:02pm
Drupal Project

Show local Australian weather forecasts on your Drupal site.

March 2014 Southern Colorado Drupal Meetup

Posted by Monarch Digital Drupalgive on February 18, 2014 at 3:36pm
Wednesday, March 5, 2014 - 17:45BombBomb Offices Panels, panels, panels! Panels are a powerful tool for content layout in a Drupal site and the guys from Oxbow will show tips and tricks they use to make the most of panels. Wait. Panels alternatives, you say? What about Display Suite? Is Context really a layout function or is it really designed for something completely different? We convene to eat and socialize starting at 5:45. The actual meeting will start sometime after 6:30. Oxbow Labs is providing the pizza. Monarch is providing the sodas. Many thanks to BombBomb, who allow us to meet in their great room with shuffle board, foosball and beer! p.s. Mark your calendar. DrupalCamp Colorado 2014 will be at the King Center in downtown Denver the first week of August. View on meetup.comView on drupal.orgEvent Type: SCUGTags: Drupalgive

March 2014 Southern Colorado Drupal Meetup

Posted by Monarch Digital Drupalgive on February 5, 2014 at 9:46pm
Tuesday, March 4, 2014 - 14:44BombBomb Offices

Last month's meeting got snowed out. We're using our February agenda this month: lightning talks on a wide variety of subjects.

Bring your Drupal or technology problems, discoveries, accomplishments, or discussion topics. Each person will kick things off and we'll share, solve and discuss.

  • If he is in town, Jerad Bittner will talk about some recent project management experience with a large Lullabot client.
  • Winn Jewett has volunteered to give an overview of how Oxbox uses panels.
  • In contrast, we can demo Display Suite.
  • Perhaps David Csonka or some other Monarchian will demo using custom views plugins as validators.

We convene to eat and socialize starting at 5:45. The actual meeting will start sometime after 6:30. Oxbow Labs is providing the pizza. Monarch is providing the sodas. Many thanks to BombBom, who allow us to meet in their great room with shuffle board, foosball and beer!

Event Type: SCUGTags: Drupalgive

February 2014 Southern Colorado Drupal Meetup

Posted by Monarch Digital Drupalgive on January 30, 2014 at 4:20pm
Tuesday, February 4, 2014 - 17:45BombBomb Offices

This month, we'll have lightning talks on a wide variety of subjects.

Bring your Drupal or technology problems, discoveries, accomplishments, or discussion topics. Each person will kick things off and we'll share, solve and discuss.

  • If he is in town, Jerad Bittner will talk about some recent project management experience with a large Lullabot client.
  • Winn Jewett has volunteered to give an overview of how Oxbox uses panels.
  • In contrast, we can demo Display Suite.
  • Perhaps David Csonka or some other Monarchian will demo using custom views plugins as validators.

We convene to eat and socialize starting at 5:45. The actual meeting will start sometime after 6:30. Oxbow Labs is providing the pizza. Monarch is providing the sodas. Many thanks to BombBom, who allow us to meet in their great room with shuffle board, foosball and beer!

View on meetup.comView on drupal.orgEvent Type: SCUGTags: Drupalgive

Services Client 2.x

Posted by Acquia Drupalgive on January 20, 2014 at 2:41pm

DrupalCamp NJ 2014

Posted by Zivtech (Drupalgive) on January 14, 2014 at 10:39pm
DrupalCamp NJ Gold Sponsor Badge

"Join over 200 Drupal enthusiasts for a fun and informative one-day DrupalCamp on the campus of Princeton University. Whether you are new to Drupal or a pro, you'll learn more about the platform, how to use it best, and how to enhance it further, as well as to network with other members of the NJ Drupal Community."

 

Contributor(s):  Alex UA David Hamme Howard Tyson Jody Hamilton

Drupal Camp Ottawa 2014 Sponsorship

Posted by OpenConcept (Drupalgive) on January 14, 2014 at 3:40am

Once again we're happy to sponsor Drupal Camp Ottawa. We'll have more posts on this soon.  There are a number of sessions we're looking forward to presenting and as always look forward to meeting with others in the Drupal community to work together to strengthen the code that glues us together.

Link to project: Drupal Camp Ottawa 2014 SponsorshipContributor role: MaintainerContributor: mgifford

Place blocks inside your content with EBA

Posted by Computerminds Drupalgive on January 13, 2014 at 1:34pm

Previously on this website I have written about rendering blocks programmatically and adding things to content to be managed alongside fields. It's time to combine the two! On many projects, we find ourselves needing to render a block consistently across all content of a certain type. For example:

  • Are you trying to place advertising blocks or fixed javascript code between the fields in the content of a page, not just shoved into regions around the content?
  • Do you want to show a standard piece of content (we use the bean module for enhanced content in blocks) to be placed on all content of a certain type, perhaps explaining about products on a brochure site or how to use webforms?
  • Would you like to show lists of links (perhaps as menu blocks) on user profiles as helpful links to common destinations?

Organized Global Sprint Weekend, Boston

Posted by Acquia Drupalgive on January 3, 2014 at 3:13am

Pages

Subscribe with RSS Subscribe to Drupal.org aggregator - Drupalgive Planet