Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Corp/Char journal import for selling data #10

Open
holmes-ra opened this issue Jun 20, 2011 · 1 comment
Open

Corp/Char journal import for selling data #10

holmes-ra opened this issue Jun 20, 2011 · 1 comment

Comments

@holmes-ra
Copy link
Collaborator

This is a feature request that will be able to pull data from the corp journal to get the correct profit from items sold. Below is a rough outline of how a feature might work.

The basic workflow for the seller would be as such:

  1. Change Active Wallet to designated loot payout division
  2. Sell items, check "Use Corp Account".
  3. Once all loot is sold, hit "Import API" button.
  4. Data is imported from API (corp and char) and loaded onto the page. (do we load it as text-only, or load into a text input to allow the user to change data in case they find a discrepancy? Perhaps )
  5. User hits submit, data is imported into database.

The basic workflow for the backend would be as such:

  1. When user requests API import, fetch data and check for the typeIDs. For rowcounts, use the number of loot that are being sold, and request 100 more (as a buffe, also make this configurable). So, if there's 38 loots being sold, request 138 rows of corp journal history. Since the API should be imported immediately after the loot is sold, it should be the most recent.
  2. Loop through the transaction entries, checking for typeID and characterID relating to the loot ID and seller ID, respectively. Disregard any other transactions. Stop if all the loot needing to be check has been checked.
  3. Once all the rows have been checked, check to see if all the loot has been account for. If it has, that means the corp journal contained all the needed info. If there's still some loot left without profit values, that means the seller may have sold the loot to his/her personal wallet. Check character wallet the same way as corp wallet
    3a. If the loot still hasn't been accounted for after the character wallet check, something's wrong. Display error. (Figure out what to do in these situations, since the loot has already been sold. Perhaps instruct user to look through corp and character tansaction history to try to find the problem. Or log the time and date of selling and have a director look into it.)
  4. Once all the loot has been accounted for and has a profit value associated to it, display it on the page. Using AJAX would work out well since it's able to load the API data and return it seamlessly.
  5. If seller has some in their personal account, add it up and instruct them to transfer the proper amount to the correct wallet division.
  6. Have seller look over the info and confirm, once that happens import data into database. (maybe: If they owed the corp some money, check corp wallet division journal for player's donation. Wallet journal should be fresh since earlier we were working with transactions. If not fresh, donation won't show up; log this so that it can be checked into later to confirm donation).
  7. Done!

Considerations:

  1. Old data. The wallet journal was accessed recently and the cache has not expired. Warn seller about this and disallow continuation until the cached time has passed (typically 15min).
  2. User's API has expired and is no longer active. We need this to check their journal. Display error message if this happens.

Since we need the characters API, it would be best to finish Issue #9 first so that we already have the info in the database.

@holmes-ra
Copy link
Collaborator Author

Feature completed with commit 6ac803. Only the characters API is fetched, since it also contains transactions made on behalf of the corp.

Features not completed as of above commit:
What to do when user's API is invalid
Logging the users debt into the database, and subsequently checking it every now and then to make sure they've made the corp donation.

I'll close this once those two additions are completed.

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

No branches or pull requests

1 participant