Git Product home page Git Product logo

spree_braintree_vzero's Introduction

Official Braintree + PayPal integration for Spree Commerce

Build Status Code Climate

This is the official Braintree + PayPal extension for Spree Commerce. It supports:

Behind-the-scenes, this extension uses Braintree Ruby SDK.

Installation

  1. Add this extension to your Gemfile with this line:

    Spree >= 3.1

    gem 'spree_braintree_vzero', '~> 3.5'

    Spree 3.0 and Spree 2.x

    gem 'spree_braintree_vzero', github: 'spree-contrib/spree_braintree_vzero', branch: 'X-X-stable'

    The branch option is important: it must match the version of Spree you're using. For example, use 3-0-stable if you're using Spree 3-0-stable or any 3.0.x version.

  2. Install the gem using Bundler:

    bundle install
  3. Copy & run migrations

    bundle exec rails g spree_braintree_vzero:install
  4. Restart your server

    If your server was running, restart it so that it can find the assets properly.

Documentation

See wiki for more detailed documentation.

Heroku installation (optional)

Additional to migrations the gem adds a cron task (via the Whenever gem) which is needed for updating transaction states from submited for settlement to settled (Braintree v.zero transaction states). To run on Heroku you have to add a task to Heroku Scheduler:

rake spree_braintree_vzero:update_states

Recommended frequency is every 6 hours.

Contributing

If you'd like to contribute, please take a look at the instructions for installing dependencies and crafting a good pull request.

License

Spree Braintree V.zero is copyright © 2015-2021 Spark Solutions Sp. z o.o.. It is free software, and may be redistributed under the terms specified in the LICENCE file.

About Spark Solutions

Spark Solutions

Spree Braintree V.zero is maintained by Spark Solutions Sp. z o.o. and funded by PayPal, Inc. The names and logos are trademarks of PayPal, inc.

We are passionate about open source software. We are available for hire.

spree_braintree_vzero's People

Contributors

bbonislawski avatar chonglou avatar damianlegawiec avatar dependabot-preview[bot] avatar dethon avatar donny741 avatar kacpermekarski avatar krzysiek1507 avatar kushniryb avatar lani13 avatar mad-eel avatar mafi88 avatar matthewkennedy avatar mdavo6 avatar melcha avatar michalprzybysz avatar nadberezny avatar nnande avatar pastullo avatar przemosk avatar pszyszkaspark avatar rafalcymerys avatar vygovskysergey avatar witekl avatar yury-paneco avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

spree_braintree_vzero's Issues

Braintree::NotFoundError issue with gateway (PayPal)

hello everyone im using Spree gem with a ecommerce site. the version are:

gem 'spree', '> 3.2.0'
gem 'spree_auth_devise', '
> 3.2.0.beta'
gem 'spree_gateway', '~> 3.2.0.beta'
and i found a video tutorial in youtube to make payments with paypal using Spree: https://www.youtube.com/watch?v=PTlRoiTHMpg&t=5s

but in the tutorial he use this gem:

gem 'spree_paypal_express', github: 'spree-contrib/better_spree_paypal_express', branch: 'X-X-stable'
but im using spree version 3.2.0 so i cant use that gem. im using this other:

Spree >= 3.1
gem 'spree_braintree_vzero', github: 'spree-contrib/spree_braintree_vzero'
i followed the video tutorial and after add the paypal credentials i get this issue:

Braintree::NotFoundError in Spree::Orders#edit
Showing C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/spree_frontend-3.2.1/app/views/spree/orders/edit.html.erb where line #38 raised:

Braintree::NotFoundError
Extracted source (around line #55):
53
54
55
56
57
58

    raise AuthorizationError, message
  when 404
    raise NotFoundError
  when 426
    raise UpgradeRequiredError, "Please upgrade your client library."
  when 429

Rails.root: C:/Users/osmarvirux/Documents/ruby_on_rails/spree_ecommerce

Application Trace | Framework Trace | Full Trace
braintree (2.74.0) lib/braintree/util.rb:55:in raise_exception_for_status_code' braintree (2.74.0) lib/braintree/http.rb:32:in post'
braintree (2.74.0) lib/braintree/client_token_gateway.rb:17:in generate' braintree (2.74.0) lib/braintree/client_token.rb:8:in generate'
C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/bundler/gems/spree_braintree_vzero-8811ea617fdc/app/models/spree/gateway/braintree_vzero_base.rb:37:in client_token' spree_frontend (3.2.1) app/views/spree/orders/edit.html.erb:38:in block in _92747094c8c827fcd207f4d4a41e9d24'
actionview (5.0.2) lib/action_view/helpers/capture_helper.rb:39:in block in capture' actionview (5.0.2) lib/action_view/helpers/capture_helper.rb:203:in with_output_buffer'
actionview (5.0.2) lib/action_view/helpers/capture_helper.rb:39:in capture' actionview (5.0.2) lib/action_view/helpers/form_helper.rb:450:in form_for'
spree_frontend (3.2.1) app/views/spree/orders/edit.html.erb:12:in _92747094c8c827fcd207f4d4a41e9d24' actionview (5.0.2) lib/action_view/template.rb:159:in block in render'
activesupport (5.0.2) lib/active_support/notifications.rb:166:in instrument' actionview (5.0.2) lib/action_view/template.rb:354:in instrument'
actionview (5.0.2) lib/action_view/template.rb:157:in render' deface (1.2.0) lib/deface/action_view_extensions.rb:41:in render'
actionview (5.0.2) lib/action_view/renderer/template_renderer.rb:54:in block (2 levels) in render_template' actionview (5.0.2) lib/action_view/renderer/abstract_renderer.rb:42:in block in instrument'
activesupport (5.0.2) lib/active_support/notifications.rb:164:in block in instrument' activesupport (5.0.2) lib/active_support/notifications/instrumenter.rb:21:in instrument'
activesupport (5.0.2) lib/active_support/notifications.rb:164:in instrument' actionview (5.0.2) lib/action_view/renderer/abstract_renderer.rb:41:in instrument'
actionview (5.0.2) lib/action_view/renderer/template_renderer.rb:53:in block in render_template' actionview (5.0.2) lib/action_view/renderer/template_renderer.rb:61:in render_with_layout'
actionview (5.0.2) lib/action_view/renderer/template_renderer.rb:52:in render_template' actionview (5.0.2) lib/action_view/renderer/template_renderer.rb:14:in render'
actionview (5.0.2) lib/action_view/renderer/renderer.rb:42:in render_template' actionview (5.0.2) lib/action_view/renderer/renderer.rb:23:in render'
actionview (5.0.2) lib/action_view/rendering.rb:104:in _render_template' actionpack (5.0.2) lib/action_controller/metal/streaming.rb:217:in _render_template'
actionview (5.0.2) lib/action_view/rendering.rb:83:in render_to_body' actionpack (5.0.2) lib/action_controller/metal/rendering.rb:52:in render_to_body'
actionpack (5.0.2) lib/action_controller/metal/renderers.rb:142:in render_to_body' actionpack (5.0.2) lib/abstract_controller/rendering.rb:26:in render'
actionpack (5.0.2) lib/action_controller/metal/rendering.rb:36:in render' actionpack (5.0.2) lib/action_controller/metal/instrumentation.rb:44:in block (2 levels) in render'
activesupport (5.0.2) lib/active_support/core_ext/benchmark.rb:12:in block in ms' C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/benchmark.rb:303:in realtime'
activesupport (5.0.2) lib/active_support/core_ext/benchmark.rb:12:in ms' actionpack (5.0.2) lib/action_controller/metal/instrumentation.rb:44:in block in render'
actionpack (5.0.2) lib/action_controller/metal/instrumentation.rb:87:in cleanup_view_runtime' activerecord (5.0.2) lib/active_record/railties/controller_runtime.rb:25:in cleanup_view_runtime'
actionpack (5.0.2) lib/action_controller/metal/instrumentation.rb:43:in render' actionpack (5.0.2) lib/action_controller/metal/implicit_render.rb:36:in default_render'
actionpack (5.0.2) lib/action_controller/metal/basic_implicit_render.rb:4:in block in send_action' actionpack (5.0.2) lib/action_controller/metal/basic_implicit_render.rb:4:in tap'
actionpack (5.0.2) lib/action_controller/metal/basic_implicit_render.rb:4:in send_action' actionpack (5.0.2) lib/abstract_controller/base.rb:188:in process_action'
actionpack (5.0.2) lib/action_controller/metal/rendering.rb:30:in process_action' actionpack (5.0.2) lib/abstract_controller/callbacks.rb:20:in block in process_action'
activesupport (5.0.2) lib/active_support/callbacks.rb:126:in call' activesupport (5.0.2) lib/active_support/callbacks.rb:126:in call'
activesupport (5.0.2) lib/active_support/callbacks.rb:506:in block (2 levels) in compile' activesupport (5.0.2) lib/active_support/callbacks.rb:455:in call'
activesupport (5.0.2) lib/active_support/callbacks.rb:455:in call' activesupport (5.0.2) lib/active_support/callbacks.rb:101:in run_callbacks'
activesupport (5.0.2) lib/active_support/callbacks.rb:750:in _run_process_action_callbacks' activesupport (5.0.2) lib/active_support/callbacks.rb:90:in run_callbacks'
actionpack (5.0.2) lib/abstract_controller/callbacks.rb:19:in process_action' actionpack (5.0.2) lib/action_controller/metal/rescue.rb:20:in process_action'
actionpack (5.0.2) lib/action_controller/metal/instrumentation.rb:32:in block in process_action' activesupport (5.0.2) lib/active_support/notifications.rb:164:in block in instrument'
activesupport (5.0.2) lib/active_support/notifications/instrumenter.rb:21:in instrument' activesupport (5.0.2) lib/active_support/notifications.rb:164:in instrument'
actionpack (5.0.2) lib/action_controller/metal/instrumentation.rb:30:in process_action' actionpack (5.0.2) lib/action_controller/metal/params_wrapper.rb:248:in process_action'
activerecord (5.0.2) lib/active_record/railties/controller_runtime.rb:18:in process_action' actionpack (5.0.2) lib/abstract_controller/base.rb:126:in process'
actionview (5.0.2) lib/action_view/rendering.rb:30:in process' actionpack (5.0.2) lib/action_controller/metal.rb:190:in dispatch'
actionpack (5.0.2) lib/action_controller/metal.rb:262:in dispatch' actionpack (5.0.2) lib/action_dispatch/routing/route_set.rb:50:in dispatch'
actionpack (5.0.2) lib/action_dispatch/routing/route_set.rb:32:in serve' actionpack (5.0.2) lib/action_dispatch/journey/router.rb:39:in block in serve'
actionpack (5.0.2) lib/action_dispatch/journey/router.rb:26:in each' actionpack (5.0.2) lib/action_dispatch/journey/router.rb:26:in serve'
actionpack (5.0.2) lib/action_dispatch/routing/route_set.rb:725:in call' railties (5.0.2) lib/rails/engine.rb:522:in call'
railties (5.0.2) lib/rails/railtie.rb:193:in public_send' railties (5.0.2) lib/rails/railtie.rb:193:in method_missing'
actionpack (5.0.2) lib/action_dispatch/routing/mapper.rb:17:in block in <class:Constraints>' actionpack (5.0.2) lib/action_dispatch/routing/mapper.rb:46:in call'
actionpack (5.0.2) lib/action_dispatch/routing/mapper.rb:46:in serve' actionpack (5.0.2) lib/action_dispatch/journey/router.rb:39:in block in serve'
actionpack (5.0.2) lib/action_dispatch/journey/router.rb:26:in each' actionpack (5.0.2) lib/action_dispatch/journey/router.rb:26:in serve'
actionpack (5.0.2) lib/action_dispatch/routing/route_set.rb:725:in call' versioncake (3.1.0) lib/versioncake/rack/middleware.rb:17:in call'
warden (1.2.7) lib/warden/manager.rb:36:in block in call' warden (1.2.7) lib/warden/manager.rb:35:in catch'
warden (1.2.7) lib/warden/manager.rb:35:in call' rack (2.0.1) lib/rack/etag.rb:25:in call'
rack (2.0.1) lib/rack/conditional_get.rb:25:in call' rack (2.0.1) lib/rack/head.rb:12:in call'
rack (2.0.1) lib/rack/session/abstract/id.rb:222:in context' rack (2.0.1) lib/rack/session/abstract/id.rb:216:in call'
actionpack (5.0.2) lib/action_dispatch/middleware/cookies.rb:613:in call' activerecord (5.0.2) lib/active_record/migration.rb:553:in call'
actionpack (5.0.2) lib/action_dispatch/middleware/callbacks.rb:38:in block in call' activesupport (5.0.2) lib/active_support/callbacks.rb:97:in run_callbacks'
activesupport (5.0.2) lib/active_support/callbacks.rb:750:in _run_call_callbacks' activesupport (5.0.2) lib/active_support/callbacks.rb:90:in run_callbacks'
actionpack (5.0.2) lib/action_dispatch/middleware/callbacks.rb:36:in call' actionpack (5.0.2) lib/action_dispatch/middleware/executor.rb:12:in call'
actionpack (5.0.2) lib/action_dispatch/middleware/remote_ip.rb:79:in call' actionpack (5.0.2) lib/action_dispatch/middleware/debug_exceptions.rb:49:in call'
web-console (3.5.0) lib/web_console/middleware.rb:135:in call_app' web-console (3.5.0) lib/web_console/middleware.rb:28:in block in call'
web-console (3.5.0) lib/web_console/middleware.rb:18:in catch' web-console (3.5.0) lib/web_console/middleware.rb:18:in call'
actionpack (5.0.2) lib/action_dispatch/middleware/show_exceptions.rb:31:in call' railties (5.0.2) lib/rails/rack/logger.rb:36:in call_app'
railties (5.0.2) lib/rails/rack/logger.rb:24:in block in call' activesupport (5.0.2) lib/active_support/tagged_logging.rb:69:in block in tagged'
activesupport (5.0.2) lib/active_support/tagged_logging.rb:26:in tagged' activesupport (5.0.2) lib/active_support/tagged_logging.rb:69:in tagged'
railties (5.0.2) lib/rails/rack/logger.rb:24:in call' sprockets-rails (3.2.0) lib/sprockets/rails/quiet_assets.rb:13:in call'
actionpack (5.0.2) lib/action_dispatch/middleware/request_id.rb:24:in call' rack (2.0.1) lib/rack/method_override.rb:22:in call'
rack (2.0.1) lib/rack/runtime.rb:22:in call' activesupport (5.0.2) lib/active_support/cache/strategy/local_cache_middleware.rb:28:in call'
actionpack (5.0.2) lib/action_dispatch/middleware/executor.rb:12:in call' actionpack (5.0.2) lib/action_dispatch/middleware/static.rb:136:in call'
rack (2.0.1) lib/rack/sendfile.rb:111:in call' railties (5.0.2) lib/rails/engine.rb:522:in call'
puma (3.8.2) lib/puma/configuration.rb:224:in call' puma (3.8.2) lib/puma/server.rb:600:in handle_request'
puma (3.8.2) lib/puma/server.rb:435:in process_client' puma (3.8.2) lib/puma/server.rb:299:in block in run'
puma (3.8.2) lib/puma/thread_pool.rb:120:in call' puma (3.8.2) lib/puma/thread_pool.rb:120:in block in spawn_thread'

Paypal initAuthFlow runs twice on paypal submit click

Steps to reproduce:

  • Enable hosted fields and paypal as payment methods
  • From payment page select hosted fields using radio button THEN select paypal
  • Click 'Save and Continue'

Issue appears to be caused by duplication of event listeners in payment partial.

Getting meaningfull errors instead of "Processor declined: Approved (1000)" when billing address or CVV don't match

In my Spree Store when you try to checkout an item, if the zip code in the billing address doesn't match the address connected to the credit card or if the CVV doesn't match the card, it returns the error "Processor declined: Approved (1000)". This is returned regardless of if it is the Zip Code that is incorrect or the CVV. In Braintree I can see under "AVS Postal Code Response" and "CVV Response" what caused the error, but my customer doesn't get an error that they can act on. Is there any way for me to fix this?

Thanks,
Amit Harlev

When submitting a payment for capture (settle) that was previously authorized, the cvv_response_code is wiped out

Steps to Reproduce:

  • Set up this gem (BT Vzero hosted fields), make sure when you configure the Payment Method set Auto-Capture OFF (disabled)
  • Go through checkout with btree vzero hosted fields checkout
  • Note in your database look at the Payment record you just created. Confirm that it has a correct value in the cvv_response_code field (usually 'M')
  • Once you submit your transaction, go into the Spree Admin interface, find your transaction (in 'pending' state), and click 'Settle' next to it on the Payments screen
  • In the database, you will note that the field cvv_response_code is now wiped out (overwritten) by the capture transaction

Technically this bug is due to an interaction between this gem and the Spree core code itself.

This is a partial log output using AR Query trace that is showing me the full callstack of where the errant UPDATE query is called from

https://gist.github.com/jasonfb/b53ecc58866bdc36508d00a2719ff472

Note that spree_braintree_vzero-5c557054d0cc/app/models/spree/payment/processing_decorator.rb:15 calls into the Spree core code, specifically this line of code:

https://github.com/spree/spree/blob/2-4-stable/core/app/models/spree/payment/processing.rb#L150

This whole part of Spree's code is unfortunate because Braintree has no field for avs_response (it has 3 other fields for AVS information), so it seems to me that a cleaner way to do this is to delegate this to the payment method and ask the payment method for the information that is need.

Anyway, this should definitely be treated like a bug because I don't want my CVV values wiped out in my database .

Paying with Paypal Express programmatically for subscriptions orders

I have a subscriptions system on my spree store where i programmatically create a new order, taking all the info from the previous one.
As long as the user create the payment in the normal checkout process, the PaypalExpress payment works great.

However, when i create the new order the next month and i run order.next to process the payment i get an error message that says:
Payment method identification was not specified

Is it possible to take a payment without the user manually doing the checkout process all over again?

Unable to pay with credit card when applying a coupon in the payments page

I don't think this is the extension's fault, but rather Spree's.
The problem is that the file payment.js.coffee calls submit() (unnecessarily) hijacking the flow from braintree and submitting the form before the payment method data can be received.

I'm opening an issue about this in Spree, but I thought it should be referenced here too.

[BUG] Capturing payment fails through API with weird errors.

Fresh Install:

  1. Spree.

  2. spree_braintree_vzero

  3. Checkout: (Don't capture payment) i.e: order is: R902964121

  4. Use API to capture/settle payment:

0.0.0.0:3000/api/v1/orders/R902964121/payments/81/capture

Error:


ArgumentError at /api/v1/orders/R902964121/payments/81/capture
==============================================================

> wrong number of arguments (given 3, expected 1)

activesupport (4.2.7) lib/active_support/core_ext/kernel/reporting.rb, line 89
------------------------------------------------------------------------------

``` ruby
   84     #   stream = capture(:stdout) { system('echo notice') }
   85     #   stream # => "notice\n"
   86     #
   87     #   stream = capture(:stderr) { system('echo error 1>&2') }
   88     #   stream # => "error\n"
>  89     def capture(stream)
   90       ActiveSupport::Deprecation.warn(
   91         "`#capture(stream)` is deprecated and will be removed in the next release."
   92       ) #not thread-safe
   93       stream = stream.to_s
   94       captured_stream = Tempfile.new(stream)

App backtrace


_payment.rb, onclick event integration issue

capture d ecran 2017-08-18 a 16 52 54

As you can see, the code about the popup "how Paypal Works" is bad implemented, I found that the issue is here

<% if method.is_a?(Spree::Gateway::BraintreeVzeroPaypalExpress) %> <img src="https://www.paypalobjects.com/webstatic/mktg/logo/pp_cc_mark_37x23.jpg" border="0" alt="PayPal Logo"> <a href="https://www.paypal.com/webapps/mpp/paypal-popup" title="<%= Spree.t(:how_paypal_works) %>" onclick="javascript:window.open('https://www.paypal.com/webapps/mpp/paypal-popup', 'WIPaypal','toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, width=1060, height=700'); return false;"> <%= Spree.t(:what_is_paypal) %></a> <% else %> <%= render_original %> <% end %>
But i don't know if it is a tag issue or something else, if someone know how to solve it?

Thanks

Billing address appears not to pass when same as shipping address (spree 2.4)

This seems to cause the BT gateway to be unable to process the AVS correctly.

Note that Manifestation 1 and Manifestation 2 have the same root cause, pay close attention to differences in settings.

What is happening is that when the SAME billing + shipping address are used, no billing information is passed at all.

replicated:

Setup steps

  • Setup a default spree 2.4 hello world (fresh install using spree sample data, obviously setting up this gem as the payment gateway)
  • setup a sandbox BT integration and configure it in your Spree hello world app
  • Turn setting "PASS BILLING AND SHIPPING ADDRESS" to "Enabled" in your Spree Settings for the Braintree Vzero Hosted Fields Payment method.

Manifestation 1

This is happening because there is no billing parameter passed to Braintree,
Outgoing data on an order with SAME billing + shipping address. Note absence of :billing parameter

(byebug) data
{:channel=>"SpreeCommerceInc_Cart_Braintree", :customer=>{}, :payment_method_nonce=>"ba976ed7-e298-4724-ac72-b01b2976c59f", :amount=>25.99, :order_id=>"R858522382", "shipping"=>{:company=>nil, :country_code_alpha2=>"US", :country_code_alpha3=>"USA", :country_code_numeric=>840, :country_name=>"United States", :first_name=>"asd", :last_name=>"sdaf", :locality=>"New York", :postal_code=>"10024", :region=>"NY", :street_address=>"dfsaadfs", :extended_address=>""}, :descriptor=>{:name=>""}, :options=>{:submit_for_settlement=>false, :add_billing_address_to_payment_method=>true, :three_d_secure=>{:required=>false}, :store_in_vault=>false}}

Note Manifestation 2
(follow same setup steps above)

Expected Result:

  • Braintree gateway rejects order with AVS error response N (does not match) (see documentation above)

Actual result:
Your order is placed successfully. (this should not be the case since the gateway should have responded with an AVS mismatch)

Paypal express – payments not captured

We’ve integrated – https://github.com/spree-contrib/spree_braintree_vzero to enable Paypal express on Spree 3.0.4. In our tests both – Test and Production we go through the checkout and paypal submission is successful. However, on both occasions no transactions are displayed on Braintree side nor in the admin console.

https://www.dropbox.com/s/02zvmpayoosf22m/Screenshot%202016-11-29%2012.58.56.png?dl=0

https://www.dropbox.com/s/i2e63qgxyx6y0zf/Screenshot%202016-11-29%2012.59.12.png?dl=0

Paypal is not working

Hi
I am using spree 3.1 and spree_braintree_vzero 3-1-stable for payment.
I am using BraintreeVzeroDropDownUi gateway.
I have a sandbox account on Braintree but when I clicked on Paypal at payment page a new window open with message Sorry we cannot connect to PayPal. Please try again in a few minutes.

How can I fix this issue.

Dropin UI v3 Support?

I see we are currently using v2 of the dropin ui and am wondering if there are any plans to upgrade to the newest version to get more cool features?

I tinkered a bit with the code and was able to load the newest version, but was unsuccessful at processing any orders. It seems they have changed quite a bit in v3 v.s v2 such as removing the need for embedding within an iframe in which I suspect is where my checkout woes were coming from.

A few benefits to upgrading are as follows:

  • Process payments through Venmo, Google Pay and even Apple Pay!
  • Better control over styling of form elements on page (no more iframe)

See here for more: https://developers.braintreepayments.com/guides/client-sdk/migration/javascript/v3

Thanks for this awesome addon! If I get the chance I will attempt to put together a PR, but am pretty busy at the moment.

Spree 3.1 cannot settle Paypal payments in production

I am trying to settle a Paypal Express payment in production, however it does not work.

No errors are getting logged, so it is hard to track down what is happening.

I've tried to manually settle the payment in rails console, but that isn't working either:

> p = Spree::Payment.find_by(number: 'xxxxxx')
> p.settle!
  Spree::PaymentMethod Load (1.5ms)  SELECT  "spree_payment_methods".* FROM "spree_payment_methods" WHERE "spree_payment_methods"."deleted_at" IS NULL AND "spree_payment_methods"."id" = $1 LIMIT 1  [["id", 4]]
  Spree::BraintreeCheckout Load (1.1ms)  SELECT  "spree_braintree_checkouts".* FROM "spree_braintree_checkouts" WHERE "spree_braintree_checkouts"."id" = $1 LIMIT 1  [["id", 3]]
=> nil

I am able to settle payment on a test account in development, which further complicates any debugging.

paypal not showing up

Hi,
i added the extension (spree 3.0) and, using paypal, nothing appears inside div#paypal-container
hosted fields seems to work, i'm using the the same sandbox credentials for both.

Any hint?

Thanks!

Paypal transactions are marked as risky

When I use PayPal as my payment method the order is marked as risky in the admin panel.
Is this expected? and if so, why?

Also, I don't know if it's related, but I'm using a sandbox Braintree account.

Incorrect polymorphic association for has_one :payment on the Spree::BraintreeCheckout

2.1.5 :001 > b = Spree::BraintreeCheckout.last
  Spree::BraintreeCheckout Load (0.3ms)  SELECT  `spree_braintree_checkouts`.* FROM `spree_braintree_checkouts`   ORDER BY `spree_braintree_checkouts`.`id` DESC LIMIT 1
 => #<Spree::BraintreeCheckout id: 55, transaction_id: nil, state: nil, created_at: "2016-09-15 19:03:28", updated_at: "2016-09-15 19:03:28", paypal_email: nil, advanced_fraud_data: "{\"device_session_id\":\"7741ee176704cd917325c42b7d37...", risk_id: nil, risk_decision: nil, braintree_last_digits: nil, braintree_card_type: nil, admin_payment: nil> 
2.1.5 :002 > b.payment
  Spree::Payment Load (0.7ms)  SELECT  `spree_payments`.* FROM `spree_payments`  WHERE `spree_payments`.`source_id` = 55  ORDER BY spree_payments.created_at LIMIT 1
 => #<Spree::Payment id: 66, amount: #<BigDecimal:7fe65eb59ec8,'0.68E2',9(18)>, order_id: 3175, created_at: "2013-03-20 17:33:05", updated_at: "2013-03-20 17:33:05", source_id: 55, source_type: "Spree::CreditCard", payment_method_id: 2, state: "checkout", response_code: nil, avs_response: nil, avs_error_response_code: nil, avs_postal_code_response_code: nil, avs_street_address_response_code: nil, identifier: nil, cvv_response_code: nil, cvv_response_message: nil, ip_address: nil, braintree_token: nil, braintree_nonce: nil> 

note that the Braintree checkout object is picking up the wrong payment record because the association incorrectly uses inverse_of instead of as

undefined method `braintree_last_digits' for nil:NilClass

Hi,

We have a production issue for which we can't explain as we have made no recent changes to the checkout/order process, apart from a recent update to gems — we have been running this gem since November with no issues.

An exception occurs when choosing Paypal and moving on to the confirmation page. For some reason payment.source is nil.

Deface::Override.new(
  virtual_path: 'spree/payments/_payment',
  name: 'Displays payment data for PayPal Express payment methods',
  replace: 'erb[silent]:contains("else")',
  text: %Q{
        <% elsif payment.payment_method.kind_of?(Spree::Gateway::BraintreeVzeroBase) %>
          <% if (last_digits = payment.source.braintree_last_digits) %>
            <%
              cc_type = payment.source.braintree_card_type
              img = "credit_cards/icons/" + cc_type.downcase + ".png"
            %>
            <% if Rails.application.assets.find_asset(img) %>
              <%= image_tag img %>
            <% else %>
              <p><%= Spree.t(:cc_type) + ": " + cc_type %></p>
              </br>
            <% end %>
            <p><%= Spree.t(:ending_in) + " " + last_digits %></p>
          <% end %>

          <% if (paypal_email = payment.source.paypal_email) %>
            <!-- PayPal Logo --><img src="https://www.paypalobjects.com/webstatic/mktg/logo/pp_cc_mark_37x23.jpg" border="0" alt="PayPal Logo"><!-- PayPal Logo -->
            <%= paypal_email %>
          <% end %>

        <% else %>
        }
)

Payment gets into unknown "processing" state

I need to manually process Paypal payments through an integration. This is how I am doing it

payment.settle!

Sometimes the payments transition to complete and sometimes they don't and get stuck in a processing state.

I thought that perhaps because Braintree was returning a settling response instead of a settled response that this was the cause. However that doesn't appear to be the case.

It seems like this line might be the culprit: https://github.com/spree-contrib/spree_braintree_vzero/blob/master/app/models/spree/payment/processing_decorator.rb#L41

If set_current_state is called, and the action is :settle, this method will just return the current_state passed into it, correct? Should I be doing payment.purchase! instead?

doesn't work on 3.3.0

adding it on gem and updating doesn't give any error, but when you checkout a product it gives an heroku error "Something went wrong"

Deface issue

On 3.0.stable branch, working with Spree 3.0.5, when I load the PaypalExpress method the 'cart' page crashes due to a deface issue:

2016-08-19T06:21:52.545714+00:00 app[web.1]:   Spree::PaymentMethod Load (0.9ms)  SELECT  "spree_payment_methods".* FROM "spree_payment_methods" WHERE "spree_payment_methods"."deleted_at" IS NULL AND "spree_payment_methods"."type" = $1 AND "spree_payment_methods"."active" = $2  ORDER BY "spree_payment_methods"."id" DESC LIMIT 1  [["type", "Spree::Gateway::BraintreeVzeroPaypalExpress"], ["active", "t"]]
2016-08-19T06:21:52.543057+00:00 app[web.1]:   Rendered vendor/bundle/ruby/2.3.0/gems/spree_frontend-3.0.5/app/views/spree/orders/_adjustments.html.erb (16.0ms)
2016-08-19T06:21:52.979575+00:00 app[web.1]: I, [2016-08-19T06:21:52.979509 #3]  INFO -- : [Braintree] [19/Aug/2016 06:21:52 UTC] POST /merchants/ymmorsurepuk_api1.hotmail.com/client_token 404
2016-08-19T06:21:52.983525+00:00 app[web.1]: Deface: 1 overrides found for 'spree/orders/edit'
2016-08-19T06:21:52.985696+00:00 app[web.1]: Deface: 'Add PayPal button' matched 1 times with 'erb[loud]:contains("checkout-link")'
2016-08-19T06:21:52.985832+00:00 app[web.1]: Deface: [WARNING] No :original defined for 'Add PayPal button', you should change its definition to include:
2016-08-19T06:21:52.985833+00:00 app[web.1]:  :original => '709c66452727d9974734499abdb77ddbcc923795'
2016-08-19T06:21:52.993198+00:00 app[web.1]:   Rendered vendor/bundle/ruby/2.3.0/gems/spree_frontend-3.0.5/app/views/spree/orders/edit.html.erb within spree/layouts/spree_application (506.2ms)
2016-08-19T06:21:52.993416+00:00 app[web.1]: Completed 500 Internal Server Error in 527ms (ActiveRecord: 27.6ms)
2016-08-19T06:21:52.995268+00:00 app[web.1]:
2016-08-19T06:21:52.995270+00:00 app[web.1]: ActionView::Template::Error (Braintree::NotFoundError):
2016-08-19T06:21:52.995271+00:00 app[web.1]:     35:     var checkout;
2016-08-19T06:21:52.995272+00:00 app[web.1]:     36:     SpreeBraintreeVzero.checkoutFormId = '#update-cart';
2016-08-19T06:21:52.995272+00:00 app[web.1]:     37:
2016-08-19T06:21:52.995273+00:00 app[web.1]:     38:     braintree.setup("<%= payment_method.client_token(current_order) %>", "paypal", {
2016-08-19T06:21:52.995274+00:00 app[web.1]:     39:       container: "paypal-container",
2016-08-19T06:21:52.995275+00:00 app[web.1]:     40:       singleUse: <%= payment_method.preferred_store_payments_in_vault.eql?('do_not_store') %>,
2016-08-19T06:21:52.995276+00:00 app[web.1]:     41:       amount: <%= @order.total %>,

Am I doing something wrong?

SystemStackError (stack level too deep) - Issue with Braintree in production

Hey all.

I've not been able to have any success getting the Braintree v.zero gem to work in production without producing the following stack error.

I, [2016-08-09T02:38:57.067355 #21275]  INFO -- :   Rendered /apps/edgelit-gallery/shared/bundle/ruby/2.3.0/gems/spree_backend-3.1.0/app/views/spree/admin/shared/_main_menu.html.erb (2.2ms)
I, [2016-08-09T02:38:57.067561 #21275]  INFO -- : Completed 500 Internal Server Error in 92ms (ActiveRecord: 3.0ms)
F, [2016-08-09T02:38:57.128941 #21275] FATAL -- :
SystemStackError (stack level too deep):
  /apps/edgelit-gallery/shared/bundle/ruby/2.3.0/bundler/gems/spree_braintree_vzero-a6b3fa637387/app/helpers/spree/admin/navigation_helper_decorator.rb:6:in `link_to_with_icon'
  /apps/edgelit-gallery/shared/bundle/ruby/2.3.0/gems/spree_backend-3.1.0/app/helpers/spree/admin/navigation_helper.rb:35:in `tab'
  /apps/edgelit-gallery/shared/bundle/ruby/2.3.0/gems/spree_backend-3.1.0/app/views/spree/admin/shared/_main_menu.html.erb:3:in `_5aa8906de7ed3f1abc19bb8b99923123'
  /apps/edgelit-gallery/shared/bundle/ruby/2.3.0/gems/spree_backend-3.1.0/app/views/spree/layouts/admin.html.erb:34:in `_1dae9f5fadea745b1b7ba9042d8797f1'

This is a fresh un-altered version of spree 3.1.0 and the corrosponding 3-1-stable Braintree v.zero gem, running with rails 4.2.6.

It's only an issue in production (runs fine in development), and I just can't understand what's going on, I wonder if there's something wrong with this particular version, or if there's something else I'm missing.

The app is running via nginx + passenger, with ruby 2.3.1p112.

Any ideas?

Support for Spree 3.2?

I am trying to setup with spree 3.2 and running into the following error loading the payment page:

Showing /usr/local/rvm/gems/ruby-2.3.3/bundler/gems/spree_braintree_vzero-a860006a9b48/app/views/spree/checkout/payment/braintree_vzero/_payment.html.erb where line #61 raised:

undefined method `to_sym' for {:values=>[:sandbox, :production]}:Hash
Did you mean?  to_s
               to_yaml
               to_set
Extracted source (around line #28):

26
27     def provider
28       Braintree::Configuration.environment = preferred_server.to_sym
29       Braintree::Configuration.merchant_id = preferred_merchant_id
30       Braintree::Configuration.public_key = preferred_public_key
31       Braintree::Configuration.private_key = preferred_private_key

I am using:
$ ruby -v
ruby 2.3.3p222 (2016-11-21 revision 56859) [x86_64-linux]
$ rails -v
Rails 5.0.1
Spree from Gemfile:

gem 'spree', '~> 3.2.0.rc1'
gem 'spree_auth_devise', '~> 3.2.0.beta'
gem 'spree_gateway', '~> 3.2.0.beta'
gem 'spree_static_content', github: 'spree-contrib/spree_static_content'
gem 'spree_braintree_vzero', github: 'spree-contrib/spree_braintree_vzero'

I suspect that my settings are not being saved (or retrieved) properly as the credential fields on the settings page are always blank when viewed.

Should this setup work? Do I need to select a specific branch of the plugin?

drop-in not appearing on checkout and hosted fields unwritable

Hello,

I'm having a problem with the payment form not showing up (if I choose drop-in), or not being writable (hosted fields).

The problem seemed to be that Rails wasn't taking care of the <%= %> fields in the js files, so I managed to fix it by changing the extension in _dropin.js, _hosted.js and _paypal.js to .js.erb (views/spree/shared/braintree_vzero).

Don't know why this wasn't a thing from the start. Maybe caused by a specific version of Rails?

Integrate with Spree 3.0 - DropInUI issue

Hi,

Does this gem work with spree 3.0 out of the box?

I've tried to integrate with spree 3.0 and the DropInUI is missing CVD/CVV field. Also, on the backend, I can't change the payment state to paid.

see screenshot below. Do I need to create a custom form/code for this to work with spree 3.0?

screen shot 2016-05-18 at 6 38 19 pm

screen shot 2016-05-18 at 6 39 16 pm

Thanks,
Nathan

[3-1] Passing billing address to braintree

If the billing and the shipping address are the same the billing address gets not passed to braintree. This causes a AVS gateway reject due to providing neither a street address nor a postal code.

https://github.com/spree-contrib/spree_braintree_vzero/blob/3-1-stable/app/models/spree/gateway/braintree_vzero_base/purchase_data.rb#L33

  data.merge!(utils.get_address('billing')) unless order.shipping_address.same_as?(order.billing_address)
  data.merge!(utils.get_address('shipping'))
end

Guidance required on how to use this library with Spree API

The wiki does not mention how tho use this gem via the spree API, I could not find any instructions online either. I am building an Angular 2 front end with Spree API backend I would like to use Braintree for credit card and PayPal payments. Could anyone provide done help with this.

PayPal payment method ignores store credit

If a customer decides to use store credit and pays the rest with PayPal he'll be charged full price while also losing the credit.
This is because the extension uses order.total to get the price instead of order.order_total_after_store_credit

I might do a PR if I can scrape some time.

Payment does not capture amount less than successful authorized amount from Braintree.

In reference this issue that was closed: #84

I did receive the same error ArgumentError: wrong number of arguments (3 for 1) when trying to capture on the payment.

  # Takes the amount in cents to capture.
  # Can be used to capture partial amounts of a payment, and will create
  # a new pending payment record for the remaining amount to capture later.
  def capture!(amount = nil)
    return true if completed?
    amount ||= money.money.cents
    started_processing!
    protect_from_connection_error do
      check_environment
      # Standard ActiveMerchant capture usage
      response = payment_method.capture(
        amount,
        response_code,
        gateway_options
      )
      money = ::Money.new(amount, currency)
      capture_events.create!(amount: money.to_f)
      split_uncaptured_amount
      handle_response(response, :complete, :failure)
    end
  end

At the line where it states response_code, Spree::Gateway::BraintreeVzeroBase, should have a #capture! method but it does not have it implemented. Also, Braintree expects BraintreeCheckout object to be passed instead of a response_code which is used but other payment processors.

I did make it pass that issue but I now have the issue of:
Spree::Core::GatewayError: Cannot submit for settlement unless status is authorized.

My current situation - I have an order that has successfully authorized the initial payment on Braintree. Now I want to capture(x-amount) (less than the order total) but I receive that error.

Strange behavior with Braintree payment objects; does not transition out of 'checkout' step, does not capture correclty

We have a highly customized checkout which does not play nicely with this gem. However, I am able to successfully get the Braintree Vzero code to work, via javascript injection of 3 iframes, communicate with Braintree, capture the BT nonce, and pass the nonce back to my server.

On my server, I've created a payment record with no source (no credit card). To do this I had to redefined source_required? on the Braintree gateway object. [Is that right?]. Without doing that, I can't create a credit card because BT gives us no CC number or expiration and these fields are required on the CC object.

So I've created a spree_payments record, it has a payment_method that points to my Braintree Vzero hosted fields payment gateway (payment method), and it also has a nonce correctly recorded in the database (braintree_nonce). I have not recorded a braintree_token in the database, because when I did this it didn't work (my rep at Braintree told me this as for a payment method token, like a token for a saved credit card, not for the token for this transaction)

However, I am seeing behavior I am not accustomed to coming from a different Gateway provider.

For one, the payment itself is in 'checkout' state once the order is completed. This is odd because our other payment gateways put the payment into 'pending' state.

When I call authorize! on the payment object I get a nil response.

When I call capture! on the payment object I get ArgumentError: wrong number of arguments (3 for 1)

Here is a full stacktrace, this code is generated simply from the console (I haven't even put these calls into my app yet). What I'd like to do is identify which are the right order of operations and methods to calla and then I will figure out where in my app to stick these calls.

In this console output p is a variable which represent my payment, which you can examine as the first line of the debugging output

https://gist.github.com/jasonfb/3626faffd59cc5c27982fabe0b5133c3

Paypal checkout button on Cart skips Confirmation page

I tried changing the options, but it still skips that last step for confirming when the user clicks on Continue on the Address page.

Is there anyway that I can bring back the confirmation page, in the case paypal checkout button was used?

NoMethodError due to 'preferred_server' being of wrong type

I installed this gem (following the instructions in the readme, using the current master version) on a brand new spree app (spree version 3.2.0.rc1), added the PayPal express payment method from the admin panel and now, whenever I try to access my cart, I get the following exception:

NoMethodError at /cart

undefined method `to_sym' for {:values=>[:sandbox, :production]}:Hash

The exception occurs at:
~/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/bundler/gems/spree_braintree_vzero-a860006a9b48/app/models/spree/gateway/braintree_vzero_base.rb line 28. Here's a link to the code here.

When adding other payment methods, the field for Server is a text field, while for PayPal Express, the field is a drop-down list.

payment state is balance_due

Hello I am using gem 'spree_braintree_vzero', github: 'spree-contrib/spree_braintree_vzero', branch: '3-1-stable'
and done following setup:

  1. Run bundle install
  2. bundle exec rails g spree_braintree_vzero:install
  3. Done settings at spree backend payment methods set merchant_id, public_key, private_key and set autocapture-yes
  4. restarted my server
  5. added rake task in heroku scheduler rake spree_braintree_vzero:update_states

Now issue is my payment is happening successfully but not able to recive payment_status as 'PAID' it always gives balance_due so wis there any api call missing and how to set this.

Thanks
Dinshaw Raje

/cart gives "Something went wrong"

whenever i go to /cart for my app it gives this heroku error "Something went wrong", this occured after creating braintree paypal express.
I'm using paypal sandbox merchant details.
error occured to these following setup
SERVER: production/sandbox
test mode: checked/unchecked
display: both
autocapture: yes

selecting frontend or backend for display renders the page normally but not showing the payment method.

Skip billing/shipping address

I comment 2 step billing and shipping address. So when try go to page checkout, I receive error:

undefined firstname for nil class

Is there any config to skip that?

[3-1] No id when addresses are the same

When the billing address and the shipping address are identical the braintree_id does not get stored properly in the address table.

In braintree the shipping address just gets displayed as Same As Billing. It does return the address yet not the id of the address.

Location:
https://github.com/spree-contrib/spree_braintree_vzero/blob/master/app/models/spree/gateway/braintree_vzero_base.rb#L107

Fix:

  def update_addresses(response, order)
    shipping_address = order.shipping_address
    billing_address = order.billing_address
    transaction = response.transaction

    shipping_details_id = transaction.shipping_details.id
    details_id = if shipping_address.same_as?(billing_address)
                   shipping_details_id ||= transaction.billing_details.id
                 else
                   transaction.billing_details.id
                 end

    shipping_address.update_attribute(:braintree_id, shipping_details_id)
    billing_address.update_attribute(:braintree_id, details_id)
  end

I will open a pull request as soon as possible.

Payment is not working with coupons.

Hi,

I have implemented braintree_dropdown_ui gateway for payment and it's working fine.
But when I try it with promotion it's give me an error "undefined method `braintree_last_digits' for nil:NilClass" while I am paying with paypal.
Please help me.

Thanks.

Reference Errror: SpreeBrainTreeVZero is not defined

Hello, I recently added this extension to my Spree application, currently in develipment. After setting up PayPal Express Payment (Adding Merchant ID, Private and Public Keys) I get to see the PayPal button on cart, but I cannot press it.

After inspecting the element, it seems that a class used by it (SpreeBrainTreeVZero) isn't defined anywhere. Does anyone know any possible cause? or is this a bug?

PD: Currently using branch 3-1-stable of spree_braintree_vzero and Spree 3.1.0

Getting an error when trying to use any of the Braintree vzero payment methods

I am getting the following error when trying to use the basic setup of BraintreeVZeroHosteFields payment method, any idea what could be causing this?

ruby 2.2.1

gem 'rails', '4.2.7'
gem 'spree', '~> 3.1.1'
gem 'spree_gateway', '~> 3.1.0'
gem 'spree_braintree_vzero', github: 'spree-contrib/spree_braintree_vzero'
ArgumentError in Spree::Checkout#edit
Showing /Users/jusefbelkasemi/.rvm/gems/ruby-2.2.1/bundler/gems/spree_braintree_vzero-a860006a9b48/app/views/spree/checkout/payment/braintree_vzero/_payment.html.erb where line #61 raised:

wrong number of arguments (3 for 0..2)
Extracted source (around line #272):
270
271
272
273
274
275
              
    #   # Instantiates a single new object
    #   User.new(first_name: 'Jamie')
    def initialize(attributes = nil, options = {})
      @attributes = self.class._default_attributes.dup
      self.class.define_attribute_methods


Trace of template inclusion: /Users/jusefbelkasemi/.rvm/gems/ruby-2.2.1/bundler/gems/spree_braintree_vzero-a860006a9b48/app/views/spree/checkout/payment/_braintree_vzero_hosted_fields.html.erb, /Users/jusefbelkasemi/.rvm/gems/ruby-2.2.1/gems/spree_frontend-3.1.3/app/views/spree/checkout/_payment.html.erb, /Users/jusefbelkasemi/.rvm/gems/ruby-2.2.1/gems/spree_frontend-3.1.3/app/views/spree/checkout/edit.html.erb

Rails.root: /Users/jusefbelkasemi/Dropbox/Web_Development/Ruby/Projects/intarestor

Application Trace | Framework Trace | Full Trace
activerecord (4.2.7) lib/active_record/core.rb:272:in `initialize'
activerecord (4.2.7) lib/active_record/inheritance.rb:61:in `new'
activerecord (4.2.7) lib/active_record/inheritance.rb:61:in `new'
/Users/jusefbelkasemi/.rvm/gems/ruby-2.2.1/bundler/gems/spree_braintree_vzero-a860006a9b48/app/models/spree/gateway/braintree_vzero_base.rb:155:in `braintree_user'
/Users/jusefbelkasemi/.rvm/gems/ruby-2.2.1/bundler/gems/spree_braintree_vzero-a860006a9b48/app/models/spree/gateway/braintree_vzero_base.rb:160:in `token_params'
/Users/jusefbelkasemi/.rvm/gems/ruby-2.2.1/bundler/gems/spree_braintree_vzero-a860006a9b48/app/models/spree/gateway/braintree_vzero_base.rb:37:in `client_token'
/Users/jusefbelkasemi/.rvm/gems/ruby-2.2.1/bundler/gems/spree_braintree_vzero-a860006a9b48/app/views/spree/checkout/payment/braintree_vzero/_payment.html.erb:61:in `_b2cf29e4f8ac860f24f4aabb8c12dc0d'
actionview (4.2.7) lib/action_view/template.rb:145:in `block in render'
activesupport (4.2.7) lib/active_support/notifications.rb:166:in `instrument'
actionview (4.2.7) lib/action_view/template.rb:333:in `instrument'
actionview (4.2.7) lib/action_view/template.rb:143:in `render'
deface (1.0.2) lib/deface/action_view_extensions.rb:41:in `render'
actionview (4.2.7) lib/action_view/renderer/partial_renderer.rb:339:in `render_partial'
actionview (4.2.7) lib/action_view/renderer/partial_renderer.rb:310:in `block in render'
actionview (4.2.7) lib/action_view/renderer/abstract_renderer.rb:39:in `block in instrument'
activesupport (4.2.7) lib/active_support/notifications.rb:164:in `block in instrument'
activesupport (4.2.7) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (4.2.7) lib/active_support/notifications.rb:164:in `instrument'
actionview (4.2.7) lib/action_view/renderer/abstract_renderer.rb:39:in `instrument'
actionview (4.2.7) lib/action_view/renderer/partial_renderer.rb:309:in `render'
actionview (4.2.7) lib/action_view/renderer/renderer.rb:51:in `render_partial'
actionview (4.2.7) lib/action_view/helpers/rendering_helper.rb:35:in `render'
/Users/jusefbelkasemi/.rvm/gems/ruby-2.2.1/bundler/gems/spree_braintree_vzero-a860006a9b48/app/views/spree/checkout/payment/_braintree_vzero_hosted_fields.html.erb:3:in `_cdfbe72e56a61d57cf6252c92c235951'
actionview (4.2.7) lib/action_view/template.rb:145:in `block in render'
activesupport (4.2.7) lib/active_support/notifications.rb:166:in `instrument'
actionview (4.2.7) lib/action_view/template.rb:333:in `instrument'
actionview (4.2.7) lib/action_view/template.rb:143:in `render'
deface (1.0.2) lib/deface/action_view_extensions.rb:41:in `render'
actionview (4.2.7) lib/action_view/renderer/partial_renderer.rb:339:in `render_partial'
actionview (4.2.7) lib/action_view/renderer/partial_renderer.rb:310:in `block in render'
actionview (4.2.7) lib/action_view/renderer/abstract_renderer.rb:39:in `block in instrument'
activesupport (4.2.7) lib/active_support/notifications.rb:164:in `block in instrument'
activesupport (4.2.7) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (4.2.7) lib/active_support/notifications.rb:164:in `instrument'
actionview (4.2.7) lib/action_view/renderer/abstract_renderer.rb:39:in `instrument'
actionview (4.2.7) lib/action_view/renderer/partial_renderer.rb:309:in `render'
actionview (4.2.7) lib/action_view/renderer/renderer.rb:51:in `render_partial'
actionview (4.2.7) lib/action_view/renderer/renderer.rb:25:in `render'
actionview (4.2.7) lib/action_view/helpers/rendering_helper.rb:32:in `render'
spree_frontend (3.1.3) app/views/spree/checkout/_payment.html.erb:65:in `block in _380946f9fce4677db8d6e978bbb56698'
activerecord (4.2.7) lib/active_record/relation/delegation.rb:46:in `each'
activerecord (4.2.7) lib/active_record/relation/delegation.rb:46:in `each'
spree_frontend (3.1.3) app/views/spree/checkout/_payment.html.erb:62:in `_380946f9fce4677db8d6e978bbb56698'
actionview (4.2.7) lib/action_view/template.rb:145:in `block in render'
activesupport (4.2.7) lib/active_support/notifications.rb:166:in `instrument'
actionview (4.2.7) lib/action_view/template.rb:333:in `instrument'
actionview (4.2.7) lib/action_view/template.rb:143:in `render'
deface (1.0.2) lib/deface/action_view_extensions.rb:41:in `render'
actionview (4.2.7) lib/action_view/renderer/partial_renderer.rb:339:in `render_partial'
actionview (4.2.7) lib/action_view/renderer/partial_renderer.rb:310:in `block in render'
actionview (4.2.7) lib/action_view/renderer/abstract_renderer.rb:39:in `block in instrument'
activesupport (4.2.7) lib/active_support/notifications.rb:164:in `block in instrument'
activesupport (4.2.7) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (4.2.7) lib/active_support/notifications.rb:164:in `instrument'
actionview (4.2.7) lib/action_view/renderer/abstract_renderer.rb:39:in `instrument'
actionview (4.2.7) lib/action_view/renderer/partial_renderer.rb:309:in `render'
actionview (4.2.7) lib/action_view/renderer/renderer.rb:51:in `render_partial'
actionview (4.2.7) lib/action_view/helpers/rendering_helper.rb:35:in `render'
spree_frontend (3.1.3) app/views/spree/checkout/edit.html.erb:31:in `block in _1cd95a4dd01435252d86877a31f8f72a'
actionview (4.2.7) lib/action_view/helpers/capture_helper.rb:38:in `block in capture'
actionview (4.2.7) lib/action_view/helpers/capture_helper.rb:202:in `with_output_buffer'
actionview (4.2.7) lib/action_view/helpers/capture_helper.rb:38:in `capture'
actionview (4.2.7) lib/action_view/helpers/form_helper.rb:444:in `form_for'
spree_frontend (3.1.3) app/views/spree/checkout/edit.html.erb:19:in `_1cd95a4dd01435252d86877a31f8f72a'
actionview (4.2.7) lib/action_view/template.rb:145:in `block in render'
activesupport (4.2.7) lib/active_support/notifications.rb:166:in `instrument'
actionview (4.2.7) lib/action_view/template.rb:333:in `instrument'
actionview (4.2.7) lib/action_view/template.rb:143:in `render'
deface (1.0.2) lib/deface/action_view_extensions.rb:41:in `render'
actionview (4.2.7) lib/action_view/renderer/template_renderer.rb:54:in `block (2 levels) in render_template'
actionview (4.2.7) lib/action_view/renderer/abstract_renderer.rb:39:in `block in instrument'
activesupport (4.2.7) lib/active_support/notifications.rb:164:in `block in instrument'
activesupport (4.2.7) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (4.2.7) lib/active_support/notifications.rb:164:in `instrument'
actionview (4.2.7) lib/action_view/renderer/abstract_renderer.rb:39:in `instrument'
actionview (4.2.7) lib/action_view/renderer/template_renderer.rb:53:in `block in render_template'
actionview (4.2.7) lib/action_view/renderer/template_renderer.rb:61:in `render_with_layout'
actionview (4.2.7) lib/action_view/renderer/template_renderer.rb:52:in `render_template'
actionview (4.2.7) lib/action_view/renderer/template_renderer.rb:14:in `render'
actionview (4.2.7) lib/action_view/renderer/renderer.rb:46:in `render_template'
actionview (4.2.7) lib/action_view/renderer/renderer.rb:27:in `render'
actionview (4.2.7) lib/action_view/rendering.rb:100:in `_render_template'
actionpack (4.2.7) lib/action_controller/metal/streaming.rb:217:in `_render_template'
actionview (4.2.7) lib/action_view/rendering.rb:83:in `render_to_body'
actionpack (4.2.7) lib/action_controller/metal/rendering.rb:32:in `render_to_body'
actionpack (4.2.7) lib/action_controller/metal/renderers.rb:37:in `render_to_body'
actionpack (4.2.7) lib/abstract_controller/rendering.rb:25:in `render'
actionpack (4.2.7) lib/action_controller/metal/rendering.rb:16:in `render'
actionpack (4.2.7) lib/action_controller/metal/instrumentation.rb:44:in `block (2 levels) in render'
activesupport (4.2.7) lib/active_support/core_ext/benchmark.rb:12:in `block in ms'
/Users/jusefbelkasemi/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/benchmark.rb:303:in `realtime'
activesupport (4.2.7) lib/active_support/core_ext/benchmark.rb:12:in `ms'
actionpack (4.2.7) lib/action_controller/metal/instrumentation.rb:44:in `block in render'
actionpack (4.2.7) lib/action_controller/metal/instrumentation.rb:87:in `cleanup_view_runtime'
activerecord (4.2.7) lib/active_record/railties/controller_runtime.rb:25:in `cleanup_view_runtime'
actionpack (4.2.7) lib/action_controller/metal/instrumentation.rb:43:in `render'
actionpack (4.2.7) lib/action_controller/metal/implicit_render.rb:10:in `default_render'
actionpack (4.2.7) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
actionpack (4.2.7) lib/abstract_controller/base.rb:198:in `process_action'
actionpack (4.2.7) lib/action_controller/metal/rendering.rb:10:in `process_action'
actionpack (4.2.7) lib/abstract_controller/callbacks.rb:20:in `block in process_action'
activesupport (4.2.7) lib/active_support/callbacks.rb:117:in `call'
activesupport (4.2.7) lib/active_support/callbacks.rb:117:in `call'
activesupport (4.2.7) lib/active_support/callbacks.rb:555:in `block (2 levels) in compile'
activesupport (4.2.7) lib/active_support/callbacks.rb:505:in `call'
activesupport (4.2.7) lib/active_support/callbacks.rb:505:in `call'
activesupport (4.2.7) lib/active_support/callbacks.rb:92:in `__run_callbacks__'
activesupport (4.2.7) lib/active_support/callbacks.rb:778:in `_run_process_action_callbacks'
activesupport (4.2.7) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (4.2.7) lib/abstract_controller/callbacks.rb:19:in `process_action'
actionpack (4.2.7) lib/action_controller/metal/rescue.rb:29:in `process_action'
actionpack (4.2.7) lib/action_controller/metal/instrumentation.rb:32:in `block in process_action'
activesupport (4.2.7) lib/active_support/notifications.rb:164:in `block in instrument'
activesupport (4.2.7) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (4.2.7) lib/active_support/notifications.rb:164:in `instrument'
actionpack (4.2.7) lib/action_controller/metal/instrumentation.rb:30:in `process_action'
actionpack (4.2.7) lib/action_controller/metal/params_wrapper.rb:250:in `process_action'
activerecord (4.2.7) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
actionpack (4.2.7) lib/abstract_controller/base.rb:137:in `process'
actionview (4.2.7) lib/action_view/rendering.rb:30:in `process'
actionpack (4.2.7) lib/action_controller/metal.rb:196:in `dispatch'
actionpack (4.2.7) lib/action_controller/metal/rack_delegation.rb:13:in `dispatch'
actionpack (4.2.7) lib/action_controller/metal.rb:237:in `block in action'
actionpack (4.2.7) lib/action_dispatch/routing/route_set.rb:74:in `call'
actionpack (4.2.7) lib/action_dispatch/routing/route_set.rb:74:in `dispatch'
actionpack (4.2.7) lib/action_dispatch/routing/route_set.rb:43:in `serve'
actionpack (4.2.7) lib/action_dispatch/journey/router.rb:43:in `block in serve'
actionpack (4.2.7) lib/action_dispatch/journey/router.rb:30:in `each'
actionpack (4.2.7) lib/action_dispatch/journey/router.rb:30:in `serve'
actionpack (4.2.7) lib/action_dispatch/routing/route_set.rb:817:in `call'
railties (4.2.7) lib/rails/engine.rb:518:in `call'
railties (4.2.7) lib/rails/railtie.rb:194:in `public_send'
railties (4.2.7) lib/rails/railtie.rb:194:in `method_missing'
actionpack (4.2.7) lib/action_dispatch/routing/mapper.rb:51:in `serve'
actionpack (4.2.7) lib/action_dispatch/journey/router.rb:43:in `block in serve'
actionpack (4.2.7) lib/action_dispatch/journey/router.rb:30:in `each'
actionpack (4.2.7) lib/action_dispatch/journey/router.rb:30:in `serve'
actionpack (4.2.7) lib/action_dispatch/routing/route_set.rb:817:in `call'
warden (1.2.6) lib/warden/manager.rb:35:in `block in call'
warden (1.2.6) lib/warden/manager.rb:34:in `catch'
warden (1.2.6) lib/warden/manager.rb:34:in `call'
rack (1.6.5) lib/rack/etag.rb:24:in `call'
rack (1.6.5) lib/rack/conditionalget.rb:25:in `call'
rack (1.6.5) lib/rack/head.rb:13:in `call'
actionpack (4.2.7) lib/action_dispatch/middleware/params_parser.rb:27:in `call'
actionpack (4.2.7) lib/action_dispatch/middleware/flash.rb:260:in `call'
rack (1.6.5) lib/rack/session/abstract/id.rb:225:in `context'
rack (1.6.5) lib/rack/session/abstract/id.rb:220:in `call'
actionpack (4.2.7) lib/action_dispatch/middleware/cookies.rb:560:in `call'
activerecord (4.2.7) lib/active_record/query_cache.rb:36:in `call'
activerecord (4.2.7) lib/active_record/connection_adapters/abstract/connection_pool.rb:653:in `call'
activerecord (4.2.7) lib/active_record/migration.rb:377:in `call'
actionpack (4.2.7) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
activesupport (4.2.7) lib/active_support/callbacks.rb:88:in `__run_callbacks__'
activesupport (4.2.7) lib/active_support/callbacks.rb:778:in `_run_call_callbacks'
activesupport (4.2.7) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (4.2.7) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
actionpack (4.2.7) lib/action_dispatch/middleware/remote_ip.rb:78:in `call'
actionpack (4.2.7) lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
web-console (2.3.0) lib/web_console/middleware.rb:28:in `block in call'
web-console (2.3.0) lib/web_console/middleware.rb:18:in `catch'
web-console (2.3.0) lib/web_console/middleware.rb:18:in `call'
actionpack (4.2.7) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
railties (4.2.7) lib/rails/rack/logger.rb:38:in `call_app'
railties (4.2.7) lib/rails/rack/logger.rb:20:in `block in call'
activesupport (4.2.7) lib/active_support/tagged_logging.rb:68:in `block in tagged'
activesupport (4.2.7) lib/active_support/tagged_logging.rb:26:in `tagged'
activesupport (4.2.7) lib/active_support/tagged_logging.rb:68:in `tagged'
railties (4.2.7) lib/rails/rack/logger.rb:20:in `call'
actionpack (4.2.7) lib/action_dispatch/middleware/request_id.rb:21:in `call'
rack (1.6.5) lib/rack/methodoverride.rb:22:in `call'
rack (1.6.5) lib/rack/runtime.rb:18:in `call'
activesupport (4.2.7) lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
rack (1.6.5) lib/rack/lock.rb:17:in `call'
actionpack (4.2.7) lib/action_dispatch/middleware/static.rb:120:in `call'
rack (1.6.5) lib/rack/sendfile.rb:113:in `call'
rack-cors (0.4.0) lib/rack/cors.rb:80:in `call'
railties (4.2.7) lib/rails/engine.rb:518:in `call'
railties (4.2.7) lib/rails/application.rb:165:in `call'
rack (1.6.5) lib/rack/lock.rb:17:in `call'
rack (1.6.5) lib/rack/content_length.rb:15:in `call'
rack (1.6.5) lib/rack/handler/webrick.rb:88:in `service'
/Users/jusefbelkasemi/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/webrick/httpserver.rb:138:in `service'
/Users/jusefbelkasemi/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/webrick/httpserver.rb:94:in `run'
/Users/jusefbelkasemi/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/webrick/server.rb:294:in `block in start_thread'
Request

Parameters:

{"state"=>"payment"}
Toggle session dump
Toggle env dump
Response

Headers:

None

Facing error sorry we cannot connect to PayPal in spree

I have an ecommerce-application in that I had integrated Paypal with braintree using

gem 'spree_braintree_vzero', github: 'spree-contrib/spree_braintree_vzero', branch: ‘3-1-stable’
I have my Paypal sandbox account and included my credentials in my application.

enter image description here

Now when I go to checkout page < select Paypal option < continue payment then I get following error :

enter image description here

Please help me out to solve this issue. Thanks in advance.

Coupon codes are ignored when paying with PayPal

As title says, If you try to use a coupon code in the payment selection page and choose PayPal as your payment method, the coupon is ignored.

This happens because the "next step" button you click when choosing PayPal is not actually a submit button, so the javascript code tasked with coupon application is not triggered. The easy way to fix it is adding some coupon managing code before calling checkout.paypal.initAuthFlow(); in _payment.html.erb

I already have a patch working, so I'll submit a PR after doing some more testing

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.