Skip to content
This repository has been archived by the owner on Mar 2, 2020. It is now read-only.

Commit

Permalink
Merge branch 'release/1.1.1' into production
Browse files Browse the repository at this point in the history
* release/1.1.1:
  Updated changelog
  Added certification tests for ipcommerce along with various fixes that came up during development.
  Converted ipcommerce to use 2 letter country codes rather than 3 letter.
  Added country_id to IP Commerce AVS data.
  Update IP Commerce to send a max of 20 characters to AVS street check. Update fixtures for AVS/CVV checks.
  Add IP Commerce CVV / AVS checking
  Add ISO3166 country code reporting to CreditCard.
  Changed method signatures for add and update customer credit card to accept options.
  Added #add_customer_credit_card and #update_customer_credit_card to ipcommerce.
  Updated error catching for session tokens.
  Add IP Commerce note.
  • Loading branch information
nbibler committed Aug 30, 2011
2 parents 1a410ef + c374e49 commit a83b05b
Show file tree
Hide file tree
Showing 57 changed files with 3,513 additions and 826 deletions.
1 change: 1 addition & 0 deletions .watchr
Expand Up @@ -22,6 +22,7 @@ def run(cmd)
$stdout.write line
growl line if line =~ /\b\d+ failure/
end
$stderr.write stderr.read
end
end

Expand Down
17 changes: 16 additions & 1 deletion Changelog.md
@@ -1,3 +1,18 @@
### 1.1.1 / 2011-08-30

[full changelog](http://github.com/envylabs/vaulted_billing/compare/v1.1.0...v1.1.1)

* Enhancements
* IP Commerce
* Added country to AVS data sent with credit cards
* Implement add_customer_credit_card via $1.00 auth/void
* Implement AVS / CVV checking
* Add certification tests

* Bug Fixes
* IP Commerce
* Handle session key non-renewals

### 1.1.0 / 2011-08-17

[full changelog](http://github.com/envylabs/vaulted_billing/compare/v1.0.2...v1.1.0)
Expand All @@ -8,4 +23,4 @@
* Added VaultedBilling::Error to collect exceptions raised
* Added optional options hash to gateway transaction calls
* Add MultiJson and MultiXml dependencies
* Allow development dependencies to be more flexible
* Allow development dependencies to be more flexible
6 changes: 2 additions & 4 deletions README.md
Expand Up @@ -13,6 +13,7 @@ Since you only store identifiers on your end, you are only responsible for: 1) t
VaultedBilling supports the following payment providers:

* [Authorize.net Customer Information Manager][authorize-net-cim]
* [IP Commerce Tokenization][ipcommerce-tokenization]
* [Network Merchant Inc. Customer Vault][nmi-vault]

VaultedBilling also supports the following fictitious payment provider for testing purposes:
Expand Down Expand Up @@ -67,10 +68,6 @@ bogus.add_customer(customer).tap do |customer_response|
end
```

### Real world example

TODO: Real world example coming soon.

## Testing

When you're manually testing your application - meaning Development mode - it is often best to actually have a "sandbox" or "test" account with your payment processor. In this mode, you should use those credentials with VaultedBilling and indicate to VaultedBilling that the processor is in test mode, either by setting it in the VaultedBilling::Configuration (see Configuration) or when you instantiate your Gateway. You should note that all gateways, except for the Bogus gateway, attempt to open network connections when in use. So, if you are testing with them (which is suggested), you should look into an HTTP mocking library like [VCR][vcr] with [WebMock][webmock].
Expand All @@ -80,6 +77,7 @@ Strictly for testing interaction with the VaultedBilling library, there is a "Bo
[ci]: http://travis-ci.org/envylabs/vaulted_billing
[ci-image]: https://secure.travis-ci.org/envylabs/vaulted_billing.png
[authorize-net-cim]: http://www.authorize.net/solutions/merchantsolutions/merchantservices/cim/
[ipcommerce-tokenization]: http://developer.ipcommerce.com/developer/integration/value_added_capabilities.aspx
[nmi-vault]: https://www.nmi.com/newsmedia/index.php?ann_id=14
[bundler]: http://gembundler.com/
[vcr]: https://github.com/myronmarston/vcr
Expand Down
34 changes: 30 additions & 4 deletions lib/vaulted_billing/credit_card.rb
@@ -1,3 +1,5 @@
require 'iso3166'

module VaultedBilling
##
# Intermediary class used to translate your local credit card information
Expand All @@ -15,8 +17,24 @@ module VaultedBilling
# the card is already stored on the gateway and is not new information.
#
class CreditCard
class Country < String
def to_iso_3166
country.number.to_i if country.data
end

def to_ipcommerce_id
VaultedBilling::Gateways::Ipcommerce::Countries.index(self) || 0
end

private

def country
ISO3166::Country.new(self)
end
end

attr_accessor :card_number # The customer's credit card number
attr_accessor :country # The country of the credit card address.
attr_reader :country # The country of the credit card address.
attr_accessor :currency # The currency used by the credit card.
attr_accessor :cvv_number # The verification number (CVV2) on the card.
attr_accessor :expires_on # The date on which the credit card expires.
Expand All @@ -41,9 +59,7 @@ def initialize(attributes = {})
send("#{key}=", value) if respond_to?("#{key}=")
end
end

def to_vaulted_billing; self; end


def ==(o)
self.attributes == o.attributes
end
Expand All @@ -65,5 +81,15 @@ def attributes
:phone => phone
}
end

def country=(input)
@country = Country.new(input) if input
end

def name_on_card
[first_name, last_name].compact.join(" ")
end

def to_vaulted_billing; self; end
end
end
7 changes: 5 additions & 2 deletions lib/vaulted_billing/gateway.rb
@@ -1,9 +1,11 @@
module VaultedBilling
module Gateway
module Response
attr_accessor :response
attr_accessor :raw_response
attr_accessor :response_message
attr_accessor :error_code
attr_accessor :transactions
attr_writer :connection_error
attr_writer :success
def success?; @success; end
Expand All @@ -22,11 +24,11 @@ def remove_customer(customer)
raise NotImplementedError
end

def add_customer_credit_card(customer, credit_card)
def add_customer_credit_card(customer, credit_card, options = {})
raise NotImplementedError
end

def update_customer_credit_card(customer, credit_card)
def update_customer_credit_card(customer, credit_card, options = {})
raise NotImplementedError
end

Expand Down Expand Up @@ -65,6 +67,7 @@ def respond_with(object, options = {})
o.raw_response = options[:raw_response] || ''
o.response_message = options[:response_message]
o.error_code = options[:error_code]
o.transactions = options[:transactions] || nil
yield(o) if block_given?
end
end
Expand Down
4 changes: 2 additions & 2 deletions lib/vaulted_billing/gateways/authorize_net_cim.rb
Expand Up @@ -58,7 +58,7 @@ def remove_customer(customer)
respond_with(customer, result, :success => result.success?)
end

def add_customer_credit_card(customer, credit_card)
def add_customer_credit_card(customer, credit_card, options = {})
customer = customer.to_vaulted_billing
credit_card = credit_card.to_vaulted_billing
data = build_request('createCustomerPaymentProfileRequest') { |xml|
Expand All @@ -75,7 +75,7 @@ def add_customer_credit_card(customer, credit_card)
end
end

def update_customer_credit_card(customer, credit_card)
def update_customer_credit_card(customer, credit_card, options = {})
customer = customer.to_vaulted_billing
credit_card = credit_card.to_vaulted_billing
data = build_request('updateCustomerPaymentProfileRequest') { |xml|
Expand Down
12 changes: 6 additions & 6 deletions lib/vaulted_billing/gateways/bogus.rb
Expand Up @@ -30,31 +30,31 @@ def remove_customer(customer)
respond_with customer.to_vaulted_billing
end

def add_customer_credit_card(customer, credit_card)
def add_customer_credit_card(customer, credit_card, options = {})
respond_with(credit_card.to_vaulted_billing) { |c| c.vault_id = new_identifier }
end

def update_customer_credit_card(customer, credit_card)
def update_customer_credit_card(customer, credit_card, options = {})
respond_with credit_card.to_vaulted_billing
end

def remove_customer_credit_card(customer, credit_card)
respond_with credit_card.to_vaulted_billing
end

def authorize(customer, credit_card, amount)
def authorize(customer, credit_card, amount, options = {})
transaction_response
end

def purchase(customer, credit_card, amount)
def purchase(customer, credit_card, amount, options = {})
transaction_response
end

def void(transaction_id)
def void(transaction_id, options = {})
transaction_response
end

def capture(transaction_id, amount)
def capture(transaction_id, amount, options = {})
transaction_response
end

Expand Down

0 comments on commit a83b05b

Please sign in to comment.