<?php
//=================================================================
// KOOBI R7 - CMS - PORTALSOFTWARE(c) DREAM4(r) 
// HTTP://WWW.DREAM4.DE
//=================================================================
// ACHTUNG!
// DIESER PROGRAMMCODE IST URHERRECHTLICH GESCHUETZT
// DIE URHEBERRECHTE LIEGEN BEI DEN JEWEILIGEN AUTOREN.
// AENDERUNGEN IN DIESER DATEI ERFOLGEN AUF EIGENE GEFAHR!
// ES IST NICHT GESTATTET, DEN COPYRIGHTHINWEIS ZU AENDERN ODER ZU
// ENTFERNEN. NUR WENN SIE EINE COPYRIGHTHINWEIS-ENTFERNUNG BESTELLT
// HABEN, DUERFEN SIE DIESEN ENTFERNEN.
//================================================================
// BEI FRAGEN WENDEN SIE SICH BITTE AN: KONTAKT@DREAM4.DE
//=================================================================
class ShopPayment
{
	function payment($ref_url)
	{
		switch($_SESSION['payment_id'])
		{
			// Ueberweisung +  Bar-Nachnahme
			case '1':
			case '2':
				$shop = new Shop;
				$GLOBALS['tmpl']->assign('content', $GLOBALS['tmpl']->fetch($GLOBALS['config']['source'] . '/shop/payment_thankyou.tpl'));
				$shop->unsetShopSessions();
			break;
			
			
			// Kreditkarte (Worldpay)
			case '3':
				$shop = new Shop;
				$payment_data = $GLOBALS['db']->ArrQuery("SELECT *, Beschreibung_" . $_SESSION['Langcode'] . " AS Beschreibung FROM " . PREFIX . "_shop_zahlungsmethoden WHERE Id = '3'");
				$GLOBALS['tmpl']->assign('payment_data', $payment_data);
				$GLOBALS['tmpl']->assign('content', $GLOBALS['tmpl']->fetch($GLOBALS['config']['source'] . '/shop/payment_worldpay.tpl'));
				$shop->unsetShopSessions();
			break;
			
			// Bankeinzug
			case '4':
				$shop = new Shop;
				$GLOBALS['tmpl']->assign('content', $GLOBALS['tmpl']->fetch($GLOBALS['config']['source'] . '/shop/payment_thankyou.tpl'));
				$shop->unsetShopSessions();
			break;
			
			// Paypal
			case '5':
				$shop = new Shop;
				$payment_data = $GLOBALS['db']->ArrQuery("SELECT *, Beschreibung_" . $_SESSION['Langcode'] . " AS Beschreibung FROM " . PREFIX . "_shop_zahlungsmethoden WHERE Id = '5'");
				$_SESSION['back_url'] = $ref_url . 'index.php?p=shop&area=' . AREA;
				$_SESSION['return_url'] = $ref_url . 'index.php?p=shop';//&area=' . AREA . '&action=thankyou_paypal';
				$GLOBALS['tmpl']->assign('payment_data', $payment_data);
				$GLOBALS['tmpl']->assign('content', $GLOBALS['tmpl']->fetch($GLOBALS['config']['source'] . '/shop/payment_paypal.tpl'));
				$shop->unsetShopSessions();
			break;
			
			
			// sofortueberweisung.de
			case '6':
				$shop = new Shop;
				$payment_data = $GLOBALS['db']->ArrQuery("SELECT *, Beschreibung_" . $_SESSION['Langcode'] . " AS Beschreibung FROM " . PREFIX . "_shop_zahlungsmethoden WHERE Id = '6'");
				$_SESSION['back_url'] = $ref_url . 'index.php?p=shop&area=' . AREA;
				$_SESSION['return_url'] = $ref_url . 'index.php?p=shop';//&area=' . AREA . '&action=thankyou_paypal';
				
				$account = explode(',', $payment_data['Install_Id']);
				
				$payment_data['Install_Id'] = $account[0];
				$payment_data['Account_Id'] = $account[1];
				
				$GLOBALS['tmpl']->assign('payment_data', $payment_data);
				$GLOBALS['tmpl']->assign('content', $GLOBALS['tmpl']->fetch($GLOBALS['config']['source'] . '/shop/payment_sofortueberweisungl.tpl'));
				$shop->unsetShopSessions();
			break;
			
			// moneybookers.com
			case '8':
				$shop = new Shop;
				$payment_data = $GLOBALS['db']->ArrQuery("SELECT *, Beschreibung_" . $_SESSION['Langcode'] . " AS Beschreibung FROM " . PREFIX . "_shop_zahlungsmethoden WHERE Id = '8'");
				$_SESSION['back_url'] = $ref_url . 'index.php?p=shop&area=' . AREA;
				$_SESSION['return_url'] = $ref_url . 'index.php?p=shop';//&area=' . AREA . '&action=thankyou_moneybookers';
				$GLOBALS['tmpl']->assign('payment_data', $payment_data);
				$GLOBALS['tmpl']->assign('content', $GLOBALS['tmpl']->fetch($GLOBALS['config']['source'] . '/shop/payment_moneybookers.tpl'));
				$shop->unsetShopSessions();
			break;
			
			default:
				$shop = new Shop;
				$GLOBALS['tmpl']->assign('content', $GLOBALS['tmpl']->fetch($GLOBALS['config']['source'] . '/shop/payment_thankyou.tpl'));
				$shop->unsetShopSessions();
			break;
		}
	}
}
?>