Skip to content

Commit

Permalink
Added a whole bunch more card tests to the remote_xpay_test
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Tenner committed Apr 19, 2009
1 parent e76f139 commit ff8611f
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 6 deletions.
6 changes: 4 additions & 2 deletions lib/active_merchant/billing/gateways/xpay.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ class XPayGateway < Gateway
:switch => "MAESTRO",
:maestro => "MAESTRO",
:electron => "ELECTRON",
:purchasing => "PURCHASING"
:purchasing => "PURCHASING",
:american_express => "AMEX"
}

API_VERSION = '3.51'
Expand Down Expand Up @@ -124,7 +125,8 @@ def add_creditcard(post, creditcard)
}
}

if [ CREDIT_CARDS[:SWITCH], CREDIT_CARDS[:SOLO] ].include?(creditcard.type)
if [ CREDIT_CARDS[:switch], CREDIT_CARDS[:solo], CREDIT_CARDS[:maestro] ].
include?(CREDIT_CARDS[creditcard.type.to_sym])
post[:PaymentMethod][:CreditCard][:Issue] = creditcard.verification_value
else
post[:PaymentMethod][:CreditCard][:SecurityCode] = creditcard.verification_value
Expand Down
23 changes: 19 additions & 4 deletions test/remote/gateways/remote_xpay_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,27 @@ def setup

@amount = 100
@credit_cards = {
:visa => credit_card('4111111111111111'),
:mastercard => credit_card('5111111111111118', :type => :master)
:visa => credit_card('4111111111111111'),
:mastercard => credit_card('5111111111111118', :type => :master),
:uk_maestro1 => credit_card('6759050000000005', :type => :maestro, :verification_value => '1'),
:uk_maestro2 => credit_card('6759000000000018', :type => :maestro, :verification_value => ''),
:solo => credit_card('676770676770676775', :type => :solo, :verification_value => '1'),
:visa_delta => credit_card('4659010000000005', :type => :delta),
:visa_electron => credit_card('49174917491749174', :type => :electron),
:visa_purchasing => credit_card('4484000000000007', :type => :purchasing),
:mastercard_debit => credit_card('5573470000000001', :type => :master),
:american_express => credit_card('377737773777380', :type => :american_express)
}
@declined_credit_cards = {
:visa => credit_card('4242424242424242'),
:mastercard => credit_card('5111111111111142', :type => :master)
:visa => credit_card('4242424242424242'),
:mastercard => credit_card('5111111111111142', :type => :master),
:uk_maestro1 => credit_card('6759050000000062', :type => :maestro, :verification_value => '1'),
:uk_maestro2 => credit_card('6759000000000042', :type => :maestro, :verification_value => ''),
:solo => credit_card('676770676770676882', :type => :solo, :verification_value => '1'),
:visa_delta => credit_card('4659010000000062', :type => :delta),
:visa_purchasing => credit_card('4484000000000072', :type => :purchasing),
:mastercard_debit => credit_card('5573470000000092', :type => :master),
:american_express => credit_card('377737773777422', :type => :american_express)
}

@options = {
Expand Down

0 comments on commit ff8611f

Please sign in to comment.