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

fix: automatic payments (MercadoPago and PagSeguro) #8

Open
wants to merge 17 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,15 @@ MERCADOPAGO_TOKEN=''
MERCADOPAGO_KEY=''
MERCADOPAGO_CLIENTID=''
MERCADOPAGO_SECRET=''
MERCADOPAGO_PAYMENT='sandbox'

# Paypal
PAYPAL_CLIENTID=''
PAYPAL_SECRET=''

# Donate
DONATE_MAX_INSTALLMENT=3

# Mail
MAIL_SMTP='smtp://localhost'
MAIL_WEB='contact@canaryaac.com'
Expand Down
4 changes: 0 additions & 4 deletions app/Controller/Admin/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,8 @@

namespace App\Controller\Admin;

use App\Model\Entity\Polls as EntityPolls;
use App\Model\Functions\Polls as FunctionsPolls;
use App\Controller\Admin\SweetAlert;
use App\Model\Entity\ServerConfig as EntityServerConfig;
use App\Model\Functions\ClientEditor;
use RuntimeException;
use App\Utils\View;

class Client extends Base
Expand Down
6 changes: 3 additions & 3 deletions app/Controller/Admin/Compendium.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public static function insertCompendium($request)
'category' => $filter_category,
'headline' => $convert_headline,
'message' => $postVars['compendium_message'],
'publishdate' => strtotime(date('m-d-Y h:i:s')),
'publishdate' => strtotime(date('m-d-Y H:i:s')),
'type' => 1, // REGULAR
]);
$status = Alert::getSuccess('Criado com sucesso.');
Expand All @@ -122,7 +122,7 @@ public static function getAllCompendium()
'id' => $compendium->id,
'index' => $index,
'message' => $compendium->message,
'publishdate' => date('M d Y h:i:s', $compendium->publishdate),
'publishdate' => date('M d Y H:i:s', $compendium->publishdate),
'type' => 'REGULAR',
];
}
Expand All @@ -137,7 +137,7 @@ public static function getCompendiumById($compendium_id)
'category' => $compendium->category,
'headline' => $compendium->headline,
'message' => $compendium->message,
'publishdate' => date('M d Y h:i:s', $compendium->publishdate),
'publishdate' => date('M d Y H:i:s', $compendium->publishdate),
'type' => 'REGULAR',
];
return $arrayCompendium;
Expand Down
7 changes: 4 additions & 3 deletions app/Controller/Admin/Donates.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

use App\Model\Entity\Account as EntityAccount;
use App\Utils\View;
use App\Model\Entity\PaymentStatus;
use App\Model\Entity\Payments as EntityPayments;
use App\Model\Entity\ServerConfig as EntityServerConfig;
use App\Model\Functions\Payments as PaymentsFunctions;
Expand All @@ -34,10 +35,10 @@ public static function getPaymentByReference($request, $reference)
'method_img' => PaymentsFunctions::convertMethodImage($payment->method),
'reference' => $payment->reference,
'total_coins' => $payment->total_coins,
'final_price' => $payment->final_price,
'status' => $payment->status,
'gross_payment' => $payment->gross_payment,
'status' => PaymentStatus::from($payment->status),
'status_badge' => PaymentsFunctions::convertStatus($payment->status),
'date' => date('d/m/Y h:i:s', $payment->date),
'date' => date('d/m/Y H:i:s', $payment->date),
];
$select_account = EntityAccount::getAccount('id = "'.$payment->account_id.'"')->fetchObject();
$arrayAccount = [
Expand Down
2 changes: 1 addition & 1 deletion app/Controller/Admin/Upload.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public static function getUploads()
'id' => $upload->id,
'name' => $upload->name,
'path' => $upload->path,
'date' => date('M d Y h:i:s', $upload->date)
'date' => date('M d Y H:i:s', $upload->date)
];
}
return $arrayUploads ?? [];
Expand Down
10 changes: 5 additions & 5 deletions app/Controller/Pages/Guilds/Applications.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,15 @@ public static function actionApplications($request,$name)
EntityGuilds::updateApplication('player_id = "'.$input_idplayer.'" AND guild_id = "'.$guild_id.'"', [
'status' => 2,
]);

$dbRanks = EntityGuilds::getRanks('guild_id = "'.$guild_id.'" AND level = 1')->fetchObject();

EntityGuilds::insertJoinMember([
'player_id' => $input_idplayer,
'guild_id' => $guild_id,
'rank_id' => $dbRanks->id,
'nick' => '',
'date' => strtotime(date('M d Y, h:i:s')),
'date' => strtotime(date('M d Y, H:i:s')),
]);
$status = 'Updated successfully.';
return self::viewApplications($request,$name,$status);
Expand Down Expand Up @@ -99,7 +99,7 @@ public static function viewApplications($request,$name,$status = null)

$dbPlayer = EntityPlayer::getPlayer('id = "'.$application->player_id.'"')->fetchObject();


switch($application->status){
case 0:
$status_app = 'open';
Expand All @@ -113,7 +113,7 @@ public static function viewApplications($request,$name,$status = null)

$applications[] = [
'player' => $dbPlayer->id,
'date' => date('M d Y, h:i:s', $application->date),
'date' => date('M d Y, H:i:s', $application->date),
'character' => $dbPlayer->name,
'level' => $dbPlayer->level,
'vocation' => FunctionPlayer::convertVocation($dbPlayer->vocation),
Expand Down
2 changes: 1 addition & 1 deletion app/Controller/Pages/Guilds/ApplyToThisGuild.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public static function insertApplyToThisGuild($request,$name)
}

$input_text = filter_var($postVars['apply_text'], FILTER_SANITIZE_SPECIAL_CHARS);
$current_date = strtotime(date('d-m-Y h:i:s'));
$current_date = strtotime(date('d-m-Y H:i:s'));

EntityGuilds::insertMyApplication([
'player_id' => $dbPlayer->id,
Expand Down
2 changes: 1 addition & 1 deletion app/Controller/Pages/Guilds/InviteCharacter.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public static function insertInviteCharacter($request,$name)
EntityGuilds::insertInvite([
'player_id' => $dbPlayer->id,
'guild_id' => $guild_id,
'date' => strtotime(date('d-m-Y h:i:s')),
'date' => strtotime(date('d-m-Y H:i:s')),
]);
$status_invite = 'Successfully invited character.';
return self::viewInviteCharacter($request,$name,$status_invite);
Expand Down
7 changes: 3 additions & 4 deletions app/Controller/Pages/Guilds/JoinGuild.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,15 @@ public static function insertJoinGuild($request,$name)
$status = 'This character is applied to another Guild.';
return self::viewJoinGuild($request,$name,$status);
}

EntityGuilds::deleteInvite('player_id = "'.$dbPlayer->id.'" AND guild_id = "'.$guild_id.'"');

$dbRanks = EntityGuilds::getRanks('guild_id = "'.$guild_id.'" AND level = 1')->fetchObject();

EntityGuilds::insertJoinMember([
'player_id' => $dbPlayer->id,
'guild_id' => $guild_id,
'rank_id' => $dbRanks->id, // MEMBER
'date' => strtotime(date('d-m-Y h:i:s')),
'date' => strtotime(date('d-m-Y H:i:s')),
]);
return self::viewJoinGuild($request,$name);
}
Expand Down
Loading