00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 class Mage_AmazonPayments_Block_Cba_Redirect extends Mage_Core_Block_Abstract
00035 {
00036
00037
00038
00039
00040
00041 protected function _toHtml()
00042 {
00043 $cba = Mage::getModel('amazonpayments/payment_cba');
00044
00045
00046 $form = new Varien_Data_Form();
00047 $form->setAction($cba->getAmazonRedirectUrl())
00048 ->setId('amazonpayments_cba')
00049 ->setName('amazonpayments_cba')
00050 ->setMethod('POST')
00051 ->setUseContainer(true);
00052
00053 $formFields = $cba->getCheckoutXmlFormFields();
00054 $values = '';
00055 $i = 1;
00056 foreach ($formFields as $field=>$value) {
00057 $form->addField($field, 'hidden', array('name'=>$field, 'value'=>$value));
00058 $values .= ($i++ > 1) ? '&' : '';
00059 $values .= "{$field}={$value}";
00060 }
00061 $html = '<html><body>';
00062 $html.= $this->__('You will be redirected to Checkout by Amazon in a few seconds.');
00063 $html.= $form->toHtml();
00064 $html.= '<script type="text/javascript">document.getElementById("amazonpayments_cba").submit();</script>';
00065 $html.= '</body></html>';
00066
00067 return $html;
00068 }
00069 }