Beispiel #1
0
    public function RedirectToPaymentForm($orderId, $amount, $currency, $continueUrl = null, $callbackUrl = null)
    {
        $cfg = PSP::GetConfig("DIBS");
        // Currency - make sure numeric value is used to work around checksum bug
        if (is_numeric($currency) === false) {
            $currency = PSP::CurrencyCodeToNumericValue($currency);
        }
        // Create checksum (if keys are configured)
        $checksum = "";
        if (isset($cfg["Encryption Key 1"]) && $cfg["Encryption Key 1"] !== "" && isset($cfg["Encryption Key 2"]) && $cfg["Encryption Key 2"] !== "") {
            $check = "";
            $check .= "merchant=" . $cfg["Merchant ID"];
            $check .= "&orderid=" . $orderId;
            $check .= "&currency=" . $currency;
            $check .= "&amount=" . $amount;
            $checksum = md5($cfg["Encryption Key 2"] . md5($cfg["Encryption Key 1"] . $check));
        }
        // Output
        echo '
		<form id="DIBS" method="POST" action="https://payment.architrade.com/paymentweb/start.action">
			<input type="hidden" name="merchant" value="' . $cfg["Merchant ID"] . '">
			<input type="hidden" name="callbackurl" value="' . PSP::GetProviderUrl("DIBS") . "/Callback.php" . '">
			<input type="hidden" name="accepturl" value="' . PSP::GetProviderUrl("DIBS") . "/Callback.php" . '">
			<input type="hidden" name="orderid" value="' . $orderId . '">
			<input type="hidden" name="amount" value="' . $amount . '">
			<input type="hidden" name="currency" value="' . $currency . '">
			<input type="hidden" name="md5key" value="' . $checksum . '">
			' . (PSP::GetTestMode() === true ? '<input type="hidden" name="test" value="true">' : '') . '
			<input type="hidden" name="CUSTOM_Callback" value="' . ($callbackUrl !== null ? $callbackUrl : "") . '">
			<input type="hidden" name="CUSTOM_ContinueUrl" value="' . ($continueUrl !== null ? $continueUrl : "") . '">
		</form>

		<script type="text/javascript">
			setTimeout(function() { document.getElementById("DIBS").submit(); }, 100);
		</script>
		';
        exit;
    }