SolidusNexio
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file lib/solidus_nexio
. To experiment with that code, run bin/console
for an interactive prompt.
TODO: Delete this and the text above, and describe your gem
Installation
Add this line to your application's Gemfile:
gem 'solidus_nexio'
And then execute:
$ bundle install
Or install it yourself as:
$ gem install solidus_nexio
Usage
This is a example of Spree config for Paragon in config/initializers/spree.rb
Spree.config do |config|
...
Rails.configuration.after_initialize do
config.static_model_preferences.add(
SolidusNexio::PaymentMethod,
'nexio',
server: ENV['NEXIO_ENV'] || 'sandbox', # production || sandbox
merchant_id: ENV['NEXIO_MERCHANT_ID'],
auth_token: ENV['NEXIO_AUTH_TOKEN'],
public_key: ENV['NEXIO_PUBLIC_KEY'],
three_d_secure: ENV['NEXIO_THREE_D_SECURE'].present?
)
config.static_model_preferences.add(
SolidusNexio::AlternativePaymentMethod,
'braintree_paypal_apm',
server: ENV['NEXIO_ENV'] || 'sandbox', # production || sandbox
merchant_id: ENV['NEXIO_MERCHANT_ID'],
auth_token: ENV['NEXIO_AUTH_TOKEN'],
payment_method: 'braintreePayPal',
save_token: true
)
Spree::PaymentMethod
config.static_model_preferences.add(
SolidusNexio::AlternativePaymentMethod,
'paypal_redirect',
server: ENV['NEXIO_ENV'] || 'sandbox', # production || sandbox
merchant_id: ENV['NEXIO_MERCHANT_ID'],
auth_token: ENV['NEXIO_AUTH_TOKEN'],
payment_method: 'payPal',
save_token: true,
customer_redirect: true
)
config.static_model_preferences.add(
SolidusNexio::AlternativePaymentMethod,
'apple_pay_by_cyber_source',
server: ENV.fetch('NEXIO_ENV', 'sandbox'), # production || sandbox
merchant_id: ENV['NEXIO_MERCHANT_ID'],
auth_token: ENV['NEXIO_AUTH_TOKEN'],
payment_method: 'applePayCyberSource',
token_domain_presence: 'applePayDomain',
save_token: true
)
end
end
Frontend Development
- Set the
development
mode for the webpacker in line #22 ofwebpack.config.js
mode: 'development',
- Add the gem as a local one in your app
Gemfile
gem 'solidus_nexio', path: '~/apps/solidus_gems/solidus_nexio'
- Uncomment the line #52 in
app/helpers/solidus_nexio/checkout_helper.rb
`cd #{::SolidusNexio.gem_dir}; yarn webpack --config webpack.config.js` if Rails.env.development?
- Reload the page you're debugging after any change in a js-file.
-
Nota Bene
- Revert all changes above after your development is completed.
- Bump version in the following files:
lib/solidus_nexio/version.rb
package.json
- Delete the precompiled asserts in the
app/assets/javascripts/
folder - Precompile asserts for production:
yarn webpack --config webpack.config.js
- Push your update to RubyGems: (Ref: https://guides.rubygems.org/publishing/)
- Build Gem
gem build solidus_nexio
- Push Gem
gem push solidus_nexio-0.6.9.gem
- Update the gem in your app
Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/solidus_nexio.