Skip to content

Commit

Permalink
Replace references to :type with :brand
Browse files Browse the repository at this point in the history
  • Loading branch information
John Duff committed Jun 8, 2012
1 parent 80801ad commit 302bc1e
Show file tree
Hide file tree
Showing 32 changed files with 142 additions and 134 deletions.
2 changes: 1 addition & 1 deletion lib/active_merchant/billing/gateways/litle.rb
Expand Up @@ -136,7 +136,7 @@ def build_response(kind, litle_response, valid_responses=%w(000))
end

def create_credit_card_hash(money, creditcard, options)
cc_type = CARD_TYPE[creditcard.type]
cc_type = CARD_TYPE[creditcard.brand]

exp_date_yr = creditcard.year.to_s()[2..3]

Expand Down
4 changes: 2 additions & 2 deletions lib/active_merchant/billing/gateways/optimal_payment.rb
Expand Up @@ -228,8 +228,8 @@ def build_card(xml, opts)
xml.tag! 'month' , @credit_card.month
xml.tag! 'year' , @credit_card.year
end
if type = card_type(@credit_card.type)
xml.tag! 'cardType' , type
if brand = card_type(@credit_card.brand)
xml.tag! 'cardType' , brand
end
if @credit_card.verification_value
xml.tag! 'cvdIndicator' , '1' # Value Provided
Expand Down
2 changes: 1 addition & 1 deletion lib/active_merchant/billing/gateways/paystation.rb
Expand Up @@ -107,7 +107,7 @@ def add_invoice(post, options)
def add_credit_card(post, credit_card)

post[:cn] = credit_card.number
post[:ct] = credit_card.type
post[:ct] = credit_card.brand
post[:ex] = format_date(credit_card.month, credit_card.year)
post[:cc] = credit_card.verification_value if credit_card.verification_value?

Expand Down
2 changes: 1 addition & 1 deletion lib/active_merchant/billing/gateways/vindicia.rb
Expand Up @@ -269,7 +269,7 @@ def add_payment_source(parameters, creditcard, options)
:accountHolderName => creditcard.name,
:nameValues => [{ :name => 'CVN', :value => creditcard.verification_value }],
:billingAddress => convert_am_address_to_vindicia(options[:billing_address] || options[:address]),
:customerSpecifiedType => creditcard.type.capitalize,
:customerSpecifiedType => creditcard.brand.capitalize,
:active => !!options[:recurring]
}
end
Expand Down
8 changes: 4 additions & 4 deletions test/remote/gateways/remote_card_stream_test.rb
Expand Up @@ -10,30 +10,30 @@ def setup
:month => '12',
:year => '2009',
:verification_value => '4887',
:type => :american_express
:brand => :american_express
)

@uk_maestro = credit_card('675940410531100173',
:month => '12',
:year => '2008',
:issue_number => '0',
:verification_value => '134',
:type => :switch
:brand => :switch
)

@solo = credit_card('676740340572345678',
:month => '12',
:year => '2008',
:issue_number => '1',
:verification_value => '773',
:type => :solo
:brand => :solo
)

@mastercard = credit_card('5301250070000191',
:month => '12',
:year => '2009',
:verification_value => '419',
:type => :master
:brand => :master
)

@declined_card = credit_card('4000300011112220',
Expand Down
4 changes: 2 additions & 2 deletions test/remote/gateways/remote_cyber_source_test.rb
Expand Up @@ -6,8 +6,8 @@ def setup

@gateway = CyberSourceGateway.new(fixtures(:cyber_source))

@credit_card = credit_card('4111111111111111', :type => 'visa')
@declined_card = credit_card('801111111111111', :type => 'visa')
@credit_card = credit_card('4111111111111111', :brand => 'visa')
@declined_card = credit_card('801111111111111', :brand => 'visa')

@amount = 100

Expand Down
8 changes: 4 additions & 4 deletions test/remote/gateways/remote_data_cash_test.rb
Expand Up @@ -12,7 +12,7 @@ def setup
:year => Date.today.year + 2,
:first_name => 'Mark',
:last_name => 'McBride',
:type => :master,
:brand => :master,
:verification_value => '547'
)

Expand All @@ -22,7 +22,7 @@ def setup
:year => Date.today.year + 2,
:first_name => 'Mark',
:last_name => 'McBride',
:type => :master,
:brand => :master,
:verification_value => '547'
)

Expand All @@ -32,7 +32,7 @@ def setup
:year => Date.today.year + 2,
:first_name => 'Mark',
:last_name => 'McBride',
:type => :visa,
:brand => :visa,
:verification_value => '444'
)

Expand All @@ -42,7 +42,7 @@ def setup
:number => '633499100000000004',
:month => 3,
:year => Date.today.year + 2,
:type => :solo,
:brand => :solo,
:issue_number => 5,
:start_month => 12,
:start_year => 2006,
Expand Down
2 changes: 1 addition & 1 deletion test/remote/gateways/remote_inspire_test.rb
Expand Up @@ -5,7 +5,7 @@ def setup
@gateway = InspireGateway.new(fixtures(:inspire))

@amount = rand(10000) + 1001
@credit_card = credit_card('4111111111111111', :type => 'visa')
@credit_card = credit_card('4111111111111111', :brand => 'visa')
@declined_amount = rand(99)
@options = { :order_id => generate_unique_id,
:billing_address => address
Expand Down
14 changes: 7 additions & 7 deletions test/remote/gateways/remote_litle.rb
Expand Up @@ -14,7 +14,7 @@ def test_successful_authorization
:last_name => 'Smith',
:month => '01',
:year => '2012',
:type => 'visa',
:brand => 'visa',
:number => '4457010000000009',
:verification_value => '349'
), {
Expand Down Expand Up @@ -42,7 +42,7 @@ def test_unsuccessful_authorization
:last_name => 'Green',
:month => '06',
:year => '2012',
:type => 'visa',
:brand => 'visa',
:number => '4457010100000008',
:verification_value => '992'
), {
Expand All @@ -69,7 +69,7 @@ def test_successful_purchase
:last_name => 'Smith',
:month => '01',
:year => '2012',
:type => 'visa',
:brand => 'visa',
:number => '4457010000000009',
:verification_value => '349'
), {
Expand Down Expand Up @@ -97,7 +97,7 @@ def test_unsuccessful_purchase
:last_name => 'Green',
:month => '06',
:year => '2012',
:type => 'visa',
:brand => 'visa',
:number => '4457010100000008',
:verification_value => '992'
), {
Expand All @@ -124,7 +124,7 @@ def test_authorization_capture_credit_void
:last_name => 'Smith',
:month => '01',
:year => '2012',
:type => 'visa',
:brand => 'visa',
:number => '4457010000000009',
:verification_value => '349'
), {
Expand Down Expand Up @@ -187,7 +187,7 @@ def test_store_successful
:last_name => 'Smith',
:month => '01',
:year => '2012',
:type => 'visa',
:brand => 'visa',
:number => '4457119922390123',
:verification_value => '349'
),
Expand All @@ -210,7 +210,7 @@ def test_store_unsuccessful
:last_name => 'Smith',
:month => '01',
:year => '2012',
:type => 'visa',
:brand => 'visa',
:number => '4457119999999999',
:verification_value => '349'
),
Expand Down
8 changes: 4 additions & 4 deletions test/remote/gateways/remote_migs_test.rb
Expand Up @@ -8,10 +8,10 @@ def setup

@amount = 100
@declined_amount = 105
@visa = credit_card('4005550000000001', :month => 5, :year => 2013, :type => 'visa')
@master = credit_card('5123456789012346', :month => 5, :year => 2013, :type => 'master')
@amex = credit_card('371449635311004', :month => 5, :year => 2013, :type => 'american_express')
@diners = credit_card('30123456789019', :month => 5, :year => 2013, :type => 'diners_club')
@visa = credit_card('4005550000000001', :month => 5, :year => 2013, :brand => 'visa')
@master = credit_card('5123456789012346', :month => 5, :year => 2013, :brand => 'master')
@amex = credit_card('371449635311004', :month => 5, :year => 2013, :brand => 'american_express')
@diners = credit_card('30123456789019', :month => 5, :year => 2013, :brand => 'diners_club')
@credit_card = @visa

@options = {
Expand Down
4 changes: 2 additions & 2 deletions test/remote/gateways/remote_netaxept_test.rb
Expand Up @@ -75,15 +75,15 @@ def test_failed_void
end

def test_successful_amex_purchase
credit_card = credit_card('378282246310005', :type => 'american_express')
credit_card = credit_card('378282246310005', :brand => 'american_express')
assert credit_card.valid?, credit_card.errors.inspect
assert response = @gateway.purchase(@amount, credit_card, @options)
assert_success response
assert_equal 'OK', response.message
end

def test_successful_master_purchase
credit_card = credit_card('5413000000000000', :type => 'master')
credit_card = credit_card('5413000000000000', :brand => 'master')
assert credit_card.valid?, credit_card.errors.inspect
assert response = @gateway.purchase(@amount, credit_card, @options)
assert_success response
Expand Down
2 changes: 1 addition & 1 deletion test/remote/gateways/remote_optimal_payment_test.rb
Expand Up @@ -43,7 +43,7 @@ def test_minimal_successful_purchase
:year => Time.now.year + 1,
:first_name => 'Longbob',
:last_name => 'Longsen',
:type => 'visa'
:brand => 'visa'
)
assert response = @gateway.purchase(@amount, credit_card, options)
assert_success response
Expand Down
6 changes: 3 additions & 3 deletions test/remote/gateways/remote_payflow_test.rb
Expand Up @@ -7,7 +7,7 @@ def setup
@gateway = PayflowGateway.new(fixtures(:payflow))

@credit_card = credit_card('5105105105105100',
:type => 'master'
:brand => 'master'
)

@options = { :billing_address => address,
Expand Down Expand Up @@ -190,7 +190,7 @@ def test_recurring_with_initial_authorization
response = @gateway.recurring(1000, @credit_card,
:periodicity => :monthly,
:initial_transaction => {
:type => :authorization
:brand => :authorization
}
)

Expand All @@ -203,7 +203,7 @@ def test_recurring_with_initial_authorization
response = @gateway.recurring(1000, @credit_card,
:periodicity => :monthly,
:initial_transaction => {
:type => :purchase,
:brand => :purchase,
:amount => 500
}
)
Expand Down
6 changes: 3 additions & 3 deletions test/remote/gateways/remote_payflow_uk_test.rb
Expand Up @@ -14,11 +14,11 @@ def setup
:first_name => 'Cody',
:last_name => 'Fauser',
:verification_value => '000',
:type => 'master'
:brand => 'master'
)

@solo = CreditCard.new(
:type => "solo",
:brand => "solo",
:number => "6334900000000005",
:month => Time.now.month,
:year => Time.now.year + 1,
Expand All @@ -28,7 +28,7 @@ def setup
)

@switch = CreditCard.new(
:type => "switch",
:brand => "switch",
:number => "5641820000000005",
:verification_value => "000",
:month => 1,
Expand Down
14 changes: 7 additions & 7 deletions test/remote/gateways/remote_sage_pay_test.rb
Expand Up @@ -18,7 +18,7 @@ def setup
:verification_value => 4887,
:first_name => 'Tekin',
:last_name => 'Suleyman',
:type => 'american_express'
:brand => 'american_express'
)

@maestro = CreditCard.new(
Expand All @@ -31,7 +31,7 @@ def setup
:verification_value => 123,
:first_name => 'Tekin',
:last_name => 'Suleyman',
:type => 'maestro'
:brand => 'maestro'
)

@visa = CreditCard.new(
Expand All @@ -41,7 +41,7 @@ def setup
:verification_value => 123,
:first_name => 'Tekin',
:last_name => 'Suleyman',
:type => 'visa'
:brand => 'visa'
)

@solo = CreditCard.new(
Expand All @@ -54,7 +54,7 @@ def setup
:verification_value => 227,
:first_name => 'Tekin',
:last_name => 'Suleyman',
:type => 'solo'
:brand => 'solo'
)

@mastercard = CreditCard.new(
Expand All @@ -64,7 +64,7 @@ def setup
:verification_value => 419,
:first_name => 'Tekin',
:last_name => 'Suleyman',
:type => 'master'
:brand => 'master'
)

@electron = CreditCard.new(
Expand All @@ -74,7 +74,7 @@ def setup
:verification_value => 123,
:first_name => 'Tekin',
:last_name => 'Suleyman',
:type => 'electron'
:brand => 'electron'
)

@declined_card = CreditCard.new(
Expand All @@ -83,7 +83,7 @@ def setup
:year => next_year,
:first_name => 'Tekin',
:last_name => 'Suleyman',
:type => 'visa'
:brand => 'visa'
)

@options = {
Expand Down
4 changes: 2 additions & 2 deletions test/remote/gateways/remote_secure_pay_au_test.rb
Expand Up @@ -5,7 +5,7 @@ class RemoteSecurePayAuTest < Test::Unit::TestCase
class MyCreditCard
include ActiveMerchant::Billing::CreditCardMethods
include ActiveMerchant::Validateable
attr_accessor :number, :month, :year, :first_name, :last_name, :verification_value, :type
attr_accessor :number, :month, :year, :first_name, :last_name, :verification_value, :brand

def verification_value?
!@verification_value.blank?
Expand Down Expand Up @@ -39,7 +39,7 @@ def test_successful_purchase_with_custom_credit_card_class
:first_name => 'Longbob',
:last_name => 'Longsen',
:verification_value => '123',
:type => 'visa'
:brand => 'visa'
}
credit_card = MyCreditCard.new(options)
assert response = @gateway.purchase(@amount, credit_card, @options)
Expand Down
4 changes: 2 additions & 2 deletions test/remote/gateways/remote_usa_epay_advanced_test.rb
Expand Up @@ -20,7 +20,7 @@ def setup
:number => '4000100011112224',
:month => 12,
:year => 12,
:type => 'visa',
:brand => 'visa',
:verification_value => '123',
:first_name => "Fred",
:last_name => "Flintstone"
Expand All @@ -30,7 +30,7 @@ def setup
:number => '4000300011112220',
:month => 12,
:year => 12,
:type => 'visa',
:brand => 'visa',
:verification_value => '999',
:first_name => "Fred",
:last_name => "Flintstone"
Expand Down
2 changes: 1 addition & 1 deletion test/test_helper.rb
Expand Up @@ -148,7 +148,7 @@ def credit_card(number = '4242424242424242', options = {})
:first_name => 'Longbob',
:last_name => 'Longsen',
:verification_value => '123',
:type => 'visa'
:brand => 'visa'
}.update(options)

Billing::CreditCard.new(defaults)
Expand Down

0 comments on commit 302bc1e

Please sign in to comment.