solidus_paypal_braintree 1.1.0 → 1.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +4 -0
  3. data/.gitignore +1 -0
  4. data/.rubocop.yml +1 -1
  5. data/CHANGELOG.md +70 -1
  6. data/Gemfile +9 -6
  7. data/app/models/solidus_paypal_braintree/gateway.rb +5 -3
  8. data/app/models/solidus_paypal_braintree/transaction.rb +2 -2
  9. data/app/models/solidus_paypal_braintree/transaction_import.rb +2 -2
  10. data/lib/solidus_paypal_braintree/engine.rb +5 -3
  11. data/lib/solidus_paypal_braintree/factories.rb +5 -5
  12. data/lib/solidus_paypal_braintree/version.rb +1 -1
  13. data/lib/views/frontend/solidus_paypal_braintree/payments/_payment.html.erb +3 -3
  14. data/solidus_paypal_braintree.gemspec +0 -1
  15. metadata +4 -122
  16. data/spec/controllers/solidus_paypal_braintree/checkouts_controller_spec.rb +0 -99
  17. data/spec/controllers/solidus_paypal_braintree/client_tokens_controller_spec.rb +0 -55
  18. data/spec/controllers/solidus_paypal_braintree/configurations_controller_spec.rb +0 -73
  19. data/spec/controllers/solidus_paypal_braintree/transactions_controller_spec.rb +0 -183
  20. data/spec/features/backend/configuration_spec.rb +0 -23
  21. data/spec/features/backend/new_payment_spec.rb +0 -137
  22. data/spec/features/frontend/braintree_credit_card_checkout_spec.rb +0 -191
  23. data/spec/features/frontend/paypal_checkout_spec.rb +0 -166
  24. data/spec/features/frontend/venmo_checkout_spec.rb +0 -189
  25. data/spec/fixtures/cassettes/admin/invalid_credit_card.yml +0 -63
  26. data/spec/fixtures/cassettes/admin/resubmit_credit_card.yml +0 -352
  27. data/spec/fixtures/cassettes/admin/valid_credit_card.yml +0 -412
  28. data/spec/fixtures/cassettes/braintree/create_profile.yml +0 -71
  29. data/spec/fixtures/cassettes/braintree/generate_token.yml +0 -63
  30. data/spec/fixtures/cassettes/braintree/token.yml +0 -63
  31. data/spec/fixtures/cassettes/checkout/invalid_credit_card.yml +0 -63
  32. data/spec/fixtures/cassettes/checkout/resubmit_credit_card.yml +0 -216
  33. data/spec/fixtures/cassettes/checkout/update.yml +0 -71
  34. data/spec/fixtures/cassettes/checkout/valid_credit_card.yml +0 -156
  35. data/spec/fixtures/cassettes/checkout/valid_venmo_transaction.yml +0 -599
  36. data/spec/fixtures/cassettes/gateway/authorize/credit_card/address.yml +0 -86
  37. data/spec/fixtures/cassettes/gateway/authorize/merchant_account/EUR.yml +0 -154
  38. data/spec/fixtures/cassettes/gateway/authorize/paypal/EUR.yml +0 -90
  39. data/spec/fixtures/cassettes/gateway/authorize/paypal/address.yml +0 -90
  40. data/spec/fixtures/cassettes/gateway/authorize.yml +0 -86
  41. data/spec/fixtures/cassettes/gateway/authorized_transaction.yml +0 -73
  42. data/spec/fixtures/cassettes/gateway/cancel/missing.yml +0 -63
  43. data/spec/fixtures/cassettes/gateway/cancel/refunds.yml +0 -272
  44. data/spec/fixtures/cassettes/gateway/cancel/void.yml +0 -201
  45. data/spec/fixtures/cassettes/gateway/capture.yml +0 -141
  46. data/spec/fixtures/cassettes/gateway/complete.yml +0 -157
  47. data/spec/fixtures/cassettes/gateway/credit.yml +0 -208
  48. data/spec/fixtures/cassettes/gateway/purchase.yml +0 -87
  49. data/spec/fixtures/cassettes/gateway/settled_transaction.yml +0 -140
  50. data/spec/fixtures/cassettes/gateway/void.yml +0 -137
  51. data/spec/fixtures/cassettes/source/card_type.yml +0 -267
  52. data/spec/fixtures/cassettes/source/last4.yml +0 -267
  53. data/spec/fixtures/cassettes/transaction/import/valid/capture.yml +0 -224
  54. data/spec/fixtures/cassettes/transaction/import/valid.yml +0 -71
  55. data/spec/fixtures/views/spree/orders/edit.html.erb +0 -50
  56. data/spec/helpers/solidus_paypal_braintree/braintree_admin_helper_spec.rb +0 -17
  57. data/spec/helpers/solidus_paypal_braintree/braintree_checkout_helper_spec.rb +0 -70
  58. data/spec/models/solidus_paypal_braintree/address_spec.rb +0 -71
  59. data/spec/models/solidus_paypal_braintree/avs_result_spec.rb +0 -317
  60. data/spec/models/solidus_paypal_braintree/gateway_spec.rb +0 -692
  61. data/spec/models/solidus_paypal_braintree/response_spec.rb +0 -280
  62. data/spec/models/solidus_paypal_braintree/source_spec.rb +0 -499
  63. data/spec/models/solidus_paypal_braintree/transaction_address_spec.rb +0 -235
  64. data/spec/models/solidus_paypal_braintree/transaction_import_spec.rb +0 -300
  65. data/spec/models/solidus_paypal_braintree/transaction_spec.rb +0 -85
  66. data/spec/models/spree/store_spec.rb +0 -14
  67. data/spec/requests/spree/api/orders_controller_spec.rb +0 -36
  68. data/spec/spec_helper.rb +0 -29
  69. data/spec/support/capybara.rb +0 -7
  70. data/spec/support/factories.rb +0 -2
  71. data/spec/support/gateway_helpers.rb +0 -29
  72. data/spec/support/order_ready_for_payment.rb +0 -37
  73. data/spec/support/vcr.rb +0 -42
  74. data/spec/support/views.rb +0 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c26febf6421b70af375fcb3faa401ac062d11e0086df77b2a18c770beeda81ec
4
- data.tar.gz: f4976b18fc728cfea2dc95ba99b63a8754610b9d0931553c4cc57b4c7590e2a5
3
+ metadata.gz: c020d3e16f7e113ad45cde24ae56a9df9df4eef47bc0698baf745648cd9f279b
4
+ data.tar.gz: 94214d4a10a14e6a894d32e859d674bb26476f8159e6b6549eb9b8c849d72f8b
5
5
  SHA512:
6
- metadata.gz: 557543f455a52fbb02ad803c8ec007292cc5b045eddc63288fb5c39eb0e87ec920a7d92f83e84422b99ecf5386362ab212698756318de636c8e39c79490daf83
7
- data.tar.gz: b9b1a28200855bfbfa2a03ad589f161b08993ce35525f889babb6ed3bcb9381c20b4ed1ee18d63cd097af010d28ec39c13b8d37ce0d54704a592438f5917e2e4
6
+ metadata.gz: 9f8f74dfa20c79a7c5b2df844260fd57887b4ccf35aa29724e605661d294ff5584eadc236c1d7a4cfc56b2cfff64913b727b9c029765600734c6874a4574fb79
7
+ data.tar.gz: 6876a643638762d3f6c6d8a915ea1651eea2f928f5ca3f92a59cbc0fcd81ce59d7ee6a688d9587a362bc9e0460efea6e312cd471c81f96fc7e4a797faab3c967
data/.circleci/config.yml CHANGED
@@ -1,6 +1,8 @@
1
1
  version: 2.1
2
2
 
3
3
  orbs:
4
+ browser-tools: circleci/browser-tools@1.1
5
+
4
6
  # Always take the latest version of the orb, this allows us to
5
7
  # run specs against Solidus supported versions only without the need
6
8
  # to change this configuration every time a Solidus version is released
@@ -11,10 +13,12 @@ jobs:
11
13
  run-specs-with-postgres:
12
14
  executor: solidusio_extensions/postgres
13
15
  steps:
16
+ - browser-tools/install-browser-tools
14
17
  - solidusio_extensions/run-tests
15
18
  run-specs-with-mysql:
16
19
  executor: solidusio_extensions/mysql
17
20
  steps:
21
+ - browser-tools/install-browser-tools
18
22
  - solidusio_extensions/run-tests
19
23
  lint-code:
20
24
  executor: solidusio_extensions/sqlite-memory
data/.gitignore CHANGED
@@ -7,6 +7,7 @@
7
7
  .project
8
8
  .sass-cache
9
9
  coverage
10
+ Gemfile-local
10
11
  Gemfile.lock
11
12
  tmp
12
13
  nbproject
data/.rubocop.yml CHANGED
@@ -3,7 +3,7 @@ require:
3
3
 
4
4
  AllCops:
5
5
  NewCops: enable
6
- TargetRubyVersion: 2.5
6
+ TargetRubyVersion: 2.6
7
7
 
8
8
  Layout/FirstArgumentIndentation:
9
9
  EnforcedStyle: consistent
data/CHANGELOG.md CHANGED
@@ -1,5 +1,46 @@
1
1
  # Changelog
2
2
 
3
+ ## [v1.1.1](https://github.com/solidusio/solidus_paypal_braintree/tree/v1.1.1) (2022-06-30)
4
+
5
+ [Full Changelog](https://github.com/solidusio/solidus_paypal_braintree/compare/v1.1.0...v1.1.1)
6
+
7
+ **Closed issues:**
8
+
9
+ - StateMachines::InvalidTransition: Cannot transition state via :invalidate from :checkout \(Reason\(s\): Payment method can't be blank\) [\#320](https://github.com/solidusio/solidus_paypal_braintree/issues/320)
10
+ - Enable Venmo [\#304](https://github.com/solidusio/solidus_paypal_braintree/issues/304)
11
+ - Make the Venmo button testable from outside US contries [\#303](https://github.com/solidusio/solidus_paypal_braintree/issues/303)
12
+
13
+ **Merged pull requests:**
14
+
15
+ - Make gem compatible with Rails 7 [\#321](https://github.com/solidusio/solidus_paypal_braintree/pull/321) ([gsmendoza](https://github.com/gsmendoza))
16
+ - Rubocop -a on spec files [\#317](https://github.com/solidusio/solidus_paypal_braintree/pull/317) ([tvdeyen](https://github.com/tvdeyen))
17
+ - Add email to Braintree customer [\#310](https://github.com/solidusio/solidus_paypal_braintree/pull/310) ([RyanofWoods](https://github.com/RyanofWoods))
18
+
19
+ ## [v1.1.0](https://github.com/solidusio/solidus_paypal_braintree/tree/v1.1.0) (2022-02-01)
20
+
21
+ [Full Changelog](https://github.com/solidusio/solidus_paypal_braintree/compare/v1.0.0...v1.1.0)
22
+
23
+ **Closed issues:**
24
+
25
+ - solidus-frontend dependency still exists [\#294](https://github.com/solidusio/solidus_paypal_braintree/issues/294)
26
+ - Could we get a new release? [\#259](https://github.com/solidusio/solidus_paypal_braintree/issues/259)
27
+
28
+ **Merged pull requests:**
29
+
30
+ - Lower ActiveRecord::Migration version in add\_paypal\_funding\_source [\#314](https://github.com/solidusio/solidus_paypal_braintree/pull/314) ([mamhoff](https://github.com/mamhoff))
31
+ - Fix rubocop warnings [\#313](https://github.com/solidusio/solidus_paypal_braintree/pull/313) ([mamhoff](https://github.com/mamhoff))
32
+ - Add skip\_avs and skip\_cvv AVS Result Mapping [\#312](https://github.com/solidusio/solidus_paypal_braintree/pull/312) ([mamhoff](https://github.com/mamhoff))
33
+ - Integrate Braintree Venmo [\#311](https://github.com/solidusio/solidus_paypal_braintree/pull/311) ([RyanofWoods](https://github.com/RyanofWoods))
34
+ - Require MFA for RubyGems actions [\#306](https://github.com/solidusio/solidus_paypal_braintree/pull/306) ([RyanofWoods](https://github.com/RyanofWoods))
35
+ - Add Venmo as a PayPal funding option for checkout [\#305](https://github.com/solidusio/solidus_paypal_braintree/pull/305) ([RyanofWoods](https://github.com/RyanofWoods))
36
+ - Update PayPal configuration steps in README [\#300](https://github.com/solidusio/solidus_paypal_braintree/pull/300) ([RyanofWoods](https://github.com/RyanofWoods))
37
+ - Update to Braintree 3.4.0 [\#299](https://github.com/solidusio/solidus_paypal_braintree/pull/299) ([pelargir](https://github.com/pelargir))
38
+ - Remove remaining frontend dependencies [\#296](https://github.com/solidusio/solidus_paypal_braintree/pull/296) ([Rtwena](https://github.com/Rtwena))
39
+ - Set sandbox mode if environment is sandbox [\#291](https://github.com/solidusio/solidus_paypal_braintree/pull/291) ([alexblackie](https://github.com/alexblackie))
40
+ - Update to Solidus 3.0 [\#286](https://github.com/solidusio/solidus_paypal_braintree/pull/286) ([MinasMazar](https://github.com/MinasMazar))
41
+ - Added 3ds errors in it locale [\#285](https://github.com/solidusio/solidus_paypal_braintree/pull/285) ([thomasrossetto](https://github.com/thomasrossetto))
42
+ - Make use of data collector in JS configurable [\#238](https://github.com/solidusio/solidus_paypal_braintree/pull/238) ([mamhoff](https://github.com/mamhoff))
43
+
3
44
  ## [v1.0.0](https://github.com/solidusio/solidus_paypal_braintree/tree/v1.0.0) (2020-11-11)
4
45
 
5
46
  [Full Changelog](https://github.com/solidusio/solidus_paypal_braintree/compare/v0.4.0...v1.0.0)
@@ -21,7 +62,7 @@
21
62
  - On PayPal payment user shipping address gets set with uncorrect firstname and lastname values if they contain a space [\#226](https://github.com/solidusio/solidus_paypal_braintree/issues/226)
22
63
  - Default Braintree configuration on store creation overwrites custom configuration [\#224](https://github.com/solidusio/solidus_paypal_braintree/issues/224)
23
64
  - Undefined local variable or method `id' error on payment page [\#222](https://github.com/solidusio/solidus_paypal_braintree/issues/222)
24
- - Can't render JSON about an order as SolidusPaypalBraintree::Source doesn't have a `expiration\_month` method [\#221](https://github.com/solidusio/solidus_paypal_braintree/issues/221)
65
+ - Can't render JSON about an order as SolidusPaypalBraintree::Source doesn't have a `expiration_month` method [\#221](https://github.com/solidusio/solidus_paypal_braintree/issues/221)
25
66
  - Paypal payment return invalid address [\#218](https://github.com/solidusio/solidus_paypal_braintree/issues/218)
26
67
  - Random Travis CI Failures [\#215](https://github.com/solidusio/solidus_paypal_braintree/issues/215)
27
68
  - Add Association for spree user to customer [\#210](https://github.com/solidusio/solidus_paypal_braintree/issues/210)
@@ -251,7 +292,35 @@
251
292
  - Default to US country code [\#32](https://github.com/solidusio/solidus_paypal_braintree/pull/32) ([adammathys](https://github.com/adammathys))
252
293
  - Allow JSON requests to transactions controller [\#31](https://github.com/solidusio/solidus_paypal_braintree/pull/31) ([luukveenis](https://github.com/luukveenis))
253
294
  - Vcr improvements [\#30](https://github.com/solidusio/solidus_paypal_braintree/pull/30) ([cbrunsdon](https://github.com/cbrunsdon))
295
+ - Only prompt for email for not logged in users [\#29](https://github.com/solidusio/solidus_paypal_braintree/pull/29) ([luukveenis](https://github.com/luukveenis))
254
296
  - Implement API Controller to generate client tokens [\#28](https://github.com/solidusio/solidus_paypal_braintree/pull/28) ([stewart](https://github.com/stewart))
297
+ - Conditionally load frontend code [\#27](https://github.com/solidusio/solidus_paypal_braintree/pull/27) ([adammathys](https://github.com/adammathys))
298
+ - Show Source token in source\_view [\#26](https://github.com/solidusio/solidus_paypal_braintree/pull/26) ([stewart](https://github.com/stewart))
299
+ - Set token on Source when creating customer profile [\#25](https://github.com/solidusio/solidus_paypal_braintree/pull/25) ([stewart](https://github.com/stewart))
300
+ - Validate address before processing imports [\#24](https://github.com/solidusio/solidus_paypal_braintree/pull/24) ([luukveenis](https://github.com/luukveenis))
301
+ - Add tests for gateway and source models [\#23](https://github.com/solidusio/solidus_paypal_braintree/pull/23) ([luukveenis](https://github.com/luukveenis))
302
+ - Raise error for invalid transactions and add specs [\#22](https://github.com/solidusio/solidus_paypal_braintree/pull/22) ([luukveenis](https://github.com/luukveenis))
303
+ - Save payment type to source [\#21](https://github.com/solidusio/solidus_paypal_braintree/pull/21) ([luukveenis](https://github.com/luukveenis))
304
+ - Correctly parse error message for failure response [\#20](https://github.com/solidusio/solidus_paypal_braintree/pull/20) ([stewart](https://github.com/stewart))
305
+ - Upcase country [\#19](https://github.com/solidusio/solidus_paypal_braintree/pull/19) ([cbrunsdon](https://github.com/cbrunsdon))
306
+ - Add Source View [\#18](https://github.com/solidusio/solidus_paypal_braintree/pull/18) ([stewart](https://github.com/stewart))
307
+ - Add actions, can\_\*? predicate methods to Source [\#17](https://github.com/solidusio/solidus_paypal_braintree/pull/17) ([stewart](https://github.com/stewart))
308
+ - End to end transaction [\#16](https://github.com/solidusio/solidus_paypal_braintree/pull/16) ([cbrunsdon](https://github.com/cbrunsdon))
309
+ - Correct foreign\_key creation for payment\_method reference on Source [\#15](https://github.com/solidusio/solidus_paypal_braintree/pull/15) ([stewart](https://github.com/stewart))
310
+ - Update Gateway Configuration [\#14](https://github.com/solidusio/solidus_paypal_braintree/pull/14) ([stewart](https://github.com/stewart))
311
+ - Use Braintree Customer ID, Payment Method ID when creating transactions [\#13](https://github.com/solidusio/solidus_paypal_braintree/pull/13) ([stewart](https://github.com/stewart))
312
+ - Register gateway with Solidus [\#12](https://github.com/solidusio/solidus_paypal_braintree/pull/12) ([adammathys](https://github.com/adammathys))
313
+ - Add Gateway\#cancel [\#11](https://github.com/solidusio/solidus_paypal_braintree/pull/11) ([adammathys](https://github.com/adammathys))
314
+ - Implement Gateway\#create\_profile [\#10](https://github.com/solidusio/solidus_paypal_braintree/pull/10) ([stewart](https://github.com/stewart))
315
+ - Add option to send extra options to Braintree [\#9](https://github.com/solidusio/solidus_paypal_braintree/pull/9) ([adammathys](https://github.com/adammathys))
316
+ - Convert cents to dollars [\#8](https://github.com/solidusio/solidus_paypal_braintree/pull/8) ([adammathys](https://github.com/adammathys))
317
+ - Add ability to capture authorized payments [\#7](https://github.com/solidusio/solidus_paypal_braintree/pull/7) ([adammathys](https://github.com/adammathys))
318
+ - VCR Fixups [\#6](https://github.com/solidusio/solidus_paypal_braintree/pull/6) ([stewart](https://github.com/stewart))
319
+ - Add support for refunding payments [\#5](https://github.com/solidusio/solidus_paypal_braintree/pull/5) ([adammathys](https://github.com/adammathys))
320
+ - Add implementation for authorization transactions [\#4](https://github.com/solidusio/solidus_paypal_braintree/pull/4) ([stewart](https://github.com/stewart))
321
+ - Implement voiding transactions [\#3](https://github.com/solidusio/solidus_paypal_braintree/pull/3) ([adammathys](https://github.com/adammathys))
322
+ - Some minor clean-up [\#2](https://github.com/solidusio/solidus_paypal_braintree/pull/2) ([adammathys](https://github.com/adammathys))
323
+ - FIx Up Test Environment [\#1](https://github.com/solidusio/solidus_paypal_braintree/pull/1) ([stewart](https://github.com/stewart))
255
324
 
256
325
 
257
326
 
data/Gemfile CHANGED
@@ -4,12 +4,15 @@ 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
- gem 'solidus', github: 'solidusio/solidus', branch: branch
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
8
14
 
9
- # Needed to help Bundler figure out how to resolve dependencies,
10
- # otherwise it takes forever to resolve them.
11
- # See https://github.com/bundler/bundler/issues/6677
12
- gem 'rails', '>0.a'
15
+ gem 'rails', ENV.fetch('RAILS_VERSION', nil)
13
16
 
14
17
  # Provides basic authentication functionality for testing parts of your engine
15
18
  gem 'solidus_auth_devise'
@@ -20,7 +23,7 @@ gem 'sassc-rails', platforms: :mri
20
23
 
21
24
  gem 'bourbon'
22
25
 
23
- case ENV['DB']
26
+ case ENV.fetch('DB', nil)
24
27
  when 'mysql'
25
28
  gem 'mysql2'
26
29
  when 'postgresql'
@@ -11,9 +11,9 @@ module SolidusPaypalBraintree
11
11
  # Error message from Braintree that gets returned by a non voidable transaction
12
12
  NON_VOIDABLE_STATUS_ERROR_REGEXP = /can only be voided if status is authorized/.freeze
13
13
 
14
- TOKEN_GENERATION_DISABLED_MESSAGE = 'Token generation is disabled.' \
15
- ' To re-enable set the `token_generation_enabled` preference on the' \
16
- ' gateway to `true`.'
14
+ TOKEN_GENERATION_DISABLED_MESSAGE = 'Token generation is disabled. ' \
15
+ 'To re-enable set the `token_generation_enabled` preference on the ' \
16
+ 'gateway to `true`.'
17
17
 
18
18
  ALLOWED_BRAINTREE_OPTIONS = [
19
19
  :device_data,
@@ -414,6 +414,8 @@ module SolidusPaypalBraintree
414
414
  def customer_profile_params(payment)
415
415
  params = {}
416
416
 
417
+ params[:email] = payment&.order&.email
418
+
417
419
  if store_in_vault && payment.source.try(:nonce)
418
420
  params[:payment_method_nonce] = payment.source.nonce
419
421
  end
@@ -18,8 +18,8 @@ module SolidusPaypalBraintree
18
18
  errors.add(:payment_method, 'Must be braintree')
19
19
  end
20
20
  if address && !address.valid?
21
- address.errors.each do |field, error|
22
- errors.add(:address, "#{field} #{error}")
21
+ address.errors.each do |error|
22
+ errors.add(:address, error.full_message)
23
23
  end
24
24
  end
25
25
  end
@@ -12,8 +12,8 @@ module SolidusPaypalBraintree
12
12
  errors.add("Address", "is invalid") if address && !address.valid?
13
13
 
14
14
  if !transaction.valid?
15
- transaction.errors.each do |field, error|
16
- errors.add(field, error)
15
+ transaction.errors.each do |error|
16
+ errors.add(error.attribute, error.message)
17
17
  end
18
18
  end
19
19
  errors.none?
@@ -19,9 +19,11 @@ module SolidusPaypalBraintree
19
19
  end
20
20
 
21
21
  initializer "register_solidus_paypal_braintree_gateway", after: "spree.register.payment_methods" do |app|
22
- app.config.spree.payment_methods << SolidusPaypalBraintree::Gateway
23
- SolidusPaypalBraintree::Gateway.allowed_admin_form_preference_types << :preference_select
24
- Spree::PermittedAttributes.source_attributes.concat [:nonce, :payment_type, :paypal_funding_source]
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
25
27
  end
26
28
 
27
29
  if SolidusSupport.frontend_available?
@@ -8,8 +8,8 @@ FactoryBot.define do
8
8
  # require 'solidus_paypal_braintree/factories'
9
9
 
10
10
  factory :solidus_paypal_braintree_payment_method, class: SolidusPaypalBraintree::Gateway do
11
- name 'Solidus PayPal Braintree Gateway'
12
- active true
11
+ name { 'Solidus PayPal Braintree Gateway' }
12
+ active { true }
13
13
  end
14
14
 
15
15
  factory :solidus_paypal_braintree_source, class: SolidusPaypalBraintree::Source do
@@ -17,15 +17,15 @@ FactoryBot.define do
17
17
  user
18
18
 
19
19
  trait :credit_card do
20
- payment_type SolidusPaypalBraintree::Source::CREDIT_CARD
20
+ payment_type { SolidusPaypalBraintree::Source::CREDIT_CARD }
21
21
  end
22
22
 
23
23
  trait :paypal do
24
- payment_type SolidusPaypalBraintree::Source::PAYPAL
24
+ payment_type { SolidusPaypalBraintree::Source::PAYPAL }
25
25
  end
26
26
 
27
27
  trait :apple_pay do
28
- payment_type SolidusPaypalBraintree::Source::APPLE_PAY
28
+ payment_type { SolidusPaypalBraintree::Source::APPLE_PAY }
29
29
  end
30
30
  end
31
31
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SolidusPaypalBraintree
4
- VERSION = '1.1.0'
4
+ VERSION = '1.1.2'
5
5
  end
@@ -1,12 +1,12 @@
1
1
  <br />
2
- <%= payment.source.display_payment_type %>
2
+ <%= payment.source.try(:display_payment_type) %>
3
3
 
4
- <% if payment.source.paypal? %>
4
+ <% if payment.source.try(:paypal?) %>
5
5
  <% if payment.source.respond_to?(:paypal_funding_source) && payment.source.paypal_funding_source.present? %>
6
6
  <br />
7
7
  <%= t('spree.paypal_funding', funding: payment.source.display_paypal_funding_source) %>
8
8
  <% end %>
9
- <% elsif payment.source.venmo? %>
9
+ <% elsif payment.source.try(:venmo?) %>
10
10
  <br />
11
11
  <%= payment.source.source_description %>
12
12
  <% end %>
@@ -19,7 +19,6 @@ Gem::Specification.new do |s|
19
19
  s.files = Dir.chdir(File.expand_path(__dir__)) do
20
20
  `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
21
21
  end
22
- s.test_files = Dir['spec/**/*']
23
22
  s.bindir = "exe"
24
23
  s.executables = s.files.grep(%r{^exe/}) { |f| File.basename(f) }
25
24
  s.require_paths = ["lib"]
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solidus_paypal_braintree
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stembolt
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-02-01 00:00:00.000000000 Z
11
+ date: 2022-10-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemerchant
@@ -269,65 +269,6 @@ files:
269
269
  - lib/views/frontend/spree/checkout/payment/_paypal_braintree.html.erb
270
270
  - lib/views/frontend/spree/shared/_paypal_checkout_button.html.erb
271
271
  - solidus_paypal_braintree.gemspec
272
- - spec/controllers/solidus_paypal_braintree/checkouts_controller_spec.rb
273
- - spec/controllers/solidus_paypal_braintree/client_tokens_controller_spec.rb
274
- - spec/controllers/solidus_paypal_braintree/configurations_controller_spec.rb
275
- - spec/controllers/solidus_paypal_braintree/transactions_controller_spec.rb
276
- - spec/features/backend/configuration_spec.rb
277
- - spec/features/backend/new_payment_spec.rb
278
- - spec/features/frontend/braintree_credit_card_checkout_spec.rb
279
- - spec/features/frontend/paypal_checkout_spec.rb
280
- - spec/features/frontend/venmo_checkout_spec.rb
281
- - spec/fixtures/cassettes/admin/invalid_credit_card.yml
282
- - spec/fixtures/cassettes/admin/resubmit_credit_card.yml
283
- - spec/fixtures/cassettes/admin/valid_credit_card.yml
284
- - spec/fixtures/cassettes/braintree/create_profile.yml
285
- - spec/fixtures/cassettes/braintree/generate_token.yml
286
- - spec/fixtures/cassettes/braintree/token.yml
287
- - spec/fixtures/cassettes/checkout/invalid_credit_card.yml
288
- - spec/fixtures/cassettes/checkout/resubmit_credit_card.yml
289
- - spec/fixtures/cassettes/checkout/update.yml
290
- - spec/fixtures/cassettes/checkout/valid_credit_card.yml
291
- - spec/fixtures/cassettes/checkout/valid_venmo_transaction.yml
292
- - spec/fixtures/cassettes/gateway/authorize.yml
293
- - spec/fixtures/cassettes/gateway/authorize/credit_card/address.yml
294
- - spec/fixtures/cassettes/gateway/authorize/merchant_account/EUR.yml
295
- - spec/fixtures/cassettes/gateway/authorize/paypal/EUR.yml
296
- - spec/fixtures/cassettes/gateway/authorize/paypal/address.yml
297
- - spec/fixtures/cassettes/gateway/authorized_transaction.yml
298
- - spec/fixtures/cassettes/gateway/cancel/missing.yml
299
- - spec/fixtures/cassettes/gateway/cancel/refunds.yml
300
- - spec/fixtures/cassettes/gateway/cancel/void.yml
301
- - spec/fixtures/cassettes/gateway/capture.yml
302
- - spec/fixtures/cassettes/gateway/complete.yml
303
- - spec/fixtures/cassettes/gateway/credit.yml
304
- - spec/fixtures/cassettes/gateway/purchase.yml
305
- - spec/fixtures/cassettes/gateway/settled_transaction.yml
306
- - spec/fixtures/cassettes/gateway/void.yml
307
- - spec/fixtures/cassettes/source/card_type.yml
308
- - spec/fixtures/cassettes/source/last4.yml
309
- - spec/fixtures/cassettes/transaction/import/valid.yml
310
- - spec/fixtures/cassettes/transaction/import/valid/capture.yml
311
- - spec/fixtures/views/spree/orders/edit.html.erb
312
- - spec/helpers/solidus_paypal_braintree/braintree_admin_helper_spec.rb
313
- - spec/helpers/solidus_paypal_braintree/braintree_checkout_helper_spec.rb
314
- - spec/models/solidus_paypal_braintree/address_spec.rb
315
- - spec/models/solidus_paypal_braintree/avs_result_spec.rb
316
- - spec/models/solidus_paypal_braintree/gateway_spec.rb
317
- - spec/models/solidus_paypal_braintree/response_spec.rb
318
- - spec/models/solidus_paypal_braintree/source_spec.rb
319
- - spec/models/solidus_paypal_braintree/transaction_address_spec.rb
320
- - spec/models/solidus_paypal_braintree/transaction_import_spec.rb
321
- - spec/models/solidus_paypal_braintree/transaction_spec.rb
322
- - spec/models/spree/store_spec.rb
323
- - spec/requests/spree/api/orders_controller_spec.rb
324
- - spec/spec_helper.rb
325
- - spec/support/capybara.rb
326
- - spec/support/factories.rb
327
- - spec/support/gateway_helpers.rb
328
- - spec/support/order_ready_for_payment.rb
329
- - spec/support/vcr.rb
330
- - spec/support/views.rb
331
272
  homepage: https://github.com/solidusio/solidus_paypal_braintree
332
273
  licenses:
333
274
  - BSD-3-Clause
@@ -350,67 +291,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
350
291
  - !ruby/object:Gem::Version
351
292
  version: '0'
352
293
  requirements: []
353
- rubygems_version: 3.2.20
294
+ rubygems_version: 3.2.32
354
295
  signing_key:
355
296
  specification_version: 4
356
297
  summary: Officially supported Paypal/Braintree extension
357
- test_files:
358
- - spec/spec_helper.rb
359
- - spec/features/frontend/venmo_checkout_spec.rb
360
- - spec/features/frontend/braintree_credit_card_checkout_spec.rb
361
- - spec/features/frontend/paypal_checkout_spec.rb
362
- - spec/features/backend/configuration_spec.rb
363
- - spec/features/backend/new_payment_spec.rb
364
- - spec/models/solidus_paypal_braintree/transaction_import_spec.rb
365
- - spec/models/solidus_paypal_braintree/gateway_spec.rb
366
- - spec/models/solidus_paypal_braintree/transaction_address_spec.rb
367
- - spec/models/solidus_paypal_braintree/transaction_spec.rb
368
- - spec/models/solidus_paypal_braintree/source_spec.rb
369
- - spec/models/solidus_paypal_braintree/avs_result_spec.rb
370
- - spec/models/solidus_paypal_braintree/response_spec.rb
371
- - spec/models/solidus_paypal_braintree/address_spec.rb
372
- - spec/models/spree/store_spec.rb
373
- - spec/requests/spree/api/orders_controller_spec.rb
374
- - spec/support/capybara.rb
375
- - spec/support/views.rb
376
- - spec/support/vcr.rb
377
- - spec/support/gateway_helpers.rb
378
- - spec/support/factories.rb
379
- - spec/support/order_ready_for_payment.rb
380
- - spec/fixtures/cassettes/transaction/import/valid.yml
381
- - spec/fixtures/cassettes/transaction/import/valid/capture.yml
382
- - spec/fixtures/cassettes/braintree/create_profile.yml
383
- - spec/fixtures/cassettes/braintree/generate_token.yml
384
- - spec/fixtures/cassettes/braintree/token.yml
385
- - spec/fixtures/cassettes/source/last4.yml
386
- - spec/fixtures/cassettes/source/card_type.yml
387
- - spec/fixtures/cassettes/admin/valid_credit_card.yml
388
- - spec/fixtures/cassettes/admin/invalid_credit_card.yml
389
- - spec/fixtures/cassettes/admin/resubmit_credit_card.yml
390
- - spec/fixtures/cassettes/checkout/valid_credit_card.yml
391
- - spec/fixtures/cassettes/checkout/invalid_credit_card.yml
392
- - spec/fixtures/cassettes/checkout/update.yml
393
- - spec/fixtures/cassettes/checkout/resubmit_credit_card.yml
394
- - spec/fixtures/cassettes/checkout/valid_venmo_transaction.yml
395
- - spec/fixtures/cassettes/gateway/cancel/missing.yml
396
- - spec/fixtures/cassettes/gateway/cancel/refunds.yml
397
- - spec/fixtures/cassettes/gateway/cancel/void.yml
398
- - spec/fixtures/cassettes/gateway/capture.yml
399
- - spec/fixtures/cassettes/gateway/settled_transaction.yml
400
- - spec/fixtures/cassettes/gateway/authorized_transaction.yml
401
- - spec/fixtures/cassettes/gateway/void.yml
402
- - spec/fixtures/cassettes/gateway/credit.yml
403
- - spec/fixtures/cassettes/gateway/authorize.yml
404
- - spec/fixtures/cassettes/gateway/authorize/credit_card/address.yml
405
- - spec/fixtures/cassettes/gateway/authorize/paypal/EUR.yml
406
- - spec/fixtures/cassettes/gateway/authorize/paypal/address.yml
407
- - spec/fixtures/cassettes/gateway/authorize/merchant_account/EUR.yml
408
- - spec/fixtures/cassettes/gateway/complete.yml
409
- - spec/fixtures/cassettes/gateway/purchase.yml
410
- - spec/fixtures/views/spree/orders/edit.html.erb
411
- - spec/controllers/solidus_paypal_braintree/configurations_controller_spec.rb
412
- - spec/controllers/solidus_paypal_braintree/transactions_controller_spec.rb
413
- - spec/controllers/solidus_paypal_braintree/client_tokens_controller_spec.rb
414
- - spec/controllers/solidus_paypal_braintree/checkouts_controller_spec.rb
415
- - spec/helpers/solidus_paypal_braintree/braintree_admin_helper_spec.rb
416
- - spec/helpers/solidus_paypal_braintree/braintree_checkout_helper_spec.rb
298
+ test_files: []
@@ -1,99 +0,0 @@
1
- require 'spec_helper'
2
- require 'support/order_ready_for_payment'
3
-
4
- RSpec.describe SolidusPaypalBraintree::CheckoutsController, type: :controller do
5
- routes { SolidusPaypalBraintree::Engine.routes }
6
-
7
- include_context 'when order is ready for payment'
8
-
9
- describe 'PATCH update' do
10
- subject(:patch_update) { patch :update, params: params }
11
-
12
- let(:params) do
13
- {
14
- "state" => "payment",
15
- "order" => {
16
- "payments_attributes" => [
17
- {
18
- "payment_method_id" => payment_method.id,
19
- "source_attributes" => {
20
- "nonce" => "fake-paypal-billing-agreement-nonce",
21
- "payment_type" => SolidusPaypalBraintree::Source::PAYPAL
22
- }
23
- }
24
- ],
25
- "use_billing" => "1",
26
- "use_postmates_shipping" => "0"
27
- },
28
- "reuse_credit" => "1",
29
- "order_bill_address" => "",
30
- "reuse_bill_address" => "1"
31
- }
32
- end
33
-
34
- let!(:payment_method) do
35
- create_gateway
36
- end
37
-
38
- before do
39
- allow(controller).to receive(:try_spree_current_user) { user }
40
- allow(controller).to receive(:spree_current_user) { user }
41
- allow(controller).to receive(:current_order) { order }
42
- end
43
-
44
- context "when a payment is created successfully", vcr: {
45
- cassette_name: 'checkout/update',
46
- match_requests_on: [:braintree_uri]
47
- } do
48
- it 'creates a payment' do
49
- expect { patch_update }.
50
- to change { order.payments.count }.
51
- from(0).
52
- to(1)
53
- end
54
-
55
- it 'creates a payment source' do
56
- expect { patch_update }.
57
- to change { SolidusPaypalBraintree::Source.count }.
58
- from(0).
59
- to(1)
60
- end
61
-
62
- it 'assigns @order' do
63
- patch_update
64
- expect(assigns(:order)).to eq order
65
- end
66
-
67
- it "is successful" do
68
- expect(patch_update).to be_successful
69
- end
70
-
71
- it "renders 'ok'" do
72
- expect(patch_update.body).to eql("ok")
73
- end
74
- end
75
-
76
- context "when a payment is not created successfully" do
77
- before do
78
- allow_any_instance_of(::Spree::Payment).to receive(:save).and_return(false)
79
- end
80
-
81
- # No idea why this is the case, but I'm just adding the tests here
82
- it "is successful" do
83
- expect(patch_update).to be_successful
84
- end
85
-
86
- it "renders 'not-ok'" do
87
- expect(patch_update.body).to eq('not-ok')
88
- end
89
-
90
- it "does not change the number of payments in the system" do
91
- expect{ patch_update }.not_to(change{ ::Spree::Payment.count })
92
- end
93
-
94
- it "does not change the number of sources in the system" do
95
- expect{ patch_update }.not_to(change{ SolidusPaypalBraintree::Source.count })
96
- end
97
- end
98
- end
99
- end
@@ -1,55 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe SolidusPaypalBraintree::ClientTokensController do
4
- routes { SolidusPaypalBraintree::Engine.routes }
5
-
6
- cassette_options = { cassette_name: "braintree/token" }
7
- describe "POST create", vcr: cassette_options do
8
- let!(:gateway) { create_gateway }
9
- let(:user) { create(:user) }
10
- let(:json) { JSON.parse(response.body) }
11
-
12
- before { user.generate_spree_api_key! }
13
-
14
- context 'without a payment method id' do
15
- subject(:response) do
16
- post :create, params: { token: user.spree_api_key }
17
- end
18
-
19
- it "returns a client token", aggregate_failures: true do
20
- expect(response).to have_http_status(:success)
21
- expect(response.content_type).to include 'application/json'
22
- expect(json["client_token"]).to be_present
23
- expect(json["client_token"]).to be_a String
24
- expect(json["payment_method_id"]).to eq gateway.id
25
- end
26
-
27
- context "when there's two gateway's for different stores" do
28
- let!(:store1) { create(:store, code: 'store_1') }
29
- let!(:store2) { create(:store, code: 'store_2') }
30
- let!(:gateway_for_store1) { create_gateway.tap{ |gw| store1.payment_methods << gw } }
31
- let!(:gateway_for_store2) { create_gateway.tap{ |gw| store2.payment_methods << gw } }
32
-
33
- it "returns the correct gateway for store1" do
34
- allow_any_instance_of(described_class).to receive(:current_store).and_return store1
35
- expect(json["payment_method_id"]).to eq gateway_for_store1.id
36
- end
37
-
38
- it "returns the correct gateway for store2" do
39
- allow_any_instance_of(described_class).to receive(:current_store).and_return store2
40
- expect(json["payment_method_id"]).to eq gateway_for_store2.id
41
- end
42
- end
43
- end
44
-
45
- context 'with a payment method id' do
46
- subject(:response) do
47
- post :create, params: { token: user.spree_api_key, payment_method_id: gateway.id }
48
- end
49
-
50
- it 'uses the selected gateway' do
51
- expect(json["payment_method_id"]).to eq gateway.id
52
- end
53
- end
54
- end
55
- end