1
0
mirror of https://gitlab.com/animath/si/plateforme.git synced 2025-06-26 05:57:39 +02:00

Page de paiement (en cours)

This commit is contained in:
Yohann
2020-01-01 21:53:46 +01:00
parent 69c453c408
commit d81ad02235
7 changed files with 95 additions and 24 deletions

View File

@ -422,6 +422,22 @@ class User
return $docs;
}
public function getPayment() {
global $DB;
$team = Team::fromId($this->team_id);
$tournament = $team->getEffectiveTournament();
$req = $DB->prepare("SELECT `id` FROM `payments` WHERE `user` = ? AND `tournament` = ?;");
$req->execute([$this->id, $tournament->getId()]);
if (($data = $req->fetch()) !== false)
return Payment::fromId($data["id"]);
$req = $DB->prepare("INSERT INTO `payments`(`user`, `tournament`, `amount`, `method`, `transaction_infos`, `validation_status`) VALUES (?, ?, ?, ?, ?, ?);");
$req->execute([$this->id, $tournament->getId(), 0, PaymentMethod::getName(PaymentMethod::NOT_PAID), "L'inscription n'est pas encore payée.", ValidationStatus::getName(ValidationStatus::NOT_READY)]);
}
public function getOrganizedTournaments()
{
global $DB;