solidus_paypal_braintree 1.2.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (124) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +0 -18
  3. data/CHANGELOG.md +9 -0
  4. data/README.md +9 -0
  5. data/lib/generators/solidus_paypal_braintree/install/install_generator.rb +2 -36
  6. data/lib/solidus_paypal_braintree/engine.rb +0 -56
  7. data/lib/solidus_paypal_braintree/version.rb +1 -1
  8. data/lib/solidus_paypal_braintree.rb +1 -6
  9. data/solidus_paypal_braintree.gemspec +7 -5
  10. data/spec/controllers/solidus_paypal_braintree/checkouts_controller_spec.rb +5 -5
  11. data/spec/controllers/solidus_paypal_braintree/client_tokens_controller_spec.rb +2 -2
  12. data/spec/controllers/solidus_paypal_braintree/configurations_controller_spec.rb +2 -2
  13. data/spec/controllers/solidus_paypal_braintree/transactions_controller_spec.rb +5 -5
  14. data/spec/features/backend/configuration_spec.rb +3 -3
  15. data/spec/features/backend/new_payment_spec.rb +1 -1
  16. data/spec/features/frontend/braintree_credit_card_checkout_spec.rb +3 -3
  17. data/spec/fixtures/views/spree/orders/edit.html.erb +1 -1
  18. data/spec/helpers/solidus_paypal_braintree/braintree_admin_helper_spec.rb +1 -1
  19. data/spec/helpers/solidus_paypal_braintree/braintree_checkout_helper_spec.rb +5 -5
  20. data/spec/models/solidus_paypal_braintree/address_spec.rb +1 -1
  21. data/spec/models/solidus_paypal_braintree/avs_result_spec.rb +1 -1
  22. data/spec/models/solidus_paypal_braintree/gateway_spec.rb +11 -11
  23. data/spec/models/solidus_paypal_braintree/response_spec.rb +1 -1
  24. data/spec/models/solidus_paypal_braintree/source_spec.rb +2 -2
  25. data/spec/models/solidus_paypal_braintree/transaction_address_spec.rb +1 -1
  26. data/spec/models/solidus_paypal_braintree/transaction_import_spec.rb +12 -12
  27. data/spec/models/solidus_paypal_braintree/transaction_spec.rb +2 -2
  28. data/spec/requests/spree/api/orders_controller_spec.rb +2 -2
  29. data/spec/spec_helper.rb +2 -2
  30. data/spec/support/gateway_helpers.rb +3 -3
  31. metadata +9 -174
  32. data/app/assets/config/solidus_paypal_braintree_manifest.js +0 -1
  33. data/app/assets/images/solidus_paypal_braintree/venmo/venmo_active_blue_button_280x48.svg +0 -19
  34. data/app/assets/images/solidus_paypal_braintree/venmo/venmo_active_blue_button_320x48.svg +0 -19
  35. data/app/assets/images/solidus_paypal_braintree/venmo/venmo_active_blue_button_375x48.svg +0 -19
  36. data/app/assets/images/solidus_paypal_braintree/venmo/venmo_active_white_button_280x48.svg +0 -19
  37. data/app/assets/images/solidus_paypal_braintree/venmo/venmo_active_white_button_320x48.svg +0 -19
  38. data/app/assets/images/solidus_paypal_braintree/venmo/venmo_active_white_button_375x48.svg +0 -19
  39. data/app/assets/images/solidus_paypal_braintree/venmo/venmo_blue_acceptance_mark.svg +0 -15
  40. data/app/assets/images/solidus_paypal_braintree/venmo/venmo_blue_button_280x48.svg +0 -19
  41. data/app/assets/images/solidus_paypal_braintree/venmo/venmo_blue_button_320x48.svg +0 -19
  42. data/app/assets/images/solidus_paypal_braintree/venmo/venmo_blue_button_375x48.svg +0 -19
  43. data/app/assets/images/solidus_paypal_braintree/venmo/venmo_blue_logo.svg +0 -18
  44. data/app/assets/images/solidus_paypal_braintree/venmo/venmo_white_acceptance_mark.svg +0 -20
  45. data/app/assets/images/solidus_paypal_braintree/venmo/venmo_white_button_280x48.svg +0 -19
  46. data/app/assets/images/solidus_paypal_braintree/venmo/venmo_white_button_320x48.svg +0 -19
  47. data/app/assets/images/solidus_paypal_braintree/venmo/venmo_white_button_375x48.svg +0 -19
  48. data/app/assets/images/solidus_paypal_braintree/venmo/venmo_white_logo.svg +0 -18
  49. data/app/assets/javascripts/solidus_paypal_braintree/apple_pay_button.js +0 -179
  50. data/app/assets/javascripts/solidus_paypal_braintree/checkout.js +0 -108
  51. data/app/assets/javascripts/solidus_paypal_braintree/client.js +0 -239
  52. data/app/assets/javascripts/solidus_paypal_braintree/constants.js +0 -89
  53. data/app/assets/javascripts/solidus_paypal_braintree/frontend.js +0 -14
  54. data/app/assets/javascripts/solidus_paypal_braintree/hosted_form.js +0 -46
  55. data/app/assets/javascripts/solidus_paypal_braintree/paypal_button.js +0 -178
  56. data/app/assets/javascripts/solidus_paypal_braintree/paypal_messaging.js +0 -22
  57. data/app/assets/javascripts/solidus_paypal_braintree/promise.js +0 -20
  58. data/app/assets/javascripts/solidus_paypal_braintree/venmo_button.js +0 -86
  59. data/app/assets/javascripts/spree/backend/solidus_paypal_braintree.js +0 -96
  60. data/app/assets/javascripts/spree/frontend/paypal_button.js +0 -34
  61. data/app/assets/javascripts/spree/frontend/solidus_paypal_braintree.js +0 -1
  62. data/app/assets/stylesheets/spree/backend/solidus_paypal_braintree.css +0 -4
  63. data/app/assets/stylesheets/spree/backend/solidus_paypal_braintree.scss +0 -28
  64. data/app/assets/stylesheets/spree/frontend/solidus_paypal_braintree.css +0 -51
  65. data/app/decorators/controllers/solidus_paypal_braintree/admin_payments_controller_decorator.rb +0 -11
  66. data/app/decorators/controllers/solidus_paypal_braintree/checkout_controller_decorator.rb +0 -11
  67. data/app/decorators/controllers/solidus_paypal_braintree/client_tokens_controller.rb +0 -41
  68. data/app/decorators/controllers/solidus_paypal_braintree/orders_controller_decorator.rb +0 -11
  69. data/app/decorators/models/solidus_paypal_braintree/spree/store_decorator.rb +0 -20
  70. data/app/decorators/models/solidus_paypal_braintree/spree/user_decorator.rb +0 -13
  71. data/app/helpers/solidus_paypal_braintree/braintree_admin_helper.rb +0 -23
  72. data/app/helpers/solidus_paypal_braintree/braintree_checkout_helper.rb +0 -60
  73. data/app/models/application_record.rb +0 -5
  74. data/app/models/solidus_paypal_braintree/address.rb +0 -64
  75. data/app/models/solidus_paypal_braintree/avs_result.rb +0 -69
  76. data/app/models/solidus_paypal_braintree/configuration.rb +0 -39
  77. data/app/models/solidus_paypal_braintree/customer.rb +0 -8
  78. data/app/models/solidus_paypal_braintree/gateway.rb +0 -433
  79. data/app/models/solidus_paypal_braintree/response.rb +0 -80
  80. data/app/models/solidus_paypal_braintree/source.rb +0 -135
  81. data/app/models/solidus_paypal_braintree/transaction.rb +0 -31
  82. data/app/models/solidus_paypal_braintree/transaction_address.rb +0 -88
  83. data/app/models/solidus_paypal_braintree/transaction_import.rb +0 -98
  84. data/app/overrides/spree/payments/payment/add_paypal_funding_source_to_payment.rb +0 -9
  85. data/app/views/spree/api/payments/source_views/_paypal_braintree.json.jbuilder +0 -3
  86. data/app/views/spree/checkout/existing_payment/_paypal_braintree.html.erb +0 -10
  87. data/app/views/spree/shared/_apple_pay_button.html.erb +0 -27
  88. data/app/views/spree/shared/_braintree_errors.html.erb +0 -16
  89. data/app/views/spree/shared/_braintree_hosted_fields.html.erb +0 -43
  90. data/app/views/spree/shared/_paypal_braintree_head_scripts.html.erb +0 -26
  91. data/app/views/spree/shared/_paypal_cart_button.html.erb +0 -38
  92. data/app/views/spree/shared/_paypal_messaging.html.erb +0 -13
  93. data/app/views/spree/shared/_venmo_button.html.erb +0 -33
  94. data/config/locales/en.yml +0 -96
  95. data/config/locales/it.yml +0 -56
  96. data/config/routes.rb +0 -14
  97. data/db/migrate/20160830061749_create_solidus_paypal_braintree_sources.rb +0 -16
  98. data/db/migrate/20160906201711_create_solidus_paypal_braintree_customers.rb +0 -13
  99. data/db/migrate/20161114231422_create_solidus_paypal_braintree_configurations.rb +0 -11
  100. data/db/migrate/20161125172005_add_braintree_configuration_to_stores.rb +0 -7
  101. data/db/migrate/20170203191030_add_credit_card_to_braintree_configuration.rb +0 -6
  102. data/db/migrate/20170505193712_add_null_constraint_to_sources.rb +0 -32
  103. data/db/migrate/20170508085402_add_not_null_constraint_to_sources_payment_type.rb +0 -11
  104. data/db/migrate/20190705115327_add_paypal_button_preferences_to_braintree_configurations.rb +0 -5
  105. data/db/migrate/20190911141712_add_3d_secure_to_braintree_configuration.rb +0 -5
  106. data/db/migrate/20211222170950_add_paypal_funding_source_to_solidus_paypal_braintree_sources.rb +0 -5
  107. data/db/migrate/20220104150301_add_venmo_to_braintree_configuration.rb +0 -5
  108. data/lib/controllers/backend/solidus_paypal_braintree/configurations_controller.rb +0 -48
  109. data/lib/controllers/frontend/solidus_paypal_braintree/checkouts_controller.rb +0 -31
  110. data/lib/controllers/frontend/solidus_paypal_braintree/transactions_controller.rb +0 -67
  111. data/lib/generators/solidus_paypal_braintree/install/templates/initializer.rb +0 -6
  112. data/lib/solidus_paypal_braintree/country_mapper.rb +0 -37
  113. data/lib/solidus_paypal_braintree/extension_configuration.rb +0 -23
  114. data/lib/solidus_paypal_braintree/request_protection.rb +0 -21
  115. data/lib/solidus_paypal_braintree/testing_support/factories.rb +0 -53
  116. data/lib/views/backend/solidus_paypal_braintree/configurations/list.html.erb +0 -63
  117. data/lib/views/backend/spree/admin/payments/source_forms/_paypal_braintree.html.erb +0 -16
  118. data/lib/views/backend/spree/admin/payments/source_views/_paypal_braintree.html.erb +0 -39
  119. data/lib/views/backend/spree/admin/shared/preference_fields/_preference_select.html.erb +0 -13
  120. data/lib/views/backend_v1.2/spree/admin/payments/source_forms/_paypal_braintree.html.erb +0 -16
  121. data/lib/views/backend_v2.4/spree/admin/shared/preference_fields/_hash.html.erb +0 -12
  122. data/lib/views/frontend/solidus_paypal_braintree/payments/_payment.html.erb +0 -12
  123. data/lib/views/frontend/spree/checkout/payment/_paypal_braintree.html.erb +0 -23
  124. data/lib/views/frontend/spree/shared/_paypal_checkout_button.html.erb +0 -32
@@ -1,32 +0,0 @@
1
- class AddNullConstraintToSources < SolidusSupport::Migration[4.2]
2
- def up
3
- payments = Spree::Payment.arel_table
4
- sources = SolidusPaypalBraintree::Source.arel_table
5
- join_sources = payments.join(sources).on(
6
- payments[:source_id].eq(sources[:id]).and(
7
- payments[:source_type].eq("SolidusPaypalBraintree::Source")
8
- ).and(
9
- sources[:payment_method_id].eq(nil)
10
- )
11
- ).join_sources
12
-
13
- count = Spree::Payment.joins(join_sources).count
14
- Rails.logger.info("Updating #{count} problematic sources")
15
-
16
- Spree::Payment.joins(join_sources).find_each do |payment|
17
- Rails.logger.info("Updating source #{payment.source_id} with payment method id #{payment.payment_method_id}")
18
- SolidusPaypalBraintree::Source.where(id: payment.source_id).update_all(
19
- payment_method_id: payment.payment_method_id
20
- )
21
- end
22
-
23
- # We use a foreign key constraint on the model,
24
- # but it doesnt make sense to have this model exist without a payment method
25
- # as two of its methods delegate to the payment method.
26
- change_column_null(:solidus_paypal_braintree_sources, :payment_method_id, false)
27
- end
28
-
29
- def down
30
- change_column_null(:solidus_paypal_braintree_sources, :payment_method_id, true)
31
- end
32
- end
@@ -1,11 +0,0 @@
1
- class AddNotNullConstraintToSourcesPaymentType < SolidusSupport::Migration[4.2]
2
- def change
3
- reversible do |dir|
4
- dir.up do
5
- SolidusPaypalBraintree::Source.where(payment_type: nil).
6
- update_all(payment_type: 'CreditCard')
7
- end
8
- end
9
- change_column_null(:solidus_paypal_braintree_sources, :payment_type, false)
10
- end
11
- end
@@ -1,5 +0,0 @@
1
- class AddPaypalButtonPreferencesToBraintreeConfigurations < ActiveRecord::Migration[5.1]
2
- def change
3
- add_column :solidus_paypal_braintree_configurations, :preferences, :text
4
- end
5
- end
@@ -1,5 +0,0 @@
1
- class Add3dSecureToBraintreeConfiguration < SolidusSupport::Migration[4.2]
2
- def change
3
- add_column :solidus_paypal_braintree_configurations, :three_d_secure, :boolean, null: false, default: false
4
- end
5
- end
@@ -1,5 +0,0 @@
1
- class AddPaypalFundingSourceToSolidusPaypalBraintreeSources < ActiveRecord::Migration[5.0]
2
- def change
3
- add_column :solidus_paypal_braintree_sources, :paypal_funding_source, :integer
4
- end
5
- end
@@ -1,5 +0,0 @@
1
- class AddVenmoToBraintreeConfiguration < ActiveRecord::Migration[5.0]
2
- def change
3
- add_column :solidus_paypal_braintree_configurations, :venmo, :boolean, null: false, default: false
4
- end
5
- end
@@ -1,48 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module SolidusPaypalBraintree
4
- class ConfigurationsController < ::Spree::Admin::BaseController
5
- helper ::Spree::Core::Engine.routes.url_helpers
6
-
7
- def list
8
- authorize! :list, SolidusPaypalBraintree::Configuration
9
-
10
- @configurations = ::Spree::Store.all.map { |s| s.braintree_configuration || s.create_braintree_configuration }
11
- end
12
-
13
- def update
14
- authorize! :update, SolidusPaypalBraintree::Configuration
15
-
16
- params = configurations_params[:configuration_fields]
17
- results = SolidusPaypalBraintree::Configuration.update(params.keys, params.values)
18
- if results.all?(&:valid?)
19
- flash[:success] = t('update_success', scope: 'solidus_paypal_braintree.configurations')
20
- else
21
- flash[:error] = t('update_error', scope: 'solidus_paypal_braintree.configurations')
22
- end
23
- redirect_to action: :list
24
- end
25
-
26
- private
27
-
28
- def configurations_params
29
- params.require(:configurations).
30
- permit(configuration_fields: [
31
- :paypal,
32
- :apple_pay,
33
- :venmo,
34
- :credit_card,
35
- :three_d_secure,
36
- :preferred_paypal_button_locale,
37
- :preferred_paypal_button_color,
38
- :preferred_paypal_button_shape,
39
- :preferred_paypal_button_label,
40
- :preferred_paypal_button_tagline,
41
- :preferred_paypal_button_layout,
42
- :preferred_paypal_button_messaging,
43
- :preferred_venmo_button_color,
44
- :preferred_venmo_button_width
45
- ])
46
- end
47
- end
48
- end
@@ -1,31 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module SolidusPaypalBraintree
4
- class CheckoutsController < ::Spree::CheckoutController
5
- PERMITTED_PAYMENT_PARAMS = [
6
- :payment_method_id,
7
- { source_attributes: [
8
- :nonce,
9
- :payment_type
10
- ] }
11
- ].freeze
12
-
13
- def update
14
- @payment = ::Spree::PaymentCreate.new(@order, payment_params).build
15
-
16
- if @payment.save
17
- render plain: "ok"
18
- else
19
- render plain: "not-ok"
20
- end
21
- end
22
-
23
- def payment_params
24
- params.
25
- require(:order).
26
- require(:payments_attributes).
27
- first.
28
- permit(PERMITTED_PAYMENT_PARAMS)
29
- end
30
- end
31
- end
@@ -1,67 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module SolidusPaypalBraintree
4
- class TransactionsController < ::Spree::StoreController
5
- class InvalidImportError < StandardError; end
6
-
7
- PERMITTED_BRAINTREE_TRANSACTION_PARAMS = [
8
- :nonce,
9
- :payment_type,
10
- :paypal_funding_source,
11
- :phone,
12
- :email,
13
- { address_attributes: [
14
- :country_code, :country_name, :name, :city, :zip, :state_code,
15
- :address_line_1, :address_line_2, :first_name, :last_name
16
- ] }
17
- ].freeze
18
-
19
- def create
20
- transaction = SolidusPaypalBraintree::Transaction.new transaction_params
21
- import = SolidusPaypalBraintree::TransactionImport.new(current_order, transaction)
22
- restart_checkout = params[:options] && params[:options][:restart_checkout] == "true"
23
-
24
- respond_to do |format|
25
- if import.valid?
26
- import.import!(import_state, restart_checkout: restart_checkout)
27
-
28
- format.html { redirect_to redirect_url(import) }
29
- format.json { render json: { redirectUrl: redirect_url(import) } }
30
- else
31
- status = 422
32
- format.html { import_error(import) }
33
- format.json { render json: { errors: import.errors, status: status }, status: status }
34
- end
35
- end
36
- end
37
-
38
- private
39
-
40
- def import_state
41
- params[:state] || 'confirm'
42
- end
43
-
44
- def import_error(import)
45
- raise InvalidImportError,
46
- "Import invalid: #{import.errors.full_messages.join(', ')}"
47
- end
48
-
49
- def redirect_url(import)
50
- if import.order.complete?
51
- spree.order_url(import.order)
52
- else
53
- spree.checkout_state_url(import.order.state)
54
- end
55
- end
56
-
57
- def transaction_params
58
- params.require(:transaction)
59
- .permit(PERMITTED_BRAINTREE_TRANSACTION_PARAMS)
60
- .merge({ payment_method: payment_method })
61
- end
62
-
63
- def payment_method
64
- SolidusPaypalBraintree::Gateway.find(params[:payment_method_id])
65
- end
66
- end
67
- end
@@ -1,6 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- SolidusPaypalBraintree.configure do |config|
4
- # TODO: Remember to change this with the actual preferences you have implemented!
5
- # config.sample_preference = 'sample_value'
6
- end
@@ -1,37 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module SolidusPaypalBraintree
4
- module CountryMapper
5
- extend ActiveSupport::Concern
6
-
7
- USA_VARIANTS = [
8
- "the united states of america",
9
- "united states of america",
10
- "the united states",
11
- "united states",
12
- "us of a",
13
- "u.s.a.",
14
- "usa",
15
- "u.s.",
16
- "us"
17
- ].freeze
18
-
19
- CANADA_VARIANTS = [
20
- "canada",
21
- "ca"
22
- ].freeze
23
-
24
- # Generates a hash mapping each variant of the country name to the same ISO
25
- # ie: { "usa" => "US", "united states" => "US", "canada" => "CA", ... }
26
- COUNTRY_MAP = {
27
- USA_VARIANTS => "US",
28
- CANADA_VARIANTS => "CA"
29
- }.flat_map { |variants, iso| variants.map { |v| [v, iso] } }.to_h
30
-
31
- included do
32
- def iso_from_name(country_name)
33
- COUNTRY_MAP[country_name.downcase.strip]
34
- end
35
- end
36
- end
37
- end
@@ -1,23 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module SolidusPaypalBraintree
4
- # Deviating from the usual `Configuration` name proposed by
5
- # `solidus_dev_support` because it's already taken by a model.
6
- class ExtensionConfiguration
7
- # Define here the settings for this extension, e.g.:
8
- #
9
- # attr_accessor :my_setting
10
- end
11
-
12
- class << self
13
- def configuration
14
- @configuration ||= ExtensionConfiguration.new
15
- end
16
-
17
- alias config configuration
18
-
19
- def configure
20
- yield configuration
21
- end
22
- end
23
- end
@@ -1,21 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'active_merchant/network_connection_retries'
4
-
5
- module SolidusPaypalBraintree
6
- module RequestProtection
7
- include ActiveMerchant::NetworkConnectionRetries
8
-
9
- def protected_request(&block)
10
- raise ArgumentError unless block_given?
11
-
12
- options = {
13
- connection_exceptions: {
14
- Braintree::BraintreeError => 'Error while connecting to Braintree gateway'
15
- },
16
- logger: Rails.logger
17
- }
18
- retry_exceptions(options, &block)
19
- end
20
- end
21
- end
@@ -1,53 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- FactoryBot.define do
4
- # Define your Spree extensions Factories within this file to enable applications,
5
- # and other extensions to use and override them.
6
- #
7
- # Example adding this to your spec_helper will load these Factories for use:
8
- # require 'solidus_paypal_braintree/factories'
9
-
10
- factory :solidus_paypal_braintree_payment_method, class: SolidusPaypalBraintree::Gateway do
11
- name { 'Solidus PayPal Braintree Gateway' }
12
- active { true }
13
- end
14
-
15
- factory :solidus_paypal_braintree_source, class: SolidusPaypalBraintree::Source do
16
- association(:payment_method, factory: :solidus_paypal_braintree_payment_method)
17
- user
18
-
19
- trait :credit_card do
20
- payment_type { SolidusPaypalBraintree::Source::CREDIT_CARD }
21
- end
22
-
23
- trait :paypal do
24
- payment_type { SolidusPaypalBraintree::Source::PAYPAL }
25
- end
26
-
27
- trait :apple_pay do
28
- payment_type { SolidusPaypalBraintree::Source::APPLE_PAY }
29
- end
30
- end
31
- end
32
-
33
- FactoryBot.modify do
34
- # The Solidus address factory randomizes the zipcode.
35
- # The OrderWalkThrough we use in the credit card checkout spec uses this factory for the user addresses.
36
- # For credit card payments we transmit the billing address to braintree, for paypal payments the shipping address.
37
- # As we match the body in our VCR settings VCR can not match the request anymore and therefore cannot replay existing
38
- # cassettes.
39
- #
40
-
41
- factory :address do
42
- zipcode { '21088-0255' }
43
-
44
- if SolidusSupport.combined_first_and_last_name_in_address?
45
- transient do
46
- firstname { "John" }
47
- lastname { "Doe" }
48
- end
49
-
50
- name { "#{firstname} #{lastname}" }
51
- end
52
- end
53
- end
@@ -1,63 +0,0 @@
1
- <% content_for :page_title do %>
2
- <%= t(:title, scope: 'solidus_paypal_braintree.configurations') %>
3
- <% end %>
4
-
5
- <%= form_for :configurations, url: solidus_paypal_braintree.configurations_path do |f| %>
6
- <% @configurations.each do |config| %>
7
- <div class="row">
8
- <fieldset>
9
- <legend><%= config.store.name %></legend>
10
-
11
- <%= f.fields_for 'configuration_fields[]', config do |c| %>
12
- <div class="field">
13
- <%= c.check_box :paypal %>
14
- <%= c.label :paypal do %>
15
- <%= tag.i class: 'fa fa-paypal' %>
16
- <%= c.object.class.human_attribute_name(:paypal) %>
17
- <% end %>
18
- </div>
19
-
20
- <div class="field">
21
- <%= c.check_box :apple_pay %>
22
- <%= c.label :apple_pay do %>
23
- <%= tag.i class: 'fa fa-apple' %>
24
- <%= c.object.class.human_attribute_name(:apple_pay) %>
25
- <% end %>
26
- </div>
27
-
28
- <div class="field">
29
- <%= c.check_box :venmo %>
30
- <%= c.label :venmo do %>
31
- <%= tag.i class: 'fa fa-mobile' %>
32
- <%= c.object.class.human_attribute_name(:venmo) %>
33
- <% end %>
34
- </div>
35
-
36
- <div class="field">
37
- <%= c.check_box :credit_card %>
38
- <%= c.label :credit_card do %>
39
- <%= tag.i class: 'fa fa-credit-card' %>
40
- <%= c.object.class.human_attribute_name(:credit_card) %>
41
- <% end %>
42
- +
43
- <%= c.check_box :three_d_secure %>
44
- <%= c.label :three_d_secure do %>
45
- <%= tag.i class: 'fa fa-shield' %>
46
- <%= c.object.class.human_attribute_name(:three_d_secure) %>
47
- <% end %>
48
- </div>
49
-
50
- <% config.admin_form_preference_names.each do |name| %>
51
- <%= render "spree/admin/shared/preference_fields/#{config.preference_type(name)}",
52
- form: c, attribute: "preferred_#{name}",
53
- label: t(name, scope: 'spree', default: name.to_s.humanize) %>
54
- <% end %>
55
- <% end %>
56
- </fieldset>
57
- </div>
58
- <% end %>
59
-
60
- <div class="form-buttons filter-actions actions">
61
- <%= submit_tag "Update", class: 'btn btn-primary' %>
62
- </div>
63
- <% end %>
@@ -1,16 +0,0 @@
1
- <% id = payment_method.id %>
2
-
3
- <fieldset class="no-border-bottom braintree-hosted-fields" data-braintree-hosted-fields data-id="<%= id %>" data-payment-method-id="<%= id %>">
4
- <div class="field" data-hook="previous_cards">
5
- <% if previous_cards.any? %>
6
- <% previous_cards.each do |card| %>
7
- <label><%= radio_button_tag :card, card.id, card == previous_cards.first %> <%= card.display_number %><br /></label>
8
- <% end %>
9
- <label><%= radio_button_tag :card, "new", false, { id: "card_new#{id}" } %> <%= I18n.t("spree.use_new_cc") %></label>
10
- <% end %>
11
- </div>
12
-
13
- <div id="card_form<%= id %>" data-hook style="display: none;">
14
- <%= render partial: "spree/shared/braintree_hosted_fields", locals: { payment_method: payment_method } %>
15
- </div>
16
- </fieldset>
@@ -1,39 +0,0 @@
1
- <fieldset data-hook="credit_card">
2
- <legend align="center"><%= SolidusPaypalBraintree::Gateway.model_name.human %></legend>
3
-
4
- <div class="row">
5
- <div class="alpha six columns">
6
- <dl>
7
- <dt><%= I18n.t("spree.identifier") %>:</dt>
8
- <dd><%= payment.number %></dd>
9
-
10
- <dt><%= I18n.t("spree.response_code") %>:</dt>
11
- <dd><%= braintree_transaction_link(payment) %></dd>
12
-
13
- <% if payment.source.token.present? %>
14
- <dt><%= t('solidus_paypal_braintree.token') %>:</dt>
15
- <dd><%= payment.source.token %></dd>
16
- <% else %>
17
- <dt><%= t('solidus_paypal_braintree.nonce') %>:</dt>
18
- <dd><%= payment.source.nonce %></dd>
19
- <% end %>
20
-
21
- <dt><%= t('solidus_paypal_braintree.payment_type.label') %>:</dt>
22
- <dd><%= payment.source.friendly_payment_type %></dd>
23
-
24
- <% if payment.source.credit_card? %>
25
- <dt><%= Spree::CreditCard.human_attribute_name(:card_type) %>:</dt>
26
- <dd><%= payment.source.card_type %></dd>
27
-
28
- <dt><%= Spree::CreditCard.human_attribute_name(:last_digits) %>:</dt>
29
- <dd><%= payment.source.last_digits %></dd>
30
- <% end %>
31
-
32
- <% if payment.source.paypal? %>
33
- <dt><%= I18n.t('spree.paypal_funding_source') %>:</dt>
34
- <dd><%= payment.source.display_paypal_funding_source %></dd>
35
- <% end %>
36
- </dl>
37
- </div>
38
- </div>
39
- </fieldset>
@@ -1,13 +0,0 @@
1
- <% label = local_assigns[:label].presence %>
2
- <% html_options = {class: 'custom-select fullwidth'}.update(local_assigns[:html_options] || {}) %>
3
- <% options = form.object.send("#{attribute}_options") %>
4
-
5
- <div class="field">
6
- <% if local_assigns[:form] %>
7
- <%= form.label attribute, label %>
8
- <%= form.select attribute, options, {}, html_options %>
9
- <% else %>
10
- <%= label_tag name, label %>
11
- <%= select_tag name, value, html_options %>
12
- <% end %>
13
- </div>
@@ -1,16 +0,0 @@
1
- <% id = payment_method.id %>
2
-
3
- <fieldset class="no-border-bottom braintree-hosted-fields" data-braintree-hosted-fields data-id="braintree" data-payment-method-id="<%= id %>">
4
- <div class="field" data-hook="previous_cards">
5
- <% if previous_cards.any? %>
6
- <% previous_cards.each do |card| %>
7
- <label><%= radio_button_tag :card, card.id, card == previous_cards.first %> <%= card.display_number %><br /></label>
8
- <% end %>
9
- <label><%= radio_button_tag :card, "new", false, { id: "card_new#{id}" } %> <%= I18n.t("spree.use_new_cc") %></label>
10
- <% end %>
11
- </div>
12
-
13
- <div id="card_form<%= id %>" data-hook style="display: none;">
14
- <%= render partial: "spree/shared/braintree_hosted_fields", locals: { payment_method: payment_method } %>
15
- </div>
16
- </fieldset>
@@ -1,12 +0,0 @@
1
- <% label = local_assigns[:label].presence %>
2
- <% html_options = {class: 'input_hash fullwidth'}.update(local_assigns[:html_options] || {}) %>
3
-
4
- <div class="field">
5
- <% if local_assigns[:form] %>
6
- <%= form.label attribute, label %>
7
- <%= form.text_area attribute, html_options %>
8
- <% else %>
9
- <%= label_tag name, label %>
10
- <%= text_area_tag name, value, html_options %>
11
- <% end %>
12
- </div>
@@ -1,12 +0,0 @@
1
- <br />
2
- <%= payment.source.try(:display_payment_type) %>
3
-
4
- <% if payment.source.try(:paypal?) %>
5
- <% if payment.source.respond_to?(:paypal_funding_source) && payment.source.paypal_funding_source.present? %>
6
- <br />
7
- <%= t('spree.paypal_funding', funding: payment.source.display_paypal_funding_source) %>
8
- <% end %>
9
- <% elsif payment.source.try(:venmo?) %>
10
- <br />
11
- <%= payment.source.source_description %>
12
- <% end %>
@@ -1,23 +0,0 @@
1
- <% id = payment_method.id %>
2
-
3
- <%= render "spree/shared/paypal_braintree_head_scripts" %>
4
-
5
- <% if current_store.braintree_configuration.paypal? %>
6
- <%= render "spree/shared/paypal_checkout_button" %>
7
- <% end %>
8
-
9
- <% if current_store.braintree_configuration.credit_card? %>
10
- <fieldset class="braintree-hosted-fields" data-braintree-hosted-fields data-id="<%= id %>">
11
- <%= render "spree/shared/braintree_hosted_fields", payment_method: payment_method %>
12
- </fieldset>
13
- <% end %>
14
-
15
- <% if current_store.braintree_configuration.apple_pay? %>
16
- <%= render "spree/shared/apple_pay_button", id: id %>
17
- <% end %>
18
-
19
- <% if current_store.braintree_configuration.venmo? %>
20
- <%= render "spree/shared/venmo_button", payment_method: payment_method %>
21
- <% end %>
22
-
23
- <%= render "spree/shared/braintree_errors" %>
@@ -1,32 +0,0 @@
1
- <div id="paypal-button"></div>
2
- <div data-pp-message data-pp-placement="payment" data-pp-amount="<%= @order.total %>"></div>
3
-
4
- <script>
5
- var address = <%= sanitize SolidusPaypalBraintree::Address.new(current_order.ship_address).to_json %>
6
-
7
- var paypalOptions = {
8
- flow: '<%= SolidusPaypalBraintree::Gateway.first.preferred_paypal_flow %>',
9
- amount: '<%= current_order.total %>',
10
- currency: '<%= current_order.currency %>',
11
- enableShippingAddress: true,
12
- venmoFunding: <%= SolidusPaypalBraintree::Gateway.first.preferred_enable_venmo_funding %>,
13
- buyerCountry: '<%= SolidusPaypalBraintree::Gateway.first.preferred_force_buyer_country %>',
14
- shippingAddressOverride: address,
15
- shippingAddressEditable: false,
16
- environment: '<%= Rails.env.production? ? "production" : "sandbox" %>',
17
- locale: '<%= paypal_button_preference(:paypal_button_locale, store: current_store) %>',
18
- style: {
19
- color: '<%= paypal_button_preference(:paypal_button_color, store: current_store) %>',
20
- shape: '<%= paypal_button_preference(:paypal_button_shape, store: current_store) %>',
21
- label: '<%= paypal_button_preference(:paypal_button_label, store: current_store) %>',
22
- layout: '<%= paypal_button_preference(:paypal_button_layout, store: current_store) %>',
23
- <% if paypal_button_preference(:paypal_button_layout, store: current_store) == "horizontal" %>
24
- tagline: '<%= paypal_button_preference(:paypal_button_tagline, store: current_store) %>',
25
- <% end %>
26
- messaging: '<%= paypal_button_preference(:paypal_button_messaging, store: current_store) %>'
27
- }
28
- }
29
-
30
- var button = new SolidusPaypalBraintree.createPaypalButton(document.querySelector("#paypal-button"), paypalOptions);
31
- button.initialize();
32
- </script>