Blog

Dec
14

Integrating CBA’s BPOINT gateway using ActiveMerchant

Recently a client of ours wanted to use the Commonwealth Bank of Australia (CBA)’s BPOINT gateway for their web application. The first thing we do is usually turn to ActiveMerchant to see if there is already a gateway class for the merchant. In this case we couldn’t find a gateway class or anything or any sort of implementation in ruby.

So today we’re releasing our open source BPOINT plugin for ActiveMerchant. Installation instructions and usage are available at the GitHub project page: https://github.com/Sentia/activemerchant-bpoint.

It’s very simple to setup and use, good luck and enjoy.

Aug
03

Sublime Text 2 the next text editor in your toolbox

Posted by Michael Cindric in development, mac osx, ruby on rails | No Comments »

So i have decided to try out Sublime Text 2. Now l have been a Textmate user for a number of years now but the speed in which you can find files and the way it handles large files such as log files or csv’s for example has always been an issue and one of the guys here at Sentia suggested l try Sublime as he is also in the process of giving it a go as well.

So there is a Beta 2 out now which l promptly downloaded and fire it up. Now l have to say that its fantastic. Its super fast and easy to use. Sure its missing some of the little things that Textmate has that makes life easy such as the rails bundles etc but you can actually download and install ported bundles from textmate that users have ported across.

The UI is clean and simple to use and the fact that you can change almost every setting in the app and also with the full screen feature its hard to beat.

The search is the best feature hands down. Its super fast and simple to use and you never get caught again hitting apple + T and find out later that you have typed some of your search letters into a random ruby file you had open at the time.

Here are some screen shots of how clean the UI is in full screen mode and the search tool

p.s One thing that you will be missing is the

mate .

Command but not to worry simply add the following

alias sub='open -a "/Applications/Sublime Text 2.app"'

to your .bashrc or .profile file and you can open projects the same you would have in textmate in sublime but with the following command

sub .

Also worth the license is cross platform so no more buying multiple licenses.

Jul
31

One Big Switch launches

Posted by Michael Cindric in client projects, development, ruby on rails | No Comments »

The CHOICE big bank switch which is powered by One Big Switch has hit the web in a big way. One Big Switch uses the power of group switching to help consumers pay less for their regular household bills, in a quick, easy and obligation free way.

So be sure to check it out at One Big Switch

Oct
20

Sentia playing host for Hack Night

Posted by Michael Cindric in ruby on rails, sentia | No Comments »

Sentia is happy to announce we are hosting the next Hack Night for the Rorosyd group. The night is being tailored to helping out people who are newer to rails with the use of mentors. Sentia is also providing along with the use of its office space the beer for the event which we all know helps the code flow easier.

For more info check out the user group here

Apr
09

Learning Ruby On Rails

Posted by Michael Cindric in development, ruby on rails, Tutorials | No Comments »

Hey spoken to a few developers mainly UNI grads who are looking to get into rails and they often ask whats the best way to do so. So l thought l would put together a list of resources they can use to get up to speed.

If anyone else knows of some other ones please let me know

== General Practices ==
Dev on a Mac
Read up on TDD (Test Driven Development)
Use Growl for your Autotest notifications
TextMate – The only Editor you need
GitHub – Great space to see open source code and gems and plugins
http://gemcutter.org/

== Rails Setup ==

http://hivelogic.com/ – Has some great tutorials on getting your environment setup on a mac.

== Tutorials ==
http://rubyonrails.org
Rails Casts – Ryan Bates screen casts about all things rails related
PeepCode – Great screen casts about all things rails related

== Blogs ==

Sentia Blog
http://thoughtbot.com
http://weblog.jamisbuck.org
http://blog.jayfields.com
http://errtheblog.com

== Books ==
http://pragmaticstudio.com – Great source of books about rails and other technologies with a focus on the right practices.

Finally the only real way to learn is to try things out. Follow other developers blogs and use all the resources you can such as Google groups etc.
Don’t be scared to get it wrong its the only way to learn.

Oct
30

PayFlow recurring billing with ActiveMerchant

Posted by James Kong in development, ruby on rails, Tutorials | 1 Comment »

Today we are going to look at using ActiveMerchant to set up a recurring billing subscription with PayFlow .

PayFlow is Paypal’s payment gateway and you need to setup a PayFlow account.
IMPORTANT! This is separate from Paypal’s development sandbox. Follow these steps to setup a Payflow testing account

  1. Go to https://www.paypal.com/cgi-bin/webscr?cmd=_payflow-get-started-outside
    and fill in the details for an account.
  2. When you get to the page where you need to enter your payment information, hit Save and Exit. This will create a testing PayFlow account for you.
  3. You will be sent an email with your partner ID and your vendor login. Take note of your partner ID as this will be important later.
  4. You should now be able to login at https://manager.paypal.com/

Now that you have a PayFlow account, you can use ActiveMerchant to setup payments. For now we will muck around in irb to test that methods out.

So lets open up irb and start by including the active merchant gem and setting ActiveMerchant to test mode

kongy@Deadpool: $ irb
irb(main):001:0> require 'rubygems'
irb(main):002:0> require 'active_merchant'
irb(main):003:0> ActiveMerchant::Billing::Base.mode = :test

Now lets setup the gateway.

gateway = ActiveMerchant::Billing::PayflowGateway.new(:login => 'PAYFLOW_LOGIN', :password => 'PAYFLOW_PASSWORD', :partner => 'PARTNER_ID')

This creates the gateway that we will be using to request purchases. By default ActiveMerchant passes PAYPAL as the partner value if you leave it out. I believe that this is the default for US PayFlow account. For my Aussie one, I received a VSA partner_id. I would suggest putting it in there anyway.

PayFlow Testing only accepts testing credit cards numbers.  You can grab them from the PayFlow recurring billing documentation found here. Here is a quick list which I can’t guarantee will be up to date.

American Express 378282246310005
American Express 371449635398431
American Express Corporate 378734493671000
Diners Club 30569309025904
Diners Club 38520000023237
Discover 6011111111111117
Discover 6011000990139424
JCB 3530111333300000
JCB 3566002020360505
MasterCard 5555555555554444
MasterCard 5105105105105100
Visa 4111111111111111
Visa 4012888888881881
Visa 4222222222222

So lets create a Mastercard credit card.

irb(main):004:0> credit_card = ActiveMerchant::Billing::CreditCard.new( :number => '5105105105105100', :month => '9', :year => '2007', :first_name => 'Mal', :last_name => 'Reynolds', :verification_value => '123', :type => 'master' )

Now we are ready to start billing. If you want to setup a one time payment it is quite easy.

irb(main):007:0> response = gateway.purchase(1000, credit_card)
irb(main):008:0> response.success?
=> true

If you go into your Paypal Manager and search for transactions you should see it appear.

To setup a recurring billing we need to use the recurring method of the gateway. The recurring method accepts the amount in cents, the credit card object and the time intervals to charge the card, at a minimum. There are other options available which you can find here. Lets charge $10/month

irb(main):009:0> response = gateway.recurring(100, credit_card, :periodicity => :monthly)
irb(main):010:0> response.success?
=> true
irb(main):011:0> response.profile_id
=> "RT0000000002"

You can view the recurring billings in your Paypal Manager by clicking on Service Settings > Recurring Billings > Manage Profiles. You will probably want to store the profile_id in your database for when you need to edit details of the recurring billing. You can do it quite simply by calling the recurring method again. Let’s change the amount we want to bill to $20/week.

irb(main):0012:0> response = gateway.recurring(2000, nil, :profile_id => "RT0000000001",  :periodicity => :weekly)
irb(main):013:0> response.success?
=> true

You can see here that we no longer need to pass in the credit card since we have the profile_id. We update the amount, and change the periodicity of the billing.

And that’s it.