Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Signed-off-by: it <it@cosmocommerce.com>

  • Loading branch information...
commit 83d2c84ac4eab67ea5b41e240f8256e18105d4f2 1 parent 7c9e6ae
it authored
Showing with 3,035 additions and 0 deletions.
  1. BIN  99Bill/release/Cosmo_Community_99BillPaymentGateway-1.3.2.4.tgz
  2. +25 −0 99Bill/trunk/app/code/community/CosmoCommerce/Cosmo99Bill/Block/Error.php
  3. +31 −0 99Bill/trunk/app/code/community/CosmoCommerce/Cosmo99Bill/Block/Form.php
  4. +50 −0 99Bill/trunk/app/code/community/CosmoCommerce/Cosmo99Bill/Block/Redirect.php
  5. +26 −0 99Bill/trunk/app/code/community/CosmoCommerce/Cosmo99Bill/Helper/Data.php
  6. +29 −0 99Bill/trunk/app/code/community/CosmoCommerce/Cosmo99Bill/Model/Api/Debug.php
  7. +30 −0 99Bill/trunk/app/code/community/CosmoCommerce/Cosmo99Bill/Model/Mysql4/Api/Debug.php
  8. +29 −0 99Bill/trunk/app/code/community/CosmoCommerce/Cosmo99Bill/Model/Mysql4/Api/Debug/Collection.php
  9. +26 −0 99Bill/trunk/app/code/community/CosmoCommerce/Cosmo99Bill/Model/Mysql4/Setup.php
  10. +365 −0 99Bill/trunk/app/code/community/CosmoCommerce/Cosmo99Bill/Model/Payment.php
  11. +39 −0 99Bill/trunk/app/code/community/CosmoCommerce/Cosmo99Bill/Model/Source/Language.php
  12. +36 −0 99Bill/trunk/app/code/community/CosmoCommerce/Cosmo99Bill/Model/Source/Servicetype.php
  13. +33 −0 99Bill/trunk/app/code/community/CosmoCommerce/Cosmo99Bill/Model/Source/Transport.php
  14. +233 −0 99Bill/trunk/app/code/community/CosmoCommerce/Cosmo99Bill/controllers/PaymentController.php
  15. +155 −0 99Bill/trunk/app/code/community/CosmoCommerce/Cosmo99Bill/etc/config.xml
  16. +225 −0 99Bill/trunk/app/code/community/CosmoCommerce/Cosmo99Bill/etc/system.xml
  17. +25 −0 99Bill/trunk/app/code/community/CosmoCommerce/Cosmo99Bill/sql/cosmo99bill_setup/mysql4-install-0.1.0.php
  18. +27 −0 99Bill/trunk/app/design/frontend/default/default/template/cosmo99bill/error.phtml
  19. +43 −0 99Bill/trunk/app/design/frontend/default/default/template/cosmo99bill/form.phtml
  20. +35 −0 99Bill/trunk/app/etc/modules/CosmoCommerce_Cosmo99Bill.xml
  21. +43 −0 99Bill/trunk/app/locale/en_US/CosmoCommerce_Cosmo99Bill.csv
  22. +41 −0 99Bill/trunk/app/locale/zh_CN/CosmoCommerce_Cosmo99Bill.csv
  23. BIN  99Bill/trunk/skin/frontend/default/default/images/cosmo99bill/99bill.gif
  24. BIN  99Bill/trunk/skin/frontend/default/default/images/cosmo99bill/bank_boc.gif
  25. BIN  99Bill/trunk/skin/frontend/default/default/images/cosmo99bill/bank_bosh.gif
  26. BIN  99Bill/trunk/skin/frontend/default/default/images/cosmo99bill/bank_ccb.gif
  27. BIN  99Bill/trunk/skin/frontend/default/default/images/cosmo99bill/bank_cib.gif
  28. BIN  99Bill/trunk/skin/frontend/default/default/images/cosmo99bill/bank_cmb.gif
  29. BIN  99Bill/trunk/skin/frontend/default/default/images/cosmo99bill/bank_cmbc.gif
  30. BIN  99Bill/trunk/skin/frontend/default/default/images/cosmo99bill/bank_gdb.gif
  31. BIN  99Bill/trunk/skin/frontend/default/default/images/cosmo99bill/bank_hxb.gif
  32. BIN  99Bill/trunk/skin/frontend/default/default/images/cosmo99bill/bank_icbc.gif
  33. BIN  99Bill/trunk/skin/frontend/default/default/images/cosmo99bill/bank_spdb.gif
  34. BIN  99Bill/trunk/skin/frontend/default/default/images/cosmo99bill/ljzf02.gif
  35. BIN  99Bill/trunk/skin/frontend/default/default/images/cosmo99bill/logo_99bill.gif
  36. BIN  Alipay/release/Cosmo_Community_AlipayPaymentGateway-1.3.2.4.tgz
  37. +25 −0 Alipay/trunk/app/code/community/CosmoCommerce/Alipay/Block/Error.php
  38. +31 −0 Alipay/trunk/app/code/community/CosmoCommerce/Alipay/Block/Form.php
  39. +50 −0 Alipay/trunk/app/code/community/CosmoCommerce/Alipay/Block/Redirect.php
  40. +26 −0 Alipay/trunk/app/code/community/CosmoCommerce/Alipay/Helper/Data.php
  41. +29 −0 Alipay/trunk/app/code/community/CosmoCommerce/Alipay/Model/Api/Debug.php
  42. +30 −0 Alipay/trunk/app/code/community/CosmoCommerce/Alipay/Model/Mysql4/Api/Debug.php
  43. +30 −0 Alipay/trunk/app/code/community/CosmoCommerce/Alipay/Model/Mysql4/Api/Debug/Collection.php
  44. +27 −0 Alipay/trunk/app/code/community/CosmoCommerce/Alipay/Model/Mysql4/Setup.php
  45. +323 −0 Alipay/trunk/app/code/community/CosmoCommerce/Alipay/Model/Payment.php
  46. +40 −0 Alipay/trunk/app/code/community/CosmoCommerce/Alipay/Model/Source/Language.php
  47. +35 −0 Alipay/trunk/app/code/community/CosmoCommerce/Alipay/Model/Source/Servicetype.php
  48. +32 −0 Alipay/trunk/app/code/community/CosmoCommerce/Alipay/Model/Source/Transport.php
  49. +275 −0 Alipay/trunk/app/code/community/CosmoCommerce/Alipay/controllers/PaymentController.php
  50. +155 −0 Alipay/trunk/app/code/community/CosmoCommerce/Alipay/etc/config.xml
  51. +163 −0 Alipay/trunk/app/code/community/CosmoCommerce/Alipay/etc/system.xml
  52. +25 −0 Alipay/trunk/app/code/community/CosmoCommerce/Alipay/sql/alipay_setup/mysql4-install-0.1.0.php
  53. +27 −0 Alipay/trunk/app/design/frontend/default/default/template/alipay/error.phtml
  54. +57 −0 Alipay/trunk/app/design/frontend/default/default/template/alipay/form.phtml
  55. +35 −0 Alipay/trunk/app/etc/modules/CosmoCommerce_Alipay.xml
  56. +43 −0 Alipay/trunk/app/locale/en_US/CosmoCommerce_Alipay.csv
  57. +31 −0 Alipay/trunk/app/locale/zh_CN/CosmoCommerce_Alipay.csv
View
BIN  99Bill/release/Cosmo_Community_99BillPaymentGateway-1.3.2.4.tgz
Binary file not shown
View
25 99Bill/trunk/app/code/community/CosmoCommerce/Cosmo99Bill/Block/Error.php
@@ -0,0 +1,25 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * @category CosmoCommerce
+ * @package CosmoCommerce_99Bill
+ * @copyright Copyright (c) 2009 CosmoCommerce,LLC. (http://www.cosmocommerce.com)
+ * @contact :
+ * T: +86-021-66346672
+ * L: Shanghai,China
+ * M:sales@cosmocommerce.com
+ */
+class CosmoCommerce_Cosmo99Bill_Block_Error extends Mage_Core_Block_Template
+{
+}
View
31 99Bill/trunk/app/code/community/CosmoCommerce/Cosmo99Bill/Block/Form.php
@@ -0,0 +1,31 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * @category CosmoCommerce
+ * @package CosmoCommerce_99Bill
+ * @copyright Copyright (c) 2009 CosmoCommerce,LLC. (http://www.cosmocommerce.com)
+ * @contact :
+ * T: +86-021-66346672
+ * L: Shanghai,China
+ * M:sales@cosmocommerce.com
+ */
+class CosmoCommerce_Cosmo99Bill_Block_Form extends Mage_Payment_Block_Form
+{
+ protected function _construct()
+ {
+ $this->setTemplate('cosmo99bill/form.phtml');
+ parent::_construct();
+ }
+
+}
View
50 99Bill/trunk/app/code/community/CosmoCommerce/Cosmo99Bill/Block/Redirect.php
@@ -0,0 +1,50 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * @category CosmoCommerce
+ * @package CosmoCommerce_99Bill
+ * @copyright Copyright (c) 2009 CosmoCommerce,LLC. (http://www.cosmocommerce.com)
+ * @contact :
+ * T: +86-021-66346672
+ * L: Shanghai,China
+ * M:sales@cosmocommerce.com
+ */
+class CosmoCommerce_Cosmo99Bill_Block_Redirect extends Mage_Core_Block_Abstract
+{
+
+ protected function _toHtml()
+ {
+ $standard = Mage::getModel('cosmo99bill/payment');
+ $form = new Varien_Data_Form();
+ $form->setAction($standard->getCosmo99BillUrl())
+ ->setId('cosmo99bill_payment_checkout')
+ ->setName('cosmo99bill_payment_checkout')
+ ->setMethod('GET')
+ ->setUseContainer(true);
+ foreach ($standard->setOrder($this->getOrder())->getStandardCheckoutFormFields() as $field => $value) {
+ $form->addField($field, 'hidden', array('name' => $field, 'value' => $value));
+ }
+
+ $formHTML = $form->toHtml();
+
+ $html = '<html><body>';
+ $html.= $this->__('You will be redirected to 99Bill in a few seconds.');
+ $html.= $formHTML;
+ $html.= '<script type="text/javascript">document.getElementById("cosmo99bill_payment_checkout").submit();</script>';
+ $html.= '</body></html>';
+
+
+ return $html;
+ }
+}
View
26 99Bill/trunk/app/code/community/CosmoCommerce/Cosmo99Bill/Helper/Data.php
@@ -0,0 +1,26 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * @category CosmoCommerce
+ * @package CosmoCommerce_99Bill
+ * @copyright Copyright (c) 2009 CosmoCommerce,LLC. (http://www.cosmocommerce.com)
+ * @contact :
+ * T: +86-021-66346672
+ * L: Shanghai,China
+ * M:sales@cosmocommerce.com
+ */
+class CosmoCommerce_Cosmo99Bill_Helper_Data extends Mage_Core_Helper_Abstract
+{
+
+}
View
29 99Bill/trunk/app/code/community/CosmoCommerce/Cosmo99Bill/Model/Api/Debug.php
@@ -0,0 +1,29 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * @category CosmoCommerce
+ * @package CosmoCommerce_99Bill
+ * @copyright Copyright (c) 2009 CosmoCommerce,LLC. (http://www.cosmocommerce.com)
+ * @contact :
+ * T: +86-021-66346672
+ * L: Shanghai,China
+ * M:sales@cosmocommerce.com
+ */
+class CosmoCommerce_Cosmo99Bill_Model_Api_Debug extends Mage_Core_Model_Abstract
+{
+ protected function _construct()
+ {
+ $this->_init('cosmo99bill/api_debug');
+ }
+}
View
30 99Bill/trunk/app/code/community/CosmoCommerce/Cosmo99Bill/Model/Mysql4/Api/Debug.php
@@ -0,0 +1,30 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * @category CosmoCommerce
+ * @package CosmoCommerce_99Bill
+ * @copyright Copyright (c) 2009 CosmoCommerce,LLC. (http://www.cosmocommerce.com)
+ * @contact :
+ * T: +86-021-66346672
+ * L: Shanghai,China
+ * M:sales@cosmocommerce.com
+ */
+
+class CosmoCommerce_Cosmo99Bill_Model_Mysql4_Api_Debug extends Mage_Core_Model_Mysql4_Abstract
+{
+ protected function _construct()
+ {
+ $this->_init('cosmo99bill/api_debug', 'debug_id');
+ }
+}
View
29 99Bill/trunk/app/code/community/CosmoCommerce/Cosmo99Bill/Model/Mysql4/Api/Debug/Collection.php
@@ -0,0 +1,29 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * @category CosmoCommerce
+ * @package CosmoCommerce_99Bill
+ * @copyright Copyright (c) 2009 CosmoCommerce,LLC. (http://www.cosmocommerce.com)
+ * @contact :
+ * T: +86-021-66346672
+ * L: Shanghai,China
+ * M:sales@cosmocommerce.com
+ */
+class CosmoCommerce_Cosmo99Bill_Model_Mysql4_Api_Debug_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
+{
+ protected function _construct()
+ {
+ $this->_init('cosmo99bill/api_debug');
+ }
+}
View
26 99Bill/trunk/app/code/community/CosmoCommerce/Cosmo99Bill/Model/Mysql4/Setup.php
@@ -0,0 +1,26 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * @category CosmoCommerce
+ * @package CosmoCommerce_99Bill
+ * @copyright Copyright (c) 2009 CosmoCommerce,LLC. (http://www.cosmocommerce.com)
+ * @contact :
+ * T: +86-021-66346672
+ * L: Shanghai,China
+ * M:sales@cosmocommerce.com
+ */
+class CosmoCommerce_Cosmo99Bill_Model_Mysql4_Setup extends Mage_Eav_Model_Entity_Setup
+{
+
+}
View
365 99Bill/trunk/app/code/community/CosmoCommerce/Cosmo99Bill/Model/Payment.php
@@ -0,0 +1,365 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * @category CosmoCommerce
+ * @package CosmoCommerce_99Bill
+ * @copyright Copyright (c) 2009 CosmoCommerce,LLC. (http://www.cosmocommerce.com)
+ * @contact :
+ * T: +86-021-66346672
+ * L: Shanghai,China
+ * M:sales@cosmocommerce.com
+ */
+class CosmoCommerce_Cosmo99Bill_Model_Payment extends Mage_Payment_Model_Method_Abstract
+{
+ protected $_code = 'cosmo99bill_payment';
+ protected $_formBlockType = 'cosmo99bill/form';
+
+ // Cosmo99Bill return codes of payment
+ const RETURN_CODE_ACCEPTED = 'Success';
+ const RETURN_CODE_TEST_ACCEPTED = 'Success';
+ const RETURN_CODE_ERROR = 'Fail';
+
+ // Payment configuration
+ protected $_isGateway = false;
+ protected $_canAuthorize = true;
+ protected $_canCapture = true;
+ protected $_canCapturePartial = false;
+ protected $_canRefund = false;
+ protected $_canVoid = false;
+ protected $_canUseInternal = false;
+ protected $_canUseCheckout = true;
+ protected $_canUseForMultishipping = false;
+
+ // Order instance
+ protected $_order = null;
+
+ /**
+ * Returns Target URL
+ *
+ * @return string Target URL
+ */
+ public function getCosmo99BillUrl()
+ {
+ $url = $this->getConfigData('transport').'://'.$this->getConfigData('gateway');
+ return $url;
+ }
+
+ /**
+ * Return back URL
+ *
+ * @return string URL
+ */
+ protected function getReturnURL()
+ {
+ return Mage::getUrl('checkout/onepage/success', array('_secure' => true));
+ }
+
+ /**
+ * Return URL for Cosmo99Bill success response
+ *
+ * @return string URL
+ */
+ protected function getSuccessURL()
+ {
+ return Mage::getUrl('checkout/onepage/success', array('_secure' => true));
+ }
+
+ /**
+ * Return URL for Cosmo99Bill failure response
+ *
+ * @return string URL
+ */
+ protected function getErrorURL()
+ {
+ return Mage::getUrl('cosmo99bill/payment/error', array('_secure' => true));
+ }
+
+ /**
+ * Return URL for Cosmo99Bill notify response
+ *
+ * @return string URL
+ */
+ protected function getNotifyURL()
+ {
+ return Mage::getUrl('checkout/onepage/success', array('_secure' => true));
+ }
+
+ /**
+ * Capture payment
+ *
+ * @param Varien_Object $orderPayment
+ * @return Mage_Payment_Model_Abstract
+ */
+ public function capture(Varien_Object $payment, $amount)
+ {
+ $payment->setStatus(self::STATUS_APPROVED)
+ ->setLastTransId($this->getTransactionId());
+
+ return $this;
+ }
+
+ /**
+ * Form block description
+ *
+ * @return object
+ */
+ public function createFormBlock($name)
+ {
+ $block = $this->getLayout()->createBlock('cosmo99bill/form_payment', $name);
+ $block->setMethod($this->_code);
+ $block->setPayment($this->getPayment());
+
+ return $block;
+ }
+
+ /**
+ * Return Order Place Redirect URL
+ *
+ * @return string Order Redirect URL
+ */
+ public function getOrderPlaceRedirectUrl()
+ {
+ return Mage::getUrl('cosmo99bill/payment/redirect');
+ }
+
+ /**
+ * Return Standard Checkout Form Fields for request to Cosmo99Bill
+ *
+ * @return array Array of hidden form fields
+ */
+ public function getStandardCheckoutFormFields()
+ {
+ $session = Mage::getSingleton('checkout/session');
+
+ $order = $this->getOrder();
+ if (!($order instanceof Mage_Sales_Model_Order)) {
+ Mage::throwException($this->_getHelper()->__('Cannot retrieve order object'));
+ }
+
+
+ $_merchantAcctId=$this->getConfigData('partner_id');
+ $_version="v2.0";
+ $_key=$this->getConfigData('security_code');
+ $_signType="1";
+ $_payerContactType="1";
+ $_orderId=$order->getRealOrderId();
+ $_orderAmount=sprintf('%.2f', $order->getBaseGrandTotal())*100;
+ $_orderTime=date('YmdHis');
+ $_productName=$order->getRealOrderId();
+ $_productNum="1";//???
+ $_productId=$order->getRealOrderId();
+ $_productDesc=$order->getRealOrderId();
+ $_ext1=$this->getConfigData('ext1');
+ $_ext2=$this->getConfigData('ext2');
+ $_bankId=$this->getConfigData('bank_id');
+
+ $_redoFlag=$this->getConfigData('redo_flag');//1代表同一订单号只允许提交1次;0表示同一订单号在没有支付成功的前提下可重复提交多次。默认为0建议实物购物车结算类商户采用0;虚拟产品类商户采用1
+
+ $_pid=$this->getConfigData('pid'); ///合作伙伴在快钱的用户编号
+
+ $_payType=$this->getConfigData('pay_type');
+
+ $_payerName=$order->getCustomerName();
+ $_payerContact=$order->getCustomerEmail() ;
+
+
+ //todo : url
+ $_pageUrl=$this->getConfigData('page_url');
+ $_bgUrl=$this->getConfigData('bg_url');
+ $_inputCharset=$this->getConfigData('input_charset');//1代表UTF-8; 2代表GBK; 3代表gb2312
+ $_language=$this->getConfigData('display_language');//1代表中文;2代表英文
+
+
+
+
+
+ //生成加密签名串
+///请务必按照如下顺序和规则组成加密串!
+ $signMsgVal="";
+ $signMsgVal=$this->appendParam($signMsgVal,"inputCharset",$_inputCharset);
+ $signMsgVal=$this->appendParam($signMsgVal,"pageUrl",$_pageUrl);
+ $signMsgVal=$this->appendParam($signMsgVal,"bgUrl",$_bgUrl);
+ $signMsgVal=$this->appendParam($signMsgVal,"version",$_version);
+ $signMsgVal=$this->appendParam($signMsgVal,"language",$_language);
+ $signMsgVal=$this->appendParam($signMsgVal,"signType",$_signType);
+ $signMsgVal=$this->appendParam($signMsgVal,"merchantAcctId",$_merchantAcctId);
+ $signMsgVal=$this->appendParam($signMsgVal,"payerName",$_payerName);
+ $signMsgVal=$this->appendParam($signMsgVal,"payerContactType",$_payerContactType);
+ $signMsgVal=$this->appendParam($signMsgVal,"payerContact",$_payerContact);
+ $signMsgVal=$this->appendParam($signMsgVal,"orderId",$_orderId);
+ $signMsgVal=$this->appendParam($signMsgVal,"orderAmount",$_orderAmount);
+ $signMsgVal=$this->appendParam($signMsgVal,"orderTime",$_orderTime);
+ $signMsgVal=$this->appendParam($signMsgVal,"productName",$_productName);
+ $signMsgVal=$this->appendParam($signMsgVal,"productNum",$_productNum);
+ $signMsgVal=$this->appendParam($signMsgVal,"productId",$_productId);
+ $signMsgVal=$this->appendParam($signMsgVal,"productDesc",$_productDesc);
+ $signMsgVal=$this->appendParam($signMsgVal,"ext1",$_ext1);
+ $signMsgVal=$this->appendParam($signMsgVal,"ext2",$_ext2);
+ $signMsgVal=$this->appendParam($signMsgVal,"payType",$_payType);
+ $signMsgVal=$this->appendParam($signMsgVal,"bankId",$_bankId);
+ $signMsgVal=$this->appendParam($signMsgVal,"redoFlag",$_redoFlag);
+ $signMsgVal=$this->appendParam($signMsgVal,"pid",$_pid);
+ $signMsgVal=$this->appendParam($signMsgVal,"key",$_key);
+ $signMsg= strtoupper(md5($signMsgVal));
+
+
+
+ $parameter = array(
+ 'inputCharset'=>$_inputCharset,
+ 'pageUrl'=>$_pageUrl,
+ 'bgUrl'=>$_bgUrl,
+ 'version'=>$_version,
+ 'language'=>$_language,
+ 'signType'=>$_signType,
+ 'merchantAcctId'=>$_merchantAcctId,
+ 'payerName'=>$_payerName,
+ 'payerContactType'=>$_payerContactType,
+ 'payerContact'=>$_payerContact,
+ 'orderId'=>$_orderId,
+ 'orderAmount'=>$_orderAmount,
+ 'orderTime'=>$_orderTime,
+ 'productName'=>$_productName,
+ 'productNum'=>$_productNum,
+ 'productId'=>$_productId,
+ 'productDesc'=>$_productDesc,
+ 'ext1'=>$_ext1,
+ 'ext2'=>$_ext2,
+ 'payType'=>$_payType,
+ 'bankId'=>$_bankId,
+ 'redoFlag'=>$_redoFlag,
+ 'pid'=>$_pid,
+ 'signMsg'=>$signMsg
+ );
+
+
+ return $parameter;
+ }
+
+
+ //功能函数。将变量值不为空的参数组成字符串
+ public function appendParam($returnStr,$paramId,$paramValue){
+
+ if($returnStr!=""){
+
+ if($paramValue!=""){
+
+ $returnStr.="&".$paramId."=".$paramValue;
+ }
+
+ }else{
+
+ If($paramValue!=""){
+ $returnStr=$paramId."=".$paramValue;
+ }
+ }
+
+ return $returnStr;
+ }
+ //功能函数。将变量值不为空的参数组成字符串。结束
+
+ /**
+ * Return authorized languages by Cosmo99Bill
+ *
+ * @param none
+ * @return array
+ */
+ protected function _getAuthorizedLanguages()
+ {
+ $languages = array();
+
+ foreach (Mage::getConfig()->getNode('global/payment/cosmo99bill_payment/languages')->asArray() as $data)
+ {
+ $languages[$data['code']] = $data['name'];
+ }
+
+ return $languages;
+ }
+
+ /**
+ * Return language code to send to Cosmo99Bill
+ *
+ * @param none
+ * @return String
+ */
+ protected function _getLanguageCode()
+ {
+ // Store language
+ $language = strtoupper(substr(Mage::getStoreConfig('general/locale/code'), 0, 2));
+
+ // Authorized Languages
+ $authorized_languages = $this->_getAuthorizedLanguages();
+
+ if (count($authorized_languages) === 1)
+ {
+ $codes = array_keys($authorized_languages);
+ return $codes[0];
+ }
+
+ if (array_key_exists($language, $authorized_languages))
+ {
+ return $language;
+ }
+
+ // By default we use language selected in store admin
+ return $this->getConfigData('language');
+ }
+
+
+
+ /**
+ * Output failure response and stop the script
+ *
+ * @param none
+ * @return void
+ */
+ public function generateErrorResponse()
+ {
+ die($this->getErrorResponse());
+ }
+
+ /**
+ * Return response for Cosmo99Bill success payment
+ *
+ * @param none
+ * @return string Success response string
+ */
+ public function getSuccessResponse()
+ {
+ $response = array(
+ 'Pragma: no-cache',
+ 'Content-type : text/plain',
+ 'Version: 1',
+ 'OK'
+ );
+ return implode("\n", $response) . "\n";
+ }
+
+ /**
+ * Return response for Cosmo99Bill failure payment
+ *
+ * @param none
+ * @return string Failure response string
+ */
+ public function getErrorResponse()
+ {
+ $response = array(
+ 'Pragma: no-cache',
+ 'Content-type : text/plain',
+ 'Version: 1',
+ 'Document falsifie'
+ );
+ return implode("\n", $response) . "\n";
+ }
+
+}
View
39 99Bill/trunk/app/code/community/CosmoCommerce/Cosmo99Bill/Model/Source/Language.php
@@ -0,0 +1,39 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * @category CosmoCommerce
+ * @package CosmoCommerce_99Bill
+ * @copyright Copyright (c) 2009 CosmoCommerce,LLC. (http://www.cosmocommerce.com)
+ * @contact :
+ * T: +86-021-66346672
+ * L: Shanghai,China
+ * M:sales@cosmocommerce.com
+ */
+class CosmoCommerce_Cosmo99Bill_Model_Source_Language
+{
+ public function toOptionArray()
+ {
+ return array(
+ array('value' => 'EN', 'label' => Mage::helper('cosmo99bill')->__('English')),
+ array('value' => 'FR', 'label' => Mage::helper('cosmo99bill')->__('French')),
+ array('value' => 'DE', 'label' => Mage::helper('cosmo99bill')->__('German')),
+ array('value' => 'IT', 'label' => Mage::helper('cosmo99bill')->__('Italian')),
+ array('value' => 'ES', 'label' => Mage::helper('cosmo99bill')->__('Spain')),
+ array('value' => 'NL', 'label' => Mage::helper('cosmo99bill')->__('Dutch')),
+ );
+ }
+}
+
+
+
View
36 99Bill/trunk/app/code/community/CosmoCommerce/Cosmo99Bill/Model/Source/Servicetype.php
@@ -0,0 +1,36 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * @category CosmoCommerce
+ * @package CosmoCommerce_99Bill
+ * @copyright Copyright (c) 2009 CosmoCommerce,LLC. (http://www.cosmocommerce.com)
+ * @contact :
+ * T: +86-021-66346672
+ * L: Shanghai,China
+ * M:sales@cosmocommerce.com
+ */
+
+class CosmoCommerce_Cosmo99Bill_Model_Source_Servicetype
+{
+ public function toOptionArray()
+ {
+ return array(
+ array('value' => '3', 'label' => Mage::helper('cosmo99bill')->__('接口类型3')),
+ array('value' => '5', 'label' => Mage::helper('cosmo99bill')->__('接口类型5')),
+ );
+ }
+}
+
+
+
View
33 99Bill/trunk/app/code/community/CosmoCommerce/Cosmo99Bill/Model/Source/Transport.php
@@ -0,0 +1,33 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * @category CosmoCommerce
+ * @package CosmoCommerce_99Bill
+ * @copyright Copyright (c) 2009 CosmoCommerce,LLC. (http://www.cosmocommerce.com)
+ * @contact :
+ * T: +86-021-66346672
+ * L: Shanghai,China
+ * M:sales@cosmocommerce.com
+ */
+
+class CosmoCommerce_Cosmo99Bill_Model_Source_Transport
+{
+ public function toOptionArray()
+ {
+ return array(
+ array('value' => 'https', 'label' => Mage::helper('cosmo99bill')->__('https')),
+ array('value' => 'http', 'label' => Mage::helper('cosmo99bill')->__('http')),
+ );
+ }
+}
View
233 99Bill/trunk/app/code/community/CosmoCommerce/Cosmo99Bill/controllers/PaymentController.php
@@ -0,0 +1,233 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * @category CosmoCommerce
+ * @package CosmoCommerce_99Bill
+ * @copyright Copyright (c) 2009 CosmoCommerce,LLC. (http://www.cosmocommerce.com)
+ * @contact :
+ * T: +86-021-66346672
+ * L: Shanghai,China
+ * M:sales@cosmocommerce.com
+ */
+class CosmoCommerce_Cosmo99Bill_PaymentController extends Mage_Core_Controller_Front_Action
+{
+ /**
+ * Order instance
+ */
+ protected $_order;
+
+ /**
+ * Get order
+ *
+ * @param none
+ * @return Mage_Sales_Model_Order
+ */
+ public function getOrder()
+ {
+ if ($this->_order == null) {
+ $session = Mage::getSingleton('checkout/session');
+ $this->_order = Mage::getModel('sales/order');
+ $this->_order->loadByIncrementId($session->getLastRealOrderId());
+ }
+ return $this->_order;
+ }
+
+ /**
+ * When a customer chooses Cosmo99Bill on Checkout/Payment page
+ *
+ */
+ public function redirectAction()
+ {
+ $session = Mage::getSingleton('checkout/session');
+ $session->setCosmo99BillPaymentQuoteId($session->getQuoteId());
+
+ $order = $this->getOrder();
+
+ if (!$order->getId()) {
+ $this->norouteAction();
+ return;
+ }
+
+ $order->addStatusToHistory(
+ $order->getStatus(),
+ Mage::helper('cosmo99bill')->__('Customer was redirected to 99Bill')
+ );
+ $order->save();
+
+ $this->getResponse()
+ ->setBody($this->getLayout()
+ ->createBlock('cosmo99bill/redirect')
+ ->setOrder($order)
+ ->toHtml());
+
+ $session->unsQuoteId();
+ }
+
+ /**
+ * Cosmo99Bill response router
+ *
+ * @param none
+ * @return void
+ */
+ public function notifyAction()
+ {
+ $model = Mage::getModel('cosmo99bill/payment');
+
+ if ($this->getRequest()->isPost()) {
+ $postData = $this->getRequest()->getPost();
+ $method = 'post';
+
+ } else if ($this->getRequest()->isGet()) {
+ $postData = $this->getRequest()->getQuery();
+ $method = 'get';
+
+ } else {
+ $model->generateErrorResponse();
+ }
+
+
+
+ $order = Mage::getModel('sales/order')
+ ->loadByIncrementId($postData['reference']);
+
+ if (!$order->getId()) {
+ $model->generateErrorResponse();
+ }
+
+ if ($returnedMAC == $correctMAC) {
+ if (1) {
+ $order->addStatusToHistory(
+ $model->getConfigData('order_status_payment_accepted'),
+ Mage::helper('cosmo99bill')->__('Payment accepted by 99Bill')
+ );
+
+ $order->sendNewOrderEmail();
+
+ if ($this->saveInvoice($order)) {
+// $order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, true);
+ }
+
+ } else {
+ $order->addStatusToHistory(
+ $model->getConfigData('order_status_payment_refused'),
+ Mage::helper('cosmo99bill')->__('Payment refused by 99Bill')
+ );
+
+ // TODO: customer notification on payment failure
+ }
+
+ $order->save();
+
+ } else {
+ $order->addStatusToHistory(
+ Mage_Sales_Model_Order::STATE_CANCELED,//$order->getStatus(),
+ Mage::helper('cosmo99bill')->__('Returned MAC is invalid. Order cancelled.')
+ );
+ $order->cancel();
+ $order->save();
+ $model->generateErrorResponse();
+ }
+ }
+
+ /**
+ * Save invoice for order
+ *
+ * @param Mage_Sales_Model_Order $order
+ * @return boolean Can save invoice or not
+ */
+ protected function saveInvoice(Mage_Sales_Model_Order $order)
+ {
+ if ($order->canInvoice()) {
+ $convertor = Mage::getModel('sales/convert_order');
+ $invoice = $convertor->toInvoice($order);
+ foreach ($order->getAllItems() as $orderItem) {
+ if (!$orderItem->getQtyToInvoice()) {
+ continue;
+ }
+ $item = $convertor->itemToInvoiceItem($orderItem);
+ $item->setQty($orderItem->getQtyToInvoice());
+ $invoice->addItem($item);
+ }
+ $invoice->collectTotals();
+ $invoice->register()->capture();
+ Mage::getModel('core/resource_transaction')
+ ->addObject($invoice)
+ ->addObject($invoice->getOrder())
+ ->save();
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * Success payment page
+ *
+ * @param none
+ * @return void
+ */
+ public function successAction()
+ {
+ $session = Mage::getSingleton('checkout/session');
+ $session->setQuoteId($session->getCosmo99BillPaymentQuoteId());
+ $session->unsCosmo99BillPaymentQuoteId();
+
+ $order = $this->getOrder();
+
+ if (!$order->getId()) {
+ $this->norouteAction();
+ return;
+ }
+
+ $order->addStatusToHistory(
+ $order->getStatus(),
+ Mage::helper('cosmo99bill')->__('Customer successfully returned from 99Bill')
+ );
+
+ $order->save();
+
+ $this->_redirect('checkout/onepage/success');
+ }
+
+ /**
+ * Failure payment page
+ *
+ * @param none
+ * @return void
+ */
+ public function errorAction()
+ {
+ $session = Mage::getSingleton('checkout/session');
+ $errorMsg = Mage::helper('cosmo99bill')->__(' There was an error occurred during paying process.');
+
+ $order = $this->getOrder();
+
+ if (!$order->getId()) {
+ $this->norouteAction();
+ return;
+ }
+ if ($order instanceof Mage_Sales_Model_Order && $order->getId()) {
+ $order->addStatusToHistory(
+ Mage_Sales_Model_Order::STATE_CANCELED,//$order->getStatus(),
+ Mage::helper('cosmo99bill')->__('Customer returned from 99Bill.') . $errorMsg
+ );
+
+ $order->save();
+ }
+
+ $this->loadLayout();
+ $this->renderLayout();
+ Mage::getSingleton('checkout/session')->unsLastRealOrderId();
+ }
+}
View
155 99Bill/trunk/app/code/community/CosmoCommerce/Cosmo99Bill/etc/config.xml
@@ -0,0 +1,155 @@
+<?xml version="1.0"?>
+<!--
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * @category CosmoCommerce
+ * @package CosmoCommerce_99Bill
+ * @copyright Copyright (c) 2009 CosmoCommerce,LLC. (http://www.cosmocommerce.com)
+ * @contact :
+ * T: +86-021-66346672
+ * L: Shanghai,China
+ * M:sales@cosmocommerce.com
+ */
+-->
+<config>
+ <modules>
+ <CosmoCommerce_Cosmo99Bill>
+ <version>0.9.0</version>
+ </CosmoCommerce_Cosmo99Bill>
+ </modules>
+ <global>
+ <helpers>
+ <cosmo99bill>
+ <class>CosmoCommerce_Cosmo99Bill_Helper</class>
+ </cosmo99bill>
+ </helpers>
+ <models>
+ <cosmo99bill>
+ <class>CosmoCommerce_Cosmo99Bill_Model</class>
+ <resourceModel>cosmo99bill_mysql4</resourceModel>
+ </cosmo99bill>
+ <cosmo99bill_mysql4>
+ <class>CosmoCommerce_Cosmo99Bill_Model_Mysql4</class>
+ <entities>
+ <api_debug><table>cosmo99bill_api_debug</table></api_debug>
+ </entities>
+ </cosmo99bill_mysql4>
+ </models>
+ <resources>
+ <cosmo99bill_setup>
+ <setup>
+ <module>CosmoCommerce_Cosmo99Bill</module>
+ <class>CosmoCommerce_Cosmo99Bill_Model_Mysql4_Setup</class>
+ </setup>
+ <connection>
+ <use>core_setup</use>
+ </connection>
+ </cosmo99bill_setup>
+ <cosmo99bill_write>
+ <connection>
+ <use>core_write</use>
+ </connection>
+ </cosmo99bill_write>
+ <cosmo99bill_read>
+ <connection>
+ <use>core_read</use>
+ </connection>
+ </cosmo99bill_read>
+ </resources>
+ <blocks>
+ <cosmo99bill><class>CosmoCommerce_Cosmo99Bill_Block</class></cosmo99bill>
+ </blocks>
+ <payment>
+ <cosmo99bill_payment>
+ <languages>
+ <FR>
+ <code>FR</code>
+ <name>Français</name>
+ </FR>
+ <EN>
+ <code>EN</code>
+ <name>Anglais</name>
+ </EN>
+ <ES>
+ <code>ES</code>
+ <name>Espagnol</name>
+ </ES>
+ <DE>
+ <code>DE</code>
+ <name>Allemand</name>
+ </DE>
+ <IT>
+ <code>IT</code>
+ <name>Italien</name>
+ </IT>
+ <NL>
+ <code>NL</code>
+ <name>Néerlandais</name>
+ </NL>
+ </languages>
+ </cosmo99bill_payment>
+ </payment>
+ </global>
+ <frontend>
+ <secure_url>
+ <cosmo99bill_payment>/cosmo99bill/payment</cosmo99bill_payment>
+ </secure_url>
+ <routers>
+ <cosmo99bill>
+ <use>standard</use>
+ <args>
+ <module>CosmoCommerce_Cosmo99Bill</module>
+ <frontName>cosmo99bill</frontName>
+ </args>
+ </cosmo99bill>
+ </routers>
+ <translate>
+ <modules>
+ <CosmoCommerce_Cosmo99Bill>
+ <files>
+ <default>CosmoCommerce_Cosmo99Bill.csv</default>
+ </files>
+ </CosmoCommerce_Cosmo99Bill>
+ </modules>
+ </translate>
+ <layout>
+ <updates>
+ <cosmo99bill>
+ <file>cosmo99bill.xml</file>
+ </cosmo99bill>
+ </updates>
+ </layout>
+ </frontend>
+ <adminhtml>
+ <translate>
+ <modules>
+ <CosmoCommerce_Cosmo99Bill>
+ <files>
+ <default>CosmoCommerce_Cosmo99Bill.csv</default>
+ </files>
+ </CosmoCommerce_Cosmo99Bill>
+ </modules>
+ </translate>
+ </adminhtml>
+ <default>
+ <payment>
+ <cosmo99bill_payment>
+ <model>cosmo99bill/payment</model>
+ <title>Cosmo99Bill</title>
+ <allowspecific>0</allowspecific>
+ <transaction_type>O</transaction_type>
+ </cosmo99bill_payment>
+ </payment>
+ </default>
+</config>
View
225 99Bill/trunk/app/code/community/CosmoCommerce/Cosmo99Bill/etc/system.xml
@@ -0,0 +1,225 @@
+<?xml version="1.0"?>
+<!--
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * @category CosmoCommerce
+ * @package CosmoCommerce_99Bill
+ * @copyright Copyright (c) 2009 CosmoCommerce,LLC. (http://www.cosmocommerce.com)
+ * @contact :
+ * T: +86-021-66346672
+ * L: Shanghai,China
+ * M:sales@cosmocommerce.com
+ */
+-->
+<config>
+ <sections>
+ <payment>
+ <groups>
+ <cosmo99bill_payment module="cosmo99bill">
+ <label>CosmoCommerce 99Bill Payment</label>
+ <frontend_type>text</frontend_type>
+ <sort_order>300</sort_order>
+ <show_in_default>1</show_in_default>
+ <show_in_website>1</show_in_website>
+ <show_in_store>0</show_in_store>
+ <fields>
+ <active translate="label">
+ <label>Enabled</label>
+ <frontend_type>select</frontend_type>
+ <source_model>adminhtml/system_config_source_yesno</source_model>
+ <sort_order>1</sort_order>
+ <show_in_default>1</show_in_default>
+ <show_in_website>1</show_in_website>
+ <show_in_store>0</show_in_store>
+ </active>
+ <title translate="label">
+ <label>Title</label>
+ <frontend_type>text</frontend_type>
+ <sort_order>2</sort_order>
+ <show_in_default>1</show_in_default>
+ <show_in_website>1</show_in_website>
+ <show_in_store>0</show_in_store>
+ </title>
+ <gateway translate="label">
+ <label>Gateway</label>
+ <frontend_type>text</frontend_type>
+ <sort_order>4</sort_order>
+ <show_in_default>1</show_in_default>
+ <show_in_website>1</show_in_website>
+ <show_in_store>0</show_in_store>
+ </gateway>
+ <partner_id translate="label">
+ <label>Partner ID</label>
+ <frontend_type>text</frontend_type>
+ <sort_order>5</sort_order>
+ <show_in_default>1</show_in_default>
+ <show_in_website>1</show_in_website>
+ <show_in_store>0</show_in_store>
+ </partner_id>
+ <security_code translate="label">
+ <label>Security Key</label>
+ <frontend_type>text</frontend_type>
+ <sort_order>6</sort_order>
+ <show_in_default>1</show_in_default>
+ <show_in_website>1</show_in_website>
+ <show_in_store>0</show_in_store>
+ </security_code>
+ <ext1 translate="label">
+ <label>Ext Field 1(Optional)</label>
+ <frontend_type>text</frontend_type>
+ <sort_order>9</sort_order>
+ <show_in_default>1</show_in_default>
+ <show_in_website>1</show_in_website>
+ <show_in_store>0</show_in_store>
+ </ext1>
+ <ext2 translate="label">
+ <label>Ext Field 2(Optional)</label>
+ <frontend_type>text</frontend_type>
+ <sort_order>9</sort_order>
+ <show_in_default>1</show_in_default>
+ <show_in_website>1</show_in_website>
+ <show_in_store>0</show_in_store>
+ </ext2>
+ <bank_id translate="label">
+ <label>Bank ID</label>
+ <frontend_type>text</frontend_type>
+ <sort_order>7</sort_order>
+ <show_in_default>1</show_in_default>
+ <show_in_website>1</show_in_website>
+ <show_in_store>0</show_in_store>
+ </bank_id>
+ <redo_flag translate="label">
+ <label>REDO Flag(Default is 0)</label>
+ <frontend_type>text</frontend_type>
+ <sort_order>7</sort_order>
+ <show_in_default>1</show_in_default>
+ <show_in_website>1</show_in_website>
+ <show_in_store>0</show_in_store>
+ </redo_flag>
+ <pid translate="label">
+ <label>Partner ID(Only For 99Bill Agency,Optional)</label>
+ <frontend_type>text</frontend_type>
+ <sort_order>7</sort_order>
+ <show_in_default>1</show_in_default>
+ <show_in_website>1</show_in_website>
+ <show_in_store>0</show_in_store>
+ </pid>
+ <pay_type translate="label">
+ <label>Payment Type(00 -- Combination; 10 -- C/D Card; 11 -- Telephone Bank ; 12 99Bill Account; 13 Offline; 14 B2B)</label>
+ <frontend_type>text</frontend_type>
+ <sort_order>7</sort_order>
+ <show_in_default>1</show_in_default>
+ <show_in_website>1</show_in_website>
+ <show_in_store>0</show_in_store>
+ </pay_type>
+ <page_url translate="label">
+ <label>Page URL</label>
+ <frontend_type>text</frontend_type>
+ <sort_order>8</sort_order>
+ <show_in_default>1</show_in_default>
+ <show_in_website>1</show_in_website>
+ <show_in_store>0</show_in_store>
+ </page_url>
+ <bg_url translate="label">
+ <label>Background URL</label>
+ <frontend_type>text</frontend_type>
+ <sort_order>8</sort_order>
+ <show_in_default>1</show_in_default>
+ <show_in_website>1</show_in_website>
+ <show_in_store>0</show_in_store>
+ </bg_url>
+ <input_charset translate="label">
+ <label>Input Charset(1 -- UTF-8; 2 -- GBK; 3 -- gb2312)</label>
+ <frontend_type>text</frontend_type>
+ <sort_order>8</sort_order>
+ <show_in_default>1</show_in_default>
+ <show_in_website>1</show_in_website>
+ <show_in_store>0</show_in_store>
+ </input_charset>
+ <display_language translate="label">
+ <label>Display Language(1 -- Chinese; 2 -- English)</label>
+ <frontend_type>text</frontend_type>
+ <sort_order>8</sort_order>
+ <show_in_default>1</show_in_default>
+ <show_in_website>1</show_in_website>
+ <show_in_store>0</show_in_store>
+ </display_language>
+ <transport translate="label">
+ <label>Transport</label>
+ <frontend_type>select</frontend_type>
+ <source_model>cosmo99bill/source_transport</source_model>
+ <sort_order>8</sort_order>
+ <show_in_default>1</show_in_default>
+ <show_in_website>1</show_in_website>
+ <show_in_store>1</show_in_store>
+ </transport>
+ <order_status translate="label">
+ <label>New order status</label>
+ <frontend_type>select</frontend_type>
+ <source_model>adminhtml/system_config_source_order_status</source_model>
+ <sort_order>12</sort_order>
+ <show_in_default>1</show_in_default>
+ <show_in_website>1</show_in_website>
+ <show_in_store>0</show_in_store>
+ </order_status>
+ <order_status_payment_accepted translate="label">
+ <label>Order status when payment accepted by Cosmo99Bill</label>
+ <frontend_type>select</frontend_type>
+ <source_model>adminhtml/system_config_source_order_status</source_model>
+ <sort_order>13</sort_order>
+ <show_in_default>1</show_in_default>
+ <show_in_website>1</show_in_website>
+ <show_in_store>0</show_in_store>
+ </order_status_payment_accepted>
+ <order_status_payment_refused translate="label">
+ <label>Order status when payment refused by Cosmo99Bill</label>
+ <frontend_type>select</frontend_type>
+ <source_model>adminhtml/system_config_source_order_status</source_model>
+ <sort_order>14</sort_order>
+ <show_in_default>1</show_in_default>
+ <show_in_website>1</show_in_website>
+ <show_in_store>0</show_in_store>
+ </order_status_payment_refused>
+ <allowspecific translate="label">
+ <label>Payment from applicable countries</label>
+ <frontend_type>allowspecific</frontend_type>
+ <sort_order>15</sort_order>
+ <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
+ <show_in_default>1</show_in_default>
+ <show_in_website>1</show_in_website>
+ <show_in_store>1</show_in_store>
+ </allowspecific>
+ <specificcountry translate="label">
+ <label>Payment from Specific countries</label>
+ <frontend_type>multiselect</frontend_type>
+ <sort_order>16</sort_order>
+ <source_model>adminhtml/system_config_source_country</source_model>
+ <show_in_default>1</show_in_default>
+ <show_in_website>1</show_in_website>
+ <show_in_store>1</show_in_store>
+ </specificcountry>
+ <sort_order translate="label">
+ <label>Sort order</label>
+ <frontend_type>text</frontend_type>
+ <sort_order>17</sort_order>
+ <show_in_default>1</show_in_default>
+ <show_in_website>1</show_in_website>
+ <show_in_store>0</show_in_store>
+ </sort_order>
+ </fields>
+ </cosmo99bill_payment>
+ </groups>
+ </payment>
+ </sections>
+</config>
View
25 99Bill/trunk/app/code/community/CosmoCommerce/Cosmo99Bill/sql/cosmo99bill_setup/mysql4-install-0.1.0.php
@@ -0,0 +1,25 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * @category CosmoCommerce
+ * @package CosmoCommerce_99Bill
+ * @copyright Copyright (c) 2009 CosmoCommerce,LLC. (http://www.cosmocommerce.com)
+ * @contact :
+ * T: +86-021-66346672
+ * L: Shanghai,China
+ * M:sales@cosmocommerce.com
+ */
+
+
+$installer = $this;
View
27 99Bill/trunk/app/design/frontend/default/default/template/cosmo99bill/error.phtml
@@ -0,0 +1,27 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * @category CosmoCommerce
+ * @package CosmoCommerce_99Bill
+ * @copyright Copyright (c) 2009 CosmoCommerce,LLC. (http://www.cosmocommerce.com)
+ * @contact :
+ * T: +86-021-66346672
+ * L: Shanghai,China
+ * M:sales@cosmocommerce.com
+ */
+?>
+<div class="page-head">
+ <h3><?php echo $this->__('Error occured') ?></h3>
+</div>
+<p><?php echo $this->__('There was an error occurred during paying process.') ?></p>
View
43 99Bill/trunk/app/design/frontend/default/default/template/cosmo99bill/form.phtml
@@ -0,0 +1,43 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * @category CosmoCommerce
+ * @package CosmoCommerce_99Bill
+ * @copyright Copyright (c) 2009 CosmoCommerce,LLC. (http://www.cosmocommerce.com)
+ * @contact :
+ * T: +86-021-66346672
+ * L: Shanghai,China
+ * M:sales@cosmocommerce.com
+ */
+?>
+
+<div class="form-divst">
+ <img src="<?php echo $this->getSkinUrl('images/cosmo99bill/ljzf02.gif') ?>" />
+<br/>
+</div>
+<fieldset class="form-divst">
+ <?php $_code=$this->getMethodCode() ?>
+
+ <ul id="payment_form_<?php echo $_code ?>" style="display:none">
+
+ <div >
+<img src="<?php echo $this->getSkinUrl('images/cosmo99bill/bank_boc.gif') ?>"> <img src="<?php echo $this->getSkinUrl('images/cosmo99bill/bank_ccb.gif') ?>"> <img src="<?php echo $this->getSkinUrl('images/cosmo99bill/bank_icbc.gif') ?>"> <img src="<?php echo $this->getSkinUrl('images/cosmo99bill/bank_cmb.gif') ?>"> <img src="<?php echo $this->getSkinUrl('images/cosmo99bill/bank_cmbc.gif') ?>"> <br />
+<img src="<?php echo $this->getSkinUrl('images/cosmo99bill/bank_spdb.gif') ?>"> <img src="<?php echo $this->getSkinUrl('images/cosmo99bill/bank_gdb.gif') ?>"> <img src="<?php echo $this->getSkinUrl('images/cosmo99bill/bank_hxb.gif') ?>"> <img src="<?php echo $this->getSkinUrl('images/cosmo99bill/bank_bosh.gif') ?>"> <img src="<?php echo $this->getSkinUrl('images/cosmo99bill/bank_cib.gif') ?>"> <br />
+
+ </div><br />
+ </ul>
+ <div style="clear:both;">
+ <?php echo $this->__('You will be redirected to 99bill website when you place an order.') ?>
+ </div>
+</fieldset>
View
35 99Bill/trunk/app/etc/modules/CosmoCommerce_Cosmo99Bill.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0"?>
+<!--
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * @category CosmoCommerce
+ * @package CosmoCommerce_99Bill
+ * @copyright Copyright (c) 2009 CosmoCommerce,LLC. (http://www.cosmocommerce.com)
+ * @contact :
+ * T: +86-021-66346672
+ * L: Shanghai,China
+ * M:sales@cosmocommerce.com
+ */
+-->
+<config>
+ <modules>
+ <CosmoCommerce_Cosmo99Bill>
+ <active>true</active>
+ <codePool>community</codePool>
+ <depends>
+ <Mage_Payment/>
+ </depends>
+ </CosmoCommerce_Cosmo99Bill>
+ </modules>
+</config>
View
43 99Bill/trunk/app/locale/en_US/CosmoCommerce_Cosmo99Bill.csv
@@ -0,0 +1,43 @@
+" There was an error occurred during paying process."," There was an error occurred during paying process."
+"Bank","Bank"
+"Credit Mutuel","Credit Mutuel"
+"Customer returned from 99Bill.","Customer returned from 99Bill."
+"Customer successfully returned from 99Bill","Customer successfully returned from 99Bill"
+"Customer was redirected to 99Bill","Customer was redirected to 99Bill"
+"99Bill Payment", "99Bill Payment"
+"Service Type","Service Type"
+"Default 99Bill Interface language","Default 99Bill Interface language"
+"Dutch","Dutch"
+"Enabled","Enabled"
+"English","English"
+"Error occured","Error occured"
+"French","French"
+"German","German"
+"Groupe CIC","Groupe CIC"
+"Italian","Italian"
+"Key","Key"
+"New order status","New order status"
+"OBC","OBC"
+"Order %s","Order %s"
+"Order number will be used if left empty","Order number will be used if left empty"
+"Order status when payment accepted by 99Bill", "Order status when payment accepted by 99Bill"
+"Order status when payment refused by 99Bill", "Order status when payment refused by 99Bill"
+"Payment accepted by 99Bill", "Payment accepted by 99Bill"
+"Payment from Specific countries","Payment from Specific countries"
+"Payment from applicable countries","Payment from applicable countries"
+"Payment refused by 99Bill", "Payment refused by 99Bill"
+"Preference will be given to store language chosen by the user", "Preference will be given to store language chosen by the user"
+"Returned MAC is invalid. Order cancelled.","Returned MAC is invalid. Order cancelled."
+"SHA key","SHA key"
+"Site code","Site code"
+"Sort order","Sort order"
+"Spain","Spain"
+"TPE number","TPE number"
+"Test mode","Test mode"
+"There was an error occurred during paying process.","There was an error occurred during paying process."
+"Title","Title"
+"Transaction Description","Transaction Description"
+"You will be redirected to 99Bill in a few seconds.","You will be redirected to 99Bill in a few seconds."
+"You will be redirected to 99Bill website when you place an order.","You will be redirected to 99Bill website when you place an order."
+"Products","Products"
+"Virtual Products","Virtual Products"
View
41 99Bill/trunk/app/locale/zh_CN/CosmoCommerce_Cosmo99Bill.csv
@@ -0,0 +1,41 @@
+" There was an error occurred during paying process.","在支付的过程中发生了一个错误"
+"Bank","银行"
+"Service Type","服务类型"
+"Enabled","启用"
+"English","英语"
+"Error occured","发生错误"
+"Key","加密号"
+"New order status","新的订单号状态"
+"Order %s","Order %s"
+"Order number will be used if left empty","Order number will be used if left empty"
+"Site code","网站代码"
+"Sort order","排序方法"
+"Spain","西班牙"
+"Test mode","测试模式"
+"There was an error occurred during paying process.","在支付的过程中发生了一个错误"
+"Title","标题"
+"Transaction Description","交易描述"
+"Products","担保支付(实物产品)"
+"Virtual Products","即时支付(虚拟产品)"
+"You will be redirected to 99Bill website when you place an order.","下订单时,会转向快钱网站。"
+"You will be redirected to 99Bill in a few seconds.","您很快将会转向快钱网站"
+"Gateway","接口地址"
+"Partner ID","合作伙伴ID (即Partner ID)"
+"Security Code","安全校验号"
+"Seller Email","快钱账号(邮件地址或ID)"
+"Transport","传输协议"
+"Order status when payment accepted by 99Bill","快钱订单接受状态"
+"Order status when payment refused by 99Bill","快钱订单拒绝状态"
+"Payment from applicable countries","支付允许国家"
+"Security Key","密钥"
+"Partner ID(Only For 99Bill Agency,Optional)","快钱合作伙伴(快钱代理,可选)"
+"REDO Flag(Default is 0)","REDO 标识(默认为0)"
+"Payment Type(00 -- Combination; 10 -- C/D Card; 11 -- Telephone Bank ; 12 99Bill Account; 13 Offline; 14 B2B)","支付类型 (00 -- 组合方式; 10 --借贷卡; 11 --电话银行; 12 快钱账号; 13 离线; 14 B2B)"
+"Bank ID","银行ID"
+"Input Charset(1 -- UTF-8; 2 -- GBK; 3 -- gb2312)","字符编码(1 -- UTF-8; 2 -- GBK; 3 -- gb2312)"
+"Background URL","后台回调(Background)URL"
+"Display Language(1 -- Chinese; 2 -- English)","显示语言( 1 -- 中文; 2 -- 英文)"
+"Page URL","页面跳转(Page)URL"
+"Ext Field 2(Optional)","扩展字段 2(可选)"
+"Ext Field 1(Optional)","扩展字段 1(可选)"
+"CosmoCommerce 99Bill Payment","CosmoCommerce 快钱支付网关"
View
BIN  99Bill/trunk/skin/frontend/default/default/images/cosmo99bill/99bill.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  99Bill/trunk/skin/frontend/default/default/images/cosmo99bill/bank_boc.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  99Bill/trunk/skin/frontend/default/default/images/cosmo99bill/bank_bosh.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  99Bill/trunk/skin/frontend/default/default/images/cosmo99bill/bank_ccb.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  99Bill/trunk/skin/frontend/default/default/images/cosmo99bill/bank_cib.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  99Bill/trunk/skin/frontend/default/default/images/cosmo99bill/bank_cmb.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  99Bill/trunk/skin/frontend/default/default/images/cosmo99bill/bank_cmbc.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  99Bill/trunk/skin/frontend/default/default/images/cosmo99bill/bank_gdb.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  99Bill/trunk/skin/frontend/default/default/images/cosmo99bill/bank_hxb.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  99Bill/trunk/skin/frontend/default/default/images/cosmo99bill/bank_icbc.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  99Bill/trunk/skin/frontend/default/default/images/cosmo99bill/bank_spdb.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  99Bill/trunk/skin/frontend/default/default/images/cosmo99bill/ljzf02.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  99Bill/trunk/skin/frontend/default/default/images/cosmo99bill/logo_99bill.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  Alipay/release/Cosmo_Community_AlipayPaymentGateway-1.3.2.4.tgz
Binary file not shown
View
25 Alipay/trunk/app/code/community/CosmoCommerce/Alipay/Block/Error.php
@@ -0,0 +1,25 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * @category CosmoCommerce
+ * @package CosmoCommerce_Alipay
+ * @copyright Copyright (c) 2009 CosmoCommerce,LLC. (http://www.cosmocommerce.com)
+ * @contact :
+ * T: +86-021-66346672
+ * L: Shanghai,China
+ * M:sales@cosmocommerce.com
+ */
+class CosmoCommerce_Alipay_Block_Error extends Mage_Core_Block_Template
+{
+}
View
31 Alipay/trunk/app/code/community/CosmoCommerce/Alipay/Block/Form.php
@@ -0,0 +1,31 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * @category CosmoCommerce
+ * @package CosmoCommerce_Alipay
+ * @copyright Copyright (c) 2009 CosmoCommerce,LLC. (http://www.cosmocommerce.com)
+ * @contact :
+ * T: +86-021-66346672
+ * L: Shanghai,China
+ * M:sales@cosmocommerce.com
+ */
+class CosmoCommerce_Alipay_Block_Form extends Mage_Payment_Block_Form
+{
+ protected function _construct()
+ {
+ $this->setTemplate('alipay/form.phtml');
+ parent::_construct();
+ }
+
+}
View
50 Alipay/trunk/app/code/community/CosmoCommerce/Alipay/Block/Redirect.php
@@ -0,0 +1,50 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * @category CosmoCommerce
+ * @package CosmoCommerce_Alipay
+ * @copyright Copyright (c) 2009 CosmoCommerce,LLC. (http://www.cosmocommerce.com)
+ * @contact :
+ * T: +86-021-66346672
+ * L: Shanghai,China
+ * M:sales@cosmocommerce.com
+ */
+class CosmoCommerce_Alipay_Block_Redirect extends Mage_Core_Block_Abstract
+{
+
+ protected function _toHtml()
+ {
+ $standard = Mage::getModel('alipay/payment');
+ $form = new Varien_Data_Form();
+ $form->setAction($standard->getAlipayUrl())
+ ->setId('alipay_payment_checkout')
+ ->setName('alipay_payment_checkout')
+ ->setMethod('GET')
+ ->setUseContainer(true);
+ foreach ($standard->setOrder($this->getOrder())->getStandardCheckoutFormFields() as $field => $value) {
+ $form->addField($field, 'hidden', array('name' => $field, 'value' => $value));
+ }
+
+ $formHTML = $form->toHtml();
+
+ $html = '<html><body>';
+ $html.= $this->__('You will be redirected to Alipay in a few seconds.');
+ $html.= $formHTML;
+ $html.= '<script type="text/javascript">document.getElementById("alipay_payment_checkout").submit();</script>';
+ $html.= '</body></html>';
+
+
+ return $html;
+ }
+}
View
26 Alipay/trunk/app/code/community/CosmoCommerce/Alipay/Helper/Data.php
@@ -0,0 +1,26 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * @category CosmoCommerce
+ * @package CosmoCommerce_Alipay
+ * @copyright Copyright (c) 2009 CosmoCommerce,LLC. (http://www.cosmocommerce.com)
+ * @contact :
+ * T: +86-021-66346672
+ * L: Shanghai,China
+ * M:sales@cosmocommerce.com
+ */
+class CosmoCommerce_Alipay_Helper_Data extends Mage_Core_Helper_Abstract
+{
+
+}
View
29 Alipay/trunk/app/code/community/CosmoCommerce/Alipay/Model/Api/Debug.php
@@ -0,0 +1,29 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * @category CosmoCommerce
+ * @package CosmoCommerce_Alipay
+ * @copyright Copyright (c) 2009 CosmoCommerce,LLC. (http://www.cosmocommerce.com)
+ * @contact :
+ * T: +86-021-66346672
+ * L: Shanghai,China
+ * M:sales@cosmocommerce.com
+ */
+class CosmoCommerce_Alipay_Model_Api_Debug extends Mage_Core_Model_Abstract
+{
+ protected function _construct()
+ {
+ $this->_init('alipay/api_debug');
+ }
+}
View
30 Alipay/trunk/app/code/community/CosmoCommerce/Alipay/Model/Mysql4/Api/Debug.php
@@ -0,0 +1,30 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * @category CosmoCommerce
+ * @package CosmoCommerce_Alipay
+ * @copyright Copyright (c) 2009 CosmoCommerce,LLC. (http://www.cosmocommerce.com)
+ * @contact :
+ * T: +86-021-66346672
+ * L: Shanghai,China
+ * M:sales@cosmocommerce.com
+ */
+
+class CosmoCommerce_Alipay_Model_Mysql4_Api_Debug extends Mage_Core_Model_Mysql4_Abstract
+{
+ protected function _construct()
+ {
+ $this->_init('alipay/api_debug', 'debug_id');
+ }
+}
View
30 Alipay/trunk/app/code/community/CosmoCommerce/Alipay/Model/Mysql4/Api/Debug/Collection.php
@@ -0,0 +1,30 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * @category CosmoCommerce
+ * @package CosmoCommerce_Alipay
+ * @copyright Copyright (c) 2009 CosmoCommerce,LLC. (http://www.cosmocommerce.com)
+ * @contact :
+ * T: +86-021-66346672
+ * L: Shanghai,China
+ * M:sales@cosmocommerce.com
+ */
+
+class CosmoCommerce_Alipay_Model_Mysql4_Api_Debug_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
+{
+ protected function _construct()
+ {
+ $this->_init('alipay/api_debug');
+ }
+}
View
27 Alipay/trunk/app/code/community/CosmoCommerce/Alipay/Model/Mysql4/Setup.php
@@ -0,0 +1,27 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * @category CosmoCommerce
+ * @package CosmoCommerce_Alipay
+ * @copyright Copyright (c) 2009 CosmoCommerce,LLC. (http://www.cosmocommerce.com)
+ * @contact :
+ * T: +86-021-66346672
+ * L: Shanghai,China
+ * M:sales@cosmocommerce.com
+ */
+
+class CosmoCommerce_Alipay_Model_Mysql4_Setup extends Mage_Eav_Model_Entity_Setup
+{
+
+}
View
323 Alipay/trunk/app/code/community/CosmoCommerce/Alipay/Model/Payment.php
@@ -0,0 +1,323 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * @category CosmoCommerce
+ * @package CosmoCommerce_Alipay
+ * @copyright Copyright (c) 2009 CosmoCommerce,LLC. (http://www.cosmocommerce.com)
+ * @contact :
+ * T: +86-021-66346672
+ * L: Shanghai,China
+ * M:sales@cosmocommerce.com
+ */
+
+class CosmoCommerce_Alipay_Model_Payment extends Mage_Payment_Model_Method_Abstract
+{
+ protected $_code = 'alipay_payment';
+ protected $_formBlockType = 'alipay/form';
+
+ // Alipay return codes of payment
+ const RETURN_CODE_ACCEPTED = 'Success';
+ const RETURN_CODE_TEST_ACCEPTED = 'Success';
+ const RETURN_CODE_ERROR = 'Fail';
+
+ // Payment configuration
+ protected $_isGateway = false;
+ protected $_canAuthorize = true;
+ protected $_canCapture = true;
+ protected $_canCapturePartial = false;
+ protected $_canRefund = false;
+ protected $_canVoid = false;
+ protected $_canUseInternal = false;
+ protected $_canUseCheckout = true;
+ protected $_canUseForMultishipping = false;
+
+ // Order instance
+ protected $_order = null;
+
+ /**
+ * Returns Target URL
+ *
+ * @return string Target URL
+ */
+ public function getAlipayUrl()
+ {
+ $url = $this->getConfigData('transport').'://'.$this->getConfigData('gateway');
+ return $url;
+ }
+
+ /**
+ * Return back URL
+ *
+ * @return string URL
+ */
+ protected function getReturnURL()
+ {
+ return Mage::getUrl('checkout/onepage/success', array('_secure' => true));
+ }
+
+ /**
+ * Return URL for Alipay success response
+ *
+ * @return string URL
+ */
+ protected function getSuccessURL()
+ {
+ return Mage::getUrl('checkout/onepage/success', array('_secure' => true));
+ }
+
+ /**
+ * Return URL for Alipay failure response
+ *
+ * @return string URL
+ */
+ protected function getErrorURL()
+ {
+ return Mage::getUrl('alipay/payment/error', array('_secure' => true));
+ }
+
+ /**
+ * Return URL for Alipay notify response
+ *
+ * @return string URL
+ */
+ protected function getNotifyURL()
+ {
+ return Mage::getUrl('alipay/payment/notify/', array('_secure' => true));
+ }
+
+ /**
+ * Capture payment
+ *
+ * @param Varien_Object $orderPayment
+ * @return Mage_Payment_Model_Abstract
+ */
+ public function capture(Varien_Object $payment, $amount)
+ {
+ $payment->setStatus(self::STATUS_APPROVED)
+ ->setLastTransId($this->getTransactionId());
+
+ return $this;
+ }
+
+ /**
+ * Form block description
+ *
+ * @return object
+ */
+ public function createFormBlock($name)
+ {
+ $block = $this->getLayout()->createBlock('alipay/form_payment', $name);
+ $block->setMethod($this->_code);
+ $block->setPayment($this->getPayment());
+
+ return $block;
+ }
+
+ /**
+ * Return Order Place Redirect URL
+ *
+ * @return string Order Redirect URL
+ */
+ public function getOrderPlaceRedirectUrl()
+ {
+ return Mage::getUrl('alipay/payment/redirect');
+ }
+
+ /**
+ * Return Standard Checkout Form Fields for request to Alipay
+ *
+ * @return array Array of hidden form fields
+ */
+ public function getStandardCheckoutFormFields()
+ {
+ $session = Mage::getSingleton('checkout/session');
+
+ $order = $this->getOrder();
+ if (!($order instanceof Mage_Sales_Model_Order)) {
+ Mage::throwException($this->_getHelper()->__('Cannot retrieve order object'));
+ }
+
+ $parameter = array('service' => $this->getConfigData('service_type'),
+ 'partner' => $this->getConfigData('partner_id'),
+ 'return_url' => $this->getReturnURL(),
+ 'notify_url' => $this->getNotifyURL(),
+ '_input_charset' => 'utf-8',
+ 'subject' => $order->getRealOrderId(),
+ 'body' => $order->getRealOrderId(),
+ 'out_trade_no' => $order->getRealOrderId(), // order ID
+ 'logistics_fee' => '0.00', //because magento has shipping system, it has included shipping price
+ 'logistics_payment' => 'BUYER_PAY', //always
+ 'logistics_type' => 'EXPRESS', //Only three shipping method:POST,EMS,EXPRESS
+ 'price' => sprintf('%.2f', $order->getBaseGrandTotal()) ,
+ 'payment_type' => '1',
+ 'quantity' => '1', // For the moment, the parameter of price is total price, so the quantity is 1.
+ 'show_url' => Mage::getUrl(),
+ 'seller_email' => $this->getConfigData('seller_email')
+ );
+ $parameter = $this->para_filter($parameter);
+ $security_code = $this->getConfigData('security_code');
+ $sign_type = 'MD5';
+
+ $sort_array = array();
+ $arg = "";
+ $sort_array = $this->arg_sort($parameter); //$parameter
+
+ while (list ($key, $val) = each ($sort_array)) {
+ $arg.=$key."=".$this->charset_encode($val,$parameter['_input_charset'])."&";
+ }
+
+ $prestr = substr($arg,0,count($arg)-2);
+
+ $mysign = $this->sign($prestr.$security_code);
+
+ $fields = array();
+ $sort_array = array();
+ $arg = "";
+ $sort_array = $this->arg_sort($parameter); //$parameter
+ while (list ($key, $val) = each ($sort_array)) {
+ $fields[$key] = $this->charset_encode($val,'utf-8');
+ }
+ $fields['sign'] = $mysign;
+ $fields['sign_type'] = $sign_type;
+ return $fields;
+ }
+
+ public function sign($prestr) {
+ $mysign = md5($prestr);
+ return $mysign;
+ }
+
+ public function para_filter($parameter) {
+ $para = array();
+ while (list ($key, $val) = each ($parameter)) {
+ if($key == "sign" || $key == "sign_type" || $val == "")continue;
+ else $para[$key] = $parameter[$key];
+
+ }
+ return $para;
+ }
+
+ public function arg_sort($array) {
+ ksort($array);
+ reset($array);
+ return $array;
+ }
+
+ public function charset_encode($input,$_output_charset ,$_input_charset ="GBK" ) {
+ $output = "";
+ if($_input_charset == $_output_charset || $input ==null) {
+ $output = $input;
+ } elseif (function_exists("mb_convert_encoding")){
+ $output = mb_convert_encoding($input,$_output_charset,$_input_charset);
+ } elseif(function_exists("iconv")) {
+ $output = iconv($_input_charset,$_output_charset,$input);
+ } else die("sorry, you have no libs support for charset change.");
+ return $output;
+ }
+
+ /**
+ * Return authorized languages by Alipay
+ *
+ * @param none
+ * @return array
+ */
+ protected function _getAuthorizedLanguages()
+ {
+ $languages = array();
+
+ foreach (Mage::getConfig()->getNode('global/payment/alipay_payment/languages')->asArray() as $data)
+ {
+ $languages[$data['code']] = $data['name'];
+ }
+
+ return $languages;
+ }
+
+ /**
+ * Return language code to send to Alipay
+ *
+ * @param none
+ * @return String
+ */
+ protected function _getLanguageCode()
+ {
+ // Store language
+ $language = strtoupper(substr(Mage::getStoreConfig('general/locale/code'), 0, 2));
+
+ // Authorized Languages
+ $authorized_languages = $this->_getAuthorizedLanguages();
+
+ if (count($authorized_languages) === 1)
+ {
+ $codes = array_keys($authorized_languages);
+ return $codes[0];
+ }
+
+ if (array_key_exists($language, $authorized_languages))
+ {
+ return $language;
+ }
+
+ // By default we use language selected in store admin
+ return $this->getConfigData('language');
+ }
+
+
+
+ /**
+ * Output failure response and stop the script
+ *
+ * @param none
+ * @return void
+ */
+ public function generateErrorResponse()
+ {
+ die($this->getErrorResponse());
+ }
+
+ /**
+ * Return response for Alipay success payment
+ *
+ * @param none
+ * @return string Success response string
+ */
+ public function getSuccessResponse()
+ {
+ $response = array(
+ 'Pragma: no-cache',
+ 'Content-type : text/plain',
+ 'Version: 1',
+ 'OK'
+ );
+ return implode("\n", $response) . "\n";
+ }
+
+ /**
+ * Return response for Alipay failure payment
+ *
+ * @param none
+ * @return string Failure response string
+ */
+ public function getErrorResponse()
+ {
+ $response = array(
+ 'Pragma: no-cache',
+ 'Content-type : text/plain',
+ 'Version: 1',
+ 'Document falsifie'
+ );
+ return implode("\n", $response) . "\n";
+ }
+
+}
View
40 Alipay/trunk/app/code/community/CosmoCommerce/Alipay/Model/Source/Language.php
@@ -0,0 +1,40 @@
+<?php
+/**
+ * Magento
+ *