Git Product home page Git Product logo

Comments (5)

vmatekole avatar vmatekole commented on May 31, 2024 1

@Mafi88 Yes. Thank you very much!

from spree_braintree_vzero.

Mafi88 avatar Mafi88 commented on May 31, 2024

@vmatekole it looks like your payment was not processed (maybe https://github.com/spree-contrib/spree_braintree_vzero/blob/master/app/models/spree/order_decorator.rb#L2 is not firing)?

Please try order.process_payments! in console and check if payment got processed (both Spree and Braintree)

from spree_braintree_vzero.

vmatekole avatar vmatekole commented on May 31, 2024

@Mafi88 Thank you so much for your support — you were correct but I don't understand the root cause, perhaps you can explain....

I have an existing order decorator, it appears this somehow was preventing the after_transition ("complete") state in the above decorator from firing, here is an excerpt:

Spree::Order.class_eval do
  # alias_method :can_ship?, :ship
  # Vend Inventory reconcile step
  insert_checkout_step :reconciled, :after => :complete
  Spree::Order.state_machine.before_transition :to => :complete, :do => :paypal
  Spree::Order.state_machine.after_transition :to => :complete, :do => :update_vend_inventory_status
  Spree::Order.state_machine.after_transition :to => :reconciled, :do => :log_order

I had to include my own method and duplicate the following code and the after_transition('complete') :

def paypal
    process_paypal_express_payments
end

def process_paypal_express_payments
    return unless paid_with_paypal_express?
    if payments.valid.empty?
      order.errors.add(:base, Spree.t(:no_payment_found))
      false
    else
      payments.valid.last.update(amount: total)
      process_payments!
    end
  end

from spree_braintree_vzero.

Mafi88 avatar Mafi88 commented on May 31, 2024

@vmatekole it happens to me when I mess with checkout flow (insert/remove checkout steps) Lately I had the same problem with tax_cloud before_transition.

I think that you only need to duplicate the transition method from gem, so:

state_machine.before_transition to: :complete, do: :process_paypal_express_payments

without overriding the actual process_paypal_express_payments method. Only this one line.

Also, I recommend usage of before_transition here, because it's the default checkout flow.
Right now, if it fails, customer will probably get order_complete email, not sure if inventory won't get processed too.

from spree_braintree_vzero.

Mafi88 avatar Mafi88 commented on May 31, 2024

@vmatekole did it help?

from spree_braintree_vzero.

Related Issues (20)

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.