Skip to content
This repository has been archived by the owner on Jan 3, 2025. It is now read-only.

Add has_paid and payment_statuses in payload #717

Merged
merged 2 commits into from
Nov 4, 2024
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
5 changes: 4 additions & 1 deletion app/controllers/registration_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,7 @@ def get_registrations(competition_id, only_attending: false)
end
else
Registration.where(competition_id: competition_id).all.map do |x|
payment_status = x.payment_status
{ user_id: x['user_id'],
competing: {
event_ids: x.event_ids,
Expand All @@ -313,7 +314,9 @@ def get_registrations(competition_id, only_attending: false)
admin_comment: x.admin_comment,
},
payment: {
payment_status: x.payment_status,
payment_status: payment_status,
payment_statuses: [payment_status],
has_paid: payment_status == 'succeeded',
payment_amount_iso: x.payment_amount,
payment_amount_human_readable: x.payment_amount_human_readable,
updated_at: x.payment_date,
Expand Down
2 changes: 1 addition & 1 deletion lib/competition_info.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def guest_limit
end

def registration_open?
@competition_json['registration_open'] <= Time.now && @competition_json['registration_close'] > Time.now
@competition_json['registration_open'] <= Time.now.utc && @competition_json['registration_close'] > Time.now.utc
end

def using_wca_payment?
Expand Down
Loading