diff options
author | jessib <jessib@leap.se> | 2013-03-21 13:51:58 -0700 |
---|---|---|
committer | Azul <azul@leap.se> | 2013-07-17 10:46:26 +0200 |
commit | 04288c2a2179d7aa71a2fa21267e6f02fb0400e2 (patch) | |
tree | cf760c8a4ee578071ee24f613d07f62ef28b55fa /billing/app/helpers/braintree_helper.rb | |
parent | a1837914b8f989e2c45fb7b78fc648f0d3f957d6 (diff) |
Unauthenticated users can make single payments (like donations), but payments from authenticated users will be as a Braintree Customer stored in the braintree vault.
Diffstat (limited to 'billing/app/helpers/braintree_helper.rb')
-rw-r--r-- | billing/app/helpers/braintree_helper.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/billing/app/helpers/braintree_helper.rb b/billing/app/helpers/braintree_helper.rb index 3d6e887..bc78c02 100644 --- a/billing/app/helpers/braintree_helper.rb +++ b/billing/app/helpers/braintree_helper.rb @@ -7,6 +7,7 @@ module BraintreeHelper super @braintree_params = @options[:params] @braintree_errors = @options[:errors] + @braintree_existing = @options[:existing] end def fields_for(record_name, *args, &block) @@ -31,6 +32,19 @@ module BraintreeHelper def determine_value(method) if @braintree_params @braintree_params[method] + elsif @braintree_existing + + if @braintree_existing.kind_of?(Braintree::CreditCard) + + case method + when :number + method = :masked_number + when :cvv + return nil + end + end + + @braintree_existing.send(method) else nil end |