solidus_paypal_braintree 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (71) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +4 -0
  3. data/.gitignore +1 -0
  4. data/CHANGELOG.md +70 -1
  5. data/Gemfile +2 -5
  6. data/app/models/solidus_paypal_braintree/gateway.rb +2 -0
  7. data/app/models/solidus_paypal_braintree/transaction.rb +2 -2
  8. data/app/models/solidus_paypal_braintree/transaction_import.rb +2 -2
  9. data/lib/solidus_paypal_braintree/engine.rb +5 -3
  10. data/lib/solidus_paypal_braintree/version.rb +1 -1
  11. data/solidus_paypal_braintree.gemspec +0 -1
  12. metadata +7 -125
  13. data/spec/controllers/solidus_paypal_braintree/checkouts_controller_spec.rb +0 -99
  14. data/spec/controllers/solidus_paypal_braintree/client_tokens_controller_spec.rb +0 -55
  15. data/spec/controllers/solidus_paypal_braintree/configurations_controller_spec.rb +0 -73
  16. data/spec/controllers/solidus_paypal_braintree/transactions_controller_spec.rb +0 -183
  17. data/spec/features/backend/configuration_spec.rb +0 -23
  18. data/spec/features/backend/new_payment_spec.rb +0 -137
  19. data/spec/features/frontend/braintree_credit_card_checkout_spec.rb +0 -191
  20. data/spec/features/frontend/paypal_checkout_spec.rb +0 -166
  21. data/spec/features/frontend/venmo_checkout_spec.rb +0 -189
  22. data/spec/fixtures/cassettes/admin/invalid_credit_card.yml +0 -63
  23. data/spec/fixtures/cassettes/admin/resubmit_credit_card.yml +0 -352
  24. data/spec/fixtures/cassettes/admin/valid_credit_card.yml +0 -412
  25. data/spec/fixtures/cassettes/braintree/create_profile.yml +0 -71
  26. data/spec/fixtures/cassettes/braintree/generate_token.yml +0 -63
  27. data/spec/fixtures/cassettes/braintree/token.yml +0 -63
  28. data/spec/fixtures/cassettes/checkout/invalid_credit_card.yml +0 -63
  29. data/spec/fixtures/cassettes/checkout/resubmit_credit_card.yml +0 -216
  30. data/spec/fixtures/cassettes/checkout/update.yml +0 -71
  31. data/spec/fixtures/cassettes/checkout/valid_credit_card.yml +0 -156
  32. data/spec/fixtures/cassettes/checkout/valid_venmo_transaction.yml +0 -599
  33. data/spec/fixtures/cassettes/gateway/authorize/credit_card/address.yml +0 -86
  34. data/spec/fixtures/cassettes/gateway/authorize/merchant_account/EUR.yml +0 -154
  35. data/spec/fixtures/cassettes/gateway/authorize/paypal/EUR.yml +0 -90
  36. data/spec/fixtures/cassettes/gateway/authorize/paypal/address.yml +0 -90
  37. data/spec/fixtures/cassettes/gateway/authorize.yml +0 -86
  38. data/spec/fixtures/cassettes/gateway/authorized_transaction.yml +0 -73
  39. data/spec/fixtures/cassettes/gateway/cancel/missing.yml +0 -63
  40. data/spec/fixtures/cassettes/gateway/cancel/refunds.yml +0 -272
  41. data/spec/fixtures/cassettes/gateway/cancel/void.yml +0 -201
  42. data/spec/fixtures/cassettes/gateway/capture.yml +0 -141
  43. data/spec/fixtures/cassettes/gateway/complete.yml +0 -157
  44. data/spec/fixtures/cassettes/gateway/credit.yml +0 -208
  45. data/spec/fixtures/cassettes/gateway/purchase.yml +0 -87
  46. data/spec/fixtures/cassettes/gateway/settled_transaction.yml +0 -140
  47. data/spec/fixtures/cassettes/gateway/void.yml +0 -137
  48. data/spec/fixtures/cassettes/source/card_type.yml +0 -267
  49. data/spec/fixtures/cassettes/source/last4.yml +0 -267
  50. data/spec/fixtures/cassettes/transaction/import/valid/capture.yml +0 -224
  51. data/spec/fixtures/cassettes/transaction/import/valid.yml +0 -71
  52. data/spec/fixtures/views/spree/orders/edit.html.erb +0 -50
  53. data/spec/helpers/solidus_paypal_braintree/braintree_admin_helper_spec.rb +0 -17
  54. data/spec/helpers/solidus_paypal_braintree/braintree_checkout_helper_spec.rb +0 -70
  55. data/spec/models/solidus_paypal_braintree/address_spec.rb +0 -71
  56. data/spec/models/solidus_paypal_braintree/avs_result_spec.rb +0 -317
  57. data/spec/models/solidus_paypal_braintree/gateway_spec.rb +0 -692
  58. data/spec/models/solidus_paypal_braintree/response_spec.rb +0 -280
  59. data/spec/models/solidus_paypal_braintree/source_spec.rb +0 -499
  60. data/spec/models/solidus_paypal_braintree/transaction_address_spec.rb +0 -235
  61. data/spec/models/solidus_paypal_braintree/transaction_import_spec.rb +0 -300
  62. data/spec/models/solidus_paypal_braintree/transaction_spec.rb +0 -85
  63. data/spec/models/spree/store_spec.rb +0 -14
  64. data/spec/requests/spree/api/orders_controller_spec.rb +0 -36
  65. data/spec/spec_helper.rb +0 -29
  66. data/spec/support/capybara.rb +0 -7
  67. data/spec/support/factories.rb +0 -2
  68. data/spec/support/gateway_helpers.rb +0 -29
  69. data/spec/support/order_ready_for_payment.rb +0 -37
  70. data/spec/support/vcr.rb +0 -42
  71. 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: 63e1ccf774638a7a86d78396a9faf2ded82d2ac849bd197c9f554b52d2257d23
4
+ data.tar.gz: 7aad39ea3e0eb572558213b51093e3fab40fed516a39802e2dafa6ae62914432
5
5
  SHA512:
6
- metadata.gz: 557543f455a52fbb02ad803c8ec007292cc5b045eddc63288fb5c39eb0e87ec920a7d92f83e84422b99ecf5386362ab212698756318de636c8e39c79490daf83
7
- data.tar.gz: b9b1a28200855bfbfa2a03ad589f161b08993ce35525f889babb6ed3bcb9381c20b4ed1ee18d63cd097af010d28ec39c13b8d37ce0d54704a592438f5917e2e4
6
+ metadata.gz: 3bffb9a52eacfa27ed6633a7f7c01eacc8aec2f0f2b2e25ca5cb1e7ef66556f2486f320260b0544186516a7f87663d3b10ef52c267343089ab822612fb0ca4c2
7
+ data.tar.gz: 3e4827feb921fc1e2d324408333ef34c89dfb01837bf1973fc998529323cfe2112970ff1d33b8f4d8792ad37df3c474516c9c2d35e5ed0fb03ee6408f969cd85
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/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
@@ -6,10 +6,7 @@ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
6
6
  branch = ENV.fetch('SOLIDUS_BRANCH', 'master')
7
7
  gem 'solidus', github: 'solidusio/solidus', branch: branch
8
8
 
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'
9
+ gem 'rails', ENV.fetch('RAILS_VERSION', nil)
13
10
 
14
11
  # Provides basic authentication functionality for testing parts of your engine
15
12
  gem 'solidus_auth_devise'
@@ -20,7 +17,7 @@ gem 'sassc-rails', platforms: :mri
20
17
 
21
18
  gem 'bourbon'
22
19
 
23
- case ENV['DB']
20
+ case ENV.fetch('DB', nil)
24
21
  when 'mysql'
25
22
  gem 'mysql2'
26
23
  when 'postgresql'
@@ -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?
@@ -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.1'
5
5
  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.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stembolt
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-02-01 00:00:00.000000000 Z
11
+ date: 2022-06-30 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
@@ -335,7 +276,7 @@ metadata:
335
276
  homepage_uri: https://github.com/solidusio/solidus_paypal_braintree
336
277
  source_code_uri: https://github.com/solidusio/solidus_paypal_braintree
337
278
  rubygems_mfa_required: 'true'
338
- post_install_message:
279
+ post_install_message:
339
280
  rdoc_options: []
340
281
  require_paths:
341
282
  - lib
@@ -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
354
- signing_key:
294
+ rubygems_version: 3.1.6
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
@@ -1,73 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe SolidusPaypalBraintree::ConfigurationsController, type: :controller do
4
- routes { SolidusPaypalBraintree::Engine.routes }
5
-
6
- let!(:store_1) { create :store }
7
- let!(:store_2) { create :store }
8
-
9
- stub_authorization!
10
-
11
- describe "GET #list" do
12
- subject { get :list }
13
-
14
- it "assigns all store's configurations as @configurations" do
15
- subject
16
- expect(assigns(:configurations)).
17
- to eq [store_1.braintree_configuration, store_2.braintree_configuration]
18
- end
19
-
20
- it "renders the correct view" do
21
- expect(subject).to render_template :list
22
- end
23
- end
24
-
25
- describe "POST #update" do
26
- subject { post :update, params: configurations_params }
27
-
28
- let(:paypal_button_color) { 'blue' }
29
- let(:configurations_params) do
30
- {
31
- configurations: {
32
- configuration_fields: {
33
- store_1.braintree_configuration.id.to_s => { paypal: true, apple_pay: true },
34
- store_2.braintree_configuration.id.to_s => {
35
- paypal: true,
36
- apple_pay: false,
37
- preferred_paypal_button_color: paypal_button_color
38
- }
39
- }
40
- }
41
- }
42
- end
43
-
44
- context "with valid parameters" do
45
- it "updates the configuration" do
46
- expect { subject }.to change { store_1.braintree_configuration.reload.paypal }.
47
- from(false).to(true)
48
- end
49
-
50
- it "displays a success message to the user" do
51
- subject
52
- expect(flash[:success]).to eq "Successfully updated Braintree configurations."
53
- end
54
-
55
- it "displays all configurations" do
56
- expect(subject).to redirect_to action: :list
57
- end
58
- end
59
-
60
- context "with invalid parameters" do
61
- let(:paypal_button_color) { 'invalid-color' }
62
-
63
- it "displays an error message to the user" do
64
- subject
65
- expect(flash[:error]).to eq "An error occurred while updating Braintree configurations."
66
- end
67
-
68
- it "returns the user to the edit page" do
69
- expect(subject).to redirect_to action: :list
70
- end
71
- end
72
- end
73
- end