<?php
require_once "../lib/DzPay.Api.php";

class PublicPay
{
    public function pay($publicPayInput,$redirect)
    {
        $pay = new Pay();
        $result = $pay->Payment($publicPayInput,5);
        if($result->GetSuccess())
        {
            if($redirect){
                header("Location: ".$result->GetData("ToPayData"));
                exit;
            }
            else
                return $result->GetData("ToPayData");
        }
        else
        {
            echo $result->GetData("RespMessage");
        }
    }
}