plateforme-tfjm2/server_files/classes/PaymentMethod.php

62 lines
1.3 KiB
PHP

<?php
class PaymentMethod
{
const CREDIT_CARD = 1;
const BANK_CHECK = 2;
const BANK_TRANSFER = 3;
const CASH = 4;
const SCHOLARSHIP = 5;
const NOT_PAID = 0;
public static function getTranslatedName($status) {
switch ($status) {
case self::CREDIT_CARD:
return "Carte bancaire";
case self::BANK_CHECK:
return "Chèque";
case self::BANK_TRANSFER:
return "Virement";
case self::CASH:
return "Espèce";
case self::SCHOLARSHIP:
return "Je suis boursier";
default:
return "Pas encore payé";
}
}
public static function getName($status) {
switch ($status) {
case self::CREDIT_CARD:
return "CREDIT_CARD";
case self::BANK_CHECK:
return "BANK_CHECK";
case self::BANK_TRANSFER:
return "BANK_TRANSFER";
case self::CASH:
return "CASH";
case self::SCHOLARSHIP:
return "SCHOLARSHIP";
default:
return "NOT_PAID";
}
}
public static function fromName($name) {
switch ($name) {
case "CREDIT_CARD":
return self::CREDIT_CARD;
case "BANK_CHECK":
return self::BANK_CHECK;
case "BANK_TRANSFER":
return self::BANK_TRANSFER;
case "CASH":
return self::CASH;
case "SCHOLARSHIP":
return self::SCHOLARSHIP;
default:
return self::NOT_PAID;
}
}
}