Пример #1
0
	function outputForm($checksum) {
		//ksort($_POST);
		foreach($_POST as $key => $value) {
			if ($key == 'returnUrl') {
				echo '<input type="hidden" name="'.$key.'" value="'.Checksum::sanitizedURL($value).'" />'."\n";
			} else {
				echo '<input type="hidden" name="'.$key.'" value="'.Checksum::sanitizedParam($value).'" />'."\n";
			}
		}
		echo '<input type="hidden" name="checksum" value="'.$checksum.'" />'."\n";
	}
Пример #2
0
 /**
  * This will just spit out the html without loading any other magento stuff
  * and the form will be submitted right away.
  */
 protected function _toHtml()
 {
     $zaakpay = Mage::getModel('zaakpay/transact');
     $fields = $zaakpay->getCheckoutFormFields();
     $form = '<form id="zaakpay_checkout" method="POST" action="' . $zaakpay->getZaakpayTransactAction() . '">';
     foreach ($fields as $key => $value) {
         $form .= '<input type="hidden" name="' . $key . '" value="' . Checksum::sanitizedParam($value) . '" />' . "\n";
         #$form .= '<input type="hidden" name="'.$key.'" value="'.$value.'" />'."\n";
     }
     $form .= '</form>';
     $html = '<html><body>';
     $html .= $this->__('You will be redirected to the Zaakpay website in a few seconds.');
     $html .= $form;
     $html .= '<script type="text/javascript">document.getElementById("zaakpay_checkout").submit();</script>';
     $html .= '</body></html>';
     return $html;
 }
Пример #3
0
 public function getRequestFields()
 {
     $fields = $this->_buildRequestFields();
     // pass it through validate so that an exception is thrown
     $this->_validateFields($fields);
     $airpCheckfields = Checksum::sanitizedParam($fields['buyerEmail']) . Checksum::sanitizedParam($fields['buyerFirstName']) . Checksum::sanitizedParam($fields['buyerLastName']) . Checksum::sanitizedParam($fields['buyerAddress']) . Checksum::sanitizedParam($fields['buyerCity']) . Checksum::sanitizedParam($fields['buyerState']) . Checksum::sanitizedParam($fields['buyerCountry']) . Checksum::sanitizedParam($fields['amount']) . Checksum::sanitizedParam($fields['orderid']);
     $all = $airpCheckfields;
     error_log("Logging stripped params : " . $all);
     $airpayConfig = $this->getAirpayConfig();
     $privatekey = Checksum::encrypt($airpayConfig['username'] . ":|:" . $airpayConfig['password'], $airpayConfig['secret_key']);
     $checksum = Checksum::calculateChecksum($all . date('Y-m-d'), $privatekey);
     error_log("Logging stripped params : " . $all);
     error_log('Logging key used to produce checksum : ' . $airpayConfig['secret_key']);
     error_log('Logging checksum : ' . $checksum);
     $this->_checksum = $checksum;
     // var_dump($all, $checksum);
     #ksort($fields);
     // first sort by key and then append checksum in the end
     $fields['checksum'] = $checksum;
     $fields['privatekey'] = $privatekey;
     $fields['mercid'] = $airpayConfig['merchant_id'];
     return $fields;
 }