solidus_braintree 2.0.0 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (109) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +39 -8
  3. data/.gitignore +1 -0
  4. data/.rubocop.yml +8 -1
  5. data/CHANGELOG.md +37 -29
  6. data/Rakefile +6 -1
  7. data/app/assets/config/solidus_braintree_manifest.js +0 -1
  8. data/app/assets/javascripts/spree/backend/solidus_braintree.js +4 -4
  9. data/app/models/solidus_braintree/gateway.rb +4 -0
  10. data/app/models/solidus_braintree/response.rb +1 -1
  11. data/app/models/solidus_braintree/source.rb +5 -0
  12. data/bin/dummy-app +37 -0
  13. data/bin/rails-dummy-app +17 -0
  14. data/bin/rspec +11 -0
  15. data/bin/sandbox +20 -62
  16. data/db/migrate/20230210104310_add_device_data_to_braintree_sources.rb +5 -0
  17. data/lib/generators/solidus_braintree/install/install_generator.rb +134 -34
  18. data/{app → lib/generators/solidus_braintree/install/templates/app}/assets/javascripts/spree/frontend/paypal_button.js +1 -1
  19. data/lib/generators/solidus_braintree/install/templates/app/assets/javascripts/spree/frontend/solidus_braintree/ajax.js +13 -0
  20. data/{app/assets/javascripts → lib/generators/solidus_braintree/install/templates/app/assets/javascripts/spree/frontend}/solidus_braintree/apple_pay_button.js +2 -2
  21. data/{app/assets/javascripts → lib/generators/solidus_braintree/install/templates/app/assets/javascripts/spree/frontend}/solidus_braintree/checkout.js +10 -5
  22. data/lib/generators/solidus_braintree/install/templates/app/assets/javascripts/spree/frontend/solidus_braintree/client.js +239 -0
  23. data/lib/generators/solidus_braintree/install/templates/app/assets/javascripts/spree/frontend/solidus_braintree/constants.js +89 -0
  24. data/lib/generators/solidus_braintree/install/templates/app/assets/javascripts/spree/frontend/solidus_braintree/frontend.js +15 -0
  25. data/lib/generators/solidus_braintree/install/templates/app/assets/javascripts/spree/frontend/solidus_braintree/hosted_form.js +48 -0
  26. data/{app/assets/javascripts → lib/generators/solidus_braintree/install/templates/app/assets/javascripts/spree/frontend}/solidus_braintree/paypal_button.js +2 -2
  27. data/{app/assets/javascripts → lib/generators/solidus_braintree/install/templates/app/assets/javascripts/spree/frontend}/solidus_braintree/paypal_messaging.js +1 -1
  28. data/lib/generators/solidus_braintree/install/templates/app/assets/javascripts/spree/frontend/solidus_braintree/promise.js +20 -0
  29. data/{app/assets/javascripts → lib/generators/solidus_braintree/install/templates/app/assets/javascripts/spree/frontend}/solidus_braintree/venmo_button.js +1 -1
  30. data/lib/generators/solidus_braintree/install/templates/app/assets/javascripts/spree/frontend/solidus_braintree.js +1 -0
  31. data/{app → lib/generators/solidus_braintree/install/templates/app}/assets/stylesheets/spree/frontend/solidus_braintree.scss +11 -0
  32. data/lib/{controllers/frontend → generators/solidus_braintree/install/templates/app/controllers}/solidus_braintree/checkouts_controller.rb +1 -1
  33. data/lib/{controllers/frontend → generators/solidus_braintree/install/templates/app/controllers}/solidus_braintree/transactions_controller.rb +3 -3
  34. data/lib/generators/solidus_braintree/install/templates/app/views/checkouts/existing_payment/_braintree.html.erb +2 -0
  35. data/lib/{views/frontend/spree/checkout → generators/solidus_braintree/install/templates/app/views/checkouts}/payment/_braintree.html.erb +1 -1
  36. data/lib/{views/frontend/solidus_braintree/payments/_payment.html.erb → generators/solidus_braintree/install/templates/app/views/payments/_braintree_payment_details.html.erb} +0 -3
  37. data/{app → lib/generators/solidus_braintree/install/templates/app}/views/spree/shared/_apple_pay_button.html.erb +1 -1
  38. data/{app → lib/generators/solidus_braintree/install/templates/app}/views/spree/shared/_braintree_head_scripts.html.erb +1 -1
  39. data/{app → lib/generators/solidus_braintree/install/templates/app}/views/spree/shared/_braintree_hosted_fields.html.erb +1 -4
  40. data/lib/solidus_braintree/engine.rb +15 -10
  41. data/lib/solidus_braintree/version.rb +1 -1
  42. data/solidus_braintree.gemspec +3 -5
  43. data/spec/controllers/solidus_braintree/checkouts_controller_spec.rb +2 -2
  44. data/spec/controllers/solidus_braintree/client_tokens_controller_spec.rb +2 -2
  45. data/spec/controllers/solidus_braintree/configurations_controller_spec.rb +2 -2
  46. data/spec/controllers/solidus_braintree/transactions_controller_spec.rb +3 -3
  47. data/spec/fixtures/views/carts/_cart_footer.html.erb +18 -0
  48. data/spec/helpers/solidus_braintree/braintree_admin_helper_spec.rb +1 -1
  49. data/spec/helpers/solidus_braintree/braintree_checkout_helper_spec.rb +1 -1
  50. data/spec/models/solidus_braintree/address_spec.rb +1 -1
  51. data/spec/models/solidus_braintree/avs_result_spec.rb +1 -1
  52. data/spec/models/solidus_braintree/gateway_spec.rb +35 -3
  53. data/spec/models/solidus_braintree/response_spec.rb +1 -1
  54. data/spec/models/solidus_braintree/source_spec.rb +17 -1
  55. data/spec/models/solidus_braintree/transaction_address_spec.rb +2 -2
  56. data/spec/models/solidus_braintree/transaction_import_spec.rb +2 -2
  57. data/spec/models/solidus_braintree/transaction_spec.rb +2 -2
  58. data/spec/models/spree/store_spec.rb +2 -2
  59. data/spec/requests/spree/api/orders_controller_spec.rb +2 -2
  60. data/spec/solidus_braintree_helper.rb +7 -0
  61. data/{lib/solidus_braintree/testing_support → spec/support/solidus_braintree}/factories.rb +17 -15
  62. data/spec/support/{order_ready_for_payment.rb → solidus_braintree/order_ready_for_payment.rb} +9 -2
  63. data/spec/support/solidus_braintree/order_walkthrough.rb +87 -0
  64. data/spec/support/solidus_braintree/with_prepended_view_fixtures.rb +19 -0
  65. data/spec/{features → system}/backend/configuration_spec.rb +2 -2
  66. data/spec/{features → system}/backend/new_payment_spec.rb +3 -4
  67. data/spec/{features → system}/frontend/braintree_credit_card_checkout_spec.rb +23 -15
  68. data/spec/{features → system}/frontend/paypal_checkout_spec.rb +6 -3
  69. data/spec/{features → system}/frontend/venmo_checkout_spec.rb +8 -9
  70. metadata +88 -107
  71. data/app/assets/javascripts/solidus_braintree/frontend.js +0 -14
  72. data/app/assets/javascripts/spree/frontend/solidus_braintree.js +0 -1
  73. data/app/decorators/controllers/solidus_braintree/checkout_controller_decorator.rb +0 -11
  74. data/app/decorators/controllers/solidus_braintree/orders_controller_decorator.rb +0 -11
  75. data/app/overrides/spree/payments/payment/add_paypal_funding_source_to_payment.rb +0 -9
  76. data/app/views/spree/checkout/existing_payment/_braintree.html.erb +0 -10
  77. data/spec/fixtures/views/spree/orders/edit.html.erb +0 -50
  78. data/spec/spec_helper.rb +0 -32
  79. data/spec/support/views.rb +0 -1
  80. /data/app/assets/javascripts/{solidus_braintree → spree/backend/solidus_braintree}/client.js +0 -0
  81. /data/app/assets/javascripts/{solidus_braintree → spree/backend/solidus_braintree}/constants.js +0 -0
  82. /data/app/assets/javascripts/{solidus_braintree → spree/backend/solidus_braintree}/hosted_form.js +0 -0
  83. /data/app/assets/javascripts/{solidus_braintree → spree/backend/solidus_braintree}/promise.js +0 -0
  84. /data/{app → lib/generators/solidus_braintree/install/templates/app}/assets/images/solidus_braintree/venmo/venmo_active_blue_button_280x48.svg +0 -0
  85. /data/{app → lib/generators/solidus_braintree/install/templates/app}/assets/images/solidus_braintree/venmo/venmo_active_blue_button_320x48.svg +0 -0
  86. /data/{app → lib/generators/solidus_braintree/install/templates/app}/assets/images/solidus_braintree/venmo/venmo_active_blue_button_375x48.svg +0 -0
  87. /data/{app → lib/generators/solidus_braintree/install/templates/app}/assets/images/solidus_braintree/venmo/venmo_active_white_button_280x48.svg +0 -0
  88. /data/{app → lib/generators/solidus_braintree/install/templates/app}/assets/images/solidus_braintree/venmo/venmo_active_white_button_320x48.svg +0 -0
  89. /data/{app → lib/generators/solidus_braintree/install/templates/app}/assets/images/solidus_braintree/venmo/venmo_active_white_button_375x48.svg +0 -0
  90. /data/{app → lib/generators/solidus_braintree/install/templates/app}/assets/images/solidus_braintree/venmo/venmo_blue_acceptance_mark.svg +0 -0
  91. /data/{app → lib/generators/solidus_braintree/install/templates/app}/assets/images/solidus_braintree/venmo/venmo_blue_button_280x48.svg +0 -0
  92. /data/{app → lib/generators/solidus_braintree/install/templates/app}/assets/images/solidus_braintree/venmo/venmo_blue_button_320x48.svg +0 -0
  93. /data/{app → lib/generators/solidus_braintree/install/templates/app}/assets/images/solidus_braintree/venmo/venmo_blue_button_375x48.svg +0 -0
  94. /data/{app → lib/generators/solidus_braintree/install/templates/app}/assets/images/solidus_braintree/venmo/venmo_blue_logo.svg +0 -0
  95. /data/{app → lib/generators/solidus_braintree/install/templates/app}/assets/images/solidus_braintree/venmo/venmo_white_acceptance_mark.svg +0 -0
  96. /data/{app → lib/generators/solidus_braintree/install/templates/app}/assets/images/solidus_braintree/venmo/venmo_white_button_280x48.svg +0 -0
  97. /data/{app → lib/generators/solidus_braintree/install/templates/app}/assets/images/solidus_braintree/venmo/venmo_white_button_320x48.svg +0 -0
  98. /data/{app → lib/generators/solidus_braintree/install/templates/app}/assets/images/solidus_braintree/venmo/venmo_white_button_375x48.svg +0 -0
  99. /data/{app → lib/generators/solidus_braintree/install/templates/app}/assets/images/solidus_braintree/venmo/venmo_white_logo.svg +0 -0
  100. /data/{app → lib/generators/solidus_braintree/install/templates/app}/helpers/solidus_braintree/braintree_checkout_helper.rb +0 -0
  101. /data/{app → lib/generators/solidus_braintree/install/templates/app}/views/spree/shared/_braintree_errors.html.erb +0 -0
  102. /data/{app → lib/generators/solidus_braintree/install/templates/app}/views/spree/shared/_paypal_cart_button.html.erb +0 -0
  103. /data/lib/{views/frontend → generators/solidus_braintree/install/templates/app/views}/spree/shared/_paypal_checkout_button.html.erb +0 -0
  104. /data/{app → lib/generators/solidus_braintree/install/templates/app}/views/spree/shared/_paypal_messaging.html.erb +0 -0
  105. /data/{app → lib/generators/solidus_braintree/install/templates/app}/views/spree/shared/_venmo_button.html.erb +0 -0
  106. /data/lib/generators/solidus_braintree/install/templates/{initializer.rb → config/initializers/solidus_braintree.rb} +0 -0
  107. /data/spec/support/{capybara.rb → solidus_braintree/capybara.rb} +0 -0
  108. /data/spec/support/{gateway_helpers.rb → solidus_braintree/gateway_helpers.rb} +0 -0
  109. /data/spec/support/{vcr.rb → solidus_braintree/vcr.rb} +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 295ecfdad98d4575e7e5b92378ebcce1d7f28ec573b9620549c32d27eb772eff
4
- data.tar.gz: ba2317b10a9cffcedd0f433a89da728d2b61f57575fd02842094080b6cdc469a
3
+ metadata.gz: 29c687c74a49c23dce595b8469774c1791b20ca32a634a5cb7cf732fc792c639
4
+ data.tar.gz: aa787422374836f1a6352599b57bb98aea63518ce13c612e53cbafc47ab2d811
5
5
  SHA512:
6
- metadata.gz: f1b6f22c5978de30e13d74552eacd1e4ce6f86c3e585648fbff5eac4cd773923f142e14eb045abea2c14e2fe883874c60467c8767e5d60ace2fc051932035e2b
7
- data.tar.gz: ec1bb595aa6373f76c362b52c9b32d05c24ddd18227eb3f50902b269900a4e98f1757c059dee0c07515094de05a88b3dc5aaba05016b1e5e117f0f81c130ed16
6
+ metadata.gz: 94c9d30e3c88d47fcf4fab6c4a3c5edb0e72e8a670e6d0a8912864c0f71b68147745349cfa673c803aad93c0efd75e08f53cbb993dc7db6a91043822909fc9e5
7
+ data.tar.gz: 0f9e0362ab7ba67a6923e5998c171f5327446c40ba7e4f549762133616c7acbfb6beea71c16bfc0ef87f52da6c9d59a226e67565fb414c6c99cb3da18c4f1123
data/.circleci/config.yml CHANGED
@@ -1,7 +1,6 @@
1
1
  version: 2.1
2
2
 
3
3
  orbs:
4
- # Required for feature specs.
5
4
  browser-tools: circleci/browser-tools@1.1
6
5
 
7
6
  # Always take the latest version of the orb, this allows us to
@@ -10,21 +9,51 @@ orbs:
10
9
  # or goes EOL.
11
10
  solidusio_extensions: solidusio/extensions@volatile
12
11
 
12
+ commands:
13
+ test-with-starter-frontend:
14
+ steps:
15
+ - checkout
16
+ - browser-tools/install-chrome
17
+ - run:
18
+ name: Install libvips
19
+ command: |
20
+ sudo apt-get update
21
+ sudo apt-get install -yq libvips-dev
22
+ - solidusio_extensions/test-branch:
23
+ branch: master
24
+ command: |
25
+ export FRONTEND=starter
26
+ sudo gem update --system
27
+ gem install bundler rails
28
+ bin/dummy-app
29
+ bin/rspec
30
+ - solidusio_extensions/store-test-results
31
+
13
32
  jobs:
14
33
  run-specs-with-postgres:
15
- executor: solidusio_extensions/postgres
34
+ executor:
35
+ name: solidusio_extensions/postgres
36
+ ruby_version: '3.1'
16
37
  steps:
17
- - browser-tools/install-browser-tools
18
- - solidusio_extensions/run-tests
38
+ - test-with-starter-frontend
39
+
19
40
  run-specs-with-mysql:
20
- executor: solidusio_extensions/mysql
41
+ executor:
42
+ name: solidusio_extensions/mysql
43
+ ruby_version: '3.0'
21
44
  steps:
22
- - browser-tools/install-browser-tools
23
- - solidusio_extensions/run-tests
45
+ - test-with-starter-frontend
46
+
47
+ run-specs-with-sqlite:
48
+ executor:
49
+ name: solidusio_extensions/sqlite
50
+ ruby_version: '2.7'
51
+ steps:
52
+ - test-with-starter-frontend
53
+
24
54
  lint-code:
25
55
  executor: solidusio_extensions/sqlite-memory
26
56
  steps:
27
- - browser-tools/install-browser-tools
28
57
  - solidusio_extensions/lint-code
29
58
 
30
59
  workflows:
@@ -32,6 +61,7 @@ workflows:
32
61
  jobs:
33
62
  - run-specs-with-postgres
34
63
  - run-specs-with-mysql
64
+ - run-specs-with-sqlite
35
65
  - lint-code
36
66
 
37
67
  "Weekly run specs against master":
@@ -45,3 +75,4 @@ workflows:
45
75
  jobs:
46
76
  - run-specs-with-postgres
47
77
  - run-specs-with-mysql
78
+ - run-specs-with-sqlite
data/.gitignore CHANGED
@@ -7,6 +7,7 @@
7
7
  .project
8
8
  .sass-cache
9
9
  coverage
10
+ dummy-app
10
11
  Gemfile.lock
11
12
  tmp
12
13
  nbproject
data/.rubocop.yml CHANGED
@@ -3,6 +3,12 @@ require:
3
3
 
4
4
  AllCops:
5
5
  NewCops: disable
6
+ TargetRubyVersion: '2.7'
7
+ Exclude:
8
+ - sandbox/**/*
9
+ - dummy-app/**/*
10
+ - spec/dummy/**/*
11
+ - vendor/bundle/**/*
6
12
 
7
13
  Layout/FirstArgumentIndentation:
8
14
  EnforcedStyle: consistent
@@ -72,7 +78,8 @@ RSpec/MultipleMemoizedHelpers:
72
78
  - spec/models/solidus_braintree/response_spec.rb
73
79
  - spec/models/solidus_braintree/gateway_spec.rb
74
80
  - spec/controllers/solidus_braintree/client_tokens_controller_spec.rb
75
- - spec/features/frontend/braintree_credit_card_checkout_spec.rb
81
+ - spec/system/frontend/braintree_credit_card_checkout_spec.rb
82
+ - spec/system/frontend/paypal_checkout_spec.rb
76
83
 
77
84
  Rails/ApplicationRecord:
78
85
  Exclude:
data/CHANGELOG.md CHANGED
@@ -1,5 +1,42 @@
1
1
  # Changelog
2
2
 
3
+ ## [v3.0.0](https://github.com/solidusio/solidus_braintree/tree/v3.0.0) (2023-03-29)
4
+
5
+ [Full Changelog](https://github.com/solidusio/solidus_braintree/compare/v2.0.0...v3.0.0)
6
+
7
+ **Implemented enhancements:**
8
+
9
+ - Release SolidusBraintree 2.0.0 [\#130](https://github.com/solidusio/solidus_braintree/issues/130)
10
+
11
+ **Merged pull requests:**
12
+
13
+ - Fix: last version supporting SolidusFrontend should be 2.x [\#137](https://github.com/solidusio/solidus_braintree/pull/137) ([gsmendoza](https://github.com/gsmendoza))
14
+ - Fix: user should still be able to disable data collection in a SolidusBraintree hosted form [\#129](https://github.com/solidusio/solidus_braintree/pull/129) ([gsmendoza](https://github.com/gsmendoza))
15
+ - Improve SolidusBraintree README [\#125](https://github.com/solidusio/solidus_braintree/pull/125) ([gsmendoza](https://github.com/gsmendoza))
16
+ - Fix: deprecated version in warning should be 1.x instead of 0.x [\#118](https://github.com/solidusio/solidus_braintree/pull/118) ([gsmendoza](https://github.com/gsmendoza))
17
+ - Migrate database by default [\#117](https://github.com/solidusio/solidus_braintree/pull/117) ([gsmendoza](https://github.com/gsmendoza))
18
+ - Add device data collection [\#116](https://github.com/solidusio/solidus_braintree/pull/116) ([gsmendoza](https://github.com/gsmendoza))
19
+ - Update Solidus dependency to \>= 3.4.0.dev and \< 4 [\#114](https://github.com/solidusio/solidus_braintree/pull/114) ([gsmendoza](https://github.com/gsmendoza))
20
+ - Update SolidusBraintree InstallGenerator to install frontend code [\#112](https://github.com/solidusio/solidus_braintree/pull/112) ([gsmendoza](https://github.com/gsmendoza))
21
+ - Deep stringify the keys of the result params [\#111](https://github.com/solidusio/solidus_braintree/pull/111) ([gsmendoza](https://github.com/gsmendoza))
22
+ - Add Response to log entry permitted classes [\#109](https://github.com/solidusio/solidus_braintree/pull/109) ([gsmendoza](https://github.com/gsmendoza))
23
+ - Make Solidus Braintree compatible with Starter Frontend [\#102](https://github.com/solidusio/solidus_braintree/pull/102) ([gsmendoza](https://github.com/gsmendoza))
24
+ - Make migrations independent of existing models [\#100](https://github.com/solidusio/solidus_braintree/pull/100) ([elia](https://github.com/elia))
25
+ - Update the SolidusPaypalBraintree namespace to SolidusBraintree [\#99](https://github.com/solidusio/solidus_braintree/pull/99) ([gsmendoza](https://github.com/gsmendoza))
26
+ - Merge the history of Solidus PayPal Braintree into this repository [\#98](https://github.com/solidusio/solidus_braintree/pull/98) ([gsmendoza](https://github.com/gsmendoza))
27
+ - Add stale bot [\#89](https://github.com/solidusio/solidus_braintree/pull/89) ([gsmendoza](https://github.com/gsmendoza))
28
+ - Update to use forked solidus\_frontend when needed [\#88](https://github.com/solidusio/solidus_braintree/pull/88) ([waiting-for-dev](https://github.com/waiting-for-dev))
29
+ - Add deprecation notice to README [\#87](https://github.com/solidusio/solidus_braintree/pull/87) ([seand7565](https://github.com/seand7565))
30
+ - Adopt CircleCI instead of Travis [\#85](https://github.com/solidusio/solidus_braintree/pull/85) ([aldesantis](https://github.com/aldesantis))
31
+ - Suggest setting a value for environment preference [\#82](https://github.com/solidusio/solidus_braintree/pull/82) ([mdesantis](https://github.com/mdesantis))
32
+ - Test suite improvements [\#80](https://github.com/solidusio/solidus_braintree/pull/80) ([aitbw](https://github.com/aitbw))
33
+ - Extension maintenance [\#78](https://github.com/solidusio/solidus_braintree/pull/78) ([aitbw](https://github.com/aitbw))
34
+ - Fix references to Spree.t [\#77](https://github.com/solidusio/solidus_braintree/pull/77) ([skukx](https://github.com/skukx))
35
+ - Remove 2.2 from CI \(EOL\) [\#71](https://github.com/solidusio/solidus_braintree/pull/71) ([jacobherrington](https://github.com/jacobherrington))
36
+ - Fix Travis issue with Solidus old versions \(Factory Bot gem\) [\#70](https://github.com/solidusio/solidus_braintree/pull/70) ([spaghetticode](https://github.com/spaghetticode))
37
+ - Remove versions past EOL from .travis.yml [\#69](https://github.com/solidusio/solidus_braintree/pull/69) ([jacobherrington](https://github.com/jacobherrington))
38
+ - Add Solidus 2.7 to .travis.yml [\#68](https://github.com/solidusio/solidus_braintree/pull/68) ([jacobherrington](https://github.com/jacobherrington))
39
+
3
40
  ## [v2.0.0](https://github.com/solidusio/solidus_braintree/tree/v2.0.0) (2023-03-17)
4
41
 
5
42
  [Full Changelog](https://github.com/solidusio/solidus_braintree/compare/v1.2.0...v2.0.0)
@@ -42,35 +79,6 @@
42
79
  - Use of undefined show\_flash function in frontend [\#31](https://github.com/solidusio/solidus_braintree/issues/31)
43
80
  - Select an implementation for how to store non credit card data in Solidus [\#3](https://github.com/solidusio/solidus_braintree/issues/3)
44
81
 
45
- **Merged pull requests:**
46
-
47
- - Fix: last version supporting SolidusFrontend should be 2.x [\#137](https://github.com/solidusio/solidus_braintree/pull/137) ([gsmendoza](https://github.com/gsmendoza))
48
- - Fix: user should still be able to disable data collection in a SolidusBraintree hosted form [\#129](https://github.com/solidusio/solidus_braintree/pull/129) ([gsmendoza](https://github.com/gsmendoza))
49
- - Improve SolidusBraintree README [\#125](https://github.com/solidusio/solidus_braintree/pull/125) ([gsmendoza](https://github.com/gsmendoza))
50
- - Fix: deprecated version in warning should be 1.x instead of 0.x [\#118](https://github.com/solidusio/solidus_braintree/pull/118) ([gsmendoza](https://github.com/gsmendoza))
51
- - Migrate database by default [\#117](https://github.com/solidusio/solidus_braintree/pull/117) ([gsmendoza](https://github.com/gsmendoza))
52
- - Add device data collection [\#116](https://github.com/solidusio/solidus_braintree/pull/116) ([gsmendoza](https://github.com/gsmendoza))
53
- - Update Solidus dependency to \>= 3.4.0.dev and \< 4 [\#114](https://github.com/solidusio/solidus_braintree/pull/114) ([gsmendoza](https://github.com/gsmendoza))
54
- - Update SolidusBraintree InstallGenerator to install frontend code [\#112](https://github.com/solidusio/solidus_braintree/pull/112) ([gsmendoza](https://github.com/gsmendoza))
55
- - Deep stringify the keys of the result params [\#111](https://github.com/solidusio/solidus_braintree/pull/111) ([gsmendoza](https://github.com/gsmendoza))
56
- - Add Response to log entry permitted classes [\#109](https://github.com/solidusio/solidus_braintree/pull/109) ([gsmendoza](https://github.com/gsmendoza))
57
- - Make Solidus Braintree compatible with Starter Frontend [\#102](https://github.com/solidusio/solidus_braintree/pull/102) ([gsmendoza](https://github.com/gsmendoza))
58
- - Make migrations independent of existing models [\#100](https://github.com/solidusio/solidus_braintree/pull/100) ([elia](https://github.com/elia))
59
- - Update the SolidusPaypalBraintree namespace to SolidusBraintree [\#99](https://github.com/solidusio/solidus_braintree/pull/99) ([gsmendoza](https://github.com/gsmendoza))
60
- - Merge the history of Solidus PayPal Braintree into this repository [\#98](https://github.com/solidusio/solidus_braintree/pull/98) ([gsmendoza](https://github.com/gsmendoza))
61
- - Add stale bot [\#89](https://github.com/solidusio/solidus_braintree/pull/89) ([gsmendoza](https://github.com/gsmendoza))
62
- - Update to use forked solidus\_frontend when needed [\#88](https://github.com/solidusio/solidus_braintree/pull/88) ([waiting-for-dev](https://github.com/waiting-for-dev))
63
- - Add deprecation notice to README [\#87](https://github.com/solidusio/solidus_braintree/pull/87) ([seand7565](https://github.com/seand7565))
64
- - Adopt CircleCI instead of Travis [\#85](https://github.com/solidusio/solidus_braintree/pull/85) ([aldesantis](https://github.com/aldesantis))
65
- - Suggest setting a value for environment preference [\#82](https://github.com/solidusio/solidus_braintree/pull/82) ([mdesantis](https://github.com/mdesantis))
66
- - Test suite improvements [\#80](https://github.com/solidusio/solidus_braintree/pull/80) ([aitbw](https://github.com/aitbw))
67
- - Extension maintenance [\#78](https://github.com/solidusio/solidus_braintree/pull/78) ([aitbw](https://github.com/aitbw))
68
- - Fix references to Spree.t [\#77](https://github.com/solidusio/solidus_braintree/pull/77) ([skukx](https://github.com/skukx))
69
- - Remove 2.2 from CI \(EOL\) [\#71](https://github.com/solidusio/solidus_braintree/pull/71) ([jacobherrington](https://github.com/jacobherrington))
70
- - Fix Travis issue with Solidus old versions \(Factory Bot gem\) [\#70](https://github.com/solidusio/solidus_braintree/pull/70) ([spaghetticode](https://github.com/spaghetticode))
71
- - Remove versions past EOL from .travis.yml [\#69](https://github.com/solidusio/solidus_braintree/pull/69) ([jacobherrington](https://github.com/jacobherrington))
72
- - Add Solidus 2.7 to .travis.yml [\#68](https://github.com/solidusio/solidus_braintree/pull/68) ([jacobherrington](https://github.com/jacobherrington))
73
-
74
82
  ## [v1.2.0](https://github.com/solidusio/solidus_braintree/tree/v1.2.0) (2018-05-25)
75
83
 
76
84
  [Full Changelog](https://github.com/solidusio/solidus_braintree/compare/v1.1.0...v1.2.0)
data/Rakefile CHANGED
@@ -3,4 +3,9 @@
3
3
  require 'solidus_dev_support/rake_tasks'
4
4
  SolidusDevSupport::RakeTasks.install
5
5
 
6
- task default: 'extension:specs'
6
+ task :default do
7
+ require 'bundler'
8
+ Bundler.with_unbundled_env do
9
+ sh 'bin/rspec'
10
+ end
11
+ end
@@ -1 +0,0 @@
1
- //= link_tree ../images
@@ -1,7 +1,7 @@
1
- //= require solidus_braintree/constants
2
- //= require solidus_braintree/client
3
- //= require solidus_braintree/promise
4
- //= require solidus_braintree/hosted_form
1
+ //= require spree/backend/solidus_braintree/constants
2
+ //= require spree/backend/solidus_braintree/client
3
+ //= require spree/backend/solidus_braintree/promise
4
+ //= require spree/backend/solidus_braintree/hosted_form
5
5
 
6
6
  $(function() {
7
7
  var $paymentForm = $("#new_payment"),
@@ -364,6 +364,10 @@ module SolidusBraintree
364
364
  params[:payment_method_nonce] = source.nonce
365
365
  end
366
366
 
367
+ if source&.device_data
368
+ params[:device_data] = source.device_data
369
+ end
370
+
367
371
  if source.paypal?
368
372
  params[:shipping] = braintree_shipping_address(options)
369
373
  end
@@ -29,7 +29,7 @@ module SolidusBraintree
29
29
  # For error responses we want to have the CVV code
30
30
  cvv_result: transaction&.cvv_response_code
31
31
  )
32
- new(false, error_message(result), result.params, options)
32
+ new(false, error_message(result), result.params.deep_stringify_keys, options)
33
33
  end
34
34
 
35
35
  def response_options(transaction)
@@ -25,6 +25,7 @@ module SolidusBraintree
25
25
 
26
26
  validates :payment_type, inclusion: [PAYPAL, APPLE_PAY, VENMO, CREDIT_CARD]
27
27
 
28
+ before_validation :clear_device_data_if_blank
28
29
  before_save :clear_paypal_funding_source, unless: :paypal?
29
30
 
30
31
  scope(:with_payment_profile, -> { joins(:customer) })
@@ -128,6 +129,10 @@ module SolidusBraintree
128
129
  @braintree_client ||= payment_method.try(:braintree)
129
130
  end
130
131
 
132
+ def clear_device_data_if_blank
133
+ self.device_data = nil if device_data.blank?
134
+ end
135
+
131
136
  def clear_paypal_funding_source
132
137
  self.paypal_funding_source = nil
133
138
  end
data/bin/dummy-app ADDED
@@ -0,0 +1,37 @@
1
+ #!/usr/bin/env bash
2
+
3
+ set -e
4
+
5
+ extension_name="solidus_braintree"
6
+
7
+ # Stay away from the bundler env of the containing extension.
8
+ function unbundled {
9
+ ruby -rbundler -e'b = proc {system *ARGV}; Bundler.respond_to?(:with_unbundled_env) ? Bundler.with_unbundled_env(&b) : Bundler.with_clean_env(&b)' -- "$@"
10
+ }
11
+
12
+ # "sqlite" is set by the ORB extension instead of "sqlite3",
13
+ # all other options are already in the format expected by `rails new`.
14
+ test "$DB" = "sqlite" && export DB="sqlite3"
15
+
16
+ rm -rf ./dummy-app
17
+ rails new dummy-app \
18
+ --database=${DB:-sqlite3} \
19
+ --skip-git \
20
+ --skip-keeps \
21
+ --skip-rc \
22
+ --skip-bootsnap \
23
+ --skip-test
24
+
25
+ if [ ! -d "dummy-app" ]; then
26
+ echo 'dummy-app rails application failed'
27
+ exit 1
28
+ fi
29
+
30
+ cd ./dummy-app
31
+ unbundled bundle add solidus --github solidusio/solidus --branch "${BRANCH:-master}" --version '> 0.a'
32
+ unbundled bundle exec rake db:drop db:create
33
+ unbundled bundle exec rails generate solidus:install --auto-accept --payment-method=none --no-seed --no-sample "$@"
34
+ unbundled bundle add $extension_name --path ..
35
+ unbundled bundle exec rails generate $extension_name:install --migrate --specs=all
36
+
37
+
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ root = "#{__dir__}/.."
4
+ app_root = "#{root}/dummy-app"
5
+
6
+ unless File.exist? "#{app_root}/bin/rails"
7
+ warn 'Creating the dummy-app app...'
8
+ Dir.chdir root do
9
+ system "#{root}/bin/dummy-app" or begin
10
+ warn 'Automatic creation of the dummy-app app failed'
11
+ exit 1
12
+ end
13
+ end
14
+ end
15
+
16
+ Dir.chdir app_root
17
+ exec "#{app_root}/bin/rails", *ARGV
data/bin/rspec ADDED
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env bash
2
+
3
+ set -e
4
+
5
+ bin/rails-dummy-app generate solidus_braintree:install --force --migrate --specs=all
6
+
7
+ cd dummy-app/
8
+ rspec "$@"
9
+ exit_status=$?
10
+ cd -
11
+ exit $exit_status
data/bin/sandbox CHANGED
@@ -1,10 +1,6 @@
1
1
  #!/usr/bin/env bash
2
2
 
3
3
  set -e
4
- if [ -n "$DEBUG" ]
5
- then
6
- set -x
7
- fi
8
4
 
9
5
  case "$DB" in
10
6
  postgres|postgresql)
@@ -13,51 +9,37 @@ postgres|postgresql)
13
9
  mysql)
14
10
  RAILSDB="mysql"
15
11
  ;;
16
- sqlite3|sqlite)
17
- RAILSDB="sqlite3"
18
- ;;
19
- '')
20
- echo "~~> Use 'export DB=[postgres|mysql|sqlite]' to control the DB adapter"
12
+ sqlite|'')
21
13
  RAILSDB="sqlite3"
22
14
  ;;
23
15
  *)
24
- echo "Invalid value specified for the Solidus sandbox: DB=\"$DB\"."
25
- echo "Please use 'postgres', 'mysql', or 'sqlite' instead."
16
+ echo "Invalid DB specified: $DB"
26
17
  exit 1
27
18
  ;;
28
19
  esac
29
- echo "~~> Using $RAILSDB as the database engine"
30
-
31
- if [ -z "$SOLIDUS_BRANCH" ]
32
- then
33
- echo "~~> Use 'export SOLIDUS_BRANCH=[master|v3.2|...]' to control the Solidus branch"
34
- SOLIDUS_BRANCH="master"
35
- fi
36
- echo "~~> Using branch $SOLIDUS_BRANCH of solidus"
37
20
 
38
- if [ -z "$SOLIDUS_FRONTEND" ]
21
+ if [ ! -z $SOLIDUS_BRANCH ]
39
22
  then
40
- echo "~~> Use 'export SOLIDUS_FRONTEND=[solidus_frontend|solidus_starter_frontend]' to control the Solidus frontend"
41
- SOLIDUS_FRONTEND="solidus_frontend"
23
+ BRANCH=$SOLIDUS_BRANCH
24
+ else
25
+ BRANCH="master"
42
26
  fi
43
- echo "~~> Using branch $SOLIDUS_FRONTEND as the solidus frontend"
44
27
 
45
28
  extension_name="solidus_braintree"
46
29
 
47
30
  # Stay away from the bundler env of the containing extension.
48
31
  function unbundled {
49
- ruby -rbundler -e'b = proc {system *ARGV}; Bundler.respond_to?(:with_unbundled_env) ? Bundler.with_unbundled_env(&b) : Bundler.with_clean_env(&b)' -- $@
32
+ ruby -rbundler -e'b = proc {system *ARGV}; Bundler.respond_to?(:with_unbundled_env) ? Bundler.with_unbundled_env(&b) : Bundler.with_clean_env(&b)' -- "$@"
50
33
  }
51
34
 
52
35
  rm -rf ./sandbox
53
- unbundled bundle exec rails new sandbox --database="$RAILSDB" \
54
- --skip-bundle \
36
+ rails new sandbox \
37
+ --database="$RAILSDB" \
55
38
  --skip-git \
56
39
  --skip-keeps \
57
40
  --skip-rc \
58
- --skip-spring \
59
- --skip-test \
60
- --skip-javascript
41
+ --skip-bootsnap \
42
+ --skip-test
61
43
 
62
44
  if [ ! -d "sandbox" ]; then
63
45
  echo 'sandbox rails application failed'
@@ -65,39 +47,15 @@ if [ ! -d "sandbox" ]; then
65
47
  fi
66
48
 
67
49
  cd ./sandbox
68
- cat <<RUBY >> Gemfile
69
- gem 'solidus', github: 'solidusio/solidus', branch: '$SOLIDUS_BRANCH'
70
- gem 'rails-i18n'
71
- gem 'solidus_i18n'
72
-
73
- # This Braintree extension contains a user decorator, so the user class must be loaded first.
74
- gem "solidus_auth_devise", "~> 2.5"
75
- gem '$extension_name', path: '..'
76
-
77
- group :test, :development do
78
- platforms :mri do
79
- gem 'pry-byebug'
80
- end
81
- end
82
- RUBY
83
-
84
- unbundled bundle install --gemfile Gemfile
85
-
50
+ unbundled bundle add solidus --github solidusio/solidus --branch "${BRANCH:-master}" --version '> 0.a'
86
51
  unbundled bundle exec rake db:drop db:create
87
-
88
- # Still request "devise". Solidus will skip installing it again but will include its seeds.
89
- unbundled bundle exec rails generate solidus:install \
90
- --auto-accept \
91
- --user_class=Spree::User \
92
- --enforce_available_locales=true \
93
- --authentication="devise" \
94
- --payment-method=none \
95
- --frontend=${SOLIDUS_FRONTEND} \
96
- $@
97
-
98
- unbundled bundle exec rails generate solidus:auth:install --auto-run-migrations
99
- unbundled bundle exec rails generate ${extension_name}:install --auto-run-migrations
52
+ unbundled bundle exec rails generate solidus:install --payment-method=none --auto-accept "$@"
53
+ unbundled bundle add ${extension_name} --path '../'
54
+ unbundled bundle exec rails generate ${extension_name}:install --frontend=starter --migrate=true
100
55
 
101
56
  echo
102
- echo "🚀 Sandbox app successfully created for $extension_name!"
103
- echo "🧪 This app is intended for test purposes."
57
+ echo "🚀 Sandbox app successfully created for ${extension_name}!"
58
+ echo "🚀 Using $RAILSDB and Solidus $BRANCH"
59
+ echo "🚀 Use 'export DB=[postgres|mysql|sqlite]' to control the DB adapter"
60
+ echo "🚀 Use 'export SOLIDUS_BRANCH=<BRANCH-NAME>' to control the Solidus version"
61
+ echo "🚀 This app is intended for test purposes."
@@ -0,0 +1,5 @@
1
+ class AddDeviceDataToBraintreeSources < ActiveRecord::Migration[5.1]
2
+ def change
3
+ add_column :solidus_paypal_braintree_sources, :device_data, :string
4
+ end
5
+ end