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.
- checksums.yaml +4 -4
- data/.circleci/config.yml +4 -0
- data/.gitignore +1 -0
- data/.rubocop.yml +1 -1
- data/CHANGELOG.md +70 -1
- data/Gemfile +9 -6
- data/app/models/solidus_paypal_braintree/gateway.rb +5 -3
- data/app/models/solidus_paypal_braintree/transaction.rb +2 -2
- data/app/models/solidus_paypal_braintree/transaction_import.rb +2 -2
- data/lib/solidus_paypal_braintree/engine.rb +5 -3
- data/lib/solidus_paypal_braintree/factories.rb +5 -5
- data/lib/solidus_paypal_braintree/version.rb +1 -1
- data/lib/views/frontend/solidus_paypal_braintree/payments/_payment.html.erb +3 -3
- data/solidus_paypal_braintree.gemspec +0 -1
- metadata +4 -122
- data/spec/controllers/solidus_paypal_braintree/checkouts_controller_spec.rb +0 -99
- data/spec/controllers/solidus_paypal_braintree/client_tokens_controller_spec.rb +0 -55
- data/spec/controllers/solidus_paypal_braintree/configurations_controller_spec.rb +0 -73
- data/spec/controllers/solidus_paypal_braintree/transactions_controller_spec.rb +0 -183
- data/spec/features/backend/configuration_spec.rb +0 -23
- data/spec/features/backend/new_payment_spec.rb +0 -137
- data/spec/features/frontend/braintree_credit_card_checkout_spec.rb +0 -191
- data/spec/features/frontend/paypal_checkout_spec.rb +0 -166
- data/spec/features/frontend/venmo_checkout_spec.rb +0 -189
- data/spec/fixtures/cassettes/admin/invalid_credit_card.yml +0 -63
- data/spec/fixtures/cassettes/admin/resubmit_credit_card.yml +0 -352
- data/spec/fixtures/cassettes/admin/valid_credit_card.yml +0 -412
- data/spec/fixtures/cassettes/braintree/create_profile.yml +0 -71
- data/spec/fixtures/cassettes/braintree/generate_token.yml +0 -63
- data/spec/fixtures/cassettes/braintree/token.yml +0 -63
- data/spec/fixtures/cassettes/checkout/invalid_credit_card.yml +0 -63
- data/spec/fixtures/cassettes/checkout/resubmit_credit_card.yml +0 -216
- data/spec/fixtures/cassettes/checkout/update.yml +0 -71
- data/spec/fixtures/cassettes/checkout/valid_credit_card.yml +0 -156
- data/spec/fixtures/cassettes/checkout/valid_venmo_transaction.yml +0 -599
- data/spec/fixtures/cassettes/gateway/authorize/credit_card/address.yml +0 -86
- data/spec/fixtures/cassettes/gateway/authorize/merchant_account/EUR.yml +0 -154
- data/spec/fixtures/cassettes/gateway/authorize/paypal/EUR.yml +0 -90
- data/spec/fixtures/cassettes/gateway/authorize/paypal/address.yml +0 -90
- data/spec/fixtures/cassettes/gateway/authorize.yml +0 -86
- data/spec/fixtures/cassettes/gateway/authorized_transaction.yml +0 -73
- data/spec/fixtures/cassettes/gateway/cancel/missing.yml +0 -63
- data/spec/fixtures/cassettes/gateway/cancel/refunds.yml +0 -272
- data/spec/fixtures/cassettes/gateway/cancel/void.yml +0 -201
- data/spec/fixtures/cassettes/gateway/capture.yml +0 -141
- data/spec/fixtures/cassettes/gateway/complete.yml +0 -157
- data/spec/fixtures/cassettes/gateway/credit.yml +0 -208
- data/spec/fixtures/cassettes/gateway/purchase.yml +0 -87
- data/spec/fixtures/cassettes/gateway/settled_transaction.yml +0 -140
- data/spec/fixtures/cassettes/gateway/void.yml +0 -137
- data/spec/fixtures/cassettes/source/card_type.yml +0 -267
- data/spec/fixtures/cassettes/source/last4.yml +0 -267
- data/spec/fixtures/cassettes/transaction/import/valid/capture.yml +0 -224
- data/spec/fixtures/cassettes/transaction/import/valid.yml +0 -71
- data/spec/fixtures/views/spree/orders/edit.html.erb +0 -50
- data/spec/helpers/solidus_paypal_braintree/braintree_admin_helper_spec.rb +0 -17
- data/spec/helpers/solidus_paypal_braintree/braintree_checkout_helper_spec.rb +0 -70
- data/spec/models/solidus_paypal_braintree/address_spec.rb +0 -71
- data/spec/models/solidus_paypal_braintree/avs_result_spec.rb +0 -317
- data/spec/models/solidus_paypal_braintree/gateway_spec.rb +0 -692
- data/spec/models/solidus_paypal_braintree/response_spec.rb +0 -280
- data/spec/models/solidus_paypal_braintree/source_spec.rb +0 -499
- data/spec/models/solidus_paypal_braintree/transaction_address_spec.rb +0 -235
- data/spec/models/solidus_paypal_braintree/transaction_import_spec.rb +0 -300
- data/spec/models/solidus_paypal_braintree/transaction_spec.rb +0 -85
- data/spec/models/spree/store_spec.rb +0 -14
- data/spec/requests/spree/api/orders_controller_spec.rb +0 -36
- data/spec/spec_helper.rb +0 -29
- data/spec/support/capybara.rb +0 -7
- data/spec/support/factories.rb +0 -2
- data/spec/support/gateway_helpers.rb +0 -29
- data/spec/support/order_ready_for_payment.rb +0 -37
- data/spec/support/vcr.rb +0 -42
- data/spec/support/views.rb +0 -1
data/spec/support/factories.rb
DELETED
@@ -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
|
data/spec/support/views.rb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
ApplicationController.prepend_view_path "spec/fixtures/views"
|