<h3 class="headline">Betaling</h3><span class="line margin-bottom-25"></span>

<div class="clearfix checkoutStep" data-step="Payment"></div>

<{if $webshop->getStatus() == "demo"}>

	<p class="error">Shoppen kører i demo-mode, så evt. betalinger går igennem som betalt.</p>
	<br/>

	<{if $order}>
		<form action="<{$webshop->getUrl()|escape}>/payment?order_id=<{$order->getOrderId()}>&email=<{$order->getEmail()|escape}>" method="post">
	<{else}>
		<form action="" method="post">
	<{/if}>
		<p>Du er ved at betale <{$total_price|number_format:2:",":"."}> <{$webshop->getCurrency()}></p><br/>
		<input type="submit" name="next" value="Lad som om du betaler &raquo;"/>
	</form>

<{else}>

	<{if $payment_gateway_type == "payson"}>

		<{$payment_html}>
	
	<{elseif $payment_gateway_type == "paypal_plus"}>

		<script src="https://www.paypalobjects.com/webstatic/ppplus/ppplus.min.js" type="text/javascript"></script>

		<div id="ppplus">
			Vent venligst ...
		</div>

		<script type="application/javascript">
			$(document).ready(function(){
				var ppp = PAYPAL.apps.PPP({
					"approvalUrl": "<{$pp_approval_url}>",
					"placeholder": "ppplus",
					"mode": "<{$pp_mode}>",
					"country": "<{$shipping_country->getCode()|escape:'javascript'}>"
				});
			});
		</script>

	<{elseif $payment_gateway_type == "other"}>

		<p>Kontakt os venligst angående betaling.</p>

		<div class="my-4"><a href="#small-dialog" class="popup-with-zoom-anim button color margin-left-0">Kontakt os her</a></div>

		<div id="small-dialog" class="zoom-anim-dialog mfp-hide">
			<h3 class="headline">Spørgsmål</h3><span class="line margin-bottom-25"></span><div class="clearfix"></div>

			<form id="add-comment" class="add-comment" method="post">
				<input type="hidden" name="subject" value="Spørgsmål ang. ordre <{$order->getWebshopOrderId()|escape}>"/>
				<input type="hidden" name="order_url" value="<{$order->getPublicUrl()|escape}>"/>

				<fieldset>
					<p>Skriv dit spørgsmål her, og vi vender tilbage hurtigst muligt pr. mail:</p>

					<div>
						<label>Dit navn:</label>
						<input type="text" name="name" value="<{$order->getOrderName()|escape}>" size="50"/>
					</div>

					<div>
						<label>Din e-mail-adresse: <span>*</span></label>
						<input type="text" name="from" value="<{$order->getEmail()|escape}>" size="50" required/>
					</div>

					<div>
						<label>Dit spørgsmål: <span>*</span></label>
						<textarea cols="40" rows="3" name="question" required></textarea>
					</div>

				</fieldset>

				<input type="submit" value="Send" class="button color" id="send_button"/>
				<div class="clearfix"></div>

			</form>
		</div>

	<{elseif $payment_gateway_type == "epay"}>

		<script type="text/javascript" src="https://ssl.ditonlinebetalingssystem.dk/integration/ewindow/paymentwindow.js" charset="UTF-8"></script>
		<script type="text/javascript">
			$(document).ready(function() {
				paymentwindow = new PaymentWindow({
					<{foreach from=$params key="key" item="value"}>
						'<{$key}>': '<{$value|escape:"javascript"}>',
					<{/foreach}>
					<{if $hash}>
						'hash': '<{$hash|escape:"javascript"}>'
					<{/if}>
				});
				paymentwindow.append('payment-div');
				paymentwindow.open();
			});
		</script>

		<div id="payment-div" style="width:650px; height:300px; background: url(<{$theme_url|escape}>/images/padlock.png) 100% 100% no-repeat">
		</div>


	<{elseif $payment_gateway_type == "epay2"}>

		<script type="text/javascript" src="https://ssl.ditonlinebetalingssystem.dk/integration/ewindow/paymentwindow.js" charset="UTF-8"></script>
		<script type="text/javascript">
			$(document).ready(function() {
				paymentwindow = new PaymentWindow({
					<{foreach from=$params key="key" item="value"}>
						'<{$key}>': '<{$value|escape:"javascript"}>',
					<{/foreach}>
					<{if $hash}>
						'hash': '<{$hash|escape:"javascript"}>'
					<{/if}>
				});
				paymentwindow.append('payment-div');
				paymentwindow.open();
			});
		</script>

		<div id="payment-div" style="width:650px; height:300px; background: url(<{$theme_url|escape}>/images/padlock.png) 100% 100% no-repeat">
		</div>

	<{elseif $payment_gateway_type == "paypal"}>

		<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_blank">
		    <input type="hidden" name="amount" value="<{$amount|escape}>"/>
			<input type="hidden" name="item_name" value="Ordre nr. <{$ordernumber|escape}> fra <{$webshop->getName()|escape}>"/>
			<input type="hidden" name="business" value="<{$merchant|escape}>"/>
			<input type="hidden" name="notify_url" value="<{$callbackurl|escape}>"/>
			<input type="hidden" name="currency_code" value="<{$currency|escape}>"/>
			<input type="hidden" name="custom" value="<{$ordernumber|escape}>"/>
		    <input type="hidden" name="return" value="<{$continueurl|escape}>"/>
			<input type="hidden" name="first_name" value="<{if $order}><{$order->getOrderName()|escape}><{/if}>"/>
			<input type="hidden" name="last_name" value=""/>
			<input type="hidden" name="address1" value="<{if $order}><{$order->getOrderAddress()|escape}><{/if}>"/>
			<input type="hidden" name="address2" value=""/>
			<input type="hidden" name="city" value="<{if $order}><{$order->getOrderCity()|escape}><{/if}>"/>
			<input type="hidden" name="zip" value="<{if $order}><{$order->getOrderZipcode()|escape}><{/if}>"/>
			<input type="hidden" name="night_phone_a" value="<{if $order}><{$order->getPhone()|escape}><{/if}>"/>
			<input type="hidden" name="cmd" value="_xclick"/>
			<input type="submit" class="payment_button green" value="Betal"/>
		</form>

	<{/if}>

<{/if}>

<div class="mt-4"></div>