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

Commit

Permalink
run rubocop
Browse files Browse the repository at this point in the history
  • Loading branch information
FinnIckler committed Oct 25, 2023
1 parent 4e6ee29 commit 8824adf
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 16 deletions.
10 changes: 5 additions & 5 deletions app/controllers/internal_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class InternalController < ApplicationController
def validate_token
service_token = request.headers['X-WCA-Service-Token']
unless service_token.present?
return render json: { error: "Missing Authentication" }, status: :forbidden
return render json: { error: 'Missing Authentication' }, status: :forbidden
end
# The Vault CLI can't parse the response from identity/oidc/introspect so
# we need to request it instead see https://github.com/hashicorp/vault/issues/9080
Expand All @@ -25,8 +25,8 @@ def validate_token
headers: { 'X-Vault-Token' => vault_token_data[:id],
'Content-Type' => 'application/json' })
if response.ok?
unless response["active"]
render json: { error: "Authentication Expired or Token Invalid" }, status: :forbidden
unless response['active']
render json: { error: 'Authentication Expired or Token Invalid' }, status: :forbidden
end
else
raise "Introspection failed with the following error: #{response.status}, #{response.body}"
Expand All @@ -41,6 +41,6 @@ def update_payment_status
payment_status = params.require(:payment_status)
registration = Registration.find(attendee_id)
registration.update_payment_lane(payment_id, iso_amount, currency_iso, payment_status)
render json: { status: "ok" }
render json: { status: 'ok' }
end
end
end
3 changes: 2 additions & 1 deletion app/helpers/lane_factory.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

require 'time'

class LaneFactory
Expand All @@ -25,7 +26,7 @@ def self.payment_lane(fee_lowest_denominator, currency_code, payment_id)
payment_id: payment_id,
currency_code: currency_code,
last_updated: Time.now,
payment_history: []
payment_history: [],
}
payment_lane
end
Expand Down
20 changes: 10 additions & 10 deletions app/models/registration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -117,17 +117,17 @@ def update_payment_lane(id, iso_amount, currency_iso, status)
# TODO: Should we only add payments to the payment_history
# if there is a new payment_id?
lane.lane_details['payment_history'].append({
status: lane.lane_state,
payment_id: old_details["payment_id"],
currency_code: old_details["currency_code"],
amount_lowest_denominator: old_details["amount_lowest_denominator"],
last_updated: old_details["last_updated"]
})
status: lane.lane_state,
payment_id: old_details['payment_id'],
currency_code: old_details['currency_code'],
amount_lowest_denominator: old_details['amount_lowest_denominator'],
last_updated: old_details['last_updated'],
})
lane.lane_state = status
lane.lane_details["payment_id"] = id
lane.lane_details["amount_lowest_denominator"] = iso_amount
lane.lane_details["currency_code"] = currency_iso
lane.lane_details["last_updated"] = Time.now
lane.lane_details['payment_id'] = id
lane.lane_details['amount_lowest_denominator'] = iso_amount
lane.lane_details['currency_code'] = currency_iso
lane.lane_details['last_updated'] = Time.now
end
lane
end
Expand Down

0 comments on commit 8824adf

Please sign in to comment.