* 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301, USA. */ require_once '../../core.php'; //change to your gateway's name define('GWNAME', 'othertestgateway'); define('INVOICE', (int) $_REQUEST['inv']); define('AMOUNT', (int) $_REQUEST['received']); define('KEY', $_REQUEST['secretkey']); define('COMMENT', ''); $gm = GatewayModule::getInstance(); $curr = Currency::getInstance(); $service = Service::getInstance(); $invoice = Invoice::getInstance(); $tr = Transaction::getInstance(); //finding ID for this gateway $gwid = $gm->GetID(GWNAME); if (!$gwid) { die("This gateway is not activated and configured to accept payments"); } $gmdata = $gm->FetchData($gwid); $invdata = $invoice->FetchData(INVOICE); $currency = $curr->FetchData($curr->GetID($gmdata['currency'], 'name')); //$currency = $curr->GetCurrency('',$gmdata['currency']); $gateway_data = unserialize($gmdata['data']); if ($invdata['amount'] > AMOUNT * $currency['rate']) {
public static function ManageTrans() { $xtpl = self::$xtpl; $user = User::getInstance(); $gm = GatewayModule::getInstance(); if (!is_numeric(self::$page)) { $page = 1; } else { $page = self::$page; } $xtpl->assign('FINCURR', 'current'); $xtpl->assign('MANAGETRANS', 'current'); $trans = Transaction::getInstance(); $transbutch = $trans->GetButch(self::$per_page, 1, 'id', 'DESC', self::$per_page * $page - self::$per_page); if (count($transbutch) > 0) { for ($i = 0; $i < count($transbutch); $i++) { $username = ''; $gatewayname = ''; if (!is_numeric($transbutch[$i]['customerid']) || !is_string($username = $user->GetUsername($transbutch[$i]['customerid']))) { self::add_message($xtpl, 'attention', 'User #' . $transbutch[$i]['customerid'] . ' not found for transaction #' . $transbutch[$i]['id']); } else { $xtpl->assign('USERNAME', $username); } if (!is_numeric($transbutch[$i]['gatewayid']) || !is_string($gatewayname = $gm->GetName($transbutch[$i]['gatewayid']))) { self::add_message($xtpl, 'attention', 'Payment gateway #' . $transbutch[$i]['gatewayid'] . ' not found for transaction #' . $transbutch[$i]['id']); } else { $xtpl->assign('GATEWAYNAME', $gatewayname); } $xtpl->assign('TRANS', $transbutch[$i]); $xtpl->parse('main.managetrans.transtable.transrow'); } for ($i = 1; $i <= self::count_pages($trans->Calculate()); $i++) { if ($page == $i) { $xtpl->assign('CURRENT', 'current'); } else { $xtpl->assign('CURRENT', ''); } $xtpl->assign('NUM', $i); if (preg_match('/page=[0-9]+/', self::$request_uri)) { $link = preg_replace('/page=[0-9]+/', 'page=' . $i, self::$request_uri); } else { $link = self::$request_uri . '&page=' . $i; } $xtpl->assign('LINK', $link); $xtpl->parse('main.managetrans.transtable.page'); } $xtpl->parse('main.managetrans.transtable'); } else { $xtpl->parse('main.managetrans.transinfo'); } $xtpl->parse('main.managetrans'); $xtpl->parse('main'); $xtpl->out('main'); }