forked from solidusio/solidus_braintree
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make Spree::CreditCard more flexible for handling paypal payments by …
…marshalling payment info into json field. * Add data json field to credit_card * Marshal payment info received from braintree into data field * Look at data field for credit card attributes, fall back to super * Add additional specs for paypal functionality * Update README
- Loading branch information
1 parent
9f095e8
commit 38e69af
Showing
40 changed files
with
2,285 additions
and
1,854 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
source 'https://rubygems.org' | ||
|
||
# Specify your gem's dependencies in solidus_braintree.gemspec | ||
#gem "solidus", github: "solidusio/solidus", branch: "master" | ||
gem "solidus", github: "solidusio/solidus", branch: "master" | ||
gemspec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
module UseDataFieldConcern | ||
extend ActiveSupport::Concern | ||
included do | ||
prepend(InstanceMethods) | ||
end | ||
|
||
module InstanceMethods | ||
|
||
def email | ||
details["email"] | ||
end | ||
|
||
def display_number | ||
cc_type == 'paypal' ? email : super | ||
end | ||
|
||
def details | ||
@details ||= (data.is_a?(String) ? JSON.parse(data) : data) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
Spree::CreditCard.include SolidusBraintree::SkipRequireCardNumbersConcern | ||
Spree::CreditCard.include SolidusBraintree::AddNameValidationConcern | ||
Spree::CreditCard.include SolidusBraintree::UseDataFieldConcern |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/usr/bin/env ruby | ||
|
||
ENGINE_ROOT = File.expand_path('../..', __FILE__) | ||
ENGINE_PATH = File.expand_path('../../lib/solidus_braintree/engine', __FILE__) | ||
|
||
require 'rails/all' | ||
require 'rails/engine/commands' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class AddDataToCreditCard < ActiveRecord::Migration | ||
def change | ||
add_column :spree_credit_cards, :data, :json | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
module SolidusBraintree | ||
VERSION = "0.1.5" | ||
VERSION = "0.1.6" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.