solidus
https://github.com/solidusio/solidus
Ruby
🛒 Solidus, the open-source eCommerce framework for industry trailblazers.
Spree::Core::ControllerHelpers::PaymentParameters#move_payment_source_into_payments_attributes
This method handles the awkwardness of how the html forms are currently
set up for frontend.
This method expects a params hash in the format of:
{
payment_source: {
# The keys here are spree_payment_method.id's
'1' => {...source attributes for payment method 1...},
'2' => {...source attributes for payment method 2...},
},
order: {
# Note that only a single entry is expected/handled in this array
payments_attributes: [
{
payment_method_id: '1',
},
],
...other params...
},
...other params...
}
And this method modifies the params into the format of:
{
order: {
payments_attributes: [
{
payment_method_id: '1',
source_attributes: {...source attributes for payment method 1...}
},
],
...other params...
},
...other params...
}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 branchgit checkout -b -your-name--update-docs-Spree--Core--ControllerHelpers--PaymentParameters-move_payment_source_into_payments_attributes-for-pr
# Commit to gitgit add core/app/helpers/spree/core/controller_helpers/payment_parameters.rbgit commit -m "better docs for Spree::Core::ControllerHelpers::PaymentParameters#move_payment_source_into_payments_attributes"
# Open pull requestgem install hub # on a mac you can `brew install hub`
hub fork
git push <your name> -your-name--update-docs-Spree--Core--ControllerHelpers--PaymentParameters-move_payment_source_into_payments_attributes-for-pr
hub pull-request
# Celebrate!