Skip to content
This repository has been archived by the owner on Mar 27, 2023. It is now read-only.

Commit

Permalink
Update Source tracking for Braintree payments
Browse files Browse the repository at this point in the history
  • Loading branch information
shivashankar-ror committed Jul 12, 2019
1 parent 5453804 commit c7f602a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions app/controllers/api/payment/braintree_controller.rb
Expand Up @@ -46,6 +46,11 @@ def oneclick_payment_errors
end

def payment_options
if params.dig(:user, :source).present?
params[:extra_action_fields] ||= {}
params[:extra_action_fields][:source] = ak_source
end

{
nonce: unsafe_params[:payment_method_nonce],
amount: unsafe_params[:amount].to_f,
Expand Down
6 changes: 6 additions & 0 deletions app/controllers/payment_controller.rb
Expand Up @@ -74,6 +74,12 @@ def builder
end
end

def ak_source
return nil unless params.dig(:user, :source).present?

'post-action-' + unsafe_params[:page_id] + '-' + params.dig(:user, :source)
end

private

def recurring?
Expand Down

0 comments on commit c7f602a

Please sign in to comment.