Example #1
0
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with VPN.  If not, see <http://www.gnu.org/licenses/>.
*/
define("MEMBERSHIP_PRICE", 24);
define("MINIMUM_MEMBERSHIP_VPN_PRICE", 12);
define("YEAR_VPN_PRICE", 60);
define("SIXMONTHS_PRICE", 33);
require_once "config/database.php";
require_once "engine/payname/api.php";
require_once "engine/bo/OrderBo.php";
require_once "engine/bo/PaymentBo.php";
require_once "engine/bo/TicketBo.php";
$paynameApi = new PaynameApiClient($config["vpn"]["payname"]["api_url"], $config["vpn"]["payname"]["token"]);
$connection = openConnection();
$orderBo = OrderBo::newInstance($connection);
$paymentBo = PaymentBo::newInstance($connection);
$ticketBo = TicketBo::newInstance($connection);
$order = array();
$order["ord_amount"] = 0;
$order["ord_lines"] = array();
$vpnId = $_REQUEST["vpnId"];
// TODO retrieve account to put it into the order
if (isset($_REQUEST["askMembership"]) && intval($_REQUEST["askMembership"])) {
    $orderLine = array();
    $orderLine["oli_product_code"] = "membership";
    $orderLine["oli_label"] = "Adhésion à Armagnet";
    $orderLine["oli_quantity"] = "1";
    $orderLine["oli_unity_price"] = MEMBERSHIP_PRICE;
Example #2
0
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with VPN.  If not, see <http://www.gnu.org/licenses/>.
*/
define("MEMBERSHIP_PRICE", 24);
define("MINIMUM_MEMBERSHIP_VPN_PRICE", 12);
define("YEAR_VPN_PRICE", 60);
define("SIXMONTHS_PRICE", 33);
require_once "config/database.php";
require_once "engine/payname/api.php";
require_once "engine/bo/OrderBo.php";
require_once "engine/bo/PaymentBo.php";
require_once "engine/bo/TicketBo.php";
require_once "engine/bo/VpnBo.php";
$paynameApi = new PaynameApiClient($config["vpn"]["payname"]["api_url"], $config["vpn"]["payname"]["token"]);
$connection = openConnection();
$orderBo = OrderBo::newInstance($connection);
$paymentBo = PaymentBo::newInstance($connection);
$ticketBo = TicketBo::newInstance($connection);
$orderId = $_REQUEST["oid"];
$payment = $paymentBo->getPaymentByOrderId($orderId);
// print_r($payment);
if ($payment["pay_type"] == "ticket") {
    $ticket = $ticketBo->getTicket($payment["pay_ticket_id"]);
    $response = array();
    $response["createdAt"] = new DateTime();
    $response["createdAt"] = $response["createdAt"]->format("Y-m-d H:i:s");
    if (!$ticket || $ticket["tic_use_date"]) {
        $response["status"] = "failed";
    } else {