Skip to content

Commit 0e3f5c8

Browse files
committed
fix: add ideal as method so we return to Koala on failure
1 parent 5f6c30a commit 0e3f5c8

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

app/models/payment.rb

+9-6
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,15 @@ def request_payment
5454
else
5555
Rails.application.routes.url_helpers.mollie_hook_url
5656
end
57+
redirect_url = Rails.application.routes.url_helpers.payment_redirect_url(token: token)
5758

5859
payment = Mollie::Payment.create(
59-
amount: { value: amount.to_s, currency: 'EUR' },
60+
amount: { value: "#{'%.2f' % amount}", currency: 'EUR' },
61+
method: 'ideal', # only ideal for now
62+
issuer: issuer,
6063
description: description,
61-
webhookUrl: webhook_url,
62-
redirectUrl: Rails.application.routes.url_helpers.payment_redirect_url(token: token)
64+
webhook_url: webhook_url,
65+
redirect_url: redirect_url,
6366
)
6467

6568
self.trxid = payment.id
@@ -158,10 +161,10 @@ def activities
158161
private
159162

160163
def status_update(new_status)
161-
self.status = case new_status.downcase
162-
when "succeeded", "paid"
164+
self.status = case new_status
165+
when "paid", "authorized"
163166
:successful
164-
when "expired", "canceled", "failed", "cancelled", "authorization_failed"
167+
when "expired", "failed", "canceled"
165168
:failed
166169
else
167170
:in_progress

0 commit comments

Comments
 (0)