diff --git a/app/controllers/solidus_paypal_braintree/transactions_controller.rb b/app/controllers/solidus_paypal_braintree/transactions_controller.rb index 957347f5..0e6f77ef 100644 --- a/app/controllers/solidus_paypal_braintree/transactions_controller.rb +++ b/app/controllers/solidus_paypal_braintree/transactions_controller.rb @@ -1,5 +1,4 @@ class SolidusPaypalBraintree::TransactionsController < Spree::StoreController - PERMITTED_BRAINTREE_TRANSACTION_PARAMS = [ :nonce, :payment_type, @@ -29,6 +28,7 @@ def create end private + def transaction_params params.require(:transaction) .permit(PERMITTED_BRAINTREE_TRANSACTION_PARAMS) diff --git a/app/models/solidus_paypal_braintree/transaction.rb b/app/models/solidus_paypal_braintree/transaction.rb index 202b9a2d..f2fdd26f 100644 --- a/app/models/solidus_paypal_braintree/transaction.rb +++ b/app/models/solidus_paypal_braintree/transaction.rb @@ -22,6 +22,5 @@ class Transaction def address_attributes=(attributes) self.address = TransactionAddress.new attributes end - end end diff --git a/app/models/solidus_paypal_braintree/transaction_import.rb b/app/models/solidus_paypal_braintree/transaction_import.rb index 1e5d36a0..568235df 100644 --- a/app/models/solidus_paypal_braintree/transaction_import.rb +++ b/app/models/solidus_paypal_braintree/transaction_import.rb @@ -1,7 +1,6 @@ require 'active_model' module SolidusPaypalBraintree - class TransactionImport attr_reader :transaction, :order @@ -55,10 +54,9 @@ def address end protected + def advance_order - until order.state == "confirm" do - order.next! - end + order.next! until order.state == "confirm" end end end diff --git a/spec/models/solidus_paypal_braintree/transaction_import_spec.rb b/spec/models/solidus_paypal_braintree/transaction_import_spec.rb index 811d377c..14e5d88c 100644 --- a/spec/models/solidus_paypal_braintree/transaction_import_spec.rb +++ b/spec/models/solidus_paypal_braintree/transaction_import_spec.rb @@ -15,7 +15,7 @@ context 'order has a user' do let(:user) { Spree::User.new } - let(:order) { Spree::Order.new user: user } + let(:order) { Spree::Order.new user: user } it 'associates user to the source' do expect(subject.user).to eq user @@ -110,9 +110,7 @@ subject expect(order.payments.first.amount).to eq 16 end - end end - end end diff --git a/spec/models/solidus_paypal_braintree/transaction_spec.rb b/spec/models/solidus_paypal_braintree/transaction_spec.rb index 6264452b..08bf9165 100644 --- a/spec/models/solidus_paypal_braintree/transaction_spec.rb +++ b/spec/models/solidus_paypal_braintree/transaction_spec.rb @@ -1,14 +1,14 @@ require 'spec_helper' describe SolidusPaypalBraintree::Transaction do - describe "#valid?" do - - let(:valid_attributes) { { - nonce: 'abcde-fghjkl-lmnop', - payment_method: SolidusPaypalBraintree::Gateway.new, - payment_type: 'ApplePayCard' - } } + let(:valid_attributes) do + { + nonce: 'abcde-fghjkl-lmnop', + payment_method: SolidusPaypalBraintree::Gateway.new, + payment_type: 'ApplePayCard' + } + end subject { described_class.new(valid_attributes).valid? } @@ -33,6 +33,5 @@ let(:valid_attributes) { super().except(:payment_type) } it { is_expected.to be false } end - end end