Skip to content

Commit

Permalink
Ensure device_data is added to the gateway_options hash.
Browse files Browse the repository at this point in the history
  • Loading branch information
hectoregm committed May 9, 2016
1 parent 19054fe commit 3563fc0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions app/models/payment_decorator.rb
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
Spree::Payment.include SolidusBraintree::PaymentBraintreeNonceConcern
Spree::Payment.include SolidusBraintree::InjectDeviceDataConcern
12 changes: 11 additions & 1 deletion spec/models/spree/payment_spec.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
require 'spec_helper'

describe Spree::Payment, type: :model do
let(:payment) { Spree::Payment.new }
let(:device_data){"{\"device_session_id\":\"75197918b634416368241bb8996b560c\",\"fraud_merchant_id\":\"600000\"}"}

it "has a payment_method_nonce accessor" do
payment = Spree::Payment.new

expect { payment.payment_method_nonce = "abc123" }.not_to raise_error
expect(payment.payment_method_nonce).to eq("abc123")
end

it 'adds device_data from the associated order to gateway_options hash' do
payment = create(:payment)

payment.order.update_attribute(:braintree_device_data, device_data)
expect(payment.gateway_options[:device_data]).to be_present
end
end

0 comments on commit 3563fc0

Please sign in to comment.