Skip to content

Commit

Permalink
Merge pull request solidusio#35 from omnistegan/payment_total
Browse files Browse the repository at this point in the history
Update transaction_import to work correctly on solidus master
  • Loading branch information
cbrunsdon authored Oct 25, 2016
2 parents 6f850df + 2c08022 commit c26021e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
8 changes: 6 additions & 2 deletions app/models/solidus_paypal_braintree/transaction_import.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ def import!
order.next
end

if order.checkout_steps.index("payment") > (order.checkout_steps.index(order.state) || 0)
advance_order "payment"
end

order.payments.new source: source,
payment_method: transaction.payment_method,
amount: order.total
Expand Down Expand Up @@ -74,8 +78,8 @@ def address

protected

def advance_order
order.next! until order.state == "confirm"
def advance_order(state = "confirm")
order.next! until order.state == state
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ def update
@payment = Spree::PaymentCreate.new(@order, payment_params).build

if @payment.save
render text: "ok"
render plain: "ok"
else
render text: "not-ok"
render plain: "not-ok"
end
end

Expand Down

0 comments on commit c26021e

Please sign in to comment.