solidus_paypal_braintree 1.1.2 โ†’ 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (171) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +1 -16
  3. data/.github/stale.yml +1 -17
  4. data/.github_changelog_generator +2 -0
  5. data/.gitignore +4 -3
  6. data/.rubocop.yml +1 -2
  7. data/CHANGELOG.md +41 -0
  8. data/Gemfile +18 -20
  9. data/README.md +50 -17
  10. data/bin/rails +4 -12
  11. data/bin/rails-engine +13 -0
  12. data/bin/rails-sandbox +16 -0
  13. data/bin/rake +7 -0
  14. data/bin/sandbox +103 -0
  15. data/bin/setup +1 -1
  16. data/lib/generators/solidus_paypal_braintree/install/install_generator.rb +2 -31
  17. data/lib/solidus_paypal_braintree/engine.rb +1 -56
  18. data/lib/solidus_paypal_braintree/version.rb +1 -1
  19. data/lib/solidus_paypal_braintree.rb +1 -4
  20. data/solidus_paypal_braintree.gemspec +41 -39
  21. data/spec/controllers/solidus_paypal_braintree/checkouts_controller_spec.rb +99 -0
  22. data/spec/controllers/solidus_paypal_braintree/client_tokens_controller_spec.rb +55 -0
  23. data/spec/controllers/solidus_paypal_braintree/configurations_controller_spec.rb +73 -0
  24. data/spec/controllers/solidus_paypal_braintree/transactions_controller_spec.rb +183 -0
  25. data/spec/features/backend/configuration_spec.rb +23 -0
  26. data/spec/features/backend/new_payment_spec.rb +137 -0
  27. data/spec/features/frontend/braintree_credit_card_checkout_spec.rb +191 -0
  28. data/spec/features/frontend/paypal_checkout_spec.rb +166 -0
  29. data/spec/features/frontend/venmo_checkout_spec.rb +194 -0
  30. data/spec/fixtures/cassettes/admin/invalid_credit_card.yml +63 -0
  31. data/spec/fixtures/cassettes/admin/resubmit_credit_card.yml +352 -0
  32. data/spec/fixtures/cassettes/admin/valid_credit_card.yml +412 -0
  33. data/spec/fixtures/cassettes/braintree/create_profile.yml +71 -0
  34. data/spec/fixtures/cassettes/braintree/generate_token.yml +63 -0
  35. data/spec/fixtures/cassettes/braintree/token.yml +63 -0
  36. data/spec/fixtures/cassettes/checkout/invalid_credit_card.yml +63 -0
  37. data/spec/fixtures/cassettes/checkout/resubmit_credit_card.yml +216 -0
  38. data/spec/fixtures/cassettes/checkout/update.yml +71 -0
  39. data/spec/fixtures/cassettes/checkout/valid_credit_card.yml +171 -0
  40. data/spec/fixtures/cassettes/checkout/valid_venmo_transaction.yml +599 -0
  41. data/spec/fixtures/cassettes/gateway/authorize/credit_card/address.yml +86 -0
  42. data/spec/fixtures/cassettes/gateway/authorize/merchant_account/EUR.yml +154 -0
  43. data/spec/fixtures/cassettes/gateway/authorize/paypal/EUR.yml +90 -0
  44. data/spec/fixtures/cassettes/gateway/authorize/paypal/address.yml +90 -0
  45. data/spec/fixtures/cassettes/gateway/authorize.yml +86 -0
  46. data/spec/fixtures/cassettes/gateway/authorized_transaction.yml +73 -0
  47. data/spec/fixtures/cassettes/gateway/cancel/missing.yml +63 -0
  48. data/spec/fixtures/cassettes/gateway/cancel/refunds.yml +272 -0
  49. data/spec/fixtures/cassettes/gateway/cancel/void.yml +201 -0
  50. data/spec/fixtures/cassettes/gateway/capture.yml +141 -0
  51. data/spec/fixtures/cassettes/gateway/complete.yml +157 -0
  52. data/spec/fixtures/cassettes/gateway/credit.yml +208 -0
  53. data/spec/fixtures/cassettes/gateway/customer.yml +79 -0
  54. data/spec/fixtures/cassettes/gateway/purchase.yml +87 -0
  55. data/spec/fixtures/cassettes/gateway/settled_transaction.yml +140 -0
  56. data/spec/fixtures/cassettes/gateway/void.yml +137 -0
  57. data/spec/fixtures/cassettes/source/bin.yml +295 -0
  58. data/spec/fixtures/cassettes/source/card_type.yml +267 -0
  59. data/spec/fixtures/cassettes/source/last4.yml +267 -0
  60. data/spec/fixtures/cassettes/transaction/import/valid/capture.yml +224 -0
  61. data/spec/fixtures/cassettes/transaction/import/valid.yml +71 -0
  62. data/spec/fixtures/views/spree/orders/edit.html.erb +50 -0
  63. data/spec/helpers/solidus_paypal_braintree/braintree_admin_helper_spec.rb +17 -0
  64. data/spec/helpers/solidus_paypal_braintree/braintree_checkout_helper_spec.rb +70 -0
  65. data/spec/models/solidus_paypal_braintree/address_spec.rb +71 -0
  66. data/spec/models/solidus_paypal_braintree/avs_result_spec.rb +317 -0
  67. data/spec/models/solidus_paypal_braintree/gateway_spec.rb +742 -0
  68. data/spec/models/solidus_paypal_braintree/response_spec.rb +280 -0
  69. data/spec/models/solidus_paypal_braintree/source_spec.rb +539 -0
  70. data/spec/models/solidus_paypal_braintree/transaction_address_spec.rb +235 -0
  71. data/spec/models/solidus_paypal_braintree/transaction_import_spec.rb +302 -0
  72. data/spec/models/solidus_paypal_braintree/transaction_spec.rb +86 -0
  73. data/spec/models/spree/store_spec.rb +14 -0
  74. data/spec/requests/spree/api/orders_controller_spec.rb +36 -0
  75. data/spec/spec_helper.rb +32 -0
  76. data/spec/support/capybara.rb +7 -0
  77. data/spec/support/gateway_helpers.rb +29 -0
  78. data/spec/support/order_ready_for_payment.rb +37 -0
  79. data/spec/support/vcr.rb +42 -0
  80. data/spec/support/views.rb +1 -0
  81. metadata +144 -178
  82. data/app/assets/config/solidus_paypal_braintree_manifest.js +0 -1
  83. data/app/assets/images/solidus_paypal_braintree/venmo/venmo_active_blue_button_280x48.svg +0 -19
  84. data/app/assets/images/solidus_paypal_braintree/venmo/venmo_active_blue_button_320x48.svg +0 -19
  85. data/app/assets/images/solidus_paypal_braintree/venmo/venmo_active_blue_button_375x48.svg +0 -19
  86. data/app/assets/images/solidus_paypal_braintree/venmo/venmo_active_white_button_280x48.svg +0 -19
  87. data/app/assets/images/solidus_paypal_braintree/venmo/venmo_active_white_button_320x48.svg +0 -19
  88. data/app/assets/images/solidus_paypal_braintree/venmo/venmo_active_white_button_375x48.svg +0 -19
  89. data/app/assets/images/solidus_paypal_braintree/venmo/venmo_blue_acceptance_mark.svg +0 -15
  90. data/app/assets/images/solidus_paypal_braintree/venmo/venmo_blue_button_280x48.svg +0 -19
  91. data/app/assets/images/solidus_paypal_braintree/venmo/venmo_blue_button_320x48.svg +0 -19
  92. data/app/assets/images/solidus_paypal_braintree/venmo/venmo_blue_button_375x48.svg +0 -19
  93. data/app/assets/images/solidus_paypal_braintree/venmo/venmo_blue_logo.svg +0 -18
  94. data/app/assets/images/solidus_paypal_braintree/venmo/venmo_white_acceptance_mark.svg +0 -20
  95. data/app/assets/images/solidus_paypal_braintree/venmo/venmo_white_button_280x48.svg +0 -19
  96. data/app/assets/images/solidus_paypal_braintree/venmo/venmo_white_button_320x48.svg +0 -19
  97. data/app/assets/images/solidus_paypal_braintree/venmo/venmo_white_button_375x48.svg +0 -19
  98. data/app/assets/images/solidus_paypal_braintree/venmo/venmo_white_logo.svg +0 -18
  99. data/app/assets/javascripts/solidus_paypal_braintree/apple_pay_button.js +0 -179
  100. data/app/assets/javascripts/solidus_paypal_braintree/checkout.js +0 -108
  101. data/app/assets/javascripts/solidus_paypal_braintree/client.js +0 -239
  102. data/app/assets/javascripts/solidus_paypal_braintree/constants.js +0 -89
  103. data/app/assets/javascripts/solidus_paypal_braintree/frontend.js +0 -14
  104. data/app/assets/javascripts/solidus_paypal_braintree/hosted_form.js +0 -46
  105. data/app/assets/javascripts/solidus_paypal_braintree/paypal_button.js +0 -178
  106. data/app/assets/javascripts/solidus_paypal_braintree/paypal_messaging.js +0 -22
  107. data/app/assets/javascripts/solidus_paypal_braintree/promise.js +0 -20
  108. data/app/assets/javascripts/solidus_paypal_braintree/venmo_button.js +0 -86
  109. data/app/assets/javascripts/spree/backend/solidus_paypal_braintree.js +0 -96
  110. data/app/assets/javascripts/spree/frontend/paypal_button.js +0 -34
  111. data/app/assets/javascripts/spree/frontend/solidus_paypal_braintree.js +0 -1
  112. data/app/assets/stylesheets/spree/backend/solidus_paypal_braintree.scss +0 -28
  113. data/app/assets/stylesheets/spree/frontend/solidus_paypal_braintree.css +0 -51
  114. data/app/decorators/controllers/solidus_paypal_braintree/admin_payments_controller_decorator.rb +0 -11
  115. data/app/decorators/controllers/solidus_paypal_braintree/checkout_controller_decorator.rb +0 -11
  116. data/app/decorators/controllers/solidus_paypal_braintree/client_tokens_controller.rb +0 -41
  117. data/app/decorators/controllers/solidus_paypal_braintree/orders_controller_decorator.rb +0 -11
  118. data/app/decorators/models/solidus_paypal_braintree/spree/store_decorator.rb +0 -20
  119. data/app/decorators/models/solidus_paypal_braintree/spree/user_decorator.rb +0 -13
  120. data/app/helpers/solidus_paypal_braintree/braintree_admin_helper.rb +0 -23
  121. data/app/helpers/solidus_paypal_braintree/braintree_checkout_helper.rb +0 -60
  122. data/app/models/application_record.rb +0 -5
  123. data/app/models/solidus_paypal_braintree/address.rb +0 -64
  124. data/app/models/solidus_paypal_braintree/avs_result.rb +0 -69
  125. data/app/models/solidus_paypal_braintree/configuration.rb +0 -41
  126. data/app/models/solidus_paypal_braintree/customer.rb +0 -8
  127. data/app/models/solidus_paypal_braintree/gateway.rb +0 -432
  128. data/app/models/solidus_paypal_braintree/response.rb +0 -80
  129. data/app/models/solidus_paypal_braintree/source.rb +0 -133
  130. data/app/models/solidus_paypal_braintree/transaction.rb +0 -31
  131. data/app/models/solidus_paypal_braintree/transaction_address.rb +0 -87
  132. data/app/models/solidus_paypal_braintree/transaction_import.rb +0 -98
  133. data/app/overrides/spree/payments/payment/add_paypal_funding_source_to_payment.rb +0 -9
  134. data/app/views/spree/api/payments/source_views/_paypal_braintree.json.jbuilder +0 -3
  135. data/app/views/spree/checkout/existing_payment/_paypal_braintree.html.erb +0 -10
  136. data/app/views/spree/shared/_apple_pay_button.html.erb +0 -27
  137. data/app/views/spree/shared/_braintree_errors.html.erb +0 -16
  138. data/app/views/spree/shared/_braintree_hosted_fields.html.erb +0 -43
  139. data/app/views/spree/shared/_paypal_braintree_head_scripts.html.erb +0 -26
  140. data/app/views/spree/shared/_paypal_cart_button.html.erb +0 -38
  141. data/app/views/spree/shared/_paypal_messaging.html.erb +0 -13
  142. data/app/views/spree/shared/_venmo_button.html.erb +0 -33
  143. data/config/locales/en.yml +0 -96
  144. data/config/locales/it.yml +0 -56
  145. data/config/routes.rb +0 -14
  146. data/db/migrate/20160830061749_create_solidus_paypal_braintree_sources.rb +0 -16
  147. data/db/migrate/20160906201711_create_solidus_paypal_braintree_customers.rb +0 -13
  148. data/db/migrate/20161114231422_create_solidus_paypal_braintree_configurations.rb +0 -11
  149. data/db/migrate/20161125172005_add_braintree_configuration_to_stores.rb +0 -7
  150. data/db/migrate/20170203191030_add_credit_card_to_braintree_configuration.rb +0 -6
  151. data/db/migrate/20170505193712_add_null_constraint_to_sources.rb +0 -32
  152. data/db/migrate/20170508085402_add_not_null_constraint_to_sources_payment_type.rb +0 -11
  153. data/db/migrate/20190705115327_add_paypal_button_preferences_to_braintree_configurations.rb +0 -5
  154. data/db/migrate/20190911141712_add_3d_secure_to_braintree_configuration.rb +0 -5
  155. data/db/migrate/20211222170950_add_paypal_funding_source_to_solidus_paypal_braintree_sources.rb +0 -5
  156. data/db/migrate/20220104150301_add_venmo_to_braintree_configuration.rb +0 -5
  157. data/lib/controllers/backend/solidus_paypal_braintree/configurations_controller.rb +0 -48
  158. data/lib/controllers/frontend/solidus_paypal_braintree/checkouts_controller.rb +0 -31
  159. data/lib/controllers/frontend/solidus_paypal_braintree/transactions_controller.rb +0 -67
  160. data/lib/solidus_paypal_braintree/country_mapper.rb +0 -37
  161. data/lib/solidus_paypal_braintree/factories.rb +0 -53
  162. data/lib/solidus_paypal_braintree/request_protection.rb +0 -21
  163. data/lib/views/backend/solidus_paypal_braintree/configurations/list.html.erb +0 -63
  164. data/lib/views/backend/spree/admin/payments/source_forms/_paypal_braintree.html.erb +0 -16
  165. data/lib/views/backend/spree/admin/payments/source_views/_paypal_braintree.html.erb +0 -39
  166. data/lib/views/backend/spree/admin/shared/preference_fields/_preference_select.html.erb +0 -13
  167. data/lib/views/backend_v1.2/spree/admin/payments/source_forms/_paypal_braintree.html.erb +0 -16
  168. data/lib/views/backend_v2.4/spree/admin/shared/preference_fields/_hash.html.erb +0 -12
  169. data/lib/views/frontend/solidus_paypal_braintree/payments/_payment.html.erb +0 -12
  170. data/lib/views/frontend/spree/checkout/payment/_paypal_braintree.html.erb +0 -23
  171. data/lib/views/frontend/spree/shared/_paypal_checkout_button.html.erb +0 -32
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c020d3e16f7e113ad45cde24ae56a9df9df4eef47bc0698baf745648cd9f279b
4
- data.tar.gz: 94214d4a10a14e6a894d32e859d674bb26476f8159e6b6549eb9b8c849d72f8b
3
+ metadata.gz: 1c6085bc8f7520e1cc3af5df786810b9ff6b4f45403dff9072f51086d9afe0b6
4
+ data.tar.gz: e652de0bf5d7b517323f02c68b361d8ebf4d51c15f987dc188f6169e3ddfbecb
5
5
  SHA512:
6
- metadata.gz: 9f8f74dfa20c79a7c5b2df844260fd57887b4ccf35aa29724e605661d294ff5584eadc236c1d7a4cfc56b2cfff64913b727b9c029765600734c6874a4574fb79
7
- data.tar.gz: 6876a643638762d3f6c6d8a915ea1651eea2f928f5ca3f92a59cbc0fcd81ce59d7ee6a688d9587a362bc9e0460efea6e312cd471c81f96fc7e4a797faab3c967
6
+ metadata.gz: 4323694d9f2478bd8839a6833591879a414e35639fbdd96a54a96bc5e8916e0ac39df525bc1f7aed7ac87039242651712429019c638dcffe8affc7a95215433a
7
+ data.tar.gz: e079058905f73cd30e4c8cc8dd846e1106160ccc36a1704adf7f081eb15612cd9c834bf67bcf16a351ac7f02b0cf6606e5d70e9ae1fb2bb360b1c4ea8c318701
data/.circleci/config.yml CHANGED
@@ -1,6 +1,7 @@
1
1
  version: 2.1
2
2
 
3
3
  orbs:
4
+ # Required for feature specs.
4
5
  browser-tools: circleci/browser-tools@1.1
5
6
 
6
7
  # Always take the latest version of the orb, this allows us to
@@ -20,25 +21,9 @@ jobs:
20
21
  steps:
21
22
  - browser-tools/install-browser-tools
22
23
  - solidusio_extensions/run-tests
23
- lint-code:
24
- executor: solidusio_extensions/sqlite-memory
25
- steps:
26
- - solidusio_extensions/lint-code
27
24
 
28
25
  workflows:
29
26
  "Run specs on supported Solidus versions":
30
27
  jobs:
31
28
  - run-specs-with-postgres
32
29
  - run-specs-with-mysql
33
- - lint-code
34
- "Weekly run specs against master":
35
- triggers:
36
- - schedule:
37
- cron: "0 0 * * 4" # every Thursday
38
- filters:
39
- branches:
40
- only:
41
- - master
42
- jobs:
43
- - run-specs-with-postgres
44
- - run-specs-with-mysql
data/.github/stale.yml CHANGED
@@ -1,17 +1 @@
1
- # Number of days of inactivity before an issue becomes stale
2
- daysUntilStale: 60
3
- # Number of days of inactivity before a stale issue is closed
4
- daysUntilClose: 7
5
- # Issues with these labels will never be considered stale
6
- exemptLabels:
7
- - pinned
8
- - security
9
- # Label to use when marking an issue as stale
10
- staleLabel: wontfix
11
- # Comment to post when marking an issue as stale. Set to `false` to disable
12
- markComment: >
13
- This issue has been automatically marked as stale because it has not had
14
- recent activity. It will be closed if no further activity occurs. Thank you
15
- for your contributions.
16
- # Comment to post when closing a stale issue. Set to `false` to disable
17
- closeComment: false
1
+ _extends: .github
@@ -0,0 +1,2 @@
1
+ issues=false
2
+ exclude-labels=infrastructure
data/.gitignore CHANGED
@@ -7,7 +7,6 @@
7
7
  .project
8
8
  .sass-cache
9
9
  coverage
10
- Gemfile-local
11
10
  Gemfile.lock
12
11
  tmp
13
12
  nbproject
@@ -15,5 +14,7 @@ pkg
15
14
  *.swp
16
15
  spec/dummy
17
16
  spec/examples.txt
18
- .bundle/
19
- .env
17
+ /sandbox
18
+ .rvmrc
19
+ .ruby-version
20
+ .ruby-gemset
data/.rubocop.yml CHANGED
@@ -2,8 +2,7 @@ require:
2
2
  - solidus_dev_support/rubocop
3
3
 
4
4
  AllCops:
5
- NewCops: enable
6
- TargetRubyVersion: 2.6
5
+ NewCops: disable
7
6
 
8
7
  Layout/FirstArgumentIndentation:
9
8
  EnforcedStyle: consistent
data/CHANGELOG.md CHANGED
@@ -1,5 +1,46 @@
1
1
  # Changelog
2
2
 
3
+ ## [v2.0.0](https://github.com/solidusio/solidus_paypal_braintree/tree/v1.2.0) (2023-03-20)
4
+
5
+ This extension is deprecated. This last version contains only a dependency to the new
6
+ recommended extension.
7
+
8
+ To upgrade, follow the instructions here:
9
+
10
+ https://github.com/solidusio/solidus_braintree/wiki/Upgrading-from-SolidusPaypalBraintree-To-SolidusBraintree
11
+
12
+ ## [v1.2.0](https://github.com/solidusio/solidus_paypal_braintree/tree/v1.2.0) (2022-12-12)
13
+
14
+ [Full Changelog](https://github.com/solidusio/solidus_paypal_braintree/compare/v1.1.2...v1.2.0)
15
+
16
+ **Fixed bugs:**
17
+
18
+ - Sandbox script is not able to install bundle due to empty $BRANCH value [\#337](https://github.com/solidusio/solidus_paypal_braintree/issues/337)
19
+ - Do not safeguard including of Spree::Preferences::Persistable [\#316](https://github.com/solidusio/solidus_paypal_braintree/pull/316) ([tvdeyen](https://github.com/tvdeyen))
20
+
21
+ **Merged pull requests:**
22
+
23
+ - Update to the latest dev-support defaults [\#339](https://github.com/solidusio/solidus_paypal_braintree/pull/339) ([elia](https://github.com/elia))
24
+ - Fix setup intructions on Rails 7 [\#332](https://github.com/solidusio/solidus_paypal_braintree/pull/332) ([waiting-for-dev](https://github.com/waiting-for-dev))
25
+ - Fix sandbox generator [\#329](https://github.com/solidusio/solidus_paypal_braintree/pull/329) ([RyanofWoods](https://github.com/RyanofWoods))
26
+ - Fix broken specs [\#328](https://github.com/solidusio/solidus_paypal_braintree/pull/328) ([RyanofWoods](https://github.com/RyanofWoods))
27
+ - Drop compatibility with Solidus \< 2.4 [\#326](https://github.com/solidusio/solidus_paypal_braintree/pull/326) ([mamhoff](https://github.com/mamhoff))
28
+ - Add BIN \(bank identification number\) to SolidusPaypalBraintree::Source [\#308](https://github.com/solidusio/solidus_paypal_braintree/pull/308) ([RyanofWoods](https://github.com/RyanofWoods))
29
+ - Improve README PayPal styling information [\#307](https://github.com/solidusio/solidus_paypal_braintree/pull/307) ([RyanofWoods](https://github.com/RyanofWoods))
30
+ - Make extension compliant to solidus\_dev\_support [\#289](https://github.com/solidusio/solidus_paypal_braintree/pull/289) ([MinasMazar](https://github.com/MinasMazar))
31
+
32
+ ## [v1.1.2](https://github.com/solidusio/solidus_paypal_braintree/tree/v1.1.2) (2022-10-14)
33
+
34
+ [Full Changelog](https://github.com/solidusio/solidus_paypal_braintree/compare/v1.1.1...v1.1.2)
35
+
36
+ **Merged pull requests:**
37
+
38
+ - Fix broken factory [\#325](https://github.com/solidusio/solidus_paypal_braintree/pull/325) ([johnpitchko](https://github.com/johnpitchko))
39
+ - Update to use forked solidus\_frontend when needed [\#324](https://github.com/solidusio/solidus_paypal_braintree/pull/324) ([waiting-for-dev](https://github.com/waiting-for-dev))
40
+ - Fix specs to stub spree\_current\_user [\#323](https://github.com/solidusio/solidus_paypal_braintree/pull/323) ([gsmendoza](https://github.com/gsmendoza))
41
+ - Bump Rubocop TargetRubyVersion from 2.5 to 2.6 [\#319](https://github.com/solidusio/solidus_paypal_braintree/pull/319) ([RyanofWoods](https://github.com/RyanofWoods))
42
+ - Fix exception when other payment methods active [\#318](https://github.com/solidusio/solidus_paypal_braintree/pull/318) ([embold-tyler](https://github.com/embold-tyler))
43
+
3
44
  ## [v1.1.1](https://github.com/solidusio/solidus_paypal_braintree/tree/v1.1.1) (2022-06-30)
4
45
 
5
46
  [Full Changelog](https://github.com/solidusio/solidus_paypal_braintree/compare/v1.1.0...v1.1.1)
data/Gemfile CHANGED
@@ -4,25 +4,20 @@ source 'https://rubygems.org'
4
4
  git_source(:github) { |repo| "https://github.com/#{repo}.git" }
5
5
 
6
6
  branch = ENV.fetch('SOLIDUS_BRANCH', 'master')
7
- solidus_git, solidus_frontend_git = if (branch == 'master') || (branch >= 'v3.2')
8
- %w[solidusio/solidus solidusio/solidus_frontend]
9
- else
10
- %w[solidusio/solidus] * 2
11
- end
12
- gem 'solidus', github: solidus_git, branch: branch
13
- gem 'solidus_frontend', github: solidus_frontend_git, branch: branch
7
+ gem 'solidus', github: 'solidusio/solidus', branch: branch
14
8
 
15
- gem 'rails', ENV.fetch('RAILS_VERSION', nil)
9
+ # The solidus_frontend gem has been pulled out since v3.2
10
+ gem 'solidus_frontend', github: 'solidusio/solidus_frontend' if branch == 'master'
11
+ gem 'solidus_frontend' if branch >= 'v3.2' # rubocop:disable Bundler/DuplicatedGem
12
+
13
+ # Needed to help Bundler figure out how to resolve dependencies,
14
+ # otherwise it takes forever to resolve them.
15
+ # See https://github.com/bundler/bundler/issues/6677
16
+ gem 'rails', '>0.a'
16
17
 
17
18
  # Provides basic authentication functionality for testing parts of your engine
18
19
  gem 'solidus_auth_devise'
19
20
 
20
- # Asset compilation speed
21
- gem 'mini_racer'
22
- gem 'sassc-rails', platforms: :mri
23
-
24
- gem 'bourbon'
25
-
26
21
  case ENV.fetch('DB', nil)
27
22
  when 'mysql'
28
23
  gem 'mysql2'
@@ -32,13 +27,16 @@ else
32
27
  gem 'sqlite3'
33
28
  end
34
29
 
35
- group :test do
36
- gem 'rails-controller-testing'
37
- gem 'webdrivers'
38
- end
30
+ # While we still support Ruby < 3 we need to workaround a limitation in
31
+ # the 'async' gem that relies on the latest ruby, since RubyGems doesn't
32
+ # resolve gems based on the required ruby version.
33
+ gem 'async', '< 3' if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('3')
39
34
 
40
35
  gemspec
41
36
 
42
37
  # Use a local Gemfile to include development dependencies that might not be
43
- # relevant for the project or for other contributors, e.g.: `gem 'pry-debug'`.
44
- eval_gemfile 'Gemfile-local' if File.exist? 'Gemfile-local'
38
+ # relevant for the project or for other contributors, e.g. pry-byebug.
39
+ #
40
+ # We use `send` instead of calling `eval_gemfile` to work around an issue with
41
+ # how Dependabot parses projects: https://github.com/dependabot/dependabot-core/issues/1658.
42
+ send(:eval_gemfile, 'Gemfile-local') if File.exist? 'Gemfile-local'
data/README.md CHANGED
@@ -1,12 +1,22 @@
1
- SolidusPaypalBraintree
2
- ======================
1
+ # SolidusPaypalBraintree
3
2
 
4
- [![CircleCI](https://circleci.com/gh/solidusio/solidus_paypal_braintree.svg?style=svg)](https://circleci.com/gh/solidusio/solidus_paypal_braintree)
3
+ โ›”๏ธ This extension is archived. โ›”๏ธ
4
+
5
+ It has been renamed and moved to [solidus_braintree](https://github.com/solidusio/solidus_braintree).
6
+
7
+ If you were using this project, you can follow the [instructions to upgrade to the new extension](https://github.com/solidusio/solidus_braintree/wiki/Upgrading-from-SolidusPaypalBraintree-To-SolidusBraintree).
8
+
9
+ <hr>
10
+ <br>
11
+
12
+ [![CircleCI](https://circleci.com/gh/solidusio/solidus_paypal_braintree.svg?style=shield)](https://circleci.com/gh/solidusio/solidus_paypal_braintree)
13
+ [![codecov](https://codecov.io/gh/solidusio/solidus_paypal_braintree/branch/master/graph/badge.svg)](https://codecov.io/gh/solidusio/solidus_paypal_braintree)
5
14
 
6
15
  `solidus_paypal_braintree` is an extension that adds support for using [Braintree](https://www.braintreepayments.com) as a payment source in your [Solidus](https://solidus.io/) store. It supports Apple Pay, PayPal, and credit card transactions.
7
16
 
8
- Installation
9
- ------------
17
+ ๐Ÿšง This extension is currently only compatible with the legacy `solidus_frontend` ๐Ÿšง
18
+
19
+ ## Installation
10
20
 
11
21
  Add solidus_paypal_braintree to your Gemfile:
12
22
 
@@ -39,8 +49,8 @@ Payment methods can accept preferences either directly entered in admin, or from
39
49
  1. Set static preferences in an initializer
40
50
  ```ruby
41
51
  # config/initializers/spree.rb
42
- Spree::Config.config do |config|
43
- config.static_model_preferences.add(
52
+ Rails.application.config.to_prepare do
53
+ Spree::Config.static_model_preferences.add(
44
54
  SolidusPaypalBraintree::Gateway,
45
55
  'braintree_credentials', {
46
56
  environment: Rails.env.production? ? 'production' : 'sandbox',
@@ -198,19 +208,22 @@ Note, other images such as Venmo's full logo and shortened "V" logo are included
198
208
 
199
209
  Ensure that you follow [Venmo's guidelines](https://developer.paypal.com/braintree/docs/files/venmo-merchant-integration-guidelines.pdf) when making other style changes, otherwise failing to comply can lead to an interruption of your Venmo service.
200
210
 
201
- PayPal
202
- ------
211
+ ## PayPal
203
212
 
204
213
  A default checkout view is provided that will display PayPal as a payment option.
205
214
  It will only be displayed if the `SolidusPaypalBraintree::Gateway` payment
206
215
  method is configured to display on the frontend and PayPal is enabled in the
207
216
  store's configuration.
208
217
 
209
- You can find button configuration options in
218
+ You can find button configuration options in
210
219
  `/solidus_paypal_braintree/configurations/list` if you want to change the color,
211
- shape, layout, and a few other options. Keep in mind that the `paypal_button_tagline`
212
- does not work when the `paypal_button_layout` is set to `vertical`, and will be
213
- ignored in that case.
220
+ shape, layout, and a few other options. For more information check out
221
+ [PayPal's documentation](https://developer.paypal.com/docs/platforms/checkout/reference/style-guide/#layout).
222
+
223
+ Keep in mind that:
224
+ - `paypal_button_tagline` does not work when the `paypal_button_layout` is set to `vertical`, and will be ignored; and
225
+ - `paypal_button_layout` of `horizontal` limits financing options/buttons to 2, where as `vertical` is 4.
226
+ Other available financing options after the limit will not be rendered in the PayPal's iframe DOM.
214
227
 
215
228
  The checkout view
216
229
  [initializes the PayPal button](/lib/views/frontend/spree/checkout/payment/_paypal_braintree.html.erb)
@@ -336,8 +349,7 @@ Once enabled, you can use the following card numbers to test 3DS 2 on your
336
349
  client side in sandbox:
337
350
  https://developers.braintreepayments.com/guides/3d-secure/migration/javascript/v3#client-side-sandbox-testing.
338
351
 
339
- Testing
340
- -------
352
+ ## Testing
341
353
 
342
354
  To run the specs it is required to set the Braintree test account data in these environment variables:
343
355
  `BRAINTREE_PUBLIC_KEY`, `BRAINTREE_PRIVATE_KEY`, `BRAINTREE_MERCHANT_ID` and `BRAINTREE_PAYPAL_PAYEE_EMAIL`
@@ -356,14 +368,35 @@ Simply add this require statement to your spec_helper:
356
368
  require 'solidus_paypal_braintree/factories'
357
369
  ```
358
370
 
359
- Development
360
- -------
371
+ ## Development
361
372
 
362
373
  ### Mocking your buyer country
363
374
  PayPal looks at the buyer's IP geolocation to determine what funding sources should be available to them. Because for example, Venmo is currently only available to US buyers. Because of this, you may want to pretend that you are from US so you can check if Venmo is correctly integrated for these customers. To do this, set the payment method's preference of `force_buyer_country` to "US". See more information about preferences above.
364
375
 
365
376
  This preference has no effect on production.
366
377
 
378
+ ### Running the sandbox
379
+
380
+ To run this extension in a sandboxed Solidus application, you can run `bin/sandbox`. The path for
381
+ the sandbox app is `./sandbox` and `bin/rails` will forward any Rails commands to
382
+ `sandbox/bin/rails`.
383
+
384
+ Here's an example:
385
+
386
+ ```
387
+ $ bin/rails server
388
+ => Booting Puma
389
+ => Rails 7.0.4 application starting in development
390
+ * Listening on tcp://127.0.0.1:3000
391
+ Use Ctrl-C to stop
392
+ ```
393
+
394
+
395
+ ### Releasing new versions
396
+
397
+ Please refer to the dedicated [page](https://github.com/solidusio/solidus/wiki/How-to-release-extensions) on Solidus wiki.
398
+
399
+
367
400
  ## License
368
401
 
369
402
  Copyright (c) 2016-2020 Stembolt and others contributors, released under the New BSD License
data/bin/rails CHANGED
@@ -1,15 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- # frozen_string_literal: true
4
-
5
- app_root = 'spec/dummy'
6
-
7
- unless File.exist? "#{app_root}/bin/rails"
8
- system "bin/rake", app_root or begin
9
- warn "Automatic creation of the dummy app failed"
10
- exit 1
11
- end
3
+ if %w[g generate].include? ARGV.first
4
+ exec "#{__dir__}/rails-engine", *ARGV
5
+ else
6
+ exec "#{__dir__}/rails-sandbox", *ARGV
12
7
  end
13
-
14
- Dir.chdir app_root
15
- exec 'bin/rails', *ARGV
data/bin/rails-engine ADDED
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env ruby
2
+ # This command will automatically be run when you run "rails" with Rails gems
3
+ # installed from the root of your application.
4
+
5
+ ENGINE_ROOT = File.expand_path('..', __dir__)
6
+ ENGINE_PATH = File.expand_path('../lib/solidus_paypal_braintree/engine', __dir__)
7
+
8
+ # Set up gems listed in the Gemfile.
9
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
10
+ require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
11
+
12
+ require 'rails/all'
13
+ require 'rails/engine/commands'
data/bin/rails-sandbox ADDED
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ app_root = 'sandbox'
4
+
5
+ unless File.exist? "#{app_root}/bin/rails"
6
+ warn 'Creating the sandbox app...'
7
+ Dir.chdir "#{__dir__}/.." do
8
+ system "#{__dir__}/sandbox" or begin
9
+ warn 'Automatic creation of the sandbox app failed'
10
+ exit 1
11
+ end
12
+ end
13
+ end
14
+
15
+ Dir.chdir app_root
16
+ exec 'bin/rails', *ARGV
data/bin/rake ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "rubygems"
5
+ require "bundler/setup"
6
+
7
+ load Gem.bin_path("rake", "rake")
data/bin/sandbox ADDED
@@ -0,0 +1,103 @@
1
+ #!/usr/bin/env bash
2
+
3
+ set -e
4
+ if [ -n "$DEBUG" ]
5
+ then
6
+ set -x
7
+ fi
8
+
9
+ case "$DB" in
10
+ postgres|postgresql)
11
+ RAILSDB="postgresql"
12
+ ;;
13
+ mysql)
14
+ RAILSDB="mysql"
15
+ ;;
16
+ sqlite3|sqlite)
17
+ RAILSDB="sqlite3"
18
+ ;;
19
+ '')
20
+ echo "~~> Use 'export DB=[postgres|mysql|sqlite]' to control the DB adapter"
21
+ RAILSDB="sqlite3"
22
+ ;;
23
+ *)
24
+ echo "Invalid value specified for the Solidus sandbox: DB=\"$DB\"."
25
+ echo "Please use 'postgres', 'mysql', or 'sqlite' instead."
26
+ exit 1
27
+ ;;
28
+ 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
+
38
+ if [ -z "$SOLIDUS_FRONTEND" ]
39
+ then
40
+ echo "~~> Use 'export SOLIDUS_FRONTEND=[solidus_frontend|solidus_starter_frontend]' to control the Solidus frontend"
41
+ SOLIDUS_FRONTEND="solidus_frontend"
42
+ fi
43
+ echo "~~> Using branch $SOLIDUS_FRONTEND as the solidus frontend"
44
+
45
+ extension_name="solidus_paypal_braintree"
46
+
47
+ # Stay away from the bundler env of the containing extension.
48
+ 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)' -- $@
50
+ }
51
+
52
+ rm -rf ./sandbox
53
+ unbundled bundle exec rails new sandbox --database="$RAILSDB" \
54
+ --skip-bundle \
55
+ --skip-git \
56
+ --skip-keeps \
57
+ --skip-rc \
58
+ --skip-spring \
59
+ --skip-test \
60
+ --skip-javascript
61
+
62
+ if [ ! -d "sandbox" ]; then
63
+ echo 'sandbox rails application failed'
64
+ exit 1
65
+ fi
66
+
67
+ 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
+
86
+ 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
100
+
101
+ echo
102
+ echo "๐Ÿš€ Sandbox app successfully created for $extension_name!"
103
+ echo "๐Ÿงช This app is intended for test purposes."
data/bin/setup CHANGED
@@ -5,4 +5,4 @@ set -vx
5
5
 
6
6
  gem install bundler --conservative
7
7
  bundle update
8
- bundle exec rake clobber
8
+ bin/rake clobber
@@ -1,37 +1,8 @@
1
- # frozen_string_literal: true
2
-
3
1
  module SolidusPaypalBraintree
4
2
  module Generators
5
3
  class InstallGenerator < Rails::Generators::Base
6
- class_option :auto_run_migrations, type: :boolean, default: false
7
-
8
- def add_javascripts
9
- append_file 'vendor/assets/javascripts/spree/frontend/all.js', "//= require solidus_paypal_braintree/frontend\n"
10
- append_file 'vendor/assets/javascripts/spree/backend/all.js', "//= require spree/backend/solidus_paypal_braintree\n" # rubocop:disable Layout/LineLength
11
- end
12
-
13
- def add_stylesheets
14
- inject_into_file 'vendor/assets/stylesheets/spree/frontend/all.css', " *= require spree/frontend/solidus_paypal_braintree\n", before: %r{\*/}, verbose: true # rubocop:disable Layout/LineLength
15
- inject_into_file 'vendor/assets/stylesheets/spree/backend/all.css', " *= require spree/backend/solidus_paypal_braintree\n", before: %r{\*/}, verbose: true # rubocop:disable Layout/LineLength
16
- end
17
-
18
- def add_migrations
19
- run 'bundle exec rake railties:install:migrations FROM=solidus_paypal_braintree'
20
- end
21
-
22
- def mount_engine
23
- insert_into_file File.join('config', 'routes.rb'), after: "Rails.application.routes.draw do\n" do
24
- "mount SolidusPaypalBraintree::Engine, at: '/solidus_paypal_braintree'\n"
25
- end
26
- end
27
-
28
- def run_migrations
29
- run_migrations = options[:auto_run_migrations] || ['', 'y', 'Y'].include?(ask('Would you like to run the migrations now? [Y/n]')) # rubocop:disable Layout/LineLength
30
- if run_migrations
31
- run 'bundle exec rake db:migrate'
32
- else
33
- say_status :skipping, 'rake db:migrate, don\'t forget to run it!'
34
- end
4
+ def install_braintree
5
+ run 'bin/rails g solidus_braintree:install --auto_run_migrations=true'
35
6
  end
36
7
  end
37
8
  end
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'solidus_core'
3
4
  require 'solidus_support'
4
5
 
5
6
  module SolidusPaypalBraintree
@@ -8,61 +9,5 @@ module SolidusPaypalBraintree
8
9
 
9
10
  isolate_namespace SolidusPaypalBraintree
10
11
  engine_name 'solidus_paypal_braintree'
11
-
12
- ActiveSupport::Inflector.inflections do |inflect|
13
- inflect.acronym 'AVS'
14
- end
15
-
16
- # use rspec for tests
17
- config.generators do |g|
18
- g.test_framework :rspec
19
- end
20
-
21
- initializer "register_solidus_paypal_braintree_gateway", after: "spree.register.payment_methods" do |app|
22
- config.to_prepare do
23
- app.config.spree.payment_methods << SolidusPaypalBraintree::Gateway
24
- SolidusPaypalBraintree::Gateway.allowed_admin_form_preference_types.push(:preference_select).uniq!
25
- ::Spree::PermittedAttributes.source_attributes.concat([:nonce, :payment_type, :paypal_funding_source]).uniq!
26
- end
27
- end
28
-
29
- if SolidusSupport.frontend_available?
30
- config.assets.precompile += [
31
- 'solidus_paypal_braintree/checkout.js',
32
- 'solidus_paypal_braintree/frontend.js',
33
- 'spree/frontend/apple_pay_button.js',
34
- 'solidus_paypal_braintree_manifest.js'
35
- ]
36
- paths["app/controllers"] << "lib/controllers/frontend"
37
- paths["app/views"] << "lib/views/frontend"
38
- end
39
-
40
- if SolidusSupport.backend_available?
41
- config.assets.precompile += ["spree/backend/solidus_paypal_braintree.js"]
42
- paths["app/controllers"] << "lib/controllers/backend"
43
-
44
- # We support Solidus v1.2, which requires some different markup in the
45
- # source form partial. This will take precedence over lib/views/backend.
46
- paths["app/views"] << "lib/views/backend_v1.2" if Spree.solidus_gem_version < Gem::Version.new('1.3')
47
-
48
- # Solidus v2.4 introduced preference field partials but does not ship a hash field type.
49
- # This is solved in Solidus v2.5.
50
- if Spree.solidus_gem_version <= Gem::Version.new('2.5.0')
51
- paths["app/views"] << "lib/views/backend_v2.4"
52
- end
53
-
54
- paths["app/views"] << "lib/views/backend"
55
-
56
- initializer "solidus_paypal_braintree_admin_menu_item", after: "register_solidus_paypal_braintree_gateway" do
57
- Spree::Backend::Config.configure do |config|
58
- config.menu_items << config.class::MenuItem.new(
59
- [:braintree],
60
- 'cc-paypal',
61
- url: '/solidus_paypal_braintree/configurations/list',
62
- condition: -> { can?(:list, SolidusPaypalBraintree::Configuration) }
63
- )
64
- end
65
- end
66
- end
67
12
  end
68
13
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SolidusPaypalBraintree
4
- VERSION = '1.1.2'
4
+ VERSION = '2.0.0'
5
5
  end
@@ -1,11 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'solidus_core'
3
+ require 'solidus_braintree'
4
4
  require 'solidus_paypal_braintree/version'
5
5
  require 'solidus_paypal_braintree/engine'
6
- require 'solidus_paypal_braintree/country_mapper'
7
- require 'solidus_paypal_braintree/request_protection'
8
- require 'solidus_support'
9
6
 
10
7
  module SolidusPaypalBraintree
11
8
  def self.table_name_prefix