Giter VIP home page Giter VIP logo

spree-split-payments's Introduction

Spree Split Payments Code Climate Build Status

######THIS GEM IS NOT READY FOR PRODUCTION USE.

This extension provides the feature for a spree store to allow user to club payment methods to pay for the order.

Easily configurable from the admin end where one can select which payment methods should be allowed for clubbing and their priorities which can be used while creating payments and displaying them to the user.

Installation

Add spree-split-payments to your Gemfile:

gem 'spree-split-payments'

Bundle your dependencies and run the installation generator:

bundle
bundle exec rails g spree_split_payments:install

Integration

The extension needs a way to find out the maximum amount that can be made via a payment method. To do so it sends a message to the user object as:

#{payment_method.class.name.demodulize.underscore}_for_partial_payments

# for example : for Spree::PaymentMethod::LoyaltyPoints it calls for
# loyalty_points_for_partial_payments
# on current_user

So you can either

  1. Alias an exising method like
# models/spree/user_decorator.rb
alias_method :loyalty_points_for_partial_payments, :loyalty_points_equivalent_currency

# where loyalty_points_equivalent_currency is the method provided by
# Spree::PaymentMethod::LoyaltyPoints extension.
  1. Define a method under user class. For example for Spree::PaymentMethod::LoyaltyPoints)
#models/spree/user_decorator.rb
Spree::User.class_eval do
  ...

  def loyalty_points_for_partial_payments
    # logic goes here
  end

  ...

end

Testing

Be sure to bundle your dependencies and then create a dummy test app for the specs to run against.

bundle
bundle exec rake test_app
bundle exec rspec spec

When testing your applications integration with this extension you may use it's factories. Simply add this require statement to your spec_helper:

require 'spree-split-payments/factories'

Contributing

  1. Fork the repo.
  2. Clone your repo.
  3. Run bundle install.
  4. Run bundle exec rake test_app to create the test application in spec/test_app.
  5. Make your changes.
  6. Ensure specs pass by running bundle exec rspec spec.
  7. Submit your pull request.

Credits

vinsol.com: Ruby on Rails, iOS and Android developers

Copyright (c) 2014 vinsol.com, released under the New MIT License

spree-split-payments's People

Contributors

satish avatar

Watchers

James Cloos avatar sunny2601 avatar

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.