Skip to content

Commit

Permalink
chore: run linter
Browse files Browse the repository at this point in the history
  • Loading branch information
leuke-naam committed Sep 24, 2024
1 parent 90a324b commit 5f6c30a
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions app/models/payment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class Payment < ApplicationRecord
validates :payment_type, presence: true

enum status: { failed: 0, in_progress: 1, successful: 2 }

# Keep payconiq_online because it is still present in the database
enum payment_type: { ideal: 0, payconiq_online: 1, pin: 3 }
enum transaction_type: { checkout: 0, activity: 1 }
Expand Down Expand Up @@ -50,22 +50,22 @@ def request_payment
self.token = Digest::SHA256.hexdigest("#{ member.id }#{ Time.now.to_f }#{ redirect_uri }")

webhook_url = if Rails.env.development?
"#{ ENV['NGROK_HOST'] }/api/hook/mollie"
else
Rails.application.routes.url_helpers.mollie_hook_url
end
"#{ ENV['NGROK_HOST'] }/api/hook/mollie"
else
Rails.application.routes.url_helpers.mollie_hook_url
end

payment = Mollie::Payment.create(
amount: { value: amount.to_s, currency: 'EUR' },
description: description,
webhookUrl: webhook_url,
redirectUrl: Rails.application.routes.url_helpers.payment_redirect_url(token: token),
redirectUrl: Rails.application.routes.url_helpers.payment_redirect_url(token: token)
)

self.trxid = payment.id
self.payment_uri = payment._links['checkout']['href']
self.status = :in_progress

# pin payment shouldn't have any extra work
when :pin
end
Expand Down Expand Up @@ -159,12 +159,12 @@ def activities

def status_update(new_status)
self.status = case new_status.downcase
when "succeeded", "paid"
:successful
when "expired", "canceled", "failed", "cancelled", "authorization_failed"
:failed
else
:in_progress
end
when "succeeded", "paid"
:successful
when "expired", "canceled", "failed", "cancelled", "authorization_failed"
:failed
else
:in_progress
end
end
end

0 comments on commit 5f6c30a

Please sign in to comment.