spree_gateway 2.1.1 → 2.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (84) hide show
  1. checksums.yaml +4 -4
  2. metadata +185 -116
  3. data/.gitignore +0 -14
  4. data/.rspec +0 -1
  5. data/.travis.yml +0 -22
  6. data/Gemfile +0 -21
  7. data/LICENSE +0 -26
  8. data/README.md +0 -68
  9. data/Rakefile +0 -14
  10. data/Versionfile +0 -12
  11. data/app/assets/javascripts/store/gateway/stripe.js.coffee +0 -58
  12. data/app/assets/javascripts/store/spree_gateway.js +0 -2
  13. data/app/assets/stylesheets/store/spree_gateway.css +0 -8
  14. data/app/controllers/spree/checkout_controller_decorator.rb +0 -51
  15. data/app/controllers/spree/skrill_status_controller.rb +0 -39
  16. data/app/models/spree/billing_integration/skrill/quick_checkout.rb +0 -48
  17. data/app/models/spree/gateway/authorize_net.rb +0 -16
  18. data/app/models/spree/gateway/authorize_net_cim.rb +0 -132
  19. data/app/models/spree/gateway/balanced_gateway.rb +0 -65
  20. data/app/models/spree/gateway/banwire.rb +0 -15
  21. data/app/models/spree/gateway/beanstream.rb +0 -193
  22. data/app/models/spree/gateway/braintree_gateway.rb +0 -147
  23. data/app/models/spree/gateway/card_save.rb +0 -10
  24. data/app/models/spree/gateway/data_cash.rb +0 -10
  25. data/app/models/spree/gateway/eway.rb +0 -20
  26. data/app/models/spree/gateway/fatzebra.rb +0 -15
  27. data/app/models/spree/gateway/linkpoint.rb +0 -28
  28. data/app/models/spree/gateway/maxipago.rb +0 -14
  29. data/app/models/spree/gateway/moneris.rb +0 -11
  30. data/app/models/spree/gateway/pay_junction.rb +0 -16
  31. data/app/models/spree/gateway/pay_pal_gateway.rb +0 -12
  32. data/app/models/spree/gateway/payflow_pro.rb +0 -17
  33. data/app/models/spree/gateway/paymill.rb +0 -12
  34. data/app/models/spree/gateway/pin_gateway.rb +0 -15
  35. data/app/models/spree/gateway/sage_pay.rb +0 -11
  36. data/app/models/spree/gateway/samurai.rb +0 -63
  37. data/app/models/spree/gateway/secure_pay_au.rb +0 -10
  38. data/app/models/spree/gateway/stripe_gateway.rb +0 -103
  39. data/app/models/spree/gateway/usa_epay.rb +0 -9
  40. data/app/models/spree/gateway/worldpay.rb +0 -91
  41. data/app/models/spree/skrill_transaction.rb +0 -19
  42. data/app/views/spree/admin/log_entries/_braintree.html.erb +0 -31
  43. data/app/views/spree/admin/log_entries/_stripe.html.erb +0 -28
  44. data/app/views/spree/admin/payments/source_forms/_quickcheckout.html.erb +0 -8
  45. data/app/views/spree/admin/payments/source_forms/_stripe.html.erb +0 -1
  46. data/app/views/spree/admin/payments/source_views/_quickcheckout.html.erb +0 -39
  47. data/app/views/spree/admin/payments/source_views/_stripe.html.erb +0 -1
  48. data/app/views/spree/checkout/payment/_quickcheckout.html.erb +0 -26
  49. data/app/views/spree/checkout/payment/_stripe.html.erb +0 -21
  50. data/config/initializers/savon.rb +0 -3
  51. data/config/locales/bg.yml +0 -11
  52. data/config/locales/de.yml +0 -11
  53. data/config/locales/en.yml +0 -30
  54. data/config/locales/sv.yml +0 -11
  55. data/config/routes.rb +0 -20
  56. data/db/migrate/20111118164631_create_skrill_transactions.rb +0 -14
  57. data/db/migrate/20121017004102_update_braintree_payment_method_type.rb +0 -9
  58. data/db/migrate/20130213222555_update_stripe_payment_method_type.rb +0 -9
  59. data/db/migrate/20130415222802_update_balanced_payment_method_type.rb +0 -9
  60. data/db/migrate/20131008221012_update_paypal_payment_method_type.rb +0 -9
  61. data/db/migrate/20131112133401_migrate_stripe_preferences.rb +0 -8
  62. data/lib/active_merchant/billing/skrill.rb +0 -18
  63. data/lib/generators/spree_gateway/install/install_generator.rb +0 -28
  64. data/lib/spree_gateway.rb +0 -3
  65. data/lib/spree_gateway/engine.rb +0 -42
  66. data/script/rails +0 -5
  67. data/spec/factories/payment_method_factory.rb +0 -4
  68. data/spec/features/stripe_checkout_spec.rb +0 -82
  69. data/spec/models/gateway/authorize_net_cim_spec.rb +0 -17
  70. data/spec/models/gateway/authorize_net_spec.rb +0 -17
  71. data/spec/models/gateway/balanced_gateway_spec.rb +0 -9
  72. data/spec/models/gateway/banwire_spec.rb +0 -9
  73. data/spec/models/gateway/braintree_gateway_spec.rb +0 -289
  74. data/spec/models/gateway/eway_spec.rb +0 -17
  75. data/spec/models/gateway/fatzebra_spec.rb +0 -47
  76. data/spec/models/gateway/linkpoint_spec.rb +0 -60
  77. data/spec/models/gateway/pay_junction_spec.rb +0 -17
  78. data/spec/models/gateway/payflow_pro_spec.rb +0 -17
  79. data/spec/models/gateway/pin_gateway_spec.rb +0 -57
  80. data/spec/models/gateway/stripe_gateway_spec.rb +0 -122
  81. data/spec/models/gateway/usa_epay_spec.rb +0 -38
  82. data/spec/models/savon_spec.rb +0 -9
  83. data/spec/spec_helper.rb +0 -56
  84. data/spree_gateway.gemspec +0 -28
@@ -1,15 +0,0 @@
1
- module Spree
2
- class Gateway::Fatzebra < Gateway
3
- preference :username, :string, default: "TEST"
4
- preference :token, :string, default: "TEST"
5
-
6
- def provider_class
7
- ActiveMerchant::Billing::FatZebraGateway
8
- end
9
-
10
- # Currently no auth/capture, but coming soon...
11
- def auto_capture?
12
- true
13
- end
14
- end
15
- end
@@ -1,28 +0,0 @@
1
- module Spree
2
- class Gateway::Linkpoint < Gateway
3
- preference :login, :string
4
- preference :pem, :text
5
-
6
- def provider_class
7
- ActiveMerchant::Billing::LinkpointGateway
8
- end
9
-
10
- [:authorize, :purchase, :capture, :void, :credit].each do |method|
11
- define_method(method) do |*args|
12
- options = add_discount_to_subtotal(args.extract_options!)
13
- provider.public_send(method, *args << options)
14
- end
15
- end
16
-
17
- private
18
-
19
- # Linkpoint ignores the discount, but it will return an error if the
20
- # chargetotal is different from the sum of the subtotal, tax and
21
- # shipping totals.
22
- def add_discount_to_subtotal(options)
23
- subtotal = options.fetch(:subtotal)
24
- discount = options.fetch(:discount)
25
- options.merge(subtotal: subtotal + discount, discount: 0)
26
- end
27
- end
28
- end
@@ -1,14 +0,0 @@
1
- module Spree
2
- class Gateway::Maxipago < Gateway
3
- preference :login, :string # ID
4
- preference :password, :string # KEY
5
-
6
- def provider_class
7
- ActiveMerchant::Billing::MaxipagoGateway
8
- end
9
-
10
- def auto_capture?
11
- true
12
- end
13
- end
14
- end
@@ -1,11 +0,0 @@
1
- module Spree
2
- class Gateway::Moneris < Gateway
3
- preference :login, :string
4
- preference :password, :password
5
-
6
- def provider_class
7
- ActiveMerchant::Billing::MonerisGateway
8
- end
9
-
10
- end
11
- end
@@ -1,16 +0,0 @@
1
- module Spree
2
- class Gateway::PayJunction < Gateway
3
- preference :login, :string
4
- preference :password, :string
5
-
6
- def provider_class
7
- ActiveMerchant::Billing::PayJunctionGateway
8
- end
9
-
10
- def options_with_test_preference
11
- options_without_test_preference.merge(:test => self.preferred_test_mode)
12
- end
13
-
14
- alias_method_chain :options, :test_preference
15
- end
16
- end
@@ -1,12 +0,0 @@
1
- module Spree
2
- class Gateway::PayPalGateway < Gateway
3
- preference :login, :string
4
- preference :password, :string
5
- preference :signature, :string
6
- preference :currency_code, :string
7
-
8
- def provider_class
9
- ActiveMerchant::Billing::PaypalGateway
10
- end
11
- end
12
- end
@@ -1,17 +0,0 @@
1
- module Spree
2
- class Gateway::PayflowPro < Gateway
3
- preference :login, :string
4
- preference :password, :password
5
-
6
- def provider_class
7
- ActiveMerchant::Billing::PayflowGateway
8
- end
9
-
10
- def options_with_test_preference
11
- options_without_test_preference.merge(:test => self.preferred_test_mode)
12
- end
13
-
14
- alias_method_chain :options, :test_preference
15
-
16
- end
17
- end
@@ -1,12 +0,0 @@
1
- module Spree
2
- class Gateway::Paymill < Gateway
3
-
4
- preference :public_key, :string
5
- preference :private_key, :string
6
- preference :currency, :string, :default => 'GBP'
7
-
8
- def provider_class
9
- ActiveMerchant::Billing::PaymillGateway
10
- end
11
- end
12
- end
@@ -1,15 +0,0 @@
1
- module Spree
2
- class Gateway::PinGateway < Gateway
3
- preference :api_key, :string
4
- preference :currency, :string, :default => 'AUD'
5
-
6
- def provider_class
7
- ActiveMerchant::Billing::PinGateway
8
- end
9
-
10
- # Pin does not appear to support authorizing transactions yet
11
- def auto_capture?
12
- true
13
- end
14
- end
15
- end
@@ -1,11 +0,0 @@
1
- module Spree
2
- class Gateway::SagePay < Gateway
3
- preference :login, :string
4
- preference :password, :string
5
- preference :account, :string
6
-
7
- def provider_class
8
- ActiveMerchant::Billing::SagePayGateway
9
- end
10
- end
11
- end
@@ -1,63 +0,0 @@
1
- module Spree
2
- class Gateway::Samurai < Gateway
3
- preference :login, :string
4
- preference :password, :string
5
- preference :processor_token, :string
6
-
7
- def provider_class
8
- ActiveMerchant::Billing::SamuraiGateway
9
- end
10
-
11
- def payment_profiles_supported?
12
- true
13
- end
14
-
15
- def purchase(money, creditcard, gateway_options)
16
- gateway_options[:billing_reference] = gateway_options[:order_id]
17
- gateway_options[:customer_reference] = gateway_options[:customer]
18
- gateway_options[:description] = "Spree Order"
19
- provider.purchase(money, creditcard.gateway_customer_profile_id, gateway_options)
20
- end
21
-
22
- def authorize(money, creditcard, gateway_options)
23
- gateway_options[:billing_reference] = gateway_options[:order_id]
24
- gateway_options[:customer_reference] = gateway_options[:customer]
25
- gateway_options[:description] = "Spree Order"
26
- provider.authorize(money, creditcard.gateway_customer_profile_id, gateway_options)
27
- end
28
-
29
- def capture(authorization, creditcard, gateway_options)
30
- gateway_options[:billing_reference] = gateway_options[:order_id]
31
- gateway_options[:customer_reference] = gateway_options[:customer]
32
- gateway_options[:description] = "Spree Order"
33
- provider.capture(nil, authorization.response_code, {})
34
- end
35
-
36
- def credit(money, creditcard, response_code, gateway_options)
37
- provider.credit(money, response_code, {})
38
- end
39
-
40
- def void(response_code, gateway_options)
41
- provider.void(response_code, {})
42
- end
43
-
44
- def create_profile(payment)
45
- return unless payment.source.gateway_customer_profile_id.nil?
46
-
47
- options = {}
48
- options[:email] = payment.order.email
49
- options[:address] = {}
50
- options[:address][:address1] = payment.order.bill_address.address1
51
- options[:address][:address2] = payment.order.bill_address.address2
52
- options[:address][:city] = payment.order.bill_address.city
53
- options[:address][:state] = payment.order.bill_address.state.abbr
54
- options[:address][:zip] = payment.order.bill_address.zipcode
55
- response = provider.store(payment.source, options)
56
- if response.success?
57
- payment.source.update_attributes!(:gateway_customer_profile_id => response.params['payment_method_token'])
58
- else
59
- payment.send(:gateway_error, response.message)
60
- end
61
- end
62
- end
63
- end
@@ -1,10 +0,0 @@
1
- module Spree
2
- class Gateway::SecurePayAU < Gateway
3
- preference :login, :string
4
- preference :password, :string
5
-
6
- def provider_class
7
- ActiveMerchant::Billing::SecurePayAU
8
- end
9
- end
10
- end
@@ -1,103 +0,0 @@
1
- module Spree
2
- class Gateway::StripeGateway < Gateway
3
- preference :secret_key, :string
4
- preference :publishable_key, :string
5
-
6
- def method_type
7
- 'stripe'
8
- end
9
-
10
- def provider_class
11
- ActiveMerchant::Billing::StripeGateway
12
- end
13
-
14
- def payment_profiles_supported?
15
- true
16
- end
17
-
18
- def purchase(money, creditcard, gateway_options)
19
- provider.purchase(*options_for_purchase_or_auth(money, creditcard, gateway_options))
20
- end
21
-
22
- def authorize(money, creditcard, gateway_options)
23
- provider.authorize(*options_for_purchase_or_auth(money, creditcard, gateway_options))
24
- end
25
-
26
- def capture(payment, creditcard, gateway_options)
27
- provider.capture((payment.amount * 100).round, payment.response_code, gateway_options)
28
- end
29
-
30
- def credit(money, creditcard, response_code, gateway_options)
31
- provider.refund(money, response_code, {})
32
- end
33
-
34
- def void(response_code, creditcard, gateway_options)
35
- provider.void(response_code, {})
36
- end
37
-
38
- def create_profile(payment)
39
- return unless payment.source.gateway_customer_profile_id.nil?
40
- options = {
41
- email: payment.order.email,
42
- login: preferred_secret_key,
43
- }.merge! address_for(payment)
44
-
45
- response = provider.store(payment.source, options)
46
- if response.success?
47
- payment.source.update_attributes!({
48
- :gateway_customer_profile_id => response.params['id'],
49
- :gateway_payment_profile_id => response.params['default_card']
50
- })
51
- else
52
- payment.send(:gateway_error, response.message)
53
- end
54
- end
55
-
56
- private
57
-
58
- # In this gateway, what we call 'secret_key' is the 'login'
59
- def options
60
- options = super
61
- options.merge(:login => preferred_secret_key)
62
- end
63
-
64
-
65
- def options_for_purchase_or_auth(money, creditcard, gateway_options)
66
- options = {}
67
- options[:description] = "Spree Order ID: #{gateway_options[:order_id]}"
68
- options[:currency] = gateway_options[:currency]
69
-
70
- if customer = creditcard.gateway_customer_profile_id
71
- options[:customer] = customer
72
- end
73
- if token_or_card_id = creditcard.gateway_payment_profile_id
74
- # The Stripe ActiveMerchant gateway supports passing the token directly as the creditcard parameter
75
- # The Stripe ActiveMerchant gateway supports passing the customer_id and credit_card id
76
- # https://github.com/Shopify/active_merchant/issues/770
77
- creditcard = token_or_card_id
78
- end
79
- return money, creditcard, options
80
- end
81
-
82
- def address_for(payment)
83
- {}.tap do |options|
84
- if address = payment.order.bill_address
85
- options.merge!(address: {
86
- address1: address.address1,
87
- address2: address.address2,
88
- city: address.city,
89
- zip: address.zipcode
90
- })
91
-
92
- if country = address.country
93
- options[:address].merge!(country: country.name)
94
- end
95
-
96
- if state = address.state
97
- options[:address].merge!(state: state.name)
98
- end
99
- end
100
- end
101
- end
102
- end
103
- end
@@ -1,9 +0,0 @@
1
- module Spree
2
- class Gateway::UsaEpay < Gateway
3
- preference :login, :string
4
-
5
- def provider_class
6
- ActiveMerchant::Billing::UsaEpayGateway
7
- end
8
- end
9
- end
@@ -1,91 +0,0 @@
1
- module Spree
2
- class Gateway::Worldpay < Gateway
3
- preference :login, :string
4
- preference :password, :string
5
- preference :currency, :string, :default => 'GBP'
6
- preference :installation_id, :string
7
-
8
- preference :american_express_login, :string
9
- preference :discover_login, :string
10
- preference :jcb_login, :string
11
- preference :mastercard_login, :string
12
- preference :maestro_login, :string
13
- preference :visa_login, :string
14
-
15
- def provider_class
16
- ActiveMerchant::Billing::WorldpayGateway
17
- end
18
-
19
- def purchase(money, credit_card, options = {})
20
- provider = credit_card_provider(credit_card, options)
21
- provider.purchase(money, credit_card, options)
22
- end
23
-
24
- def authorize(money, credit_card, options = {})
25
- provider = credit_card_provider(credit_card, options)
26
- provider.authorize(money, credit_card, options)
27
- end
28
-
29
- def capture(money, authorization, options = {})
30
- provider = credit_card_provider(auth_credit_card(authorization), options)
31
- provider.capture(money, authorization, options)
32
- end
33
-
34
- def refund(money, authorization, options = {})
35
- provider = credit_card_provider(auth_credit_card(authorization), options)
36
- provider.refund(money, authorization, options)
37
- end
38
-
39
- def credit(money, authorization, options = {})
40
- refund(money, authorization, options)
41
- end
42
-
43
- def void(authorization, options = {})
44
- provider = credit_card_provider(auth_credit_card(authorization), options)
45
- provider.void(authorization, options)
46
- end
47
-
48
- private
49
-
50
- def options_for_card(credit_card, options)
51
- options[:login] = login_for_card(credit_card)
52
- options = options().merge( options )
53
- end
54
-
55
- def auth_credit_card(authorization)
56
- Spree::Payment.find_by_response_code(authorization).source
57
- end
58
-
59
- def credit_card_provider(credit_card, options = {})
60
- gateway_options = options_for_card(credit_card, options)
61
- gateway_options.delete :login if gateway_options.has_key?(:login) and gateway_options[:login].nil?
62
- gateway_options[:currency] = self.preferred_currency
63
- gateway_options[:inst_id] = self.preferred_installation_id
64
- ActiveMerchant::Billing::Base.gateway_mode = gateway_options[:server].to_sym
65
- @provider = provider_class.new(gateway_options)
66
- end
67
-
68
- def login_for_card(card)
69
- case card.brand
70
- when 'american_express'
71
- choose_login preferred_american_express_login
72
- when 'discover'
73
- choose_login preferred_discover_login
74
- when 'jcb'
75
- choose_login preferred_jcb_login
76
- when 'maestro'
77
- choose_login preferred_maestro_login
78
- when 'master'
79
- choose_login preferred_mastercard_login
80
- when 'visa'
81
- choose_login preferred_visa_login
82
- else
83
- preferred_login
84
- end
85
- end
86
-
87
- def choose_login(login)
88
- return login ? login : preferred_login
89
- end
90
- end
91
- end