Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for refund amount losing cents #65

Merged
merged 1 commit into from
Jan 7, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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