Permalink
Browse files

Rename Creditcard to Credit Card

[Fixes #1605]
  • Loading branch information...
1 parent 4b499b8 commit cfad73301c7876796c28ed7c353e9e4ee282e375 @joneslee85 joneslee85 committed with radar May 31, 2012
Showing with 114 additions and 109 deletions.
  1. BIN core/app/assets/images/{creditcards → credit_cards}/amex_cid.gif
  2. BIN core/app/assets/images/{creditcards/creditcard.gif → credit_cards/credit_card.gif}
  3. BIN core/app/assets/images/{creditcards → credit_cards}/discover_cid.gif
  4. BIN core/app/assets/images/{creditcards → credit_cards}/icons/american_express.png
  5. BIN core/app/assets/images/{creditcards → credit_cards}/icons/cirrus.png
  6. BIN core/app/assets/images/{creditcards → credit_cards}/icons/delta.png
  7. BIN core/app/assets/images/{creditcards → credit_cards}/icons/dinersclub.png
  8. BIN core/app/assets/images/{creditcards → credit_cards}/icons/directdebit.png
  9. BIN core/app/assets/images/{creditcards → credit_cards}/icons/discover.png
  10. BIN core/app/assets/images/{creditcards → credit_cards}/icons/egold.png
  11. BIN core/app/assets/images/{creditcards → credit_cards}/icons/maestro.png
  12. BIN core/app/assets/images/{creditcards → credit_cards}/icons/master.png
  13. BIN core/app/assets/images/{creditcards → credit_cards}/icons/paypal.png
  14. BIN core/app/assets/images/{creditcards → credit_cards}/icons/solo.png
  15. BIN core/app/assets/images/{creditcards → credit_cards}/icons/switch.png
  16. BIN core/app/assets/images/{creditcards → credit_cards}/icons/visa.png
  17. BIN core/app/assets/images/{creditcards → credit_cards}/icons/visaelectron.png
  18. BIN core/app/assets/images/{creditcards → credit_cards}/icons/westernunion.png
  19. BIN core/app/assets/images/{creditcards → credit_cards}/icons/wirecard.png
  20. BIN core/app/assets/images/{creditcards → credit_cards}/icons/worldpay.png
  21. BIN core/app/assets/images/{creditcards → credit_cards}/master_cid.jpg
  22. BIN core/app/assets/images/{creditcards → credit_cards}/visa_cid.gif
  23. +2 −2 core/app/controllers/spree/admin/payments_controller.rb
  24. +1 −1 core/app/models/spree/app_configuration.rb
  25. +1 −1 core/app/models/spree/{creditcard.rb → credit_card.rb}
  26. +1 −1 core/app/models/spree/gateway.rb
  27. +10 −10 core/app/models/spree/gateway/bogus.rb
  28. +4 −4 core/app/models/spree/gateway/bogus_simple.rb
  29. +3 −3 core/app/models/spree/order.rb
  30. +2 −2 core/app/models/spree/payment.rb
  31. +4 −4 core/app/models/spree/payment/processing.rb
  32. +1 −1 core/app/models/spree/payment_method.rb
  33. +1 −1 core/app/views/spree/admin/payments/source_forms/_gateway.html.erb
  34. +2 −2 core/app/views/spree/admin/payments/source_views/_gateway.html.erb
  35. +1 −1 core/app/views/spree/admin/shared/_tabs.html.erb
  36. +1 −1 core/app/views/spree/checkout/payment/_gateway.html.erb
  37. +4 −4 core/app/views/spree/content/cvv.html.erb
  38. +5 −5 core/app/views/spree/shared/_order_details.html.erb
  39. +5 −5 core/config/locales/en.yml
  40. +1 −1 core/config/routes.rb
  41. +5 −5 core/db/migrate/20100209144531_polymorphic_payments.rb
  42. +4 −4 core/db/migrate/20100214212536_assign_creditcard_txns_to_payment.rb
  43. +5 −0 core/db/migrate/20120530012000_rename_creditcards_to_credit_cards.rb
  44. +3 −3 core/lib/spree/core/testing_support/factories/{creditcard_factory.rb → credit_card_factory.rb}
  45. +1 −1 core/lib/spree/core/testing_support/factories/payment_factory.rb
  46. +41 −41 core/spec/models/{creditcard_spec.rb → credit_card_spec.rb}
  47. +1 −1 core/spec/models/payment_spec.rb
  48. +5 −5 sample/db/sample/spree/payments.rb
@@ -21,7 +21,7 @@ def new
def create
@payment = @order.payments.build(object_params)
if @payment.payment_method.is_a?(Spree::Gateway) && @payment.payment_method.payment_profiles_supported? && params[:card].present? and params[:card] != 'new'
- @payment.source = Creditcard.find_by_id(params[:card])
+ @payment.source = CreditCard.find_by_id(params[:card])
end
begin
@@ -83,7 +83,7 @@ def load_data
else
@payment_method = @payment_methods.first
end
- @previous_cards = @order.creditcards.with_payment_profile
+ @previous_cards = @order.credit_cards.with_payment_profile
end
def load_order
@@ -35,7 +35,7 @@ class AppConfiguration < Preferences::Configuration
preference :alternative_billing_phone, :boolean, :default => false # Request extra phone for bill addr
preference :alternative_shipping_phone, :boolean, :default => false # Request extra phone for ship addr
preference :always_put_site_name_in_title, :boolean, :default => true
- preference :auto_capture, :boolean, :default => false # automatically capture the creditcard (as opposed to just authorize and capture later)
+ preference :auto_capture, :boolean, :default => false # automatically capture the credit card (as opposed to just authorize and capture later)
preference :cache_static_content, :boolean, :default => true
preference :check_for_spree_alerts, :boolean, :default => true
preference :checkout_zone, :string, :default => nil # replace with the name of a zone if you would like to limit the countries
@@ -1,5 +1,5 @@
module Spree
- class Creditcard < ActiveRecord::Base
+ class CreditCard < ActiveRecord::Base
has_many :payments, :as => :source, :class_name => "Spree::Payment"
before_save :set_last_digits
@@ -10,7 +10,7 @@ class Gateway < PaymentMethod
attr_accessible :preferred_server, :preferred_test_mode
def payment_source_class
- Creditcard
+ CreditCard
end
# instantiates the selected gateway and configures with the options stored in the database
@@ -23,29 +23,29 @@ def create_profile(payment)
payment.source.update_attributes(:gateway_customer_profile_id => generate_profile_id(success))
end
- def authorize(money, creditcard, options = {})
- profile_id = creditcard.gateway_customer_profile_id
- if VALID_CCS.include? creditcard.number or (profile_id and profile_id.starts_with? 'BGS-')
+ def authorize(money, credit_card, options = {})
+ profile_id = credit_card.gateway_customer_profile_id
+ if VALID_CCS.include? credit_card.number or (profile_id and profile_id.starts_with? 'BGS-')
ActiveMerchant::Billing::Response.new(true, 'Bogus Gateway: Forced success', {}, :test => true, :authorization => '12345', :avs_result => { :code => 'A' })
else
ActiveMerchant::Billing::Response.new(false, 'Bogus Gateway: Forced failure', { :message => 'Bogus Gateway: Forced failure' }, :test => true)
end
end
- def purchase(money, creditcard, options = {})
- profile_id = creditcard.gateway_customer_profile_id
- if VALID_CCS.include? creditcard.number or (profile_id and profile_id.starts_with? 'BGS-')
+ def purchase(money, credit_card, options = {})
+ profile_id = credit_card.gateway_customer_profile_id
+ if VALID_CCS.include? credit_card.number or (profile_id and profile_id.starts_with? 'BGS-')
ActiveMerchant::Billing::Response.new(true, 'Bogus Gateway: Forced success', {}, :test => true, :authorization => '12345', :avs_result => { :code => 'A' })
else
ActiveMerchant::Billing::Response.new(false, 'Bogus Gateway: Forced failure', :message => 'Bogus Gateway: Forced failure', :test => true)
end
end
- def credit(money, creditcard, response_code, options = {})
+ def credit(money, credit_card, response_code, options = {})
ActiveMerchant::Billing::Response.new(true, 'Bogus Gateway: Forced success', {}, :test => true, :authorization => '12345')
end
- def capture(authorization, creditcard, gateway_options)
+ def capture(authorization, credit_card, gateway_options)
if authorization.response_code == '12345'
ActiveMerchant::Billing::Response.new(true, 'Bogus Gateway: Forced success', {}, :test => true, :authorization => '67890')
else
@@ -54,7 +54,7 @@ def capture(authorization, creditcard, gateway_options)
end
- def void(response_code, creditcard, options = {})
+ def void(response_code, credit_card, options = {})
ActiveMerchant::Billing::Response.new(true, 'Bogus Gateway: Forced success', {}, :test => true, :authorization => '12345')
end
@@ -77,7 +77,7 @@ def generate_profile_id(success)
prefix = success ? 'BGS' : 'FAIL'
while record
random = "#{prefix}-#{Array.new(6){rand(6)}.join}"
- record = Creditcard.where(:gateway_customer_profile_id => random).first
+ record = CreditCard.where(:gateway_customer_profile_id => random).first
end
random
end
@@ -6,16 +6,16 @@ def payment_profiles_supported?
false
end
- def authorize(money, creditcard, options = {})
- if VALID_CCS.include? creditcard.number
+ def authorize(money, credit_card, options = {})
+ if VALID_CCS.include? credit_card.number
ActiveMerchant::Billing::Response.new(true, 'Bogus Gateway: Forced success', {}, :test => true, :authorization => '12345', :avs_result => { :code => 'A' })
else
ActiveMerchant::Billing::Response.new(false, 'Bogus Gateway: Forced failure', { :message => 'Bogus Gateway: Forced failure' }, :test => true)
end
end
- def purchase(money, creditcard, options = {})
- if VALID_CCS.include? creditcard.number
+ def purchase(money, credit_card, options = {})
+ if VALID_CCS.include? credit_card.number
ActiveMerchant::Billing::Response.new(true, 'Bogus Gateway: Forced success', {}, :test => true, :authorization => '12345', :avs_result => { :code => 'A' })
else
ActiveMerchant::Billing::Response.new(false, 'Bogus Gateway: Forced failure', :message => 'Bogus Gateway: Forced failure', :test => true)
@@ -380,9 +380,9 @@ def name
end
end
- def creditcards
- creditcard_ids = payments.from_creditcard.map(&:source_id).uniq
- Creditcard.scoped(:conditions => { :id => creditcard_ids })
+ def credit_cards
+ credit_card_ids = payments.from_credit_card.map(&:source_id).uniq
+ CreditCard.scoped(:conditions => { :id => credit_card_ids })
end
def process_payments!
@@ -18,7 +18,7 @@ class Payment < ActiveRecord::Base
attr_accessible :amount, :payment_method_id, :source_attributes
- scope :from_creditcard, where(:source_type => 'Spree::Creditcard')
+ scope :from_credit_card, where(:source_type => 'Spree::CreditCard')
scope :with_state, lambda { |s| where(:state => s) }
scope :completed, with_state('completed')
scope :pending, with_state('pending')
@@ -90,7 +90,7 @@ def profiles_supported?
end
def create_payment_profile
- return unless source.is_a?(Creditcard) && source.number && !source.has_payment_profile?
+ return unless source.is_a?(CreditCard) && source.number && !source.has_payment_profile?
payment_method.create_profile(self)
rescue ActiveMerchant::ConnectionError => e
gateway_error e
@@ -32,8 +32,8 @@ def capture!
check_environment
if payment_method.payment_profiles_supported?
- # Gateways supporting payment profiles will need access to creditcard object because this stores the payment profile information
- # so supply the authorization itself as well as the creditcard, rather than just the authorization code
+ # Gateways supporting payment profiles will need access to credit card object because this stores the payment profile information
+ # so supply the authorization itself as well as the credit card, rather than just the authorization code
response = payment_method.capture(self, source, gateway_options)
else
# Standard ActiveMerchant capture usage
@@ -51,8 +51,8 @@ def void_transaction!
check_environment
if payment_method.payment_profiles_supported?
- # Gateways supporting payment profiles will need access to creditcard object because this stores the payment profile information
- # so supply the authorization itself as well as the creditcard, rather than just the authorization code
+ # Gateways supporting payment profiles will need access to credit card object because this stores the payment profile information
+ # so supply the authorization itself as well as the credit card, rather than just the authorization code
response = payment_method.void(self.response_code, source, gateway_options)
else
# Standard ActiveMerchant void usage
@@ -16,7 +16,7 @@ def provider_class
end
# The class that will process payments for this payment type, used for @payment.source
- # e.g. Creditcard in the case of a the Gateway payment type
+ # e.g. CreditCard in the case of a the Gateway payment type
# nil means the payment method doesn't require a source e.g. check
def payment_source_class
raise 'You must implement payment_source_class method for this gateway.'
@@ -6,7 +6,7 @@
<label><%= radio_button_tag :card, 'new', @previous_cards.none? %> <%= t(:use_new_cc) %></label>
</p>
<div id="card_form" data-hook>
- <%= image_tag 'creditcards/creditcard.gif', :id => 'creditcard-image' %>
+ <%= image_tag 'credit_cards/credit_card.gif', :id => 'credit-card-image' %>
<% param_prefix = "payment_source[#{payment_method.id}]" %>
<div data-hook="card_number">
@@ -1,5 +1,5 @@
-<fieldset data-hook="creditcard">
- <legend><%= t(:creditcard) %></legend>
+<fieldset data-hook="credit_card">
+ <legend><%= t(:credit_card) %></legend>
<table class="index">
<tr>
@@ -1,5 +1,5 @@
<%= tab :overview, :route => :admin %>
-<%= tab :orders, :payments, :creditcard_payments, :shipments, :creditcards, :return_authorizations %>
+<%= tab :orders, :payments, :creditcard_payments, :shipments, :credit_cards, :return_authorizations %>
<%= tab :products , :option_types, :properties, :prototypes, :variants, :product_properties, :taxons %>
<%= tab :reports %>
<%= tab :configurations, :general_settings, :mail_methods, :tax_categories, :zones, :states, :payment_methods, :inventory_settings, :taxonomies, :shipping_methods, :trackers, :label => 'configuration' %>
@@ -1,4 +1,4 @@
-<%= image_tag 'creditcards/creditcard.gif', :id => 'creditcard-image' %>
+<%= image_tag 'credit_cards/credit_card.gif', :id => 'credit-card-image' %>
<% param_prefix = "payment_source[#{payment_method.id}]" %>
<p class="field" data-hook="card_number">
@@ -3,11 +3,11 @@
<p>For Visa, MasterCard, and Discover cards, the card code is the last 3 digit number located on the back of your card on or above your signature line. For an American Express card, it is the 4 digits on the FRONT above the end of your card number.</p>
<p>To help reduce fraud in the card-not-present environment, credit card companies have introduced a card code program. Visa calls this code Card Verification Value (CVV); MasterCard calls it Card Validation Code (CVC); Discover calls it Card ID (CID). The card code is a three- or four- digit security code that is printed on the back of cards. The number typically appears at the end of the signature panel.</p>
<div class="cid-caption">Visa</div>
- <%= image_tag 'creditcards/visa_cid.gif' %>
+ <%= image_tag 'credit_cards/visa_cid.gif' %>
<div class="cid-caption">Master Card</div>
- <%= image_tag 'creditcards/master_cid.jpg' %>
+ <%= image_tag 'credit_cards/master_cid.jpg' %>
<div class="cid-caption">American Express</div>
- <%= image_tag 'creditcards/amex_cid.gif' %>
+ <%= image_tag 'credit_cards/amex_cid.gif' %>
<div class="cid-caption">Discover</div>
- <%= image_tag 'creditcards/discover_cid.gif' %>
+ <%= image_tag 'credit_cards/discover_cid.gif' %>
</div>
@@ -24,15 +24,15 @@
<div class="columns omega four">
<h6><%= t(:payment_information) %> <%= link_to "(#{t(:edit)})", checkout_state_path(:payment) unless @order.completed? %></h6>
<div class="payment-info">
- <% unless order.creditcards.empty? %>
+ <% unless order.credit_cards.empty? %>
<span class="cc-type">
- <%= image_tag "creditcards/icons/#{order.creditcards.first.cc_type}.png" %>
- <%= t(:ending_in)%> <%= order.creditcards.first.last_digits %>
+ <%= image_tag "credit_cards/icons/#{order.credit_cards.first.cc_type}.png" %>
+ <%= t(:ending_in)%> <%= order.credit_cards.first.last_digits %>
</span>
<br />
<span class="full-name">
- <%= order.creditcards.first.first_name %>
- <%= order.creditcards.first.last_name %>
+ <%= order.credit_cards.first.first_name %>
+ <%= order.credit_cards.first.last_name %>
</span>
<% end %>
</div>
@@ -37,7 +37,7 @@ en:
iso_name: "ISO Name"
name: Name
numcode: "ISO Code"
- spree/creditcard:
+ spree/credit_card:
cc_type: Type
month: Month
number: Number
@@ -140,7 +140,7 @@ en:
spree/country:
one: Country
other: Countries
- spree/creditcard:
+ spree/credit_card:
one: "Credit Card"
other: "Credit Cards"
spree/creditcard_payment:
@@ -330,8 +330,8 @@ en:
credit_card_payment: "Credit Card Payment"
credit_owed: "Credit Owed"
credit_total: Credit Total
- creditcard: Creditcard
- creditcards: Creditcards
+ credit_card: Credit Card
+ credit_cards: Credit Cards
credits: Credits
current: Current
customer: Customer
@@ -871,7 +871,7 @@ en:
search_results: "Search results for '%{keywords}'"
searching: Searching
secure_connection_type: Secure Connection Type
- secure_creditcard: Secure Creditcard
+ secure_credit_card: Secure Credit Card
select: Select
select_from_prototype: "Select From Prototype"
select_preferred_shipping_option: "Select preferred shipping option"
@@ -19,7 +19,7 @@
post :populate, :on => :collection
resources :line_items
- resources :creditcards
+ resources :credit_cards
resources :creditcard_payments
resources :shipments do
@@ -12,17 +12,17 @@ def up
end
execute "UPDATE payments SET payable_type = 'Order'"
- Spree::Creditcard.table_name = 'creditcards'
+ Spree::CreditCard.table_name = 'creditcards'
- Spree::Creditcard.all.each do |creditcard|
- if checkout = Checkout.find_by_id(creditcard.checkout_id) and checkout.order
+ Spree::CreditCard.all.each do |credit_card|
+ if checkout = Checkout.find_by_id(credit_card.checkout_id) && checkout.order
if payment = checkout.order.payments.first
- execute "UPDATE payments SET source_type = 'Creditcard', source_id = #{creditcard.id} WHERE id = #{payment.id}"
+ execute "UPDATE payments SET source_type = 'Creditcard', source_id = #{credit_card.id} WHERE id = #{payment.id}"
end
end
end
- Spree::Creditcard.table_name = 'spree_creditcards'
+ Spree::CreditCard.table_name = 'spree_creditcards'
remove_column :creditcards, :checkout_id
end
@@ -3,15 +3,15 @@ def up
add_column :creditcard_txns, :payment_id, :integer
# Temporarily set back to creditcards
- Spree::Creditcard.table_name = 'creditcards'
+ Spree::CreditCard.table_name = 'creditcards'
ActiveRecord::Base.connection.select_all('SELECT * FROM creditcard_txns').each do |txn_attrs|
- if creditcard = Spree::Creditcard.find_by_id(txn_attrs['creditcard_id']) and creditcard.payments.first
- execute "UPDATE creditcard_txns SET payment_id = #{creditcard.payments.first.id} WHERE id = #{txn_attrs['id']}"
+ if credit_card = Spree::CreditCard.find_by_id(txn_attrs['creditcard_id']) && credit_card.payments.first
+ execute "UPDATE creditcard_txns SET payment_id = #{credit_card.payments.first.id} WHERE id = #{txn_attrs['id']}"
end
end
- Spree::Creditcard.table_name = 'spree_creditcards'
+ Spree::CreditCard.table_name = 'spree_creditcards'
remove_column :creditcard_txns, :creditcard_payment_id
end
@@ -0,0 +1,5 @@
+class RenameCreditcardsToCreditCards < ActiveRecord::Migration
+ def change
+ rename_table :spree_creditcards, :spree_credit_cards
+ end
+end
@@ -1,10 +1,10 @@
-# allows creditcard info to be saved to the datbase which is needed for factories to work properly
-class TestCard < Spree::Creditcard
+# allows credit card info to be saved to the database which is needed for factories to work properly
+class TestCard < Spree::CreditCard
def remove_readonly_attributes(attributes) attributes; end
end
FactoryGirl.define do
- factory :creditcard, :class => TestCard do
+ factory :credit_card, :class => TestCard do
verification_value 123
month 12
year 2013
@@ -2,7 +2,7 @@
factory :payment, :class => Spree::Payment do
amount 45.75
payment_method { FactoryGirl.create(:bogus_payment_method) }
- source { FactoryGirl.build(:creditcard) }
+ source { FactoryGirl.build(:credit_card) }
order { FactoryGirl.create(:order) }
state 'pending'
response_code '12345'
Oops, something went wrong. Retry.

0 comments on commit cfad733

Please sign in to comment.