Permalink
Browse files

Signed-off-by: gongyuan.mao@cosmocommerce.com <gongyuan.mao@cosmocomm…

…erce.com>

patch for currency
  • Loading branch information...
1 parent 97f15ad commit 0a2b67de4aabbd86d1f116159a2b16f8f7175b4f gongyuan.mao@cosmocommerce.com committed Mar 13, 2013
Showing with 582 additions and 57 deletions.
  1. +1 −1 Alipay/trunk/app/code/community/CosmoCommerce/Alipay/Block/Error.php
  2. +1 −1 Alipay/trunk/app/code/community/CosmoCommerce/Alipay/Block/Form.php
  3. +1 −1 Alipay/trunk/app/code/community/CosmoCommerce/Alipay/Block/Redirect.php
  4. +1 −1 Alipay/trunk/app/code/community/CosmoCommerce/Alipay/Helper/Data.php
  5. +1 −1 Alipay/trunk/app/code/community/CosmoCommerce/Alipay/Model/Api/Debug.php
  6. +1 −2 Alipay/trunk/app/code/community/CosmoCommerce/Alipay/Model/Mysql4/Api/Debug.php
  7. +1 −1 Alipay/trunk/app/code/community/CosmoCommerce/Alipay/Model/Mysql4/Api/Debug/Collection.php
  8. +1 −1 Alipay/trunk/app/code/community/CosmoCommerce/Alipay/Model/Mysql4/Setup.php
  9. +27 −6 Alipay/trunk/app/code/community/CosmoCommerce/Alipay/Model/Payment.php
  10. +3 −3 Alipay/trunk/app/code/community/CosmoCommerce/Alipay/Model/Source/Language.php
  11. +2 −1 Alipay/trunk/app/code/community/CosmoCommerce/Alipay/Model/Source/Servicetype.php
  12. +1 −1 Alipay/trunk/app/code/community/CosmoCommerce/Alipay/Model/Source/Transport.php
  13. +188 −23 Alipay/trunk/app/code/community/CosmoCommerce/Alipay/controllers/PaymentController.php
  14. +5 −5 Alipay/trunk/app/code/community/CosmoCommerce/Alipay/etc/config.xml
  15. +3 −3 Alipay/trunk/app/code/community/CosmoCommerce/Alipay/etc/system.xml
  16. +1 −3 Alipay/trunk/app/code/community/CosmoCommerce/Alipay/sql/alipay_setup/mysql4-install-0.1.0.php
  17. +24 −0 Alipay/trunk/app/code/community/CosmoCommerce/Alipay/sql/alipay_setup/mysql4-install-0.9.2.php
  18. +29 −0 Alipay/trunk/app/code/community/CosmoCommerce/Updates/Helper/Data.php
  19. +96 −0 Alipay/trunk/app/code/community/CosmoCommerce/Updates/Model/Feed.php
  20. +24 −0 Alipay/trunk/app/code/community/CosmoCommerce/Updates/etc/adminhtml.xml
  21. +94 −0 Alipay/trunk/app/code/community/CosmoCommerce/Updates/etc/config.xml
  22. +65 −0 Alipay/trunk/app/code/community/CosmoCommerce/Updates/etc/system.xml
  23. +1 −1 Alipay/trunk/app/design/frontend/default/default/template/alipay/error.phtml
  24. +1 −1 Alipay/trunk/app/design/frontend/default/default/template/alipay/form.phtml
  25. +1 −1 Alipay/trunk/app/etc/modules/CosmoCommerce_Alipay.xml
  26. +9 −0 Alipay/trunk/app/etc/modules/CosmoCommerce_Updates.xml
  27. 0 Ctopay/README.md
@@ -14,7 +14,7 @@
*
* @category CosmoCommerce
* @package CosmoCommerce_Alipay
- * @copyright Copyright (c) 2009 CosmoCommerce,LLC. (http://www.cosmocommerce.com)
+ * @copyright Copyright (c) 2009-2013 CosmoCommerce,LLC. (http://www.cosmocommerce.com)
* @contact :
* T: +86-021-66346672
* L: Shanghai,China
@@ -14,7 +14,7 @@
*
* @category CosmoCommerce
* @package CosmoCommerce_Alipay
- * @copyright Copyright (c) 2009 CosmoCommerce,LLC. (http://www.cosmocommerce.com)
+ * @copyright Copyright (c) 2009-2013 CosmoCommerce,LLC. (http://www.cosmocommerce.com)
* @contact :
* T: +86-021-66346672
* L: Shanghai,China
@@ -14,7 +14,7 @@
*
* @category CosmoCommerce
* @package CosmoCommerce_Alipay
- * @copyright Copyright (c) 2009 CosmoCommerce,LLC. (http://www.cosmocommerce.com)
+ * @copyright Copyright (c) 2009-2013 CosmoCommerce,LLC. (http://www.cosmocommerce.com)
* @contact :
* T: +86-021-66346672
* L: Shanghai,China
@@ -14,7 +14,7 @@
*
* @category CosmoCommerce
* @package CosmoCommerce_Alipay
- * @copyright Copyright (c) 2009 CosmoCommerce,LLC. (http://www.cosmocommerce.com)
+ * @copyright Copyright (c) 2009-2013 CosmoCommerce,LLC. (http://www.cosmocommerce.com)
* @contact :
* T: +86-021-66346672
* L: Shanghai,China
@@ -14,7 +14,7 @@
*
* @category CosmoCommerce
* @package CosmoCommerce_Alipay
- * @copyright Copyright (c) 2009 CosmoCommerce,LLC. (http://www.cosmocommerce.com)
+ * @copyright Copyright (c) 2009-2013 CosmoCommerce,LLC. (http://www.cosmocommerce.com)
* @contact :
* T: +86-021-66346672
* L: Shanghai,China
@@ -14,13 +14,12 @@
*
* @category CosmoCommerce
* @package CosmoCommerce_Alipay
- * @copyright Copyright (c) 2009 CosmoCommerce,LLC. (http://www.cosmocommerce.com)
+ * @copyright Copyright (c) 2009-2013 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()
@@ -14,7 +14,7 @@
*
* @category CosmoCommerce
* @package CosmoCommerce_Alipay
- * @copyright Copyright (c) 2009 CosmoCommerce,LLC. (http://www.cosmocommerce.com)
+ * @copyright Copyright (c) 2009-2013 CosmoCommerce,LLC. (http://www.cosmocommerce.com)
* @contact :
* T: +86-021-66346672
* L: Shanghai,China
@@ -14,7 +14,7 @@
*
* @category CosmoCommerce
* @package CosmoCommerce_Alipay
- * @copyright Copyright (c) 2009 CosmoCommerce,LLC. (http://www.cosmocommerce.com)
+ * @copyright Copyright (c) 2009-2013 CosmoCommerce,LLC. (http://www.cosmocommerce.com)
* @contact :
* T: +86-021-66346672
* L: Shanghai,China
@@ -12,15 +12,14 @@
* 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)
+ * @category CosmoCommerce
+ * @package CosmoCommerce_Alipay
+ * @copyright Copyright (c) 2009-2013 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';
@@ -147,7 +146,29 @@ public function getStandardCheckoutFormFields()
if (!($order instanceof Mage_Sales_Model_Order)) {
Mage::throwException($this->_getHelper()->__('Cannot retrieve order object'));
}
-
+
+
+ $converted_final_price=$order->getGrandTotal();
+ $fromCur = Mage::app()->getStore()->getCurrentCurrencyCode();
+ $toCur = 'CNY';
+
+
+
+ if(Mage::app()->getStore()->getCurrentCurrencyCode() !=$toCur){
+ if(Mage::app()->getStore()->getBaseCurrencyCode()!=$toCur){
+
+ $rate=Mage::getModel('directory/currency')->load($toCur)->getAnyRate($fromCur);
+ $converted_final_price= $order->getGrandTotal()/$rate;
+
+
+ }else{
+ $rate=Mage::getModel('directory/currency')->load($toCur)->getAnyRate($fromCur);
+ $converted_final_price= $order->getGrandTotal()/$rate;
+
+ }
+ }else{
+ //$converted_final_price=$order->getGrandTotal();
+ }
$parameter = array('service' => $this->getConfigData('service_type'),
'partner' => $this->getConfigData('partner_id'),
'return_url' => $this->getReturnURL(),
@@ -159,7 +180,7 @@ public function getStandardCheckoutFormFields()
'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()) ,
+ 'price' => sprintf('%.2f', $converted_final_price) ,
'payment_type' => '1',
'quantity' => '1', // For the moment, the parameter of price is total price, so the quantity is 1.
'show_url' => Mage::getUrl(),
@@ -12,9 +12,9 @@
* 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)
+ * @category CosmoCommerce
+ * @package CosmoCommerce_Alipay
+ * @copyright Copyright (c) 2009-2013 CosmoCommerce,LLC. (http://www.cosmocommerce.com)
* @contact :
* T: +86-021-66346672
* L: Shanghai,China
@@ -14,7 +14,7 @@
*
* @category CosmoCommerce
* @package CosmoCommerce_Alipay
- * @copyright Copyright (c) 2009 CosmoCommerce,LLC. (http://www.cosmocommerce.com)
+ * @copyright Copyright (c) 2009-2013 CosmoCommerce,LLC. (http://www.cosmocommerce.com)
* @contact :
* T: +86-021-66346672
* L: Shanghai,China
@@ -27,6 +27,7 @@ public function toOptionArray()
return array(
array('value' => 'trade_create_by_buyer', 'label' => Mage::helper('alipay')->__('Products')),
array('value' => 'create_direct_pay_by_user', 'label' => Mage::helper('alipay')->__('Virtual Products')),
+ array('value' => 'create_partner_trade_by_buyer', 'label' => Mage::helper('alipay')->__('Trade by Buyer')),
);
}
}
@@ -14,7 +14,7 @@
*
* @category CosmoCommerce
* @package CosmoCommerce_Alipay
- * @copyright Copyright (c) 2009 CosmoCommerce,LLC. (http://www.cosmocommerce.com)
+ * @copyright Copyright (c) 2009-2013 CosmoCommerce,LLC. (http://www.cosmocommerce.com)
* @contact :
* T: +86-021-66346672
* L: Shanghai,China
Oops, something went wrong.

0 comments on commit 0a2b67d

Please sign in to comment.