Exemple #1
0
    /**
     * Generates the HTML to use on the checkout/confirmation page.
     * 
     * @param PaymentGateway $gateway The payment gateway to use
     * @param Cart $cart The cart we're purchasing
     * @Param string $baseURI The base URI for the site 
     * @return string The HTML to display 
     */
    public static function generateCheckoutHTML($gateway, $cart, $baseURI)
    {
        $url = $gateway->getSetting('endpoint');
        $email = $gateway->getSetting('email');
        $notifyURL = $gateway->getSetting('notificationurl');
        $amount = self::formatMoney($cart->cost(true, false));
        return <<<EOT
<p>
\tIf you have a Paypal account, you can use it to pay us. If you don't you can
\tstill use Paypal to pay with your credit/debit card and you don't even need a
\tPaypal account.
</p>

<p>
\tClick on the Paypal logo below to go to the Paypal website and pay for your
\tbooking.
</p>
<form action="{$url}" method="post" id="paypal" name="paypal">
\t<input type="hidden" name="cmd" value="_cart" />
\t<input type="hidden" name="upload" value="1" />
\t<input type="hidden" name="business" value="{$email}" />
\t<input type="hidden" name="currency_code" value="GBP" />
\t<input type="hidden" name="custom" value="cart-{$cart->id}" />
\t<input type="hidden" name="notify_url" value="{$notifyURL}" />
\t<input type="hidden" name="return" value="{$baseURI}/payments/{$cart->id}/complete" />
\t<input type="hidden" name="item_name_1" value="epic.LAN Booking - Cart {$cart->id}" />
\t<input type="hidden" name="amount_1" value="{$amount}" />
\t\t
\t<h4 class="center">
\t\t<input type="image" value="PayPal" src="/images/paypal.gif" />
\t\t<br />
\t\t<a href="javascript:document.paypal.submit();">Total to pay by Paypal: &pound;{$amount}</a>
\t</h4>
</form> 
EOT;
    }