public
Description: RESTful Rails app for storing credit cards
Homepage:
Clone URL: git://github.com/joevandyk/monkeycharger.git
Joe Van Dyk (author)
Tue Mar 10 14:46:32 -0700 2009
commit  9b66af4d7a20c1925fea8c58dfde62aa5f45e572
tree    c1126d30118673f907410684e3b1806c42d04e71
parent  d8e5abc847324b2565adeca27d864b393869ea56
name age message
file .gitignore Mon Feb 25 04:11:08 -0800 2008 updated git ignores [joevandyk]
file CHANGELOG Thu Nov 22 23:18:10 -0800 2007 moved files around [joevandyk]
file MIT-LICENSE Thu Nov 22 23:18:10 -0800 2007 moved files around [joevandyk]
file README Tue Mar 10 14:46:32 -0700 2009 Updated README [Joe Van Dyk]
file Rakefile Thu Nov 22 23:18:10 -0800 2007 moved files around [joevandyk]
directory app/ Wed Feb 20 07:46:57 -0800 2008 Security Fix!! -- Removed iv from credit card... [joevandyk]
directory config/ Wed Feb 20 07:46:57 -0800 2008 Security Fix!! -- Removed iv from credit card... [joevandyk]
directory db/ Thu Oct 23 12:28:48 -0700 2008 Transaction IDs should be strings, not integers... [joevandyk]
directory lib/ Thu Nov 22 23:18:10 -0800 2007 moved files around [joevandyk]
directory public/ Thu Nov 22 23:18:10 -0800 2007 moved files around [joevandyk]
directory script/ Thu Nov 22 23:43:37 -0800 2007 Upgraded Rails [joevandyk]
directory spec/ Wed Feb 20 17:36:40 -0800 2008 Upgraded to rspec trunk [joevandyk]
directory stories/ Thu Nov 22 23:40:18 -0800 2007 Upgraded Rails and RSpec [joevandyk]
directory test/ Thu Nov 22 23:18:10 -0800 2007 moved files around [joevandyk]
directory vendor/ Wed Feb 20 17:36:40 -0800 2008 Upgraded to rspec trunk [joevandyk]
README
MonkeyCharger is a small stand-alone RESTified Rails app that lets you store
and charge credit cards.  It uses the ActiveMerchant library for the 
authorizing and capturing of credit cards.

You probably want to run this application on a super-secured machine that's firewalled
like crazy and is not accessible from the internet.  And follow the Visa CISP 
documentation.

NOTE ON RUNNING TESTS: running 'rake' will run the integration tests, which do hit the 
remote payment gateways.  You'll need a valid account with someone like authorize.net 
to successfully run those tests.  Running 'rake spec' doesn't hit any remote gateways.

Also, before running the tests, cp config/initializers/monkeycharger.rb.example to 
config/initializers/monkeycharger.rb.

=API summary=

==Storing Credit Cards==

  * `POST /credit_cards.xml`  
  use with parameters such as number, cvv, month, year, name, etc.  
  You'll also need to supply a passphrase parameter.  Use the passphrase parameter when authorizing against the saved 
  card.

Uses the ActiveResource conventions.  But this might change -- ActiveResource might be overkill for this.

==Authorizing credit cards==

  * `POST /authorizations.xml` use parameters amount and the same credit card group as above. 
  * `POST /authorizations.xml` use parameters amount and a credit_card_id. 

Both these return a transaction_id and a X-AuthorizationSuccess HTTP header on success, 
or text that represents the failure reason if it failed to authorize the card.

==Capturing==

  * `POST /captures.xml` use parameters amount and transaction_id.

If the capture was successful, the X-CaptureSuccess HTTP header will be set.  If not successful, will return the reason 
why.

==Cancelling==

  * `POST /cancelations.xml` use parameter transaction_id.

==Refunds==

  * `POST /refunds.xml` use parameters amount, transaction_id, and last_four_digits_of_credit_card

==Rails Way Writeup==

Jamis Buck did a write-up on monkeycharger: 
http://www.therailsway.com/2007/9/3/using-activeresource-to-consume-web-services

Also, MonkeyCharger was featured in "The Rails Way" book by Obie Fernandez on an example of how to 
write good, descriptive tests for a Rails application.


Copyright (c) 2009 Joe Van Dyk, released under the MIT license