solidus

https://github.com/solidusio/solidus

Ruby

🛒 Solidus, the open-source eCommerce framework for industry trailblazers.

Spree::Core::ControllerHelpers::PaymentParameters#set_payment_parameters_amount

This is a strange thing to do since an order can have multiple payments
but we always assume that it only has a single payment and that its
amount should be the current order total.  Also, this is pretty much
overridden when the order transitions to confirm by the logic inside of
Order#add_store_credit_payments.
We should reconsider this method and its usage at some point.

This method expects a params hash in the format of:

 {
   order: {
     # Note that only a single entry is expected/handled in this array
     payments_attributes: [
       {
         ...params...
       },
     ],
     ...other params...
   },
   ...other params...
 }

And this method modifies the params into the format of:

 {
   order: {
     payments_attributes: [
       {
         ...params...
         amount: <the order total>,
       },
     ],
     ...other params...
   },
   ...other params...
 }

Source | Google | Stack overflow

Edit

git clone [email protected]:solidusio/solidus.git

cd solidus

open core/app/helpers/spree/core/controller_helpers/payment_parameters.rb

Contribute

# Make a new branch

git checkout -b -your-name--update-docs-Spree--Core--ControllerHelpers--PaymentParameters-set_payment_parameters_amount-for-pr


# Commit to git

git add core/app/helpers/spree/core/controller_helpers/payment_parameters.rbgit commit -m "better docs for Spree::Core::ControllerHelpers::PaymentParameters#set_payment_parameters_amount"


# Open pull request

gem install hub # on a mac you can `brew install hub`

hub fork

git push <your name> -your-name--update-docs-Spree--Core--ControllerHelpers--PaymentParameters-set_payment_parameters_amount-for-pr

hub pull-request


# Celebrate!