Пример #1
0
<?php

session_start();
require 'ParsianGateway.php';
define('Parsian_PIN', 'N7xv862r77428Sey1IUD');
define('CALL_BACK_URL', 'http://safarbooking.ir/pst/');
//address hamin file gozashteh shvad
$gateway = new ParsianGateway(Parsian_PIN);
if (isset($_POST['act'])) {
    $act = $_POST['act'];
    switch ($act) {
        case 'PinPaymentRequest':
            $_SESSION['callback'] = $_POST['callback'];
            $result = $gateway->PinPaymentRequest($_POST['amount'], $_POST['orderid'], CALL_BACK_URL);
            if ($result) {
                echo json_encode(array('err' => 1));
            } else {
                echo json_encode(array('err' => 0, 'status' => $result['status'], 'authority' => $result['authority']));
            }
            break;
        case 'redirect':
            $gateway->Redirect_GateWay($_POST['au'], $_POST['status']);
            break;
        case 'PinPaymentEnquiry':
            $result = $gateway->PinPaymentEnquiry($_POST['au'], $_POST['status']);
            echo json_encode(array('status' => $result));
            break;
    }
}
if (isset($_GET['au'])) {
    $data = '<form method="GET" action="' . $_SESSION['callback'] . '" id="myForm">';
Пример #2
0
         $invcdtl = new InvoiceDetail();
         $invcdtl->invoice = $invc_num;
         $invcdtl->room = $detail['id'];
         $invcdtl->room_title = '';
         $invcdtl->adult = 0;
         $invcdtl->child = 0;
         $invcdtl->amount = $detail['price'];
         $invcdtl->save();
     }
 } else {
     $app = new AppController();
     $app->Erro('متاسفانه درتکمیل   فرآیند  خطایی رخ داد');
 }
 if ($_POST['paymentype'] == 'parsian') {
     $gt = new ParsianGateway(Parsian_PIN);
     $st = $gt->PinPaymentRequest($totalamont, time(), Base_URL . '?controller=bank&action=callback');
     if ($st && $st['authority'] && $st['status'] == 0) {
         $trans = new Transaction();
         $trans->amount = $totalamont;
         if (isset($_SESSION['user']['id'])) {
             $trans->user = $_SESSION['user']['id'];
             $trans->email = $_SESSION['user']['email'];
             $trans->name = $_SESSION['user']['name'];
             $trans->family = $_SESSION['user']['family'];
         } else {
             $u = new user();
             $trans->user = $u->Get_Guest_ID();
             $trans->email = '';
             $trans->name = '';
             $trans->family = '';
         }