This repository has been archived by the owner on Jun 24, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge commit 'c3ba4a85c1bb9f620b7d6cd344d6d8477e567608' into tests
- Loading branch information
Showing
12 changed files
with
1,693 additions
and
440 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,10 @@ | ||
## [Unreleased] | ||
|
||
## [0.1.0] - 2022-10-18 | ||
|
||
- Initial release | ||
## [0.1.5] | ||
### Added | ||
- Initial Version | ||
## [0.1.6] | ||
### Added | ||
- Docker Compose Installation Recognition | ||
- Refactored some tests | ||
- Added lib tasks helper to created rake tasks for blockchain |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
# frozen_string_literal: true | ||
|
||
class Api::V1::TicketManagerController < Api::V1::ApplicationController | ||
before_action :unauthorized? | ||
before_action :block_transactions_empty?, only: [:open_ticket] | ||
|
||
def open_ticket | ||
return ticket_already_opened_response unless ticket_nil? | ||
return ticket_already_opened_response if ticket_active? | ||
return terms_not_confirmed_response unless ticket_params_confirmed? | ||
create_ticket if acceptable_create? | ||
ticket_opened_response | ||
end | ||
|
||
|
||
private | ||
def ticket_nil? | ||
ticket.nil? | ||
end | ||
|
||
def ticket_active? | ||
return false if ticket_nil? | ||
ticket.status == "active" | ||
end | ||
|
||
def acceptable_create? | ||
ticket_nil? && ticket_params_confirmed? || ticket_params_confirmed? && ticket_active? == false | ||
end | ||
|
||
def ticket_params_confirmed? | ||
open_ticket_params[:ticket_terms] == "confirmed" | ||
end | ||
|
||
def ticket_already_opened_response | ||
render json: { error: "Ticket already opened" }, status: :not_found | ||
end | ||
|
||
def ticket_opened_response | ||
render json: { message: "Ticket opened" }, status: :ok | ||
end | ||
|
||
def terms_not_confirmed_response | ||
render json: { error: "Ticket terms not confirmed" }, status: :not_found | ||
end | ||
|
||
def open_ticket_params | ||
params.permit(:ticket_terms) | ||
end | ||
|
||
def time_ref | ||
@time_ref = block_transactions.first.created_at.to_s | ||
end | ||
|
||
def user_id | ||
@user_id = user.id.to_s | ||
end | ||
|
||
def current_pool_id | ||
@current_pool_id = current_pool.id.to_s | ||
end | ||
|
||
def create_ticket | ||
CreateTicketWorker.perform_async(user_id, current_pool_id, time_ref) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Sidekiq.strict_args! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"result": { | ||
"line": 81.24 | ||
"line": 83.46 | ||
} | ||
} |
Oops, something went wrong.