Skip to content

Commit

Permalink
Merge pull request #65 from Lostmyname/fix-refund-lost-cents
Browse files Browse the repository at this point in the history
Fix for refund amount losing cents
  • Loading branch information
Dylan C. Kendal committed Jan 7, 2016
2 parents 037b218 + da5a35b commit e1e06db
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/models/spree/adyen/notification_processor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def handle_modification_event

elsif notification.refund?
payment.refunds.create!(
amount: notification.value / 100, # cents to dollars
amount: notification.value / 100.0, # cents to dollars
transaction_id: notification.psp_reference,
refund_reason_id: ::Spree::RefundReason.first.id # FIXME
)
Expand Down
5 changes: 5 additions & 0 deletions spec/models/spree/adyen/notification_processor_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,11 @@
from(0).
to(1)
end

it "creates a refund of the correct value" do
subject
expect(payment.reload.refunds.last.amount).to eq 23.99
end
end

context "when refunded from Solidus" do
Expand Down

0 comments on commit e1e06db

Please sign in to comment.