solidus_braintree 1.2.0 → 2.0.0
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 +47 -0
- data/.gem_release.yml +5 -0
- data/.github/stale.yml +1 -0
- data/.github_changelog_generator +2 -0
- data/.gitignore +20 -10
- data/.rspec +1 -1
- data/.rubocop.yml +79 -0
- data/CHANGELOG.md +178 -18
- data/Gemfile +35 -17
- data/LICENSE +26 -0
- data/README.md +389 -24
- data/Rakefile +4 -19
- data/app/assets/config/solidus_braintree_manifest.js +1 -0
- data/app/assets/images/solidus_braintree/venmo/venmo_active_blue_button_280x48.svg +19 -0
- data/app/assets/images/solidus_braintree/venmo/venmo_active_blue_button_320x48.svg +19 -0
- data/app/assets/images/solidus_braintree/venmo/venmo_active_blue_button_375x48.svg +19 -0
- data/app/assets/images/solidus_braintree/venmo/venmo_active_white_button_280x48.svg +19 -0
- data/app/assets/images/solidus_braintree/venmo/venmo_active_white_button_320x48.svg +19 -0
- data/app/assets/images/solidus_braintree/venmo/venmo_active_white_button_375x48.svg +19 -0
- data/app/assets/images/solidus_braintree/venmo/venmo_blue_acceptance_mark.svg +15 -0
- data/app/assets/images/solidus_braintree/venmo/venmo_blue_button_280x48.svg +19 -0
- data/app/assets/images/solidus_braintree/venmo/venmo_blue_button_320x48.svg +19 -0
- data/app/assets/images/solidus_braintree/venmo/venmo_blue_button_375x48.svg +19 -0
- data/app/assets/images/solidus_braintree/venmo/venmo_blue_logo.svg +18 -0
- data/app/assets/images/solidus_braintree/venmo/venmo_white_acceptance_mark.svg +20 -0
- data/app/assets/images/solidus_braintree/venmo/venmo_white_button_280x48.svg +19 -0
- data/app/assets/images/solidus_braintree/venmo/venmo_white_button_320x48.svg +19 -0
- data/app/assets/images/solidus_braintree/venmo/venmo_white_button_375x48.svg +19 -0
- data/app/assets/images/solidus_braintree/venmo/venmo_white_logo.svg +18 -0
- data/app/assets/javascripts/solidus_braintree/apple_pay_button.js +179 -0
- data/app/assets/javascripts/solidus_braintree/checkout.js +108 -0
- data/app/assets/javascripts/solidus_braintree/client.js +239 -0
- data/app/assets/javascripts/solidus_braintree/constants.js +89 -0
- data/app/assets/javascripts/solidus_braintree/frontend.js +14 -0
- data/app/assets/javascripts/solidus_braintree/hosted_form.js +46 -0
- data/app/assets/javascripts/solidus_braintree/paypal_button.js +178 -0
- data/app/assets/javascripts/solidus_braintree/paypal_messaging.js +22 -0
- data/app/assets/javascripts/solidus_braintree/promise.js +20 -0
- data/app/assets/javascripts/solidus_braintree/venmo_button.js +86 -0
- data/app/assets/javascripts/spree/backend/solidus_braintree.js +96 -0
- data/app/assets/javascripts/spree/frontend/paypal_button.js +34 -0
- data/app/assets/javascripts/spree/frontend/solidus_braintree.js +1 -0
- data/app/assets/stylesheets/spree/backend/solidus_braintree.scss +28 -0
- data/app/assets/stylesheets/spree/frontend/solidus_braintree.scss +51 -0
- data/app/decorators/controllers/solidus_braintree/admin_payments_controller_decorator.rb +11 -0
- data/app/decorators/controllers/solidus_braintree/checkout_controller_decorator.rb +11 -0
- data/app/decorators/controllers/solidus_braintree/client_tokens_controller.rb +41 -0
- data/app/decorators/controllers/solidus_braintree/orders_controller_decorator.rb +11 -0
- data/app/decorators/models/solidus_braintree/spree/store_decorator.rb +20 -0
- data/app/decorators/models/solidus_braintree/spree/user_decorator.rb +13 -0
- data/app/helpers/solidus_braintree/braintree_admin_helper.rb +23 -0
- data/app/helpers/solidus_braintree/braintree_checkout_helper.rb +60 -0
- data/app/models/application_record.rb +5 -0
- data/app/models/solidus_braintree/address.rb +64 -0
- data/app/models/solidus_braintree/avs_result.rb +69 -0
- data/app/models/solidus_braintree/configuration.rb +39 -0
- data/app/models/solidus_braintree/customer.rb +8 -0
- data/app/models/solidus_braintree/gateway.rb +433 -0
- data/app/models/solidus_braintree/response.rb +80 -0
- data/app/models/solidus_braintree/source.rb +135 -0
- data/app/models/solidus_braintree/transaction.rb +31 -0
- data/app/models/solidus_braintree/transaction_address.rb +88 -0
- data/app/models/solidus_braintree/transaction_import.rb +98 -0
- data/app/overrides/spree/payments/payment/add_paypal_funding_source_to_payment.rb +9 -0
- data/app/views/spree/api/payments/source_views/_braintree.json.jbuilder +3 -0
- data/app/views/spree/checkout/existing_payment/_braintree.html.erb +10 -0
- data/app/views/spree/shared/_apple_pay_button.html.erb +27 -0
- data/app/views/spree/shared/_braintree_errors.html.erb +16 -0
- data/app/views/spree/shared/_braintree_head_scripts.html.erb +26 -0
- data/app/views/spree/shared/_braintree_hosted_fields.html.erb +43 -0
- data/app/views/spree/shared/_paypal_cart_button.html.erb +38 -0
- data/app/views/spree/shared/_paypal_messaging.html.erb +13 -0
- data/app/views/spree/shared/_venmo_button.html.erb +33 -0
- data/bin/console +4 -1
- data/bin/rails +5 -5
- data/bin/rails-engine +13 -0
- data/bin/rails-sandbox +16 -0
- data/bin/rake +7 -0
- data/bin/sandbox +103 -0
- data/bin/setup +5 -4
- data/config/locales/en.yml +94 -2
- data/config/locales/it.yml +56 -0
- data/config/routes.rb +12 -3
- data/db/migrate/20160830061749_create_solidus_paypal_braintree_sources.rb +16 -0
- data/db/migrate/20160906201711_create_solidus_paypal_braintree_customers.rb +13 -0
- data/db/migrate/20161114231422_create_solidus_paypal_braintree_configurations.rb +11 -0
- data/db/migrate/20161125172005_add_braintree_configuration_to_stores.rb +7 -0
- data/db/migrate/20170203191030_add_credit_card_to_braintree_configuration.rb +6 -0
- data/db/migrate/20170505193712_add_null_constraint_to_sources.rb +38 -0
- data/db/migrate/20170508085402_add_not_null_constraint_to_sources_payment_type.rb +14 -0
- data/db/migrate/20190705115327_add_paypal_button_preferences_to_braintree_configurations.rb +5 -0
- data/db/migrate/20190911141712_add_3d_secure_to_braintree_configuration.rb +5 -0
- data/db/migrate/20211222170950_add_paypal_funding_source_to_solidus_paypal_braintree_sources.rb +5 -0
- data/db/migrate/20220104150301_add_venmo_to_braintree_configuration.rb +5 -0
- data/db/migrate/20230109080950_rename_solidus_paypal_braintree_source_type.rb +31 -0
- data/lib/controllers/backend/solidus_braintree/configurations_controller.rb +48 -0
- data/lib/controllers/frontend/solidus_braintree/checkouts_controller.rb +31 -0
- data/lib/controllers/frontend/solidus_braintree/transactions_controller.rb +67 -0
- data/lib/generators/solidus_braintree/install/install_generator.rb +54 -18
- data/lib/generators/solidus_braintree/install/templates/initializer.rb +6 -0
- data/lib/solidus_braintree/country_mapper.rb +37 -0
- data/lib/solidus_braintree/engine.rb +55 -10
- data/lib/solidus_braintree/extension_configuration.rb +23 -0
- data/lib/solidus_braintree/request_protection.rb +21 -0
- data/lib/solidus_braintree/testing_support/factories.rb +53 -0
- data/lib/solidus_braintree/version.rb +3 -1
- data/lib/solidus_braintree.rb +14 -2
- data/lib/solidus_paypal_braintree.rb +6 -0
- data/lib/views/backend/solidus_braintree/configurations/list.html.erb +63 -0
- data/lib/views/backend/spree/admin/payments/source_forms/_braintree.html.erb +16 -0
- data/lib/views/backend/spree/admin/payments/source_views/_braintree.html.erb +39 -0
- data/lib/views/backend/spree/admin/shared/preference_fields/_preference_select.html.erb +13 -0
- data/lib/views/backend_v1.2/spree/admin/payments/source_forms/_braintree.html.erb +16 -0
- data/lib/views/backend_v2.4/spree/admin/shared/preference_fields/_hash.html.erb +12 -0
- data/lib/views/frontend/solidus_braintree/payments/_payment.html.erb +12 -0
- data/lib/views/frontend/spree/checkout/payment/_braintree.html.erb +23 -0
- data/lib/views/frontend/spree/shared/_paypal_checkout_button.html.erb +32 -0
- data/solidus_braintree.gemspec +39 -38
- data/spec/controllers/solidus_braintree/checkouts_controller_spec.rb +99 -0
- data/spec/controllers/solidus_braintree/client_tokens_controller_spec.rb +55 -0
- data/spec/controllers/solidus_braintree/configurations_controller_spec.rb +73 -0
- data/spec/controllers/solidus_braintree/transactions_controller_spec.rb +183 -0
- data/spec/features/backend/configuration_spec.rb +23 -0
- data/spec/features/backend/new_payment_spec.rb +137 -0
- data/spec/features/frontend/braintree_credit_card_checkout_spec.rb +191 -0
- data/spec/features/frontend/paypal_checkout_spec.rb +166 -0
- data/spec/features/frontend/venmo_checkout_spec.rb +194 -0
- data/spec/fixtures/cassettes/admin/invalid_credit_card.yml +63 -0
- data/spec/fixtures/cassettes/admin/resubmit_credit_card.yml +352 -0
- data/spec/fixtures/cassettes/admin/valid_credit_card.yml +412 -0
- data/spec/fixtures/cassettes/braintree/create_profile.yml +71 -0
- data/spec/fixtures/cassettes/braintree/generate_token.yml +63 -0
- data/spec/fixtures/cassettes/braintree/token.yml +63 -0
- data/spec/fixtures/cassettes/checkout/invalid_credit_card.yml +63 -0
- data/spec/fixtures/cassettes/checkout/resubmit_credit_card.yml +216 -0
- data/spec/fixtures/cassettes/checkout/update.yml +71 -0
- data/spec/fixtures/cassettes/checkout/valid_credit_card.yml +171 -0
- data/spec/fixtures/cassettes/checkout/valid_venmo_transaction.yml +599 -0
- data/spec/fixtures/cassettes/gateway/authorize/credit_card/address.yml +86 -0
- data/spec/fixtures/cassettes/gateway/authorize/merchant_account/EUR.yml +154 -0
- data/spec/fixtures/cassettes/gateway/authorize/paypal/EUR.yml +90 -0
- data/spec/fixtures/cassettes/gateway/authorize/paypal/address.yml +90 -0
- data/spec/fixtures/cassettes/gateway/authorize.yml +86 -0
- data/spec/fixtures/cassettes/gateway/authorized_transaction.yml +73 -0
- data/spec/fixtures/cassettes/gateway/cancel/missing.yml +63 -0
- data/spec/fixtures/cassettes/gateway/cancel/refunds.yml +272 -0
- data/spec/fixtures/cassettes/gateway/cancel/void.yml +201 -0
- data/spec/fixtures/cassettes/gateway/capture.yml +141 -0
- data/spec/fixtures/cassettes/gateway/complete.yml +157 -0
- data/spec/fixtures/cassettes/gateway/credit.yml +208 -0
- data/spec/fixtures/cassettes/gateway/customer.yml +79 -0
- data/spec/fixtures/cassettes/gateway/purchase.yml +87 -0
- data/spec/fixtures/cassettes/gateway/settled_transaction.yml +140 -0
- data/spec/fixtures/cassettes/gateway/void.yml +137 -0
- data/spec/fixtures/cassettes/source/bin.yml +295 -0
- data/spec/fixtures/cassettes/source/card_type.yml +267 -0
- data/spec/fixtures/cassettes/source/last4.yml +267 -0
- data/spec/fixtures/cassettes/transaction/import/valid/capture.yml +224 -0
- data/spec/fixtures/cassettes/transaction/import/valid.yml +71 -0
- data/spec/fixtures/views/spree/orders/edit.html.erb +50 -0
- data/spec/helpers/solidus_braintree/braintree_admin_helper_spec.rb +17 -0
- data/spec/helpers/solidus_braintree/braintree_checkout_helper_spec.rb +70 -0
- data/spec/models/solidus_braintree/address_spec.rb +71 -0
- data/spec/models/solidus_braintree/avs_result_spec.rb +317 -0
- data/spec/models/solidus_braintree/gateway_spec.rb +742 -0
- data/spec/models/solidus_braintree/response_spec.rb +280 -0
- data/spec/models/solidus_braintree/source_spec.rb +539 -0
- data/spec/models/solidus_braintree/transaction_address_spec.rb +235 -0
- data/spec/models/solidus_braintree/transaction_import_spec.rb +302 -0
- data/spec/models/solidus_braintree/transaction_spec.rb +86 -0
- data/spec/models/spree/store_spec.rb +14 -0
- data/spec/requests/spree/api/orders_controller_spec.rb +36 -0
- data/spec/spec_helper.rb +32 -0
- data/spec/support/capybara.rb +7 -0
- data/spec/support/gateway_helpers.rb +29 -0
- data/spec/support/order_ready_for_payment.rb +37 -0
- data/spec/support/vcr.rb +42 -0
- data/spec/support/views.rb +1 -0
- metadata +281 -228
- data/.travis.yml +0 -41
- data/LICENSE.txt +0 -21
- data/app/controllers/spree/api/braintree_client_token_controller.rb +0 -13
- data/app/helpers/braintree_view_helpers.rb +0 -20
- data/app/models/concerns/solidus_braintree/add_name_validation_concern.rb +0 -8
- data/app/models/concerns/solidus_braintree/inject_device_data_concern.rb +0 -18
- data/app/models/concerns/solidus_braintree/payment_braintree_nonce_concern.rb +0 -8
- data/app/models/concerns/solidus_braintree/permitted_attributes_concern.rb +0 -11
- data/app/models/concerns/solidus_braintree/skip_require_card_numbers_concern.rb +0 -14
- data/app/models/concerns/solidus_braintree/use_data_field_concern.rb +0 -23
- data/app/models/credit_card_decorator.rb +0 -3
- data/app/models/payment_decorator.rb +0 -2
- data/app/models/permitted_attributes_decorator.rb +0 -1
- data/app/models/solidus/gateway/braintree_gateway.rb +0 -306
- data/app/overrides/spree/checkout/_confirm/braintree_security.html.erb.deface +0 -9
- data/app/views/spree/admin/payments/source_forms/_braintree.html.erb +0 -38
- data/app/views/spree/admin/payments/source_views/_braintree.html.erb +0 -30
- data/app/views/spree/checkout/payment/_braintree.html.erb +0 -55
- data/app/views/spree/checkout/payment/_braintree_initialization.html.erb +0 -12
- data/config/initializers/braintree.rb +0 -1
- data/db/migrate/20150910170527_add_data_to_credit_card.rb +0 -5
- data/db/migrate/20160426221931_add_braintree_device_data_to_order.rb +0 -5
- data/lib/assets/javascripts/spree/backend/braintree/solidus_braintree.js +0 -59
- data/lib/assets/javascripts/spree/frontend/braintree/solidus_braintree.js +0 -144
- data/lib/assets/javascripts/vendor/braintree.js +0 -8
- data/lib/assets/stylesheets/spree/frontend/solidus_braintree.scss +0 -26
@@ -0,0 +1,224 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://api.sandbox.braintreegateway.com/merchants/7rdg92j7bm7fk5h3/customers
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: |
|
9
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
10
|
+
<customer>
|
11
|
+
<payment-method-nonce>fake-valid-nonce</payment-method-nonce>
|
12
|
+
</customer>
|
13
|
+
headers:
|
14
|
+
Accept-Encoding:
|
15
|
+
- gzip
|
16
|
+
Accept:
|
17
|
+
- application/xml
|
18
|
+
User-Agent:
|
19
|
+
- Braintree Ruby Gem 2.98.0
|
20
|
+
X-Apiversion:
|
21
|
+
- '5'
|
22
|
+
Content-Type:
|
23
|
+
- application/xml
|
24
|
+
Authorization:
|
25
|
+
- Basic bXdqa2t4d2NwMzJja2huZjphOTI5OGY0M2IzMGM2OTlkYjMwNzJjYzRhMDBmN2Y0OQ==
|
26
|
+
response:
|
27
|
+
status:
|
28
|
+
code: 201
|
29
|
+
message: Created
|
30
|
+
headers:
|
31
|
+
Date:
|
32
|
+
- Fri, 13 Sep 2019 14:28:01 GMT
|
33
|
+
Content-Type:
|
34
|
+
- application/xml; charset=utf-8
|
35
|
+
Transfer-Encoding:
|
36
|
+
- chunked
|
37
|
+
X-Frame-Options:
|
38
|
+
- SAMEORIGIN
|
39
|
+
X-Xss-Protection:
|
40
|
+
- 1; mode=block
|
41
|
+
X-Content-Type-Options:
|
42
|
+
- nosniff
|
43
|
+
X-Authentication:
|
44
|
+
- basic_auth
|
45
|
+
X-User:
|
46
|
+
- 3v249hqtptsg744y
|
47
|
+
Vary:
|
48
|
+
- Accept-Encoding
|
49
|
+
Content-Encoding:
|
50
|
+
- gzip
|
51
|
+
Etag:
|
52
|
+
- W/"110ef4341df24590b6e3c609ec3ba459"
|
53
|
+
Cache-Control:
|
54
|
+
- max-age=0, private, must-revalidate
|
55
|
+
X-Runtime:
|
56
|
+
- '0.378468'
|
57
|
+
X-Request-Id:
|
58
|
+
- 02-1568384880.224-92.223.152.178-13026813
|
59
|
+
Content-Security-Policy:
|
60
|
+
- frame-ancestors 'self'
|
61
|
+
X-Broxyid:
|
62
|
+
- 02-1568384880.224-92.223.152.178-13026813
|
63
|
+
Strict-Transport-Security:
|
64
|
+
- max-age=31536000; includeSubDomains
|
65
|
+
body:
|
66
|
+
encoding: ASCII-8BIT
|
67
|
+
string: !binary |-
|
68
|
+
H4sIAHGne10AA6xWy3KjOhDd5ytc7AkPmxhSmOySqVlkc5PMJJspgRqjWEhcSTj2fP0IzMsPPE5ldu7Tp6Wmdbrb4d0mp5M1CEk4WxjOtW1MgCUcE7ZcGM9P96Zv3EVXYVJKxXMQ0dVkEhIc3cxtb+55wTS0tFWB2plkiClT23OBl4H7Po/zebryMk0aeit2SoRUJkM5TBihC0OJEgyrdlE05kl4XiC2PcIhR4QeoUXG2fEZKdocYR8QS6JO3CcAKcAmUhO1LWBhYG0qkoMRubYTmHZgOtMnZ3br+re2/RZafUAdXxb48nhHx/cBu/vropspAYrlLqUl5TGiVRVfpy+/8UOg3n5+Tx/fk4/Hp8R5fFr9Dq2e03wEJspMkMCySQMJgbZG5d337xCNxYRSLQATYSxAyhbfPb1M2jdvsFYb5r4uhnBPHn/4hjD6/O1tp0XQeKUSAKpNfIQEGwUMV3U+S6M8QZSosasELHXPjDgLLpV+A91IEAUzx56H1hAafk7JlNjWsIlokSF39MMPmdNLmKzUb0CSv1DPFfxrXdCc8qlesI96oT7DGtGl1iuLZrbj+n7FYR1eidqsroteiEQ6s84eMjJOsZbpWAkqxVXjiyAaPbMV4x9Mn9RjPW1XSp6aRMoSsQSG/GNnF/j1An+iB3tqpW+lJRw9/zdgdmjLxxAT1X/JzuydKSppm3jMOQXEjKiqYEWtnT25FPp1TN04Ja0+YHDooacNgU1BRJ2PmXOmsshxQ+sIPMHeAhK6fK69R6/RPTbgw9xTRCU0UYNM+qmaPNx78Y+XEj84FD9k67f74P3V8d3XvHDhGz8YwHVwBoiqTIttIIkB1tJIjpZgloJGmVKFvLUsJCUoeR0LRFg12pa6Oh9oe631ZxVomwNTv3JQGce/KF9ya611fl2w5R2wNRGcVYSFRAzHfKPHdnd+d6MWY9VRMWKrPrU9tKXWg3kWOb7vhFZjtD6diuB00B8t0BEEFEgX5FGXp/3d+zguk/qvQR/fYy1NlrFMBCmqh9zfZH2rKr4CFt3E7+uNXoQ7q/WVjPxf1vMwrhtCV4bo1SoilHrefBakXpA6KZ76+CZJE0cD6czz41QLbjS0O/sfTLc1sJybEq9GBNn5BxFCp7Fr15MVqUfFcLvvAfX8DJtZCif/HBwO2qP1/5nBc371n1/859b+BUv/opV/duGfWfcXLvtLV/2li/7iNf/XJf9PNtCXWyC0BmrrDNBmL6fo6g8AAAD//wMAfnRhhbEMAAA=
|
69
|
+
http_version:
|
70
|
+
recorded_at: Fri, 13 Sep 2019 14:28:01 GMT
|
71
|
+
- request:
|
72
|
+
method: post
|
73
|
+
uri: https://api.sandbox.braintreegateway.com/merchants/7rdg92j7bm7fk5h3/transactions
|
74
|
+
body:
|
75
|
+
encoding: UTF-8
|
76
|
+
string: |
|
77
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
78
|
+
<transaction>
|
79
|
+
<amount>15.00</amount>
|
80
|
+
<order-id>R999999999-ABCD1234</order-id>
|
81
|
+
<channel>Solidus</channel>
|
82
|
+
<options>
|
83
|
+
<store-in-vault-on-success type="boolean">true</store-in-vault-on-success>
|
84
|
+
</options>
|
85
|
+
<payment-method-token>6bjvxz</payment-method-token>
|
86
|
+
<shipping>
|
87
|
+
<first-name>John</first-name>
|
88
|
+
<last-name>Doe</last-name>
|
89
|
+
<street-address>10 Lovely Street Northwest</street-address>
|
90
|
+
<locality>Herndon</locality>
|
91
|
+
<postal-code>21088-0255</postal-code>
|
92
|
+
<region>AL</region>
|
93
|
+
<country-code-alpha2>US</country-code-alpha2>
|
94
|
+
</shipping>
|
95
|
+
<customer-id>670575593</customer-id>
|
96
|
+
<type>sale</type>
|
97
|
+
</transaction>
|
98
|
+
headers:
|
99
|
+
Accept-Encoding:
|
100
|
+
- gzip
|
101
|
+
Accept:
|
102
|
+
- application/xml
|
103
|
+
User-Agent:
|
104
|
+
- Braintree Ruby Gem 2.98.0
|
105
|
+
X-Apiversion:
|
106
|
+
- '5'
|
107
|
+
Content-Type:
|
108
|
+
- application/xml
|
109
|
+
Authorization:
|
110
|
+
- Basic bXdqa2t4d2NwMzJja2huZjphOTI5OGY0M2IzMGM2OTlkYjMwNzJjYzRhMDBmN2Y0OQ==
|
111
|
+
response:
|
112
|
+
status:
|
113
|
+
code: 201
|
114
|
+
message: Created
|
115
|
+
headers:
|
116
|
+
Date:
|
117
|
+
- Fri, 13 Sep 2019 14:28:02 GMT
|
118
|
+
Content-Type:
|
119
|
+
- application/xml; charset=utf-8
|
120
|
+
Transfer-Encoding:
|
121
|
+
- chunked
|
122
|
+
X-Frame-Options:
|
123
|
+
- SAMEORIGIN
|
124
|
+
X-Xss-Protection:
|
125
|
+
- 1; mode=block
|
126
|
+
X-Content-Type-Options:
|
127
|
+
- nosniff
|
128
|
+
X-Authentication:
|
129
|
+
- basic_auth
|
130
|
+
X-User:
|
131
|
+
- 3v249hqtptsg744y
|
132
|
+
Vary:
|
133
|
+
- Accept-Encoding
|
134
|
+
Content-Encoding:
|
135
|
+
- gzip
|
136
|
+
Etag:
|
137
|
+
- W/"f39e2777d3b86e6d871f5bc62e96f566"
|
138
|
+
Cache-Control:
|
139
|
+
- max-age=0, private, must-revalidate
|
140
|
+
X-Runtime:
|
141
|
+
- '0.365501'
|
142
|
+
X-Request-Id:
|
143
|
+
- 01-1568384881.777-92.223.152.178-12974361
|
144
|
+
Content-Security-Policy:
|
145
|
+
- frame-ancestors 'self'
|
146
|
+
X-Broxyid:
|
147
|
+
- 01-1568384881.777-92.223.152.178-12974361
|
148
|
+
Strict-Transport-Security:
|
149
|
+
- max-age=31536000; includeSubDomains
|
150
|
+
body:
|
151
|
+
encoding: ASCII-8BIT
|
152
|
+
string: !binary |-
|
153
|
+
H4sIAHKne10AA7RYS3PbNhC+51dodIf5kORIGZqpG0/sZhK3TZzU9iUDkqAImwRYAJQl//ou+BIpgrJzqE7i7oclsNjHt/Teb7N0siFCUs7Ops6JPZ0QFvKIsvXZ9PvNR7ScvvffeEpgJnGoAOW/mUw8GvkPp88LuVhGngUPWiYVVoX0caESLugzAU0t0lq1y4kvcUo8q/yrZWEhBLxth6jkCF5K/O/fLjxrKNZgnPGCKd9ZnNi2Z9VPWpERESaYKYTDUAsR7EcqkgU8VZ5l0pa7LQJk0E0YTc+mShRkalXWMdgSr4JyEQES7H9dNT90/vuHC8edzT2r1ZYnFwQrEiGsJtobZ9MIHhXNyNR3bWeF7BVyZjfO/J27fGe79+CTdkG5vsijX1u/X1B7XioOZ9IP1XWevrUXbxeL1ay5TxDHVEiFGM7I4VlBmeJxXcizHLOdQUMyTFOD/IkEkiqTrTzhzCSP8dYgXac8wKl2893sx3N0uVL3t5/i64fw6fomdK5vHp89a4/RrrC6vvACmqYQ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QQyxPrq0srwhLONIRo8jqdzqa57cT+V63kMJhbgXux4ZaglEiSBgqI4Qnf8wpYAiy185ubT41sLRQbNy6cisWDlUggfa1PqtGRV1coHLZOMevdUOhZMcSifxcU5hS0N5dWDr8MStpPZSVYRTbKaERSBDQfNRytjRtyWz5MMoB3LAIwR0C2l/GsLoAAnbEsqIhS0fvEd3IgRNx8B3IyrL4DXqSGWFN/E2Uv7GBjwoWMO99Y0CPdQfC+BcIyHc6qtmBBM8I6n/jac0KiSEdC2oCLnY6BYaEzLW/PS7+ROqrnSgBV8EhZAVp4+IgkG3YcJ9lfmCOgOB+fV9zOAjySvhZKsPDf1AmLehhyMIVyCTJoNFGBqIPFzLyNn1yfNCc+3xWanqrzh6gAaq15uwddNDlAGRLKphTDf6qib91DXJs8ZAfSrWcUqfsXXZ2CjoZVslf3vJVkvyGFFPXDwevOX21rPMGuOa0pqEEpnCjVbKSUsUtdJgrd2BSqAKIqgIOlUIOC/mxkFUoljAnNEZB0bn1bH8aarFmL7ZZH909m3dGOyVM3Pm7tJ294c5wI1Rbh0D+CjlbqKkH5Il+yPy2Ec21+62qrHl3Y8Sbfc3h/nRbw5H1xq/a7QrhrOf+UvF+II9bYmuPiUBu07uZl/zwF3E+OH+9Pr2i/Pn5d89dtNrlP6b/wAAAP//AwAQnAh0bBYAAA==
|
154
|
+
http_version:
|
155
|
+
recorded_at: Fri, 13 Sep 2019 14:28:02 GMT
|
156
|
+
- request:
|
157
|
+
method: put
|
158
|
+
uri: https://api.sandbox.braintreegateway.com/merchants/7rdg92j7bm7fk5h3/transactions/j6z5s58d/submit_for_settlement
|
159
|
+
body:
|
160
|
+
encoding: UTF-8
|
161
|
+
string: |
|
162
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
163
|
+
<transaction>
|
164
|
+
<amount>15.00</amount>
|
165
|
+
</transaction>
|
166
|
+
headers:
|
167
|
+
Accept-Encoding:
|
168
|
+
- gzip
|
169
|
+
Accept:
|
170
|
+
- application/xml
|
171
|
+
User-Agent:
|
172
|
+
- Braintree Ruby Gem 2.98.0
|
173
|
+
X-Apiversion:
|
174
|
+
- '5'
|
175
|
+
Content-Type:
|
176
|
+
- application/xml
|
177
|
+
Authorization:
|
178
|
+
- Basic bXdqa2t4d2NwMzJja2huZjphOTI5OGY0M2IzMGM2OTlkYjMwNzJjYzRhMDBmN2Y0OQ==
|
179
|
+
response:
|
180
|
+
status:
|
181
|
+
code: 200
|
182
|
+
message: OK
|
183
|
+
headers:
|
184
|
+
Date:
|
185
|
+
- Fri, 13 Sep 2019 14:28:03 GMT
|
186
|
+
Content-Type:
|
187
|
+
- application/xml; charset=utf-8
|
188
|
+
Transfer-Encoding:
|
189
|
+
- chunked
|
190
|
+
X-Frame-Options:
|
191
|
+
- SAMEORIGIN
|
192
|
+
X-Xss-Protection:
|
193
|
+
- 1; mode=block
|
194
|
+
X-Content-Type-Options:
|
195
|
+
- nosniff
|
196
|
+
X-Authentication:
|
197
|
+
- basic_auth
|
198
|
+
X-User:
|
199
|
+
- 3v249hqtptsg744y
|
200
|
+
Vary:
|
201
|
+
- Accept-Encoding
|
202
|
+
Content-Encoding:
|
203
|
+
- gzip
|
204
|
+
Etag:
|
205
|
+
- W/"77e50737669d11411f113d3437283723"
|
206
|
+
Cache-Control:
|
207
|
+
- max-age=0, private, must-revalidate
|
208
|
+
X-Runtime:
|
209
|
+
- '0.245194'
|
210
|
+
X-Request-Id:
|
211
|
+
- 01-1568384883.102-92.223.152.178-12974580
|
212
|
+
Content-Security-Policy:
|
213
|
+
- frame-ancestors 'self'
|
214
|
+
X-Broxyid:
|
215
|
+
- 01-1568384883.102-92.223.152.178-12974580
|
216
|
+
Strict-Transport-Security:
|
217
|
+
- max-age=31536000; includeSubDomains
|
218
|
+
body:
|
219
|
+
encoding: ASCII-8BIT
|
220
|
+
string: !binary |-
|
221
|
+
H4sIAHOne10AA8xY23LbNhB9z1do9E7zIsmRMjRTN57YzSRumzip7RcPSIAmbBJgAVCW/PVd8CZSBGVnOp2p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TGRh747ek739h4z736naQmROc0PfoY5aGv81NNaDMdh88ebcYMdk8MXn5KQXSY3s6956C1i9HB7fHn9xf39/M8e4etdlMGbfwAAAP//AwA7baSMjRcAAA==
|
222
|
+
http_version:
|
223
|
+
recorded_at: Fri, 13 Sep 2019 14:28:03 GMT
|
224
|
+
recorded_with: VCR 5.0.0
|
@@ -0,0 +1,71 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://api.sandbox.braintreegateway.com/merchants/7rdg92j7bm7fk5h3/customers
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: |
|
9
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
10
|
+
<customer>
|
11
|
+
<payment-method-nonce>fake-valid-nonce</payment-method-nonce>
|
12
|
+
</customer>
|
13
|
+
headers:
|
14
|
+
Accept-Encoding:
|
15
|
+
- gzip
|
16
|
+
Accept:
|
17
|
+
- application/xml
|
18
|
+
User-Agent:
|
19
|
+
- Braintree Ruby Gem 2.98.0
|
20
|
+
X-Apiversion:
|
21
|
+
- '5'
|
22
|
+
Content-Type:
|
23
|
+
- application/xml
|
24
|
+
Authorization:
|
25
|
+
- Basic bXdqa2t4d2NwMzJja2huZjphOTI5OGY0M2IzMGM2OTlkYjMwNzJjYzRhMDBmN2Y0OQ==
|
26
|
+
response:
|
27
|
+
status:
|
28
|
+
code: 201
|
29
|
+
message: Created
|
30
|
+
headers:
|
31
|
+
Date:
|
32
|
+
- Fri, 13 Sep 2019 14:27:57 GMT
|
33
|
+
Content-Type:
|
34
|
+
- application/xml; charset=utf-8
|
35
|
+
Transfer-Encoding:
|
36
|
+
- chunked
|
37
|
+
X-Frame-Options:
|
38
|
+
- SAMEORIGIN
|
39
|
+
X-Xss-Protection:
|
40
|
+
- 1; mode=block
|
41
|
+
X-Content-Type-Options:
|
42
|
+
- nosniff
|
43
|
+
X-Authentication:
|
44
|
+
- basic_auth
|
45
|
+
X-User:
|
46
|
+
- 3v249hqtptsg744y
|
47
|
+
Vary:
|
48
|
+
- Accept-Encoding
|
49
|
+
Content-Encoding:
|
50
|
+
- gzip
|
51
|
+
Etag:
|
52
|
+
- W/"353759854f3f20558dfdfbeff3bd4668"
|
53
|
+
Cache-Control:
|
54
|
+
- max-age=0, private, must-revalidate
|
55
|
+
X-Runtime:
|
56
|
+
- '0.384787'
|
57
|
+
X-Request-Id:
|
58
|
+
- 02-1568384876.677-92.223.152.178-13026259
|
59
|
+
Content-Security-Policy:
|
60
|
+
- frame-ancestors 'self'
|
61
|
+
X-Broxyid:
|
62
|
+
- 02-1568384876.677-92.223.152.178-13026259
|
63
|
+
Strict-Transport-Security:
|
64
|
+
- max-age=31536000; includeSubDomains
|
65
|
+
body:
|
66
|
+
encoding: ASCII-8BIT
|
67
|
+
string: !binary |-
|
68
|
+
H4sIAG2ne10AA6xWXXPaOhB9z69g/O4YAy44Y5xp506405mmD01y27x0ZGuNFWTJlWQC/fVXMv7iw5RM+saePSutV2d3CW43GR2sQUjC2dxyr4fWAFjMMWHLufX4cGfPrNvwKogLqXgGIrwaDAKCQ8+fTob+eOgHjrYMqJ1xipiytT0VeOmPXqZRNk1WXjoOnK7XsBMipLIZymDACJ1bShRgOaWLoj5PzLMcse0RDhki9AjNU86Oz0jQ5gh7hUgSdeI+AUgBtpEaqG0OcwtrU5EMrHA0dH176Nvu+MGd3IymN970OXDagDK+yPHb4tuA3f1l0e2EAMVyl9KS8ghRU8Uf46ffeOGr5++fk/uH1fj+n4/el98fvcBpOdVHYKLsGAksqzSQEGhrGe++f4doLCKUagHYCGMBUtb47ul/zeo3r7BaG/a+LrpwS+5/+IrQ+/z1badFUHmlEgCqTryHBBsFDJs6n6VRHiNKVN9VApa6Z3qcOZdKv4FuJAj9iTucBk4X6n5OwZTYlrCNaJ6iUe+HHzLHlzBZod+AxH+gniv4+7qgOuWdvVCe4fToUuuVhZOhO5rNDIc1uBG1ba4Ln4hEOrPG7jJSTrGWaV8JjOLM+CKIho9sxfgr0ye1WEvblZInNpGyQCyGLv/Y2QS+v8Bv6MGWavSttITDx28dZoPWfAwRUe2X7MzWmaCC1olHnFNAzApNBQ21dLbkQujXsXXjFNR8QOfQQ08dApuciDIfO+NMpaE7Cpwj8AR7C0jo8o2Ge/QS3WMDPsw9QVRCFdXJpJ2q8eLOi/57KvDCpXiRrp/v/Jcfrv8S//vp5etCHgzgMjgFRFWqxdaRRAeraSRDS7ALQcNUqVzeOA6SEpS8jgQizIy2pa7OK9pea/05OdpmwNTPDFTK8U/Kl9xZa51f52x5C2xNBGeGMJeI4Yhv9Nhuzm9u1GI0HRUhtmpT20NrajmYJ6E7m7mBUxm1T6ciOO30Rw00BAE50gW559pX/W59HBdx+degjW+xmiaLSMaC5OYh9zdZ26qKr4CFcZ7Hs1Xg7KzaVzDyqyjnYVQ2hK4M0atVhCjxvOnETzw/cRM8nuEPcRK7Gkgm3ixKtOB6Q5uz/8J0WwPLuC3xqkeQjb8TIXQau3Y9WZFyVHS3+x5Qzs+gmqVw8s/B4aA9Wv9vGTznV//5xX9u7V+w9C9a+WcX/pl1f+Gyv3TVX7roL17zf1zyf2UDvbsFAqejtsYAbbZyCq/+BwAA//8DAGwXsMSxDAAA
|
69
|
+
http_version:
|
70
|
+
recorded_at: Fri, 13 Sep 2019 14:27:57 GMT
|
71
|
+
recorded_with: VCR 5.0.0
|
@@ -0,0 +1,50 @@
|
|
1
|
+
<!-- Modified cart view with PayPal button, from solidus_braintree -->
|
2
|
+
|
3
|
+
<% @body_id = 'cart' %>
|
4
|
+
<div data-hook="cart_container">
|
5
|
+
<h1><%= t('spree.shopping_cart') %></h1>
|
6
|
+
|
7
|
+
<% if @order.line_items.empty? %>
|
8
|
+
|
9
|
+
<div data-hook="empty_cart">
|
10
|
+
<p><%= t('spree.your_cart_is_empty') %></p>
|
11
|
+
<p><%= link_to t('spree.continue_shopping'), products_path, class: 'button continue' %></p>
|
12
|
+
</div>
|
13
|
+
|
14
|
+
<% else %>
|
15
|
+
|
16
|
+
<div data-hook="outside_cart_form">
|
17
|
+
<%= form_for @order, url: update_cart_path, html: {id: 'update-cart'} do |order_form| %>
|
18
|
+
<div data-hook="inside_cart_form">
|
19
|
+
|
20
|
+
<div data-hook="cart_items">
|
21
|
+
<%= render 'form', order_form: order_form %>
|
22
|
+
</div>
|
23
|
+
|
24
|
+
<div class="links columns sixteen alpha omega" data-hook="cart_buttons">
|
25
|
+
<%= order_form.text_field :coupon_code, size: 10, placeholder: t('spree.coupon_code') %>
|
26
|
+
<%= button_tag class: 'primary', id: 'update-button' do %>
|
27
|
+
<%= t('spree.update') %>
|
28
|
+
<% end %>
|
29
|
+
<%= button_tag class: 'button checkout primary', id: 'checkout-link', name: 'checkout' do %>
|
30
|
+
<%= t('spree.checkout') %>
|
31
|
+
<% end %>
|
32
|
+
</div>
|
33
|
+
|
34
|
+
</div>
|
35
|
+
<% end %>
|
36
|
+
</div>
|
37
|
+
|
38
|
+
<div id="empty-cart" data-hook>
|
39
|
+
<%= form_tag empty_cart_path, method: :put do %>
|
40
|
+
<p id="clear_cart_link" data-hook>
|
41
|
+
<%= submit_tag t('spree.empty_cart'), class: 'button gray' %>
|
42
|
+
<%= t('spree.or') %>
|
43
|
+
<%= link_to t('spree.continue_shopping'), products_path, class: 'continue button gray' %>
|
44
|
+
</p>
|
45
|
+
<% end %>
|
46
|
+
</div>
|
47
|
+
|
48
|
+
<%= render "spree/shared/paypal_cart_button" %>
|
49
|
+
<% end %>
|
50
|
+
</div>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
RSpec.describe SolidusBraintree::BraintreeAdminHelper do
|
4
|
+
describe '#braintree_transaction_link' do
|
5
|
+
subject { helper.braintree_transaction_link(payment) }
|
6
|
+
|
7
|
+
let(:payment_method) { create_gateway }
|
8
|
+
let(:payment) do
|
9
|
+
instance_double(Spree::Payment, payment_method: payment_method, response_code: 'abcde')
|
10
|
+
end
|
11
|
+
let(:merchant_id) { payment_method.preferences[:merchant_id] }
|
12
|
+
|
13
|
+
it 'generates a link to Braintree admin' do
|
14
|
+
expect(subject).to eq "<a title=\"Show payment on Braintree\" target=\"_blank\" rel=\"noopener\" href=\"https://sandbox.braintreegateway.com/merchants/#{merchant_id}/transactions/abcde\">abcde</a>" # rubocop:disable Layout/LineLength
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
RSpec.describe SolidusBraintree::BraintreeCheckoutHelper do
|
4
|
+
let!(:store) { create :store }
|
5
|
+
let(:braintree_configuration) { {} }
|
6
|
+
|
7
|
+
before do
|
8
|
+
store.braintree_configuration.update(braintree_configuration)
|
9
|
+
end
|
10
|
+
|
11
|
+
describe '#venmo_button_style' do
|
12
|
+
subject { helper.venmo_button_style(store) }
|
13
|
+
|
14
|
+
context 'when the venmo button is white and has a width of 280' do
|
15
|
+
let(:braintree_configuration) { { preferred_venmo_button_width: '280', preferred_venmo_button_color: 'white' } }
|
16
|
+
|
17
|
+
it 'returns a hash of the width and color' do
|
18
|
+
expect(subject).to eq({ width: '280', color: 'white' })
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
context 'when the venmo button is blue and has a width of 375' do
|
23
|
+
let(:braintree_configuration) { { preferred_venmo_button_width: '375', preferred_venmo_button_color: 'blue' } }
|
24
|
+
|
25
|
+
it 'returns a hash of the width and color' do
|
26
|
+
expect(subject).to eq({ width: '375', color: 'blue' })
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
describe '#venmo_button_width' do
|
32
|
+
subject { helper.venmo_button_asset_url(style, active: active) }
|
33
|
+
|
34
|
+
context 'when the given style color is white and width is 280, and the given active is false' do
|
35
|
+
let(:style) { { width: '280', color: 'white' } }
|
36
|
+
let(:active) { false }
|
37
|
+
|
38
|
+
it 'returns the correct url' do
|
39
|
+
expect(subject).to match(%r[\A/assets/solidus_braintree/venmo/venmo_white_button_280x48-.+\.svg])
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
context 'when the given style color is white and width is 280, and the given active is true' do
|
44
|
+
let(:style) { { width: '280', color: 'white' } }
|
45
|
+
let(:active) { true }
|
46
|
+
|
47
|
+
it 'returns the correct url' do
|
48
|
+
expect(subject).to match(%r[\A/assets/solidus_braintree/venmo/venmo_active_white_button_280x48-.+\.svg])
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
context 'when the given style color is blue and width is 320, and the given active is false' do
|
53
|
+
let(:style) { { width: '320', color: 'blue' } }
|
54
|
+
let(:active) { false }
|
55
|
+
|
56
|
+
it 'returns the correct url' do
|
57
|
+
expect(subject).to match(%r[\A/assets/solidus_braintree/venmo/venmo_blue_button_320x48-.+\.svg])
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
context 'when the given style color is blue and width is 320, and the given active is true' do
|
62
|
+
let(:style) { { width: '320', color: 'blue' } }
|
63
|
+
let(:active) { true }
|
64
|
+
|
65
|
+
it 'returns the correct url' do
|
66
|
+
expect(subject).to match(%r[\A/assets/solidus_braintree/venmo/venmo_active_blue_button_320x48-.+\.svg])
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
RSpec.describe SolidusBraintree::Address do
|
4
|
+
describe "::split_name" do
|
5
|
+
subject { described_class.split_name(name) }
|
6
|
+
|
7
|
+
context "with a one word name" do
|
8
|
+
let(:name) { "Bruce" }
|
9
|
+
|
10
|
+
it "correctly splits" do
|
11
|
+
expect(subject).to eq ["Bruce"]
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
context "with a multi word name" do
|
16
|
+
let(:name) { "Bruce Wayne The Batman" }
|
17
|
+
|
18
|
+
it "correctly splits" do
|
19
|
+
expect(subject).to eq ["Bruce", "Wayne The Batman"]
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
describe '#to_json' do
|
25
|
+
subject(:address_json) { JSON.parse(described_class.new(spree_address).to_json) }
|
26
|
+
|
27
|
+
let(:german_address) { create(:address, country_iso: 'DE', state: nil) } # Does not require states
|
28
|
+
let(:us_address) { create(:address, country_iso: 'US') } # Requires states
|
29
|
+
let(:spree_address) { us_address }
|
30
|
+
|
31
|
+
before do
|
32
|
+
create(:country, iso: 'DE', states_required: false)
|
33
|
+
create(:country, iso: 'US', states_required: true)
|
34
|
+
end
|
35
|
+
|
36
|
+
it 'has all the required keys' do
|
37
|
+
expect(address_json.keys).to contain_exactly(
|
38
|
+
'line1',
|
39
|
+
'line2',
|
40
|
+
'city',
|
41
|
+
'postalCode',
|
42
|
+
'countryCode',
|
43
|
+
'recipientName',
|
44
|
+
'state',
|
45
|
+
'phone'
|
46
|
+
)
|
47
|
+
end
|
48
|
+
|
49
|
+
context 'with a country that does not require state' do
|
50
|
+
let(:spree_address) { german_address }
|
51
|
+
|
52
|
+
it { is_expected.not_to have_key('state') }
|
53
|
+
end
|
54
|
+
|
55
|
+
context 'with states turned off globally' do
|
56
|
+
before do
|
57
|
+
allow(::Spree::Config).to receive(:address_requires_state).and_return(false)
|
58
|
+
end
|
59
|
+
|
60
|
+
context 'with a country that requires states' do
|
61
|
+
it { is_expected.not_to have_key('state') }
|
62
|
+
end
|
63
|
+
|
64
|
+
context 'with a country that does not require state' do
|
65
|
+
let(:spree_address) { german_address }
|
66
|
+
|
67
|
+
it { is_expected.not_to have_key('state') }
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|