* file that was distributed with this source code.
 *
 * @author Aram Alipoor <*****@*****.**>
 * @license MIT
 */
// Composer autoloader
include_once '../vendor/autoload.php';
use Ravaj\Component\Payment\BankMellat\BankMellat;
use Ravaj\Component\Payment\BankMellat\Order;
use Ravaj\Component\Payment\BankMellat\Request;
// Initial
session_start();
$errorMessage = null;
$successMessage = null;
// Initialize a simple request helper
$request = new Request();
// Whether to use Test API (for development) or production API (for staging)
define('USE_TEST_WEBSERVICE', true);
// If form is posted OR returned back from the bank
if ($request->getMethod() === 'POST' || $request->get('RefId')) {
    try {
        // Create a BankMellat instance with provided credentials
        $bankmellat = new BankMellat($request);
        // WARNING!
        //
        // For the sake of this example I need to store credentionals in session
        // so when we're returning back from the bank we can create a BankMellat instance.
        //
        // DO NOT USE IN PRODUCTION
        if ($request->get('terminalId')) {
            $terminalId = $_SESSION['vendora.bankmellat.terminalId'] = $request->get('terminalId');
 * file that was distributed with this source code.
 *
 * @author Aram Alipoor <*****@*****.**>
 * @license MIT
 */
// Composer autoloader
include_once '../vendor/autoload.php';
use Ravaj\Component\Payment\BankMellat\BankMellat;
use Ravaj\Component\Payment\BankMellat\Order;
use Ravaj\Component\Payment\BankMellat\Request;
// Initial
session_start();
$errorMessage = null;
$successMessage = null;
// Initialize a simple request helper
$request = new Request();
// Whether to use Test API (for development) or production API (for staging)
define('USE_TEST_WEBSERVICE', true);
// If form is posted OR returned back from the bank
if ($request->getMethod() === 'POST' || $request->get('RefId')) {
    try {
        // Create a BankMellat instance with provided credentials
        $bankmellat = new BankMellat($request);
        // WARNING!
        //
        // For the sake of this example I need to store credentionals in session
        // so when we're returning back from the bank we can create a BankMellat instance.
        //
        // DO NOT USE IN PRODUCTION
        if ($request->get('terminalId')) {
            $terminalId = $_SESSION['vendora.bankmellat.terminalId'] = $request->get('terminalId');