solidus_paypal_braintree 1.1.0 → 1.1.2

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -1,2 +0,0 @@
1
- # Requires factories defined in lib/solidus_paypal_braintree/factories.rb
2
- require 'solidus_paypal_braintree/factories'
@@ -1,29 +0,0 @@
1
- module SolidusPaypalBraintree
2
- module GatewayHelpers
3
- def new_gateway(opts = {})
4
- SolidusPaypalBraintree::Gateway.new({
5
- name: "Braintree",
6
- preferences: {
7
- environment: 'sandbox',
8
- public_key: ENV.fetch('BRAINTREE_PUBLIC_KEY', 'dummy_public_key'),
9
- private_key: ENV.fetch('BRAINTREE_PRIVATE_KEY', 'dummy_private_key'),
10
- merchant_id: ENV.fetch('BRAINTREE_MERCHANT_ID', 'dummy_merchant_id'),
11
- merchant_currency_map: {
12
- 'EUR' => 'stembolt_EUR'
13
- },
14
- paypal_payee_email_map: {
15
- 'EUR' => ENV.fetch('BRAINTREE_PAYPAL_PAYEE_EMAIL', 'paypal+europe@example.com')
16
- }
17
- }
18
- }.merge(opts))
19
- end
20
-
21
- def create_gateway(opts = {})
22
- new_gateway(opts).tap(&:save!)
23
- end
24
- end
25
- end
26
-
27
- RSpec.configure do |config|
28
- config.include SolidusPaypalBraintree::GatewayHelpers
29
- end
@@ -1,37 +0,0 @@
1
- shared_context 'when order is ready for payment' do
2
- let!(:country) { create :country }
3
-
4
- let(:user) { create :user }
5
- let(:address) { create :address, zipcode: "90210", lastname: "Doe", country: country }
6
-
7
- before do
8
- create :shipping_method, cost: 5
9
- end
10
-
11
- let(:gateway) do
12
- new_gateway(auto_capture: true)
13
- end
14
-
15
- let(:order) do
16
- order = Spree::Order.create!(
17
- line_items: [create(:line_item, price: 50)],
18
- email: 'test@example.com',
19
- bill_address: address,
20
- ship_address: address,
21
- user: user
22
- )
23
- order.recalculate
24
-
25
- expect(order.state).to eq "cart"
26
-
27
- # push through cart, address and delivery
28
- # its sadly unsafe to use any reasonable factory here accross
29
- # supported solidus versions
30
- order.next!
31
- order.next!
32
- order.next!
33
-
34
- expect(order.state).to eq "payment"
35
- order
36
- end
37
- end
data/spec/support/vcr.rb DELETED
@@ -1,42 +0,0 @@
1
- require 'vcr'
2
- require 'webmock'
3
-
4
- VCR.configure do |c|
5
- c.cassette_library_dir = "spec/fixtures/cassettes"
6
- c.hook_into :webmock
7
- c.configure_rspec_metadata!
8
- c.default_cassette_options = {
9
- match_requests_on: [:method, :uri, :body]
10
- }
11
- c.allow_http_connections_when_no_cassette = false
12
- c.ignore_localhost = true
13
- c.ignore_hosts 'chromedriver.storage.googleapis.com'
14
-
15
- # client token used for the fronted JS lib cannot be mocked:
16
- # it contains a cryptographically signed string containing the merchant id
17
- # that's sent back to braintree's server by the JS lib
18
- c.ignore_request do |request|
19
- !(request.uri =~ %r{/merchants/\w+/client_token\z}).nil?
20
- end
21
-
22
- # match a request to Braintree sandbox APIs by ignoring the merchant ID
23
- # in the request URI
24
- c.register_request_matcher :braintree_uri do |request1, request2|
25
- extract_url_resource = lambda do |uri|
26
- uri_match_pattern =
27
- %r{\Ahttps://api\.sandbox\.braintreegateway\.com/merchants/\w+(/.*)\z}
28
-
29
- if match = uri.match(uri_match_pattern)
30
- match.captures.first
31
- end
32
- end
33
- r1_resource = extract_url_resource.call(request1.uri)
34
- r2_resource = extract_url_resource.call(request2.uri)
35
-
36
- !r1_resource.nil? && r1_resource == r2_resource
37
- end
38
-
39
- # https://github.com/titusfortner/webdrivers/wiki/Using-with-VCR-or-WebMock
40
- driver_hosts = Webdrivers::Common.subclasses.map { |driver| URI(driver.base_url).host }
41
- c.ignore_hosts(*driver_hosts)
42
- end
@@ -1 +0,0 @@
1
- ApplicationController.prepend_view_path "spec/fixtures/views"