alliance journal stuff

This commit is contained in:
2019-08-04 01:22:49 -05:00
parent 4701abc691
commit 396d02e7a3
6 changed files with 102 additions and 16 deletions

View File

@@ -13,15 +13,15 @@ use App\Library\Esi\Esi;
use App\Models\Finances\CorpMarketJournal;
class MarketTax {
class AllianceMarketTax {
public function InsertMarketTax($journal, $corpId, $division) {
//Create the ESI Helper class
$esiHelper = new Esi;
//Check to see if we can find the entry in the database already.
//If we don't then add it to the database
if(!CorpMarketJournal::where(['id' => $journal['id']])->exists()) {
$entry = new CorpMarketJournal;
if(!AllianceMarketJournal::where(['id' => $journal['id']])->exists()) {
$entry = new AllianceMarketJournal;
$entry->id = $journal['id'];
$entry->corporation_id = $corpId;
$entry->division = $division;

View File

@@ -72,7 +72,7 @@ class FinanceHelper {
try {
$journals = $esi->invoke('get', '/corporations/{corporation_id}/wallets/{division}/transactions/', [
'corporation_id' => 98287666,
'division' => 3,
'division' => 5,
]);
} catch(RequestFailedException $e) {
Log::critical($e->getEsiResponse());
@@ -85,7 +85,7 @@ class FinanceHelper {
//For each transactional entry, attempt to store it in the database.
//The PutWalletJournal function checks to see if it's already in the database.
foreach($wallet as $entry) {
if($division == 3 && $charId == 94415555) {
if($division == 5 && $charId == 94415555) {
if(in_array($entry['type_id'], $pi_items, false)) {
$pi = new PISale();
$pi->InsertPISale($entry, 98287666);
@@ -103,15 +103,13 @@ class FinanceHelper {
$industry = new StructureIndustryTax();
$office = new OfficeFee();
$esiHelper = new Esi();
$lookups = new LookupHelper;
//Get the ESI refresh token for the corporation to add new wallet journals into the database
$token = $esiHelper->GetToken($charId, 'esi-wallet.read_corporation_wallets.v1');
if($token == null) {
return null;
}
//Declare the lookup class helper
$lookups = new LookupHelper;
}
//Reference to see if the character is in our look up table for corporations and characters
$corpId = $lookups->LookupCharacter($charId);
@@ -269,7 +267,7 @@ class FinanceHelper {
public function GetWalletJournalPage($division, $charId, $page = 1) {
//Declare new class variables
$market = new MarketTax();
$market = new AllianceMarketTax();
$reprocessing = new ReprocessingTax();
$jb = new JumpBridgeTax();
$other = new PlayerDonation();
@@ -277,15 +275,13 @@ class FinanceHelper {
$office = new OfficeFee();
$pi = new PlanetProductionTax();
$esiHelper = new Esi();
$lookups = new LookupHelper;
//Get the ESI refresh token for the corporation to add new wallet journals into the database
$token = $esiHelper->GetToken($charId, 'esi-wallet.read_corporation_wallets.v1');
if($token == null) {
return null;
}
//Declare the lookup class helper
$lookups = new LookupHelper;
}
//Reference to see if the character is in our look up table for corporations and characters
$corpId = $lookups->LookupCorporationId($charId);

View File

@@ -0,0 +1,41 @@
<?php
namespace App\Models\Finances;
use Illuminate\Database\Eloquent\Model;
class AllianceMarketJournal extends Model
{
/**
* Table Name
*/
protected $table = 'alliance_market_journal';
/**
* Timestamps
*/
public $timestamps = true;
/**
* The attributes that are mass assignable
*
* @var array
*/
protected $fillable = [
'id',
'corporation_id',
'division',
'amount',
'balance',
'context_id',
'context_id_type',
'date',
'description',
'first_party_id',
'reason',
'ref_type',
'second_party_id',
'tax',
'tax_receiver_id',
];
}

View File

@@ -0,0 +1,47 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AllianceMarketJournalTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
if(!Schema::hasTable('alliance_market_journal')) {
Schema::create('alliance_market_journal', function(Blueprint $table) {
$table->string('id')->unique();
$table->integer('corporation_id')->nullabe();
$table->integer('division')->default(0);
$table->decimal('amount', 20, 2)->nullable();
$table->decimal('balance', 20, 2)->nullable();
$table->bigInteger('context_id')->nullable();
$table->string('context_id_type')->nullable();
$table->dateTime('date')->nullabe();
$table->string('description')->nullabe();
$table->integer('first_party_id')->nullable();
$table->string('reason')->default(' ');
$table->string('ref_type')->nullabe();
$table->integer('second_party_id')->nullable();
$table->decimal('tax', 20, 2)->default(0.00);
$table->integer('tax_receiver_id')->nullable();
$table->timestamps();
});
}
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('alliance_market_journal');
}
}

View File

@@ -62,10 +62,10 @@ return array(
'App\\Library\\Contracts\\EveContractsHelper' => $baseDir . '/app/Library/Contracts/EveContractsHelper.php',
'App\\Library\\Esi\\Esi' => $baseDir . '/app/Library/Esi/Esi.php',
'App\\Library\\Esi\\Mail' => $baseDir . '/app/Library/Esi/Mail.php',
'App\\Library\\Finances\\AllianceMarketTax' => $baseDir . '/app/Library/Finances/AllianceMarketTax.php',
'App\\Library\\Finances\\CorpMarketTax' => $baseDir . '/app/Library/Finances/CorpMarketTax.php',
'App\\Library\\Finances\\Helper\\FinanceHelper' => $baseDir . '/app/Library/Finances/Helper/FinanceHelper.php',
'App\\Library\\Finances\\JumpBridgeTax' => $baseDir . '/app/Library/Finances/JumpBridgeTax.php',
'App\\Library\\Finances\\MarketTax' => $baseDir . '/app/Library/Finances/MarketTax.php',
'App\\Library\\Finances\\OfficeFee' => $baseDir . '/app/Library/Finances/OfficeFee.php',
'App\\Library\\Finances\\PISale' => $baseDir . '/app/Library/Finances/PISale.php',
'App\\Library\\Finances\\PlanetProductionTax' => $baseDir . '/app/Library/Finances/PlanetProductionTax.php',
@@ -91,6 +91,7 @@ return array(
'App\\Models\\Doku\\DokuUser' => $baseDir . '/app/Models/Doku/DokuUser.php',
'App\\Models\\Esi\\EsiScope' => $baseDir . '/app/Models/Esi/EsiScope.php',
'App\\Models\\Esi\\EsiToken' => $baseDir . '/app/Models/Esi/EsiToken.php',
'App\\Models\\Finances\\AllianceMarketJournal' => $baseDir . '/app/Models/Finances/AllianceMarketJournal.php',
'App\\Models\\Finances\\CorpMarketJournal' => $baseDir . '/app/Models/Finances/CorpMarketJournal.php',
'App\\Models\\Finances\\JumpBridgeJournal' => $baseDir . '/app/Models/Finances/JumpBridgeJournal.php',
'App\\Models\\Finances\\OfficeFeesJournal' => $baseDir . '/app/Models/Finances/OfficeFeesJournal.php',

View File

@@ -525,10 +525,10 @@ class ComposerStaticInitc3f953f8a7291d41a76e1664339777c9
'App\\Library\\Contracts\\EveContractsHelper' => __DIR__ . '/../..' . '/app/Library/Contracts/EveContractsHelper.php',
'App\\Library\\Esi\\Esi' => __DIR__ . '/../..' . '/app/Library/Esi/Esi.php',
'App\\Library\\Esi\\Mail' => __DIR__ . '/../..' . '/app/Library/Esi/Mail.php',
'App\\Library\\Finances\\AllianceMarketTax' => __DIR__ . '/../..' . '/app/Library/Finances/AllianceMarketTax.php',
'App\\Library\\Finances\\CorpMarketTax' => __DIR__ . '/../..' . '/app/Library/Finances/CorpMarketTax.php',
'App\\Library\\Finances\\Helper\\FinanceHelper' => __DIR__ . '/../..' . '/app/Library/Finances/Helper/FinanceHelper.php',
'App\\Library\\Finances\\JumpBridgeTax' => __DIR__ . '/../..' . '/app/Library/Finances/JumpBridgeTax.php',
'App\\Library\\Finances\\MarketTax' => __DIR__ . '/../..' . '/app/Library/Finances/MarketTax.php',
'App\\Library\\Finances\\OfficeFee' => __DIR__ . '/../..' . '/app/Library/Finances/OfficeFee.php',
'App\\Library\\Finances\\PISale' => __DIR__ . '/../..' . '/app/Library/Finances/PISale.php',
'App\\Library\\Finances\\PlanetProductionTax' => __DIR__ . '/../..' . '/app/Library/Finances/PlanetProductionTax.php',
@@ -554,6 +554,7 @@ class ComposerStaticInitc3f953f8a7291d41a76e1664339777c9
'App\\Models\\Doku\\DokuUser' => __DIR__ . '/../..' . '/app/Models/Doku/DokuUser.php',
'App\\Models\\Esi\\EsiScope' => __DIR__ . '/../..' . '/app/Models/Esi/EsiScope.php',
'App\\Models\\Esi\\EsiToken' => __DIR__ . '/../..' . '/app/Models/Esi/EsiToken.php',
'App\\Models\\Finances\\AllianceMarketJournal' => __DIR__ . '/../..' . '/app/Models/Finances/AllianceMarketJournal.php',
'App\\Models\\Finances\\CorpMarketJournal' => __DIR__ . '/../..' . '/app/Models/Finances/CorpMarketJournal.php',
'App\\Models\\Finances\\JumpBridgeJournal' => __DIR__ . '/../..' . '/app/Models/Finances/JumpBridgeJournal.php',
'App\\Models\\Finances\\OfficeFeesJournal' => __DIR__ . '/../..' . '/app/Models/Finances/OfficeFeesJournal.php',