Skip to content
This repository has been archived by the owner on Jun 11, 2023. It is now read-only.

Add Virus collect feature #386

Merged
merged 9 commits into from
Feb 16, 2018

Conversation

renatomassaro
Copy link
Member

@renatomassaro renatomassaro commented Feb 14, 2018

This PR is meant to allow players to collect money off of active viruses and have the earnings transferred to their bank account / bitcoin wallet.

  • VirusCollectProcess
  • VirusFlow
  • VirusPublic
  • collect/2 on VirusAction
  • VirusHandler
  • Collect verifications on VirusHenforcer
  • Doc / spec / test everything
  • VirusCollectRequest
  • Events
    • VirusCollectedEvent
    • VirusCollectProcessedEvent
  • Gradual reward collect (Accumulate virus rewards gradually when hardware changes #308). Postponed.
  • Review

Incidental

  • src_atm_id, src_acc_number, tgt_atm_id and tgt_acc_number were added to the Process struct
  • BankHenforcer and owns_bank_account? check on EntityHenforcer
  • Added BankAccountUpdatedEvent (part of Add Bank-related requests/events #361)
  • Added BankAction.direct_deposit/2
  • order macro on HELL.Ecto.Macros

This change is Reviewable

@renatomassaro renatomassaro force-pushed the virus-collect branch 2 times, most recently from 2e63df1 to 53dac79 Compare February 15, 2018 14:35
@sourcelevel-bot
Copy link

Ebert has finished reviewing this Pull Request and has found:

  • 2 possible new issues (including those that may have been commented here).

You can see more details about this review at https://ebertapp.io/github/HackerExperience/Helix/pulls/386.

@renatomassaro
Copy link
Member Author

Reviewed 55 of 55 files at r1.
Review status: all files reviewed at latest revision, 12 unresolved discussions.


lib/network/henforcer/bounce.ex, line 113 at r1 (raw file):

  end

  # REVIEW: Why the empty map?

Review


lib/software/action/virus.ex, line 34 at r1 (raw file):

  """
  def collect(file, payment_info) do
    virus = VirusQuery.fetch(file.file_id)

Add this into the with


lib/software/internal/virus.ex, line 134 at r1 (raw file):

    result = force_activate_virus(virus, storage_id)

    # Review: really? because comment says only `:nothing`

Review


lib/software/model/virus.ex, line 104 at r1 (raw file):

  end

  def calculate_earnings(

doc + spec


lib/software/model/virus.ex, line 107 at r1 (raw file):

    _file = %File{}, _virus = %Virus{is_active?: true}, _saved_earnings)
    do
    # Obviously TODO

Add issue about global Balance module and reference it


lib/software/process/virus/collect.ex, line 125 at r1 (raw file):

    end

    target_bank_account(_, _, _, %{virus: %{software_type: :virus_miner}}) do

doc


lib/software/websocket/requests/virus/collect.ex, line 20 at r1 (raw file):

  def check_params(request, socket) do
    check_account_info =

doc


lib/software/websocket/requests/virus/collect.ex, line 42 at r1 (raw file):

      true <- valid_bank_info?(atm_id, account_number),

      # Viruses must not be an empty list

Use backquotes


lib/software/websocket/requests/virus/collect.ex, line 138 at r1 (raw file):

  render_empty()

  defp valid_bank_info?(nil, nil),

spec


lib/software/websocket/requests/virus/collect.ex, line 145 at r1 (raw file):

    do: false

  defp valid_payment_info?({nil, nil}, nil),

spec


test/support/software/setup/virus.ex, line 33 at r1 (raw file):

      end

    virus =

doc the extra conditional


test/universe/bank/henforcer/bank_test.exs, line 25 at r1 (raw file):

    test "rejects when account does not exist" do

extra line


Comments from Reviewable

@renatomassaro
Copy link
Member Author

Reviewed 10 of 10 files at r2.
Review status: all files reviewed at latest revision, all discussions resolved.


Comments from Reviewable

@renatomassaro renatomassaro merged commit f768e02 into HackerExperience:master Feb 16, 2018
@renatomassaro renatomassaro deleted the virus-collect branch February 16, 2018 16:49
@GodlyOne123
Copy link

when will we next hear about an update for he2?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants