cashcloud_payments - Version 0.2.0

Version Notes

This extension adds CashCloud payment methods

Download this release

Release Info

Developer cashcloud
Extension cashcloud_payments
Version 0.2.0
Comparing to
See all releases


Code changes from version 0.0.2 to 0.2.0

Files changed (141) hide show
  1. README.txt +0 -11
  2. app/code/local/Mage/CashCloud/Helper/Data.php +227 -196
  3. app/code/local/Mage/CashCloud/Model/Mysql4/Setup.php +9 -9
  4. app/code/local/Mage/CashCloud/Model/PaymentMethod.php +320 -253
  5. app/code/local/Mage/CashCloud/controllers/PayController.php +114 -114
  6. app/code/local/Mage/CashCloud/etc/config.xml +82 -82
  7. app/code/local/Mage/CashCloud/etc/system.xml +127 -127
  8. app/code/local/Mage/CashCloud/sql/cashcloud_setup/{mysql4-install-0.0.1.php → mysql4-install-0.2.0.php} +0 -0
  9. app/design/adminhtml/default/default/template/cashcloud/checks.phtml +13 -13
  10. app/design/frontend/base/default/template/cashcloud/form.phtml +48 -42
  11. app/design/frontend/base/default/template/cashcloud/info.phtml +28 -28
  12. app/design/frontend/base/default/template/cashcloud/process.phtml +35 -35
  13. app/etc/modules/Mage_CashCloud.xml +12 -12
  14. app/locale/de_DE/Mage_CashCloud.csv +36 -0
  15. app/locale/en_GB/Mage_CashCloud.csv +13 -12
  16. app/locale/en_US/Mage_CashCloud.csv +13 -12
  17. lib/CashCloudApi/README.md +0 -0
  18. lib/CashCloudApi/composer.json +0 -0
  19. lib/CashCloudApi/phpunit.xml +0 -0
  20. lib/CashCloudApi/samples/GetRate.php +0 -0
  21. lib/CashCloudApi/samples/GetReasons.php +0 -0
  22. lib/CashCloudApi/samples/GetSettings.php +0 -0
  23. lib/CashCloudApi/samples/RequestMoney.php +0 -0
  24. lib/CashCloudApi/samples/SaveSettings.php +0 -0
  25. lib/CashCloudApi/samples/credentials.php +0 -0
  26. lib/CashCloudApi/src/CashCloud/Api/Exception/AuthException.php +0 -0
  27. lib/CashCloudApi/src/CashCloud/Api/Exception/CashCloudException.php +0 -0
  28. lib/CashCloudApi/src/CashCloud/Api/Exception/ValidateException.php +0 -0
  29. lib/CashCloudApi/src/CashCloud/Api/Method/GetRates.php +0 -0
  30. lib/CashCloudApi/src/CashCloud/Api/Method/GetReasons.php +0 -0
  31. lib/CashCloudApi/src/CashCloud/Api/Method/GetSettings.php +0 -0
  32. lib/CashCloudApi/src/CashCloud/Api/Method/GetTransactions.php +0 -0
  33. lib/CashCloudApi/src/CashCloud/Api/Method/Method.php +0 -0
  34. lib/CashCloudApi/src/CashCloud/Api/Method/Refund.php +137 -131
  35. lib/CashCloudApi/src/CashCloud/Api/Method/RequestMoney.php +3 -3
  36. lib/CashCloudApi/src/CashCloud/Api/Method/SaveSettings.php +0 -0
  37. lib/CashCloudApi/src/CashCloud/Api/Rest/Auth.php +0 -0
  38. lib/CashCloudApi/src/CashCloud/Api/Rest/Client.php +1 -1
  39. lib/CashCloudApi/src/CashCloud/Api/Rest/CurlRequest.php +0 -0
  40. lib/CashCloudApi/src/CashCloud/Api/Rest/Request.php +0 -0
  41. lib/CashCloudApi/tests/CashCloud/Test/Api/Exception/ValidateExceptionTest.php +0 -0
  42. lib/CashCloudApi/tests/CashCloud/Test/Api/Method/GetRatesTest.php +0 -0
  43. lib/CashCloudApi/tests/CashCloud/Test/Api/Method/GetReasonsTest.php +0 -0
  44. lib/CashCloudApi/tests/CashCloud/Test/Api/Method/GetSettingsTest.php +0 -0
  45. lib/CashCloudApi/tests/CashCloud/Test/Api/Method/RequestMoneyTest.php +0 -0
  46. lib/CashCloudApi/tests/CashCloud/Test/Api/Method/SaveSettingsTest.php +0 -0
  47. lib/CashCloudApi/tests/CashCloud/Test/Api/Rest/AuthTest.php +0 -0
  48. lib/CashCloudApi/tests/CashCloud/Test/Api/Rest/ClientTest.php +0 -0
  49. lib/CashCloudApi/tests/CashCloud/Test/Api/Rest/CurlRequestTest.php +0 -0
  50. lib/CashCloudApi/tests/CashCloud/Test/TestCase.php +0 -0
  51. lib/CashCloudApi/tests/bootstrap.php +0 -0
  52. lib/CashCloudApi/vendor/autoload.php +7 -7
  53. lib/CashCloudApi/vendor/composer/ClassLoader.php +8 -3
  54. lib/CashCloudApi/vendor/composer/autoload_real.php +50 -53
  55. lib/CashCloudApi/vendor/composer/include_paths.php +17 -0
  56. lib/CashCloudApi/vendor/composer/installed.json +3 -0
  57. package.xml +12 -270
  58. skin/frontend/base/default/css/widgets.css +96 -0
  59. skin/frontend/base/default/favicon.ico +0 -0
  60. skin/frontend/base/default/images/calendar.gif +0 -0
  61. skin/frontend/base/default/images/catalog/product/placeholder/image.jpg +0 -0
  62. skin/frontend/base/default/images/catalog/product/placeholder/small_image.jpg +0 -0
  63. skin/frontend/base/default/images/catalog/product/placeholder/thumbnail.jpg +0 -0
  64. skin/frontend/base/default/images/centinel/sc_learn_62x34.png +0 -0
  65. skin/frontend/base/default/images/centinel/v_activate_steps.gif +0 -0
  66. skin/frontend/base/default/images/centinel/vbv_ltbg_71x57.png +0 -0
  67. skin/frontend/base/default/images/cookies/firefox.png +0 -0
  68. skin/frontend/base/default/images/cookies/ie6-1.gif +0 -0
  69. skin/frontend/base/default/images/cookies/ie6-2.gif +0 -0
  70. skin/frontend/base/default/images/cookies/ie7-1.gif +0 -0
  71. skin/frontend/base/default/images/cookies/ie7-2.gif +0 -0
  72. skin/frontend/base/default/images/cookies/ie7-3.gif +0 -0
  73. skin/frontend/base/default/images/cookies/ie7-4.gif +0 -0
  74. skin/frontend/base/default/images/cookies/ie7-5.gif +0 -0
  75. skin/frontend/base/default/images/cookies/ie7-6.gif +0 -0
  76. skin/frontend/base/default/images/cookies/opera.png +0 -0
  77. skin/frontend/base/default/images/cvv.gif +0 -0
  78. skin/frontend/base/default/images/fam_book_open.png +0 -0
  79. skin/frontend/base/default/images/moneybookers/banner_120_de.gif +0 -0
  80. skin/frontend/base/default/images/moneybookers/banner_120_de.png +0 -0
  81. skin/frontend/base/default/images/moneybookers/banner_120_dk.gif +0 -0
  82. skin/frontend/base/default/images/moneybookers/banner_120_fr.gif +0 -0
  83. skin/frontend/base/default/images/moneybookers/banner_120_fr.png +0 -0
  84. skin/frontend/base/default/images/moneybookers/banner_120_int.gif +0 -0
  85. skin/frontend/base/default/images/moneybookers/banner_120_int.png +0 -0
  86. skin/frontend/base/default/images/moneybookers/banner_120_pl.gif +0 -0
  87. skin/frontend/base/default/images/moneybookers/banner_120_pl.png +0 -0
  88. skin/frontend/base/default/images/moneybookers/banner_120_sp.gif +0 -0
  89. skin/frontend/base/default/images/moneybookers/banner_120_sp.png +0 -0
  90. skin/frontend/base/default/images/moneybookers/moneybookers_acc.png +0 -0
  91. skin/frontend/base/default/images/moneybookers/moneybookers_csi.gif +0 -0
  92. skin/frontend/base/default/images/moneybookers/moneybookers_did.gif +0 -0
  93. skin/frontend/base/default/images/moneybookers/moneybookers_dnk.gif +0 -0
  94. skin/frontend/base/default/images/moneybookers/moneybookers_ebt.gif +0 -0
  95. skin/frontend/base/default/images/moneybookers/moneybookers_ent.gif +0 -0
  96. skin/frontend/base/default/images/moneybookers/moneybookers_gcb.gif +0 -0
  97. skin/frontend/base/default/images/moneybookers/moneybookers_gir.gif +0 -0
  98. skin/frontend/base/default/images/moneybookers/moneybookers_idl.gif +0 -0
  99. skin/frontend/base/default/images/moneybookers/moneybookers_lsr.gif +0 -0
  100. skin/frontend/base/default/images/moneybookers/moneybookers_mae.gif +0 -0
  101. skin/frontend/base/default/images/moneybookers/moneybookers_npy.gif +0 -0
  102. skin/frontend/base/default/images/moneybookers/moneybookers_obt_de.png +0 -0
  103. skin/frontend/base/default/images/moneybookers/moneybookers_obt_dk.png +0 -0
  104. skin/frontend/base/default/images/moneybookers/moneybookers_obt_ee.png +0 -0
  105. skin/frontend/base/default/images/moneybookers/moneybookers_obt_en.png +0 -0
  106. skin/frontend/base/default/images/moneybookers/moneybookers_obt_fl.png +0 -0
  107. skin/frontend/base/default/images/moneybookers/moneybookers_obt_lt.png +0 -0
  108. skin/frontend/base/default/images/moneybookers/moneybookers_obt_lv.png +0 -0
  109. skin/frontend/base/default/images/moneybookers/moneybookers_obt_pl.png +0 -0
  110. skin/frontend/base/default/images/moneybookers/moneybookers_obt_se.png +0 -0
  111. skin/frontend/base/default/images/moneybookers/moneybookers_pli.gif +0 -0
  112. skin/frontend/base/default/images/moneybookers/moneybookers_psp.gif +0 -0
  113. skin/frontend/base/default/images/moneybookers/moneybookers_pwy.gif +0 -0
  114. skin/frontend/base/default/images/moneybookers/moneybookers_sft.gif +0 -0
  115. skin/frontend/base/default/images/moneybookers/moneybookers_so2.gif +0 -0
  116. skin/frontend/base/default/images/moneybookers/moneybookers_wlt.gif +0 -0
  117. skin/frontend/base/default/images/reload.png +0 -0
  118. skin/frontend/base/default/images/widgets/i_block-list.gif +0 -0
  119. skin/frontend/base/default/images/widgets/i_widget-link.gif +0 -0
  120. skin/frontend/base/default/images/widgets/i_widget-new.gif +0 -0
  121. skin/frontend/base/default/images/xmlconnect/catalog/category/placeholder/image.jpg +0 -0
  122. skin/frontend/base/default/images/xmlconnect/catalog/category/placeholder/small_image.jpg +0 -0
  123. skin/frontend/base/default/images/xmlconnect/catalog/category/placeholder/thumbnail.jpg +0 -0
  124. skin/frontend/base/default/images/xmlconnect/tab_account.png +0 -0
  125. skin/frontend/base/default/images/xmlconnect/tab_cart.png +0 -0
  126. skin/frontend/base/default/images/xmlconnect/tab_home.png +0 -0
  127. skin/frontend/base/default/images/xmlconnect/tab_more.png +0 -0
  128. skin/frontend/base/default/images/xmlconnect/tab_page.png +0 -0
  129. skin/frontend/base/default/images/xmlconnect/tab_search.png +0 -0
  130. skin/frontend/base/default/images/xmlconnect/tab_shop.png +0 -0
  131. skin/frontend/base/default/js/bundle.js +274 -0
  132. skin/frontend/base/default/js/checkout/review.js +454 -0
  133. skin/frontend/base/default/js/giftmessage.js +129 -0
  134. skin/frontend/base/default/js/ie6.js +48 -0
  135. skin/frontend/base/default/js/msrp.js +368 -0
  136. skin/frontend/base/default/js/opcheckout.js +962 -0
  137. skin/frontend/base/default/lib/prototype/windows/themes/magento.css +64 -0
  138. skin/frontend/base/default/lib/prototype/windows/themes/magento/btn_bg.gif +0 -0
  139. skin/frontend/base/default/lib/prototype/windows/themes/magento/content_bg.gif +0 -0
  140. skin/frontend/base/default/lib/prototype/windows/themes/magento/top_bg.gif +0 -0
  141. skin/frontend/base/default/lib/prototype/windows/themes/magento/window_close.png +0 -0
README.txt DELETED
@@ -1,11 +0,0 @@
1
- ==================================================
2
- Installation
3
- ==================================================
4
-
5
- 1. Login to magento backend as administrator
6
- 2. Navigate to "System -> Magento Connect -> Magento Connect Manager"
7
- 3. Enter your username and password if needed
8
- 5. Click "Choose file" in "Direct package file upload"
9
- 6. Select ZIP and click upload
10
- 7. Plugin is now installed
11
- 8. Plugin configuration can be found in "System -> Configuration -> Payment methods"
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Mage/CashCloud/Helper/Data.php CHANGED
@@ -1,196 +1,227 @@
1
- <?php
2
- use CashCloud\Api\Exception\CashCloudException;
3
-
4
- /**
5
- * Class Api
6
- */
7
- class Mage_CashCloud_Helper_Data extends Mage_Core_Helper_Data
8
- {
9
- protected $username;
10
- protected $password;
11
- protected $deviceId;
12
- protected $sandboxMode = false;
13
-
14
- /**
15
- * @var \CashCloud\Api\Rest\Client
16
- */
17
- private $client = null;
18
-
19
- function __construct()
20
- {
21
- $this->init();
22
- }
23
-
24
- public function init()
25
- {
26
- // setup autoload
27
- require_once Mage::getBaseDir("lib") . DS . "CashCloudApi" . DS . "vendor" . DS . "autoload.php";
28
-
29
- /** @var Mage_CashCloud_Model_PaymentMethod $payment */
30
- $payment = Mage::getSingleton("Mage_CashCloud_Model_PaymentMethod");
31
- $this->username = $payment->getConfigData('api_username');
32
- $this->password = $payment->getConfigData('api_password');
33
- $this->deviceId = $payment->getConfigData('api_device_id');
34
- $this->sandboxMode = $payment->getConfigData('enable_sandbox');
35
- }
36
-
37
- /**
38
- * @param string $username
39
- * @param string $password
40
- * @param string $deviceId
41
- * @param bool $sandboxMode
42
- */
43
- public function setCredentials($username, $password, $deviceId, $sandboxMode = false)
44
- {
45
- $this->username = $username;
46
- $this->password = $password;
47
- $this->deviceId = $deviceId;
48
- $this->sandboxMode = $sandboxMode;
49
- }
50
-
51
- /**
52
- * @return \CashCloud\Api\Rest\Client
53
- */
54
- public function getClient()
55
- {
56
- if (is_null($this->client)) {
57
- // create client
58
- $this->client = new \CashCloud\Api\Rest\Client(
59
- new \CashCloud\Api\Rest\Auth($this->username, $this->password, $this->deviceId), null, $this->sandboxMode
60
- );
61
- }
62
- return $this->client;
63
- }
64
-
65
- /**
66
- * @return array
67
- */
68
- public function getReasons()
69
- {
70
- $reasons = $this->getCached("cashcloud/reason_ids");
71
- if ($reasons != false) {
72
- return $reasons;
73
- }
74
-
75
- try {
76
- $req = new \CashCloud\Api\Method\GetReasons();
77
- $reasons = $req->perform($this->getClient());
78
- } catch (CashCloudException $e) {
79
- $reasons = array();
80
- }
81
-
82
- return $this->cache($reasons, "cashcloud/reason_ids");
83
- }
84
-
85
- /**
86
- * @param Mage_Sales_Model_Order_Payment $payment
87
- * @return string order ID
88
- */
89
- public function requestMoney($payment)
90
- {
91
- $order = $payment->getOrder();
92
- $method = Mage::getSingleton("Mage_CashCloud_Model_PaymentMethod");
93
-
94
- $request = new \CashCloud\Api\Method\RequestMoney();
95
- $request->setEmail($order->getPayment()->getAdditionalInformation('cashcloud_username'));
96
- $request->setAmount($order->getGrandTotal() * 100);
97
- if($order->getPayment()->getAdditionalInformation('cashcloud_currency') == "CCR") {
98
- $request->setCurrency(\CashCloud\Api\Rest\Client::CURRENCY_CCR);
99
- } else {
100
- $request->setCurrency(\CashCloud\Api\Rest\Client::CURRENCY_EUR);
101
- }
102
- $request->setExternalData($order->getId());
103
- if ($method->getConfigData('reason') == "") {
104
- Mage::throwException($this->__("Payments category not selected"));
105
- }
106
- $request->setReason($method->getConfigData('reason'));
107
-
108
- $response = $request->perform($this->getClient());
109
- return $response->hash;
110
- }
111
-
112
- /**
113
- * @param float $amount
114
- * @return false|float
115
- */
116
- public function getAmountInCCR($amount)
117
- {
118
- try {
119
- $request = new \CashCloud\Api\Method\GetRates();
120
- $request->setAmount($amount * 100); //cents
121
- $rate = $request->perform($this->getClient());
122
-
123
- $currencyId = \CashCloud\Api\Rest\Client::CURRENCY_CCR;
124
- $actionId = \CashCloud\Api\Rest\Client::CURRENCY_RECEIVE;
125
- if(isset($rate->{$currencyId}->{$actionId})) {
126
- // cents
127
- return (float) ($rate->{$currencyId}->{$actionId} / 100);
128
- }
129
- } catch (CashCloudException $e) {
130
- Mage::logException($e);
131
- }
132
- return false;
133
- }
134
-
135
- /**
136
- * @param $url
137
- * @param $request_expiration
138
- * @return bool|float
139
- */
140
- public function setCallback($url = null, $request_expiration = null)
141
- {
142
- $url = is_null($url) ? $this->getCallbackUrl() : $url;
143
- $request = new \CashCloud\Api\Method\SaveSettings();
144
- $request->setCallbackUrl($url);
145
- $request->setRequestExpiration($request_expiration);
146
- $result = $request->perform($this->getClient()) / 100;
147
- return $result;
148
- }
149
-
150
- public function refund($transactionId, $amount, $remark = "no remark")
151
- {
152
- try {
153
- $refund = new \CashCloud\Api\Method\Refund();
154
- $refund->setHash($transactionId);
155
- $refund->setAmount($amount * 100);
156
- $refund->setRemark($remark);
157
- $refund->perform($this->getClient());
158
- } catch (\CashCloud\Api\Exception\CashCloudException $e) {
159
- Mage::throwException("Could not refund: " . $e->getMessage());
160
- }
161
-
162
- return $this;
163
- }
164
-
165
- /**
166
- * @param string $key
167
- * @return false|mixed
168
- */
169
- private function getCached($key)
170
- {
171
- $data = Mage::app()->getCache()->load($key);
172
- if ($data) {
173
- return unserialize(base64_decode($data));
174
- }
175
- return false;
176
- }
177
-
178
- /**
179
- * @param mixed $data
180
- * @param string $key
181
- * @return mixed
182
- */
183
- private function cache($data, $key)
184
- {
185
- Mage::app()->getCache()->save(base64_encode(serialize($data)), $key, array('cashcloud'), 60 * 60 * 3);
186
- return $data;
187
- }
188
-
189
- /**
190
- * @return string
191
- */
192
- public function getCallbackUrl()
193
- {
194
- return Mage::getUrl("cashcloud/pay/callback");
195
- }
196
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ use CashCloud\Api\Exception\CashCloudException;
3
+
4
+ /**
5
+ * Class Api
6
+ */
7
+ class Mage_CashCloud_Helper_Data extends Mage_Core_Helper_Data
8
+ {
9
+ protected $username;
10
+ protected $password;
11
+ protected $deviceId;
12
+ protected $sandboxMode = false;
13
+
14
+ /**
15
+ * @var \CashCloud\Api\Rest\Client
16
+ */
17
+ private $client = null;
18
+
19
+ function __construct()
20
+ {
21
+ $this->init();
22
+ }
23
+
24
+ public function init()
25
+ {
26
+ // setup autoload
27
+ require_once Mage::getBaseDir("lib") . DS . "CashCloudApi" . DS . "vendor" . DS . "autoload.php";
28
+
29
+ /** @var Mage_CashCloud_Model_PaymentMethod $payment */
30
+ $payment = Mage::getSingleton("Mage_CashCloud_Model_PaymentMethod");
31
+ $this->username = $payment->getConfigData('api_username');
32
+ $this->password = $payment->getConfigData('api_password');
33
+ $this->deviceId = $payment->getConfigData('api_device_id');
34
+ $this->sandboxMode = $payment->getConfigData('enable_sandbox');
35
+ }
36
+
37
+ /**
38
+ * @param string $username
39
+ * @param string $password
40
+ * @param string $deviceId
41
+ * @param bool $sandboxMode
42
+ */
43
+ public function setCredentials($username, $password, $deviceId, $sandboxMode = false)
44
+ {
45
+ $this->username = $username;
46
+ $this->password = $password;
47
+ $this->deviceId = $deviceId;
48
+ $this->sandboxMode = $sandboxMode;
49
+ }
50
+
51
+ /**
52
+ * @return \CashCloud\Api\Rest\Client
53
+ */
54
+ public function getClient()
55
+ {
56
+ if (is_null($this->client)) {
57
+ // create client
58
+ $this->client = new \CashCloud\Api\Rest\Client(
59
+ new \CashCloud\Api\Rest\Auth($this->username, $this->password, $this->deviceId), null, $this->sandboxMode
60
+ );
61
+ }
62
+ return $this->client;
63
+ }
64
+
65
+ /**
66
+ * @return array
67
+ */
68
+ public function getReasons()
69
+ {
70
+ $reasons = $this->getCached("cashcloud/reason_ids");
71
+ if ($reasons != false) {
72
+ return $reasons;
73
+ }
74
+
75
+ try {
76
+ $req = new \CashCloud\Api\Method\GetReasons();
77
+ $reasons = $req->perform($this->getClient());
78
+ } catch (CashCloudException $e) {
79
+ $reasons = array();
80
+ }
81
+
82
+ return $this->cache($reasons, "cashcloud/reason_ids");
83
+ }
84
+
85
+ /**
86
+ * @param Mage_Sales_Model_Order_Payment $payment
87
+ * @return string order ID
88
+ */
89
+ public function requestMoney($payment)
90
+ {
91
+ $order = $payment->getOrder();
92
+ $method = Mage::getSingleton("Mage_CashCloud_Model_PaymentMethod");
93
+
94
+ $request = new \CashCloud\Api\Method\RequestMoney();
95
+ $request->setEmail($order->getPayment()->getAdditionalInformation('cashcloud_username'));
96
+ $request->setAmount($order->getGrandTotal() * 100);
97
+ if($order->getPayment()->getAdditionalInformation('cashcloud_currency') == "CCR") {
98
+ $request->setCurrency(\CashCloud\Api\Rest\Client::CURRENCY_CCR);
99
+ } else {
100
+ $request->setCurrency(\CashCloud\Api\Rest\Client::CURRENCY_EUR);
101
+ }
102
+ $request->setExternalData($order->getId());
103
+ if ($method->getConfigData('reason') == "") {
104
+ Mage::throwException($this->__("Payments category not selected"));
105
+ }
106
+ $request->setReason($method->getConfigData('reason'));
107
+
108
+ $response = $request->perform($this->getClient());
109
+ return $response->hash;
110
+ }
111
+
112
+ /**
113
+ * @param float $amount
114
+ * @return false|float
115
+ */
116
+ public function getAmountInCCR($amount)
117
+ {
118
+ try {
119
+ $request = new \CashCloud\Api\Method\GetRates();
120
+ $request->setAmount($amount * 100); //cents
121
+ $rate = $request->perform($this->getClient());
122
+
123
+ $currencyId = \CashCloud\Api\Rest\Client::CURRENCY_CCR;
124
+ $actionId = \CashCloud\Api\Rest\Client::CURRENCY_RECEIVE;
125
+ if(isset($rate->{$currencyId}->{$actionId})) {
126
+ // cents
127
+ return (float) ($rate->{$currencyId}->{$actionId});
128
+ }
129
+ } catch (CashCloudException $e) {
130
+ Mage::logException($e);
131
+ }
132
+ return false;
133
+ }
134
+
135
+ /**
136
+ * @param $url
137
+ * @param $request_expiration
138
+ * @return bool|float
139
+ */
140
+ public function setCallback($url = null, $request_expiration = null)
141
+ {
142
+ $url = is_null($url) ? $this->getCallbackUrl() : $url;
143
+ $request = new \CashCloud\Api\Method\SaveSettings();
144
+ $request->setCallbackUrl($url);
145
+ $request->setRequestExpiration($request_expiration);
146
+ $result = $request->perform($this->getClient()) / 100;
147
+ return $result;
148
+ }
149
+
150
+ public function refund($transactionId, $amount, $remark = "no remark")
151
+ {
152
+ try {
153
+ $order = $this->loadOrderByHash($transactionId);
154
+ $refund = new \CashCloud\Api\Method\Refund();
155
+ $refund->setHash($transactionId);
156
+ $refund->setAmount($amount * 100);
157
+ $refund->setExternalData($order->getIncrementId());
158
+ $refund->setRemark($remark);
159
+ $refund->perform($this->getClient());
160
+ } catch (\CashCloud\Api\Exception\CashCloudException $e) {
161
+ Mage::throwException("Could not refund: " . $e->getMessage());
162
+ }
163
+
164
+ return $this;
165
+ }
166
+ /**
167
+ * @param $hash
168
+ * @return Mage_Sales_Model_Order
169
+ */
170
+ public function loadOrderByHash($hash)
171
+ {
172
+ /** @var Mage_Sales_Model_Order_Payment $orderPayment */
173
+ $orderPayment = Mage::getSingleton("sales/order_payment")->load($hash, 'cashcloud_id');
174
+ /** @var Mage_Sales_Model_Order $order */
175
+ $order = Mage::getSingleton("sales/order")->load($orderPayment->getParentId());
176
+ if($order)
177
+ {
178
+
179
+ } else {
180
+ Mage::throwException($this->getHelper()->__("Order not found!"));
181
+ }
182
+ return $order;
183
+ }
184
+ public function getTransactionDataFromHash($hash)
185
+ {
186
+ try{
187
+ $request = new \CashCloud\Api\Method\GetTransactions();
188
+ $request->setHash($hash);
189
+ $result = $request->perform($this->getClient());
190
+ return $result->transaction;
191
+ } catch (\CashCloud\Api\Exception\CashCloudException $e) {
192
+
193
+ }
194
+ return false;
195
+ }
196
+ /**
197
+ * @param string $key
198
+ * @return false|mixed
199
+ */
200
+ private function getCached($key)
201
+ {
202
+ $data = Mage::app()->getCache()->load($key);
203
+ if ($data) {
204
+ return unserialize(base64_decode($data));
205
+ }
206
+ return false;
207
+ }
208
+
209
+ /**
210
+ * @param mixed $data
211
+ * @param string $key
212
+ * @return mixed
213
+ */
214
+ private function cache($data, $key)
215
+ {
216
+ Mage::app()->getCache()->save(base64_encode(serialize($data)), $key, array('cashcloud'), 60 * 60 * 3);
217
+ return $data;
218
+ }
219
+
220
+ /**
221
+ * @return string
222
+ */
223
+ public function getCallbackUrl()
224
+ {
225
+ return Mage::getUrl("cashcloud/pay/callback");
226
+ }
227
+ }
app/code/local/Mage/CashCloud/Model/Mysql4/Setup.php CHANGED
@@ -1,9 +1,9 @@
1
- <?php
2
-
3
- /**
4
- * Class Mage_CashCloud_Model_Mysql4_Setup
5
- */
6
- class Mage_CashCloud_Model_Mysql4_Setup extends Mage_Core_Model_Resource_Setup
7
- {
8
-
9
- }
1
+ <?php
2
+
3
+ /**
4
+ * Class Mage_CashCloud_Model_Mysql4_Setup
5
+ */
6
+ class Mage_CashCloud_Model_Mysql4_Setup extends Mage_Core_Model_Resource_Setup
7
+ {
8
+
9
+ }
app/code/local/Mage/CashCloud/Model/PaymentMethod.php CHANGED
@@ -1,253 +1,320 @@
1
- <?php
2
-
3
-
4
- /**
5
- * Class PaymentMethod
6
- */
7
- class Mage_CashCloud_Model_PaymentMethod extends Mage_Payment_Model_Method_Abstract
8
- {
9
- protected $_code = 'cashcloud';
10
- protected $_formBlockType = 'cashCloud/form';
11
- protected $_infoBlockType = 'cashCloud/info';
12
-
13
- /**
14
- * @var bool
15
- */
16
- protected $_canRefund = true;
17
-
18
- /**
19
- * Availability options
20
- */
21
- protected $_canCapture = true;
22
- protected $_isGateway = false;
23
-
24
- /**
25
- * @param Varien_Object $payment
26
- * @param float $amount
27
- * @return $this
28
- */
29
- public function capture(Varien_Object $payment, $amount)
30
- {
31
- $payment->setStatus(self::STATUS_APPROVED)
32
- ->setTransactionId($payment->getCashcloudId())->setIsTransactionClosed(0);
33
-
34
- return $this;
35
- }
36
-
37
-
38
- /**
39
- * @param Varien_Object $payment
40
- * @param float $amount
41
- * @return $this
42
- */
43
- public function refund(Varien_Object $payment, $amount)
44
- {
45
- $this->getHelper()->refund($payment->getParentTransactionId(), $amount);
46
- return $this;
47
- }
48
-
49
-
50
- /**
51
- * @param null $quote
52
- * @return bool
53
- */
54
- public function isAvailable($quote = null)
55
- {
56
- if (Mage::app()->getStore()->getCurrentCurrencyCode() == "EUR") {
57
- return parent::isAvailable($quote);
58
- }
59
- return false;
60
- }
61
-
62
- /**
63
- * @return int
64
- */
65
- public function getGrandTotal()
66
- {
67
- return $this->getCart()->getQuote()->getGrandTotal();
68
- }
69
-
70
- /**
71
- * @return Mage_Directory_Model_Currency
72
- */
73
- public function getEur()
74
- {
75
- return Mage::getModel('directory/currency')->load("EUR");
76
- }
77
-
78
- /**
79
- * @param bool $raw
80
- * @return int
81
- */
82
- public function getGrandTotalInEur($raw = false)
83
- {
84
- $priceInEur = Mage::app()->getStore()->getCurrentCurrency()->convert($this->getGrandTotal(), $this->getEur());
85
- return $raw ? $priceInEur : $this->getEur()->format($priceInEur);
86
- }
87
-
88
- /**
89
- * @return $this
90
- */
91
- public function validate()
92
- {
93
- $info = $this->getInfoInstance();
94
-
95
- $username = $info->getAdditionalInformation("cashcloud_username");
96
- if (!preg_match('/([\w-+\.]+)@((?:[\w]+\.)+)([a-zA-Z]{2,4})/', $username)) {
97
- Mage::throwException(
98
- $this->_getHelper()->__('Invalid CashCloud username')
99
- );
100
- }
101
-
102
- $currency = $info->getAdditionalInformation("cashcloud_currency");
103
- if ($this->getConfigData('enable_ccr') && $currency != "EUR" && $currency != "CCR") {
104
- Mage::throwException(
105
- $this->_getHelper()->__('Please select currency')
106
- );
107
- }
108
-
109
- if (!$this->getConfigData('reason')) {
110
- $reason = $info->getAdditionalInformation("cashcloud_reason_id");
111
- if (empty($reason) || !array_key_exists($reason, $this->getHelper()->getReasons())) {
112
- Mage::throwException(
113
- $this->_getHelper()->__('Please select purchase reason')
114
- );
115
- }
116
- }
117
-
118
- return parent::validate();
119
- }
120
-
121
- /**
122
- * @param mixed $data
123
- * @return $this|Mage_Payment_Model_Info
124
- */
125
- public function assignData($data)
126
- {
127
- parent::assignData($data);
128
-
129
- $currency = isset($_POST['payment']['cashcloud_currency']) ? $_POST['payment']['cashcloud_currency'] : "EUR";
130
- $username = isset($_POST['payment']['cashcloud_username']) ? $_POST['payment']['cashcloud_username'] : false;
131
- $reason = isset($_POST['payment']['cashcloud_reason_id']) ? $_POST['payment']['cashcloud_reason_id'] : false;
132
-
133
- $this->getInfoInstance()->setAdditionalInformation(array(
134
- 'cashcloud_username' => $username,
135
- 'cashcloud_currency' => $currency,
136
- 'cashcloud_reason_id' => $reason,
137
- ));
138
- return $this;
139
- }
140
-
141
-
142
- /**
143
- * @return Mage_Checkout_Model_Cart
144
- */
145
- public function getCart()
146
- {
147
- return Mage::helper('checkout/cart');
148
- }
149
-
150
- /**
151
- * @return Mage_CashCloud_Helper_Data
152
- */
153
- public function getHelper()
154
- {
155
- return Mage::helper("cashcloud");
156
- }
157
-
158
- /**
159
- * Payment action getter compatible with payment model
160
- *
161
- * @see Mage_Sales_Model_Payment::place()
162
- * @return string
163
- */
164
- public function getConfigPaymentAction()
165
- {
166
- return "order";
167
- }
168
-
169
-
170
- public function order(Varien_Object $payment, $amount)
171
- {
172
- $this->getHelper()->init();
173
- try {
174
- $orderId = $this->getHelper()->requestMoney($payment);
175
- $payment->setCashcloudId($orderId);
176
- $payment->save();
177
- } catch (\CashCloud\Api\Exception\ValidateException $e) {
178
- Mage::throwException(
179
- $this->_getHelper()->__("Validation failed").": ".$this->_getHelper()->__($e->getFirstError())
180
- );
181
- } catch (\CashCloud\Api\Exception\AuthException $e) {
182
- Mage::throwException(
183
- $this->_getHelper()->__("Error while authorizing payment. Please check CashCloud account details in configuration!")
184
- );
185
- } catch (\CashCloud\Api\Exception\CashCloudException $e) {
186
- Mage::logException($e);
187
- Mage::throwException(
188
- $this->_getHelper()->__("Error while executing payment in CashCloud!")
189
- );
190
- }
191
-
192
- return $this;
193
- }
194
-
195
- public function getOrderPlaceRedirectUrl()
196
- {
197
- return Mage::getUrl('cashcloud/pay/process');
198
- }
199
-
200
- /**
201
- * @param Mage_Sales_Model_Order $order
202
- * @param array $callbackData
203
- */
204
- public function validateCallback($order, $callbackData)
205
- {
206
- $this->getHelper()->init();
207
- $status = isset($callbackData['status']) ? $callbackData['status'] : null;
208
- $unsuccessfulStatuses = array(
209
- \CashCloud\Api\Rest\Client::STATUS_EXPIRED,
210
- \CashCloud\Api\Rest\Client::STATUS_REFUNDED,
211
- \CashCloud\Api\Rest\Client::STATUS_DECLINED,
212
- \CashCloud\Api\Rest\Client::STATUS_MONEY_SERVICE_FAILED
213
- );
214
-
215
- if($status == \CashCloud\Api\Rest\Client::STATUS_COMPLETED) {
216
- $orderState = Mage_Sales_Model_Order::STATE_PROCESSING;
217
- $orderStatus = $this->getConfigData('order_status_after_payment');
218
- $this->saveStatus($order, $orderState, $orderStatus, $this->getHelper()->__("Payment notification received"));
219
- } elseif(in_array($status, $unsuccessfulStatuses)) {
220
- $orderState = Mage_Sales_Model_Order::STATE_CANCELED;
221
- $orderStatus = Mage_Sales_Model_Order::STATE_CANCELED;
222
- $this->saveStatus($order, $orderState, $orderStatus, $this->getHelper()->__("Customer cancelled order"));
223
- } else {
224
- Mage::throwException("Invalid cashcloud status: $status");
225
- }
226
- }
227
-
228
- /**
229
- * @param Mage_Sales_Model_Order $order
230
- * @param string $orderState
231
- * @param string $orderStatus
232
- * @param string $comment
233
- */
234
- protected function saveStatus($order, $orderState, $orderStatus, $comment){
235
- $order->setState($orderState, $orderStatus, $comment)->save();
236
-
237
- /** @var Mage_Sales_Model_Order_Payment $payment */
238
- $payment = $order->getPaymentsCollection()->getFirstItem();
239
-
240
- if($orderStatus == Mage_Sales_Model_Order::STATE_PROCESSING) {
241
- $order->addStatusHistoryComment($this->getHelper()->__("Payment received"), $orderStatus);
242
- } else {
243
-
244
- }
245
-
246
-
247
- // var_dump($order->getData(), $payment->getData()); die();
248
- /** @var Mage_Sales_Model_Order_Status_History $comment */
249
- //
250
- //
251
- // $comment->save();
252
- }
253
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ /**
5
+ * Class PaymentMethod
6
+ */
7
+ class Mage_CashCloud_Model_PaymentMethod extends Mage_Payment_Model_Method_Abstract
8
+ {
9
+ protected $_code = 'cashcloud';
10
+ protected $_formBlockType = 'cashCloud/form';
11
+ protected $_infoBlockType = 'cashCloud/info';
12
+
13
+ /**
14
+ * @var bool
15
+ */
16
+ protected $_canRefund = true;
17
+
18
+ /**
19
+ * Availability options
20
+ */
21
+ protected $_canCapture = true;
22
+ protected $_isGateway = false;
23
+ protected $_canCapturePartial = true;
24
+ protected $_canRefundInvoicePartial = true;
25
+ /**
26
+ * @param Varien_Object $payment
27
+ * @param float $amount
28
+ * @return $this
29
+ */
30
+ public function capture(Varien_Object $payment, $amount)
31
+ {
32
+ $payment->setStatus(self::STATUS_APPROVED)
33
+ ->setTransactionId($payment->getCashcloudId())->setIsTransactionClosed(0);
34
+
35
+ return $this;
36
+ }
37
+
38
+
39
+ /**
40
+ * @param Varien_Object $payment
41
+ * @param float $amount
42
+ * @return $this
43
+ */
44
+ public function refund(Varien_Object $payment, $amount)
45
+ {
46
+ $this->getHelper()->refund($payment->getParentTransactionId(), $amount);
47
+ return $this;
48
+ }
49
+
50
+
51
+ /**
52
+ * @param null $quote
53
+ * @return bool
54
+ */
55
+ public function isAvailable($quote = null)
56
+ {
57
+ if (Mage::app()->getStore()->getCurrentCurrencyCode() == "EUR") {
58
+ return parent::isAvailable($quote);
59
+ }
60
+ return false;
61
+ }
62
+
63
+ /**
64
+ * @return int
65
+ */
66
+ public function getGrandTotal()
67
+ {
68
+ return $this->getCart()->getQuote()->getGrandTotal();
69
+ }
70
+
71
+ /**
72
+ * @return Mage_Directory_Model_Currency
73
+ */
74
+ public function getEur()
75
+ {
76
+ return Mage::getModel('directory/currency')->load("EUR");
77
+ }
78
+
79
+ /**
80
+ * @param bool $raw
81
+ * @return int
82
+ */
83
+ public function getGrandTotalInEur($raw = false)
84
+ {
85
+ $priceInEur = Mage::app()->getStore()->getCurrentCurrency()->convert($this->getGrandTotal(), $this->getEur());
86
+ return $raw ? $priceInEur : $this->getEur()->format($priceInEur);
87
+ }
88
+
89
+ /**
90
+ * @return $this
91
+ */
92
+ public function validate()
93
+ {
94
+ $info = $this->getInfoInstance();
95
+
96
+ $username = $info->getAdditionalInformation("cashcloud_username");
97
+ if (!preg_match('/([\w-+\.]+)@((?:[\w]+\.)+)([a-zA-Z]{2,4})/', $username)) {
98
+ Mage::throwException(
99
+ $this->_getHelper()->__('Invalid cashcloud username')
100
+ );
101
+ }
102
+
103
+ $currency = $info->getAdditionalInformation("cashcloud_currency");
104
+ if ($this->getConfigData('enable_ccr') && $currency != "EUR" && $currency != "CCR") {
105
+ Mage::throwException(
106
+ $this->_getHelper()->__('Please select currency')
107
+ );
108
+ }
109
+
110
+ if (!$this->getConfigData('reason')) {
111
+ $reason = $info->getAdditionalInformation("cashcloud_reason_id");
112
+ if (empty($reason) || !array_key_exists($reason, $this->getHelper()->getReasons())) {
113
+ Mage::throwException(
114
+ $this->_getHelper()->__('Please select purchase reason')
115
+ );
116
+ }
117
+ }
118
+
119
+ return parent::validate();
120
+ }
121
+
122
+ /**
123
+ * @param mixed $data
124
+ * @return $this|Mage_Payment_Model_Info
125
+ */
126
+ public function assignData($data)
127
+ {
128
+ parent::assignData($data);
129
+
130
+ $currency = isset($_POST['payment']['cashcloud_currency']) ? $_POST['payment']['cashcloud_currency'] : "EUR";
131
+ $username = isset($_POST['payment']['cashcloud_username']) ? $_POST['payment']['cashcloud_username'] : false;
132
+ $reason = isset($_POST['payment']['cashcloud_reason_id']) ? $_POST['payment']['cashcloud_reason_id'] : false;
133
+
134
+ $this->getInfoInstance()->setAdditionalInformation(array(
135
+ 'cashcloud_username' => $username,
136
+ 'cashcloud_currency' => $currency,
137
+ 'cashcloud_reason_id' => $reason,
138
+ ));
139
+ return $this;
140
+ }
141
+
142
+
143
+ /**
144
+ * @return Mage_Checkout_Model_Cart
145
+ */
146
+ public function getCart()
147
+ {
148
+ return Mage::helper('checkout/cart');
149
+ }
150
+
151
+ /**
152
+ * @return Mage_CashCloud_Helper_Data
153
+ */
154
+ public function getHelper()
155
+ {
156
+ return Mage::helper("cashcloud");
157
+ }
158
+
159
+ /**
160
+ * Payment action getter compatible with payment model
161
+ *
162
+ * @see Mage_Sales_Model_Payment::place()
163
+ * @return string
164
+ */
165
+ public function getConfigPaymentAction()
166
+ {
167
+ return "order";
168
+ }
169
+
170
+
171
+ public function order(Varien_Object $payment, $amount)
172
+ {
173
+ $this->getHelper()->init();
174
+ try {
175
+ $orderId = $this->getHelper()->requestMoney($payment);
176
+ $payment->setCashcloudId($orderId);
177
+ $payment->save();
178
+ } catch (\CashCloud\Api\Exception\ValidateException $e) {
179
+ Mage::throwException(
180
+ $this->_getHelper()->__("Validation failed").": ".$this->_getHelper()->__($e->getFirstError())
181
+ );
182
+ } catch (\CashCloud\Api\Exception\AuthException $e) {
183
+ Mage::throwException(
184
+ $this->_getHelper()->__("Error while authorizing payment. Please check cashcloud account details in configuration!")
185
+ );
186
+ } catch (\CashCloud\Api\Exception\CashCloudException $e) {
187
+ Mage::logException($e);
188
+ Mage::throwException(
189
+ $this->_getHelper()->__("Error while executing payment in cashcloud!")
190
+ );
191
+ }
192
+
193
+ return $this;
194
+ }
195
+
196
+ public function getOrderPlaceRedirectUrl()
197
+ {
198
+ return Mage::getUrl('cashcloud/pay/process');
199
+ }
200
+
201
+ /**
202
+ * @param Mage_Sales_Model_Order $order
203
+ * @param array $callbackData
204
+ */
205
+ public function validateCallback($order, $callbackData)
206
+ {
207
+ $this->getHelper()->init();
208
+ $status = isset($callbackData['status']) ? $callbackData['status'] : null;
209
+ $unsuccessfulStatuses = array(
210
+ \CashCloud\Api\Rest\Client::STATUS_EXPIRED,
211
+ \CashCloud\Api\Rest\Client::STATUS_REFUNDED,
212
+ \CashCloud\Api\Rest\Client::STATUS_DECLINED,
213
+ \CashCloud\Api\Rest\Client::STATUS_MONEY_SERVICE_FAILED
214
+ );
215
+
216
+ if($status == \CashCloud\Api\Rest\Client::STATUS_COMPLETED) {
217
+ $orderState = Mage_Sales_Model_Order::STATE_PROCESSING;
218
+ $orderStatus = $this->getConfigData('order_status_after_payment');
219
+ $this->saveStatus($order, $orderState, $orderStatus, $this->getHelper()->__("Payment notification received"));
220
+ } elseif(in_array($status, $unsuccessfulStatuses)) {
221
+ $orderState = Mage_Sales_Model_Order::STATE_CANCELED;
222
+ $orderStatus = Mage_Sales_Model_Order::STATE_CANCELED;
223
+ $this->saveStatus($order, $orderState, $orderStatus, $this->getHelper()->__("Customer cancelled order"));
224
+ } else {
225
+ Mage::throwException("Invalid cashcloud status: $status");
226
+ }
227
+ }
228
+
229
+ /**
230
+ * @param Mage_Sales_Model_Order $order
231
+ * @param array $callbackData
232
+ */
233
+ public function validateRefundCallback($hash)
234
+ {
235
+ $this->getHelper()->init();
236
+ $transaction = $this->getHelper()->getTransactionDataFromHash($hash);
237
+ $order_id = $transaction->extern->id;
238
+ $status = (int)$transaction->transaction_state_id;
239
+
240
+ $order = Mage::getModel('sales/order')->loadByIncrementId($order_id);
241
+ $credit_memo = $order->getCreditmemosCollection()->getLastItem();
242
+ if($status == \CashCloud\Api\Method\Refund::REFUND_ACCEPTED_STATUS)
243
+ {
244
+ $orderState = Mage_Sales_Model_Order::STATE_CLOSED;
245
+ $orderStatus = $this->getConfigData('order_status_after_payment');
246
+ $this->saveStatus($order, $orderState, $orderStatus, $this->getHelper()->__("Refund accepted by user"));
247
+
248
+ }
249
+ if($status == \CashCloud\Api\Method\Refund::REFUND_CANCELLED_STATUS)
250
+ {
251
+ $credit_memo->cancel()->save();
252
+ $this->cancelOrderRefundAction($order);
253
+ $orderState = Mage_Sales_Model_Order::STATE_COMPLETE;
254
+ $orderStatus = $this->getConfigData('order_status_after_payment');
255
+ $this->saveStatus($order, $orderState, $orderStatus, $this->getHelper()->__("Refund cancelled by user"));
256
+ }
257
+ }
258
+ /*
259
+ *Deletes order refund information
260
+ */
261
+ public function cancelOrderRefundAction($order)
262
+ {
263
+ foreach($order->getItemsCollection() as $item)
264
+ {
265
+ if ($item->getQtyRefunded() > 0)
266
+ {
267
+ $item->setQtyRefunded(0)
268
+ ->setAmountRefunded(0)
269
+ ->setBaseAmountRefunded(0)
270
+ ->setHiddenTaxRefunded(0)
271
+ ->setBaseHiddenTaxRefunded(0)
272
+ ->setTaxRefunded(0)
273
+ ->setBaseTaxRefunded(0)
274
+ ->setDiscountRefunded(0)
275
+ ->setBaseDiscountRefunded(0)
276
+ ->save();
277
+ }
278
+ }
279
+
280
+ $order
281
+ ->setBaseDiscountRefunded(0)
282
+ ->setBaseShippingRefunded(0)
283
+ ->setBaseSubtotalRefunded(0)
284
+ ->setBaseTaxRefunded(0)
285
+ ->setBaseShippingTaxRefunded(0)
286
+ ->setBaseTotalOnlineRefunded(0)
287
+ ->setBaseTotalOfflineRefunded(0)
288
+ ->setBaseTotalRefunded(0)
289
+ ->setTotalOnlineRefunded(0)
290
+ ->setTotalOfflineRefunded(0)
291
+ ->setDiscountRefunded(0)
292
+ ->setShippingRefunded(0)
293
+ ->setShippingTaxRefunded(0)
294
+ ->setSubtotalRefunded(0)
295
+ ->setTaxRefunded(0)
296
+ ->setTotalRefunded(0)
297
+ ->save();
298
+
299
+ $invoice = $order->getInvoiceCollection()->getLastItem();
300
+ $invoice->setIsUsedForRefund(0)->save();
301
+ }
302
+ /**
303
+ * @param Mage_Sales_Model_Order $order
304
+ * @param string $orderState
305
+ * @param string $orderStatus
306
+ * @param string $comment
307
+ */
308
+ protected function saveStatus($order, $orderState, $orderStatus, $comment){
309
+ $order->setState($orderState, $orderStatus, $comment)->save();
310
+
311
+ /** @var Mage_Sales_Model_Order_Payment $payment */
312
+ $payment = $order->getPaymentsCollection()->getFirstItem();
313
+
314
+ if($orderStatus == Mage_Sales_Model_Order::STATE_PROCESSING) {
315
+ $order->addStatusHistoryComment($this->getHelper()->__("Payment received"), $orderStatus);
316
+ } else {
317
+
318
+ }
319
+ }
320
+ }
app/code/local/Mage/CashCloud/controllers/PayController.php CHANGED
@@ -1,114 +1,114 @@
1
- <?php
2
- /**
3
- * Class Mage_CashCloud_PayController
4
- */
5
- class Mage_CashCloud_PayController extends Mage_Core_Controller_Front_Action
6
- {
7
- /**
8
- * @return Mage_Checkout_Model_Session
9
- */
10
- public function getCheckout()
11
- {
12
- return Mage::getSingleton('checkout/session');
13
- }
14
-
15
- public function processAction()
16
- {
17
- $this->loadLayout();
18
-
19
- $order = $this->getCheckout()->getLastRealOrder();
20
- if(!$order) {
21
- Mage::throwException("Cannot find order");
22
- }
23
-
24
- $success = null;
25
- $orderStatus = $this->getMethodInstance()->getConfigData('order_status_after_payment');
26
- if($order->getState() == Mage_Sales_Model_Order::STATE_PROCESSING && $order->getStatus() == $orderStatus) {
27
- $success = true;
28
- } elseif ($order->getState() == Mage_Sales_Model_Order::STATE_CANCELED) {
29
- $success = false;
30
- }
31
-
32
- if(!$this->getRequest()->isAjax() && !is_null($success)) {
33
- $this->_redirect(
34
- $success ? 'checkout/onepage/success' : 'checkout/onepage/failure'
35
- );
36
- }
37
-
38
- if($this->getRequest()->isPost()) {
39
- $this->getResponse()->setHeader('Content-type', 'application/x-json');
40
- $this->getResponse()->setBody(Mage::helper('core')->jsonEncode(array(
41
- 'action'=> is_null($success) ? "wait" : "reload",
42
- )));
43
- } else {
44
- $this->getResponse()->setBody($this->getLayout()->createBlock('cashcloud/process')->toHtml());
45
- }
46
- }
47
-
48
- public function callbackAction()
49
- {
50
- $method = isset($_POST['method']) ? $_POST['method'] : false;
51
- $securityToken = isset($_POST['control']) ? $_POST['control'] : false;
52
- $time = isset($_POST['time']) ? $_POST['time'] : false;
53
- $status = isset($_POST['status']) ? $_POST['status'] : false;
54
-
55
- $payment = Mage::getSingleton("Mage_CashCloud_Model_PaymentMethod");
56
-
57
- $controlString = "$method|$status|$time|".md5(sha1($payment->getConfigData('api_password'), true), true);
58
- $realToken = base64_encode( md5( sha1( $controlString, true), true));
59
-
60
- if($securityToken != $realToken) {
61
- Mage::throwException("Not found");
62
- }
63
-
64
- if($method == "refund") {
65
- Mage::throwException("Method not supported");
66
- }
67
-
68
- $hash = isset($_POST['hash']) ? $_POST['hash'] : false;
69
- $order = $this->loadOrder($hash);
70
-
71
- if($order->getId()) {
72
- $callbackData = $this->getRequest()->getPost();
73
- $this->getMethodInstance()->validateCallback($order, $callbackData);
74
- echo "OK";
75
- } else {
76
- Mage::throwException($this->getHelper()->__("Order not found!"));
77
- }
78
- }
79
-
80
- /**
81
- * @return Mage_CashCloud_Helper_Data
82
- */
83
- public function getHelper()
84
- {
85
- return Mage::helper("cashcloud");
86
- }
87
-
88
- /**
89
- * @param $hash
90
- * @return Mage_Sales_Model_Order
91
- */
92
- public function loadOrder($hash)
93
- {
94
- /** @var Mage_Sales_Model_Order_Payment $orderPayment */
95
- $orderPayment = Mage::getSingleton("sales/order_payment")->load($hash, 'cashcloud_id');
96
- /** @var Mage_Sales_Model_Order $order */
97
- $order = Mage::getSingleton("sales/order")->load($orderPayment->getParentId());
98
- if($order) {
99
- $orderPayment->setOrder($order);
100
- $order->setPayment($orderPayment);
101
- } else {
102
- Mage::throwException($this->getHelper()->__("Order not found!"));
103
- }
104
- return $order;
105
- }
106
-
107
- /**
108
- * @return Mage_CashCloud_Model_PaymentMethod
109
- */
110
- public function getMethodInstance()
111
- {
112
- return Mage::getSingleton("Mage_CashCloud_Model_PaymentMethod");
113
- }
114
- }
1
+ <?php
2
+ /**
3
+ * Class Mage_CashCloud_PayController
4
+ */
5
+ class Mage_CashCloud_PayController extends Mage_Core_Controller_Front_Action
6
+ {
7
+ /**
8
+ * @return Mage_Checkout_Model_Session
9
+ */
10
+ public function getCheckout()
11
+ {
12
+ return Mage::getSingleton('checkout/session');
13
+ }
14
+
15
+ public function processAction()
16
+ {
17
+ $this->loadLayout();
18
+
19
+ $order = $this->getCheckout()->getLastRealOrder();
20
+ if(!$order) {
21
+ Mage::throwException("Cannot find order");
22
+ }
23
+
24
+ $success = null;
25
+ $orderStatus = $this->getMethodInstance()->getConfigData('order_status_after_payment');
26
+ if($order->getState() == Mage_Sales_Model_Order::STATE_PROCESSING && $order->getStatus() == $orderStatus) {
27
+ $success = true;
28
+ } elseif ($order->getState() == Mage_Sales_Model_Order::STATE_CANCELED) {
29
+ $success = false;
30
+ }
31
+
32
+ if(!$this->getRequest()->isAjax() && !is_null($success)) {
33
+ $this->_redirect(
34
+ $success ? 'checkout/onepage/success' : 'checkout/onepage/failure'
35
+ );
36
+ }
37
+
38
+ if($this->getRequest()->isPost()) {
39
+ $this->getResponse()->setHeader('Content-type', 'application/x-json');
40
+ $this->getResponse()->setBody(Mage::helper('core')->jsonEncode(array(
41
+ 'action'=> is_null($success) ? "wait" : "reload",
42
+ )));
43
+ } else {
44
+ $this->getResponse()->setBody($this->getLayout()->createBlock('cashcloud/process')->toHtml());
45
+ }
46
+ }
47
+
48
+ public function callbackAction()
49
+ {
50
+ $method = isset($_POST['method']) ? $_POST['method'] : false;
51
+ if($method == "refund") {
52
+ $this->getMethodInstance()->validateRefundCallback($_POST['hash']);
53
+ exit();
54
+ }
55
+ $securityToken = isset($_POST['control']) ? $_POST['control'] : false;
56
+ $time = isset($_POST['time']) ? $_POST['time'] : false;
57
+ $status = isset($_POST['status']) ? $_POST['status'] : false;
58
+
59
+ $payment = Mage::getSingleton("Mage_CashCloud_Model_PaymentMethod");
60
+
61
+ $controlString = "$method|$status|$time|".md5(sha1($payment->getConfigData('api_password'), true), true);
62
+ $realToken = base64_encode( md5( sha1( $controlString, true), true));
63
+
64
+ if($securityToken != $realToken) {
65
+ Mage::throwException("Not found");
66
+ }
67
+
68
+ $hash = isset($_POST['hash']) ? $_POST['hash'] : false;
69
+ $order = $this->loadOrder($hash);
70
+
71
+ if($order->getId()) {
72
+ $callbackData = $this->getRequest()->getPost();
73
+ $this->getMethodInstance()->validateCallback($order, $callbackData);
74
+ echo "OK";
75
+ } else {
76
+ Mage::throwException($this->getHelper()->__("Order not found!"));
77
+ }
78
+ }
79
+
80
+ /**
81
+ * @return Mage_CashCloud_Helper_Data
82
+ */
83
+ public function getHelper()
84
+ {
85
+ return Mage::helper("cashcloud");
86
+ }
87
+
88
+ /**
89
+ * @param $hash
90
+ * @return Mage_Sales_Model_Order
91
+ */
92
+ public function loadOrder($hash)
93
+ {
94
+ /** @var Mage_Sales_Model_Order_Payment $orderPayment */
95
+ $orderPayment = Mage::getSingleton("sales/order_payment")->load($hash, 'cashcloud_id');
96
+ /** @var Mage_Sales_Model_Order $order */
97
+ $order = Mage::getSingleton("sales/order")->load($orderPayment->getParentId());
98
+ if($order) {
99
+ $orderPayment->setOrder($order);
100
+ $order->setPayment($orderPayment);
101
+ } else {
102
+ Mage::throwException($this->getHelper()->__("Order not found!"));
103
+ }
104
+ return $order;
105
+ }
106
+
107
+ /**
108
+ * @return Mage_CashCloud_Model_PaymentMethod
109
+ */
110
+ public function getMethodInstance()
111
+ {
112
+ return Mage::getSingleton("Mage_CashCloud_Model_PaymentMethod");
113
+ }
114
+ }
app/code/local/Mage/CashCloud/etc/config.xml CHANGED
@@ -1,82 +1,82 @@
1
- <?xml version="1.0"?>
2
- <config>
3
- <modules>
4
- <Mage_CashCloud>
5
- <version>0.0.1</version>
6
- </Mage_CashCloud>
7
- </modules>
8
-
9
- <global>
10
- <blocks>
11
- <cashcloud>
12
- <class>Mage_CashCloud_Block</class>
13
- </cashcloud>
14
- </blocks>
15
- <models>
16
- <CashCloud>
17
- <class>Mage_CashCloud_Model</class>
18
- </CashCloud>
19
- </models>
20
- <resources>
21
- <cashcloud_setup>
22
- <setup>
23
- <module>Mage_CashCloud</module>
24
- <class>Mage_CashCloud_Model_Mysql4_Setup</class>
25
- </setup>
26
- <connection>
27
- <use>core_setup</use>
28
- </connection>
29
- </cashcloud_setup>
30
- </resources>
31
- <helpers>
32
- <cashcloud>
33
- <class>Mage_CashCloud_Helper</class>
34
- </cashcloud>
35
- </helpers>
36
- </global>
37
- <adminhtml>
38
- <translate>
39
- <modules>
40
- <Mage_Epay>
41
- <files>
42
- <default>Mage_CashCloud.csv</default>
43
- </files>
44
- </Mage_Epay>
45
- </modules>
46
- </translate>
47
- </adminhtml>
48
- <frontend>
49
- <routers>
50
- <cashcloud>
51
- <use>standard</use>
52
- <args>
53
- <module>Mage_CashCloud</module>
54
- <frontName>cashcloud</frontName>
55
- </args>
56
- </cashcloud>
57
- </routers>
58
- <translate>
59
- <modules>
60
- <Mage_Epay>
61
- <files>
62
- <default>Mage_CashCloud.csv</default>
63
- </files>
64
- </Mage_Epay>
65
- </modules>
66
- </translate>
67
- </frontend>
68
- <default>
69
- <payment>
70
- <cashcloud>
71
- <active>0</active>
72
- <model>CashCloud/paymentMethod</model>
73
- <request_expiration>691200</request_expiration>
74
- <order_status>pending</order_status>
75
- <order_status_after_payment>processing</order_status_after_payment>
76
- <auto_set_settings>1</auto_set_settings>
77
- <device_id>magento</device_id>
78
- <title>CashCloud</title>
79
- </cashcloud>
80
- </payment>
81
- </default>
82
- </config>
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Mage_CashCloud>
5
+ <version>0.2.0</version>
6
+ </Mage_CashCloud>
7
+ </modules>
8
+
9
+ <global>
10
+ <blocks>
11
+ <cashcloud>
12
+ <class>Mage_CashCloud_Block</class>
13
+ </cashcloud>
14
+ </blocks>
15
+ <models>
16
+ <CashCloud>
17
+ <class>Mage_CashCloud_Model</class>
18
+ </CashCloud>
19
+ </models>
20
+ <resources>
21
+ <cashcloud_setup>
22
+ <setup>
23
+ <module>Mage_CashCloud</module>
24
+ <class>Mage_CashCloud_Model_Mysql4_Setup</class>
25
+ </setup>
26
+ <connection>
27
+ <use>core_setup</use>
28
+ </connection>
29
+ </cashcloud_setup>
30
+ </resources>
31
+ <helpers>
32
+ <cashcloud>
33
+ <class>Mage_CashCloud_Helper</class>
34
+ </cashcloud>
35
+ </helpers>
36
+ </global>
37
+ <adminhtml>
38
+ <translate>
39
+ <modules>
40
+ <Mage_Epay>
41
+ <files>
42
+ <default>Mage_CashCloud.csv</default>
43
+ </files>
44
+ </Mage_Epay>
45
+ </modules>
46
+ </translate>
47
+ </adminhtml>
48
+ <frontend>
49
+ <routers>
50
+ <cashcloud>
51
+ <use>standard</use>
52
+ <args>
53
+ <module>Mage_CashCloud</module>
54
+ <frontName>cashcloud</frontName>
55
+ </args>
56
+ </cashcloud>
57
+ </routers>
58
+ <translate>
59
+ <modules>
60
+ <Mage_Epay>
61
+ <files>
62
+ <default>Mage_CashCloud.csv</default>
63
+ </files>
64
+ </Mage_Epay>
65
+ </modules>
66
+ </translate>
67
+ </frontend>
68
+ <default>
69
+ <payment>
70
+ <cashcloud>
71
+ <active>0</active>
72
+ <model>CashCloud/paymentMethod</model>
73
+ <request_expiration>691200</request_expiration>
74
+ <order_status>pending</order_status>
75
+ <order_status_after_payment>processing</order_status_after_payment>
76
+ <auto_set_settings>1</auto_set_settings>
77
+ <device_id>magento</device_id>
78
+ <title>cashcloud</title>
79
+ </cashcloud>
80
+ </payment>
81
+ </default>
82
+ </config>
app/code/local/Mage/CashCloud/etc/system.xml CHANGED
@@ -1,127 +1,127 @@
1
- <?xml version="1.0"?>
2
- <config>
3
- <sections>
4
- <payment>
5
- <groups>
6
- <cashcloud translate="label" module="paygate">
7
- <label>CashCloud</label>
8
- <sort_order>670</sort_order>
9
- <show_in_default>1</show_in_default>
10
- <show_in_website>1</show_in_website>
11
- <show_in_store>0</show_in_store>
12
- <comment>Please enter your CashCloud account details</comment>
13
- <fields>
14
- <active translate="label">
15
- <label>Enabled</label>
16
- <frontend_type>select</frontend_type>
17
- <source_model>adminhtml/system_config_source_yesno</source_model>
18
- <sort_order>1</sort_order>
19
- <show_in_default>1</show_in_default>
20
- <show_in_website>1</show_in_website>
21
- <show_in_store>0</show_in_store>
22
- </active>
23
- <auto_set_settings translate="label">
24
- <label>Save settings</label>
25
- <comment><![CDATA[If yes, save callback and expiration to cashcloud account]]></comment>
26
- <frontend_type>select</frontend_type>
27
- <source_model>adminhtml/system_config_source_yesno</source_model>
28
- <sort_order>2</sort_order>
29
- <show_in_default>1</show_in_default>
30
- <show_in_website>1</show_in_website>
31
- <show_in_store>0</show_in_store>
32
- </auto_set_settings>
33
- <request_expiration translate="label">
34
- <label>Payment expires in:</label>
35
- <frontend_type>select</frontend_type>
36
- <source_model>Mage_CashCloud_Adminhtml_Model_Expiration</source_model>
37
- <sort_order>3</sort_order>
38
- <validate>validate-number</validate>
39
- <show_in_default>1</show_in_default>
40
- <show_in_website>1</show_in_website>
41
- <show_in_store>0</show_in_store>
42
- </request_expiration>
43
- <api_username translate="label">
44
- <label>Username</label>
45
- <frontend_type>text</frontend_type>
46
- <sort_order>4</sort_order>
47
- <validate>validate-email</validate>
48
- <validate>validate-one-required</validate>
49
- <show_in_default>1</show_in_default>
50
- <show_in_website>1</show_in_website>
51
- <show_in_store>0</show_in_store>
52
- </api_username>
53
- <api_password translate="label">
54
- <label>Password</label>
55
- <frontend_type>text</frontend_type>
56
- <validate>validate-one-required</validate>
57
- <backend_model>Mage_CashCloud_Adminhtml_Model_Config</backend_model>
58
- <sort_order>5</sort_order>
59
- <show_in_default>1</show_in_default>
60
- <show_in_website>1</show_in_website>
61
- <show_in_store>0</show_in_store>
62
- </api_password>
63
- <title translate="label">
64
- <label>Title</label>
65
- <frontend_type>text</frontend_type>
66
- <sort_order>6</sort_order>
67
- <show_in_default>1</show_in_default>
68
- <show_in_website>1</show_in_website>
69
- <show_in_store>0</show_in_store>
70
- </title>
71
- <reason translate="label">
72
- <label>Category</label>
73
- <frontend_type>select</frontend_type>
74
- <source_model>Mage_CashCloud_Adminhtml_Model_Reason</source_model>
75
- <sort_order>7</sort_order>
76
- <show_in_default>1</show_in_default>
77
- <show_in_website>1</show_in_website>
78
- <show_in_store>0</show_in_store>
79
- </reason>
80
- <enable_ccr translate="label">
81
- <label>Enable CCR</label>
82
- <frontend_type>select</frontend_type>
83
- <source_model>adminhtml/system_config_source_yesno</source_model>
84
- <sort_order>8</sort_order>
85
- <show_in_default>1</show_in_default>
86
- <show_in_website>1</show_in_website>
87
- <show_in_store>0</show_in_store>
88
- </enable_ccr>
89
- <device_id translate="label">
90
- <label>Device ID</label>
91
- <frontend_type>text</frontend_type>
92
- <sort_order>9</sort_order>
93
- <show_in_default>1</show_in_default>
94
- <show_in_website>1</show_in_website>
95
- <show_in_store>0</show_in_store>
96
- </device_id>
97
- <order_status translate="label">
98
- <label><![CDATA[Order status (Before the payment)]]></label>
99
- <comment><![CDATA[Set the status of the order <b>before</b> the payment is made.]]></comment>
100
- <frontend_type>select</frontend_type>
101
- <source_model>adminhtml/system_config_source_order_status</source_model>
102
- <sort_order>10</sort_order>
103
- <show_in_default>1</show_in_default>
104
- </order_status>
105
- <order_status_after_payment translate="label">
106
- <label><![CDATA[Order status (When the payment is made):]]></label>
107
- <comment><![CDATA[Set the status of the order <b>after</b> the payment is made. This is used to distinguish between paid and not paid orders!]]></comment>
108
- <frontend_type>select</frontend_type>
109
- <source_model>adminhtml/system_config_source_order_status</source_model>
110
- <sort_order>11</sort_order>
111
- <show_in_default>1</show_in_default>
112
- </order_status_after_payment>
113
- <enable_sandbox translate="label">
114
- <label>Sandbox mode</label>
115
- <frontend_type>select</frontend_type>
116
- <source_model>adminhtml/system_config_source_yesno</source_model>
117
- <sort_order>12</sort_order>
118
- <show_in_default>1</show_in_default>
119
- <show_in_website>1</show_in_website>
120
- <show_in_store>0</show_in_store>
121
- </enable_sandbox>
122
- </fields>
123
- </cashcloud>
124
- </groups>
125
- </payment>
126
- </sections>
127
- </config>
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <sections>
4
+ <payment>
5
+ <groups>
6
+ <cashcloud translate="label" module="paygate">
7
+ <label>cashcloud</label>
8
+ <sort_order>670</sort_order>
9
+ <show_in_default>1</show_in_default>
10
+ <show_in_website>1</show_in_website>
11
+ <show_in_store>0</show_in_store>
12
+ <comment>Please enter your cashcloud account details</comment>
13
+ <fields>
14
+ <active translate="label">
15
+ <label>Enabled</label>
16
+ <frontend_type>select</frontend_type>
17
+ <source_model>adminhtml/system_config_source_yesno</source_model>
18
+ <sort_order>1</sort_order>
19
+ <show_in_default>1</show_in_default>
20
+ <show_in_website>1</show_in_website>
21
+ <show_in_store>0</show_in_store>
22
+ </active>
23
+ <auto_set_settings translate="label">
24
+ <label>Save settings</label>
25
+ <comment><![CDATA[If yes, save callback and expiration to cashcloud account]]></comment>
26
+ <frontend_type>select</frontend_type>
27
+ <source_model>adminhtml/system_config_source_yesno</source_model>
28
+ <sort_order>2</sort_order>
29
+ <show_in_default>1</show_in_default>
30
+ <show_in_website>1</show_in_website>
31
+ <show_in_store>0</show_in_store>
32
+ </auto_set_settings>
33
+ <request_expiration translate="label">
34
+ <label>Payment expires in:</label>
35
+ <frontend_type>select</frontend_type>
36
+ <source_model>Mage_CashCloud_Adminhtml_Model_Expiration</source_model>
37
+ <sort_order>3</sort_order>
38
+ <validate>validate-number</validate>
39
+ <show_in_default>1</show_in_default>
40
+ <show_in_website>1</show_in_website>
41
+ <show_in_store>0</show_in_store>
42
+ </request_expiration>
43
+ <api_username translate="label">
44
+ <label>Username</label>
45
+ <frontend_type>text</frontend_type>
46
+ <sort_order>4</sort_order>
47
+ <validate>validate-email</validate>
48
+ <validate>validate-one-required</validate>
49
+ <show_in_default>1</show_in_default>
50
+ <show_in_website>1</show_in_website>
51
+ <show_in_store>0</show_in_store>
52
+ </api_username>
53
+ <api_password translate="label">
54
+ <label>Password</label>
55
+ <frontend_type>text</frontend_type>
56
+ <validate>validate-one-required</validate>
57
+ <backend_model>Mage_CashCloud_Adminhtml_Model_Config</backend_model>
58
+ <sort_order>5</sort_order>
59
+ <show_in_default>1</show_in_default>
60
+ <show_in_website>1</show_in_website>
61
+ <show_in_store>0</show_in_store>
62
+ </api_password>
63
+ <title translate="label">
64
+ <label>Title</label>
65
+ <frontend_type>text</frontend_type>
66
+ <sort_order>6</sort_order>
67
+ <show_in_default>1</show_in_default>
68
+ <show_in_website>1</show_in_website>
69
+ <show_in_store>0</show_in_store>
70
+ </title>
71
+ <reason translate="label">
72
+ <label>Category</label>
73
+ <frontend_type>select</frontend_type>
74
+ <source_model>Mage_CashCloud_Adminhtml_Model_Reason</source_model>
75
+ <sort_order>7</sort_order>
76
+ <show_in_default>1</show_in_default>
77
+ <show_in_website>1</show_in_website>
78
+ <show_in_store>0</show_in_store>
79
+ </reason>
80
+ <enable_ccr translate="label">
81
+ <label>Enable CCR</label>
82
+ <frontend_type>select</frontend_type>
83
+ <source_model>adminhtml/system_config_source_yesno</source_model>
84
+ <sort_order>8</sort_order>
85
+ <show_in_default>1</show_in_default>
86
+ <show_in_website>1</show_in_website>
87
+ <show_in_store>0</show_in_store>
88
+ </enable_ccr>
89
+ <device_id translate="label">
90
+ <label>Device ID</label>
91
+ <frontend_type>text</frontend_type>
92
+ <sort_order>9</sort_order>
93
+ <show_in_default>1</show_in_default>
94
+ <show_in_website>1</show_in_website>
95
+ <show_in_store>0</show_in_store>
96
+ </device_id>
97
+ <order_status translate="label">
98
+ <label><![CDATA[Order status (Before the payment)]]></label>
99
+ <comment><![CDATA[Set the status of the order <b>before</b> the payment is made.]]></comment>
100
+ <frontend_type>select</frontend_type>
101
+ <source_model>adminhtml/system_config_source_order_status</source_model>
102
+ <sort_order>10</sort_order>
103
+ <show_in_default>1</show_in_default>
104
+ </order_status>
105
+ <order_status_after_payment translate="label">
106
+ <label><![CDATA[Order status (When the payment is made):]]></label>
107
+ <comment><![CDATA[Set the status of the order <b>after</b> the payment is made. This is used to distinguish between paid and not paid orders!]]></comment>
108
+ <frontend_type>select</frontend_type>
109
+ <source_model>adminhtml/system_config_source_order_status</source_model>
110
+ <sort_order>11</sort_order>
111
+ <show_in_default>1</show_in_default>
112
+ </order_status_after_payment>
113
+ <enable_sandbox translate="label">
114
+ <label>Sandbox mode</label>
115
+ <frontend_type>select</frontend_type>
116
+ <source_model>adminhtml/system_config_source_yesno</source_model>
117
+ <sort_order>12</sort_order>
118
+ <show_in_default>1</show_in_default>
119
+ <show_in_website>1</show_in_website>
120
+ <show_in_store>0</show_in_store>
121
+ </enable_sandbox>
122
+ </fields>
123
+ </cashcloud>
124
+ </groups>
125
+ </payment>
126
+ </sections>
127
+ </config>
app/code/local/Mage/CashCloud/sql/cashcloud_setup/{mysql4-install-0.0.1.php → mysql4-install-0.2.0.php} RENAMED
File without changes
app/design/adminhtml/default/default/template/cashcloud/checks.phtml CHANGED
@@ -1,13 +1,13 @@
1
- <?php
2
- /**
3
- * @var Mage_CashCloud_Adminhtml_Model_Checks $this
4
- */
5
- ?>
6
- <div class="payflow-settings-notice">
7
- <strong class="important-label"><?php echo $this->__('Important: ') ?></strong>
8
- <?php echo $this->__('To use CashCloud, you must configure your account on the CashCloud website.'); ?>
9
- <?php echo $this->__('Once you log into your account, navigate to the Settings and set the options described below') ?>
10
- <ul class="options-list">
11
- <li><strong><?php echo $this->__('Callback URL') ?>:</strong> <?php echo $this->getCallbackUrl() ?></li>
12
- </ul>
13
- </div>
1
+ <?php
2
+ /**
3
+ * @var Mage_CashCloud_Adminhtml_Model_Checks $this
4
+ */
5
+ ?>
6
+ <div class="payflow-settings-notice">
7
+ <strong class="important-label"><?php echo $this->__('Important: ') ?></strong>
8
+ <?php echo $this->__('To use cashcloud, you must configure your account on the cashcloud website.'); ?>
9
+ <?php echo $this->__('Once you log into your account, navigate to the Settings and set the options described below') ?>
10
+ <ul class="options-list">
11
+ <li><strong><?php echo $this->__('Callback URL') ?>:</strong> <?php echo $this->getCallbackUrl() ?></li>
12
+ </ul>
13
+ </div>
app/design/frontend/base/default/template/cashcloud/form.phtml CHANGED
@@ -1,42 +1,48 @@
1
- <?php
2
- /**
3
- * @var Mage_CashCloud_Block_Form $this
4
- */
5
- ?>
6
- <div id="payment_form_<?php echo $this->getMethodCode() ?>" style="display: none">
7
- <ul class="form-list">
8
- <li>
9
- <label for="cashcloud_username" class="required"><em>*</em> Username</label>
10
-
11
- <div class="input-box">
12
- <input type="text" name="payment[cashcloud_username]" id="cashcloud_username" class="input-text required-entry"/>
13
- </div>
14
- </li>
15
- <?php if (!$this->isReasonSelected()) { ?>
16
- <li>
17
- <label for="cashcloud_reason_id" class="required"><em>*</em> Reason</label>
18
-
19
- <div class="input-box">
20
- <select name="payment[cashcloud_reason_id]" id="cashcloud_reason_id">
21
- <?php foreach ($this->getReasons() as $reasonId => $reasonName) {
22
- echo "<option value='$reasonId'>$reasonName</option>";
23
- } ?>
24
- </select>
25
- </div>
26
- </li>
27
- <?php } ?>
28
- <?php if ($this->isCCREnabled()) { ?>
29
- <li>
30
- <label for="cashcloud_currency" class="required"><em>*</em> Currency</label>
31
- </li>
32
- <li class="control">
33
- <input type="radio" name="payment[cashcloud_currency]" id="cashcloud_currency_eur" value="EUR" class="radio validation-passed" checked/>
34
- <label for="cashcloud_currency_eur">EUR (<?php echo $this->getPriceInEur() ?>, <?php echo number_format($this->getConversationRate(), 4) ?>)</label>
35
- </li>
36
- <li class="control">
37
- <input type="radio" name="payment[cashcloud_currency]" id="cashcloud_currency_ccr" value="CCR" class="radio validation-passed"/>
38
- <label for="cashcloud_currency_ccr">CCR (<?php echo number_format($this->getPriceInCCR(), 2) ?> CCR)</label>
39
- </li>
40
- <?php } ?>
41
- </ul>
42
- </div>
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @var Mage_CashCloud_Block_Form $this
4
+ */
5
+ ?>
6
+ <div id="payment_form_<?php echo $this->getMethodCode() ?>" style="display: none">
7
+ <ul class="form-list">
8
+ <li>
9
+ <img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB) ?>/skin/frontend/base/default/images/cashcloud/logo.png" alt="Cashcloud"/>
10
+ </li>
11
+ <li>
12
+ <label for="cashcloud_description"><?php echo $this->__("cashcloud.description"); ?></label>
13
+ </li>
14
+ <li>
15
+ <label for="cashcloud_username" class="required"><em>*</em><?php echo $this->__("Username")?></label>
16
+
17
+ <div class="input-box">
18
+ <input type="text" name="payment[cashcloud_username]" id="cashcloud_username" class="input-text required-entry"/>
19
+ </div>
20
+ </li>
21
+ <?php if (!$this->isReasonSelected()) { ?>
22
+ <li>
23
+ <label for="cashcloud_reason_id" class="required"><em>*</em><?php echo $this->__("Reason")?></label>
24
+
25
+ <div class="input-box">
26
+ <select name="payment[cashcloud_reason_id]" id="cashcloud_reason_id">
27
+ <?php foreach ($this->getReasons() as $reasonId => $reasonName) {
28
+ echo "<option value='$reasonId'>$reasonName</option>";
29
+ } ?>
30
+ </select>
31
+ </div>
32
+ </li>
33
+ <?php } ?>
34
+ <?php if ($this->isCCREnabled()) { ?>
35
+ <li>
36
+ <label for="cashcloud_currency" class="required"><em>*</em><?php echo $this->__("Currency")?></label>
37
+ </li>
38
+ <li class="control">
39
+ <input type="radio" name="payment[cashcloud_currency]" id="cashcloud_currency_eur" value="EUR" class="radio validation-passed" checked/>
40
+ <label for="cashcloud_currency_eur">EUR (<?php echo $this->getPriceInEur() ?>, <?php echo number_format($this->getConversationRate(), 4) ?>)</label>
41
+ </li>
42
+ <li class="control">
43
+ <input type="radio" name="payment[cashcloud_currency]" id="cashcloud_currency_ccr" value="CCR" class="radio validation-passed"/>
44
+ <label for="cashcloud_currency_ccr">CCR (<?php echo number_format($this->getPriceInCCR(), 2) ?> CCR)</label>
45
+ </li>
46
+ <?php } ?>
47
+ </ul>
48
+ </div>
app/design/frontend/base/default/template/cashcloud/info.phtml CHANGED
@@ -1,28 +1,28 @@
1
- <table>
2
- <tbody>
3
- <?php
4
- $username = $this->getInfo()->getAdditionalInformation("cashcloud_username");
5
- $currency = $this->getInfo()->getAdditionalInformation("cashcloud_currency");
6
- ?>
7
- <tr>
8
- <th><strong>CashCloud <?php echo $this->__("user")?>:</strong></th>
9
- </tr>
10
- <tr>
11
- <td><?php echo $this->escapeHtml($username)?></td>
12
- </tr>
13
- <tr>
14
- <th><strong><?php echo $this->__("Amount")?>:</strong></th>
15
- </tr>
16
- <tr>
17
- <td><?php echo $this->escapeHtml($currency)?>: <?php echo $this->getFormattedPrice() ?></td>
18
- </tr>
19
- <tr>
20
- <th><strong><?php echo $this->__("Reason")?>:</strong></th>
21
- </tr>
22
- <tr>
23
- <td><?php echo $this->escapeHtml($this->getReason()) ?></td>
24
- </tr>
25
- </tbody>
26
- </table>
27
-
28
- <?php echo $this->getChildHtml()?>
1
+ <table>
2
+ <tbody>
3
+ <?php
4
+ $username = $this->getInfo()->getAdditionalInformation("cashcloud_username");
5
+ $currency = $this->getInfo()->getAdditionalInformation("cashcloud_currency");
6
+ ?>
7
+ <tr>
8
+ <th><strong>Cashcloud <?php echo $this->__("user")?>:</strong></th>
9
+ </tr>
10
+ <tr>
11
+ <td><?php echo $this->escapeHtml($username)?></td>
12
+ </tr>
13
+ <tr>
14
+ <th><strong><?php echo $this->__("Amount")?>:</strong></th>
15
+ </tr>
16
+ <tr>
17
+ <td><?php echo $this->escapeHtml($currency)?>: <?php echo $this->getFormattedPrice() ?></td>
18
+ </tr>
19
+ <tr>
20
+ <th><strong><?php echo $this->__("Reason")?>:</strong></th>
21
+ </tr>
22
+ <tr>
23
+ <td><?php echo $this->escapeHtml($this->getReason()) ?></td>
24
+ </tr>
25
+ </tbody>
26
+ </table>
27
+
28
+ <?php echo $this->getChildHtml()?>
app/design/frontend/base/default/template/cashcloud/process.phtml CHANGED
@@ -1,35 +1,35 @@
1
- <!DOCTYPE HTML>
2
- <html>
3
- <head>
4
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
5
- <title>CashCloud</title>
6
- <link href="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB) ?>/skin/frontend/base/default/css/cashcloud.css" rel="stylesheet" />
7
- <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
8
-
9
- </head>
10
- <body>
11
- <div class="container">
12
- <div class="logo">
13
- <img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB) ?>/skin/frontend/base/default/images/cashcloud/logo.png" alt="CashCloud"/>
14
- </div>
15
- <div class="desc">
16
- Please approve payment in CashCloud app
17
- </div>
18
- <div class="loader">
19
- <img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB) ?>/skin/frontend/base/default/images/cashcloud/loader.gif" alt="CashCloud"/>
20
- </div>
21
- </div>
22
-
23
- <div class="loader"></div>
24
- <script>
25
- setInterval(function(){
26
- $.post(window.location.href, {action: "check"}, function(data){
27
- if(data.action && data.action == "reload") {
28
- location.reload();
29
- }
30
- });
31
- return true;
32
- }, 5000)
33
- </script>
34
- </body>
35
- </html>
1
+ <!DOCTYPE HTML>
2
+ <html>
3
+ <head>
4
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
5
+ <title>Cashcloud</title>
6
+ <link href="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB) ?>/skin/frontend/base/default/css/cashcloud.css" rel="stylesheet" />
7
+ <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
8
+
9
+ </head>
10
+ <body>
11
+ <div class="container">
12
+ <div class="logo">
13
+ <img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB) ?>/skin/frontend/base/default/images/cashcloud/logo.png" alt="Cashcloud"/>
14
+ </div>
15
+ <div class="desc">
16
+ <?php echo $this->__("Please approve payment in Cashcloud app")?>
17
+ </div>
18
+ <div class="loader">
19
+ <img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB) ?>/skin/frontend/base/default/images/cashcloud/loader.gif" alt="Cashcloud"/>
20
+ </div>
21
+ </div>
22
+
23
+ <div class="loader"></div>
24
+ <script>
25
+ setInterval(function(){
26
+ $.post(window.location.href, {action: "check"}, function(data){
27
+ if(data.action && data.action == "reload") {
28
+ location.reload();
29
+ }
30
+ });
31
+ return true;
32
+ }, 5000)
33
+ </script>
34
+ </body>
35
+ </html>
app/etc/modules/Mage_CashCloud.xml CHANGED
@@ -1,12 +1,12 @@
1
- <config>
2
- <modules>
3
- <Mage_CashCloud>
4
- <active>true</active>
5
- <codePool>local</codePool>
6
- <depends>
7
- <Mage_Payment />
8
- </depends>
9
- <version>0.0.1</version>
10
- </Mage_CashCloud>
11
- </modules>
12
- </config>
1
+ <config>
2
+ <modules>
3
+ <Mage_CashCloud>
4
+ <active>true</active>
5
+ <codePool>local</codePool>
6
+ <depends>
7
+ <Mage_Payment />
8
+ </depends>
9
+ <version>{{extension.version}}</version>
10
+ </Mage_CashCloud>
11
+ </modules>
12
+ </config>
app/locale/de_DE/Mage_CashCloud.csv ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "isNotCorporateUser","Um cashcloud als Bezahlmethode nutzen zu können, benötigen Sie ein Corporate-Konto"
2
+ "SendMoneyOptionBlocked","Geld senden blockiert"
3
+ "minAmountTransactionPerTradeLimit","Transaktionsbetrag zu klein"
4
+ "maxAmountTransactionPerTradeLimit","Maximales Handelslimit erreicht"
5
+ "blackList","Benutzer auf die schwarze Liste gesetzt"
6
+ "isBankAvailable","Bank nicht verfügbar"
7
+ "isCompanyApproved","Unternehmen nicht zugelassen"
8
+ "isReasonAvailable","Grund nicht ausgewählt"
9
+ "email.emailDomain","E-Mail-Adresse ist nicht korrekt"
10
+ "recipient.errorStatus","Aufgrund deines verfügbaren Kontostandes ist es dir nicht möglich, dieses Produkt zu bestellen. Bitte lade zuerst dein Konto auf."
11
+ "recipient.notFound","Empfänger nicht gefunden"
12
+ "Validation failed: email.emailDomain","Ungültige E-Mail Adresse"
13
+ "Please enter your Cashcloud account details","Bitte die cashcloud Kontodaten eingeben"
14
+ "Save settings","Speichere Einstellungen"
15
+ "Payment expires in:","Zahlung läuft ab in:"
16
+ "Username","Benutzername"
17
+ "Enable CCR","CCR aktivieren"
18
+ "Device ID","Geräte-ID"
19
+ "Sandbox mode","Sandbox-Modus"
20
+ cashcloud.description,"Cashcloud ist deine mobile eWallet und dein Zahlungsservice. Zahle einfach mit deinem Smartphone. Es besteht keine Notwendigkeit Karten- oder Bankkontodaten einzugeben. Trage einfach deinen cashcloud Benutzername ein, sende eine Zahlungsanforderung und bestätige die Zahlungen mit deinem Smartphone in der cashcloud APP. Wie kannst du ein cashcloud Nutzer werden? Lade einfach die cashcloud eWallet APP aus dem Apple App Store oder Google Play Store herunter, registriere dich kostenlos und lade deine cashcloud eWallet auf. Alternative kannst du dich auch Online anmelden unter www.cashcloud.com."
21
+ "Currency","Auswählen"
22
+ "Amount","Menge"
23
+ "Reason","Grund"
24
+ "Please approve payment in Cashcloud app","Bitte die Zahlung in der cashcloud App bestätigen"
25
+ "Order status (Before the payment)","Bestellstatus (vor der Zahlung)"
26
+ "Order status (When the payment is made):","Bestellstatus (wenn die Zahlung erfolgt ist):"
27
+ "Set the status of the order <b>before</b> the payment is made.","Lege den Status der Bestellung fest, bevor diese bezahlt wird."
28
+ "Set the status of the order <b>after</b> the payment is made. This is used to distinguish between paid and not paid orders!","Lege den Status der Bestellung fest, nachdem diese bezahlt wurde. Das wird genutzt um zwischen bezahlten und nicht bezahlten Bestellungen zu unterscheiden!"
29
+ "Validation failed","Validierung fehlgeschlagen"
30
+ "Error while authorizing payment. Please check cashcloud account details in configuration!","Fehler beim Genehmigung der Zahlung. Bitte überprüfen Sie cashcloud Kontodaten in der Konfiguration!"
31
+ "Error while executing payment in cashcloud!","Fehler beim Ausführen Zahlung in cashcloud!"
32
+ "Invalid cashcloud username or password","Ungültige cashcloud Benutzername oder Passwort"
33
+ "Invalid cashcloud username","Der eingetragene Benutzername is falsch. Bitte versuche es erneut"
34
+ "Please select currency","Bitte wählen Sie Währung"
35
+ "Please select purchase reason","Bitte wählen Sie Kauf Grund"
36
+ "recipient.notFound","Der eingegebene Benutzername existiert nicht. Bitte geben deinen richtigen Benutzernamen (E-Mail-Adresse) zur Anmeldung ein oder registriere dich bei cashcloud mit deiner E-Mail-Adresse als Benutzernamen."
app/locale/en_GB/Mage_CashCloud.csv CHANGED
@@ -1,12 +1,13 @@
1
- "isNotCorporateUser","In order to use cashcloud payments, your account must be corporate"
2
- "SendMoneyOptionBlocked","Sending money blocked"
3
- "minAmountTransactionPerTradeLimit","Transaction amount too small"
4
- "maxAmountTransactionPerTradeLimit","Maximum trade limit reached"
5
- "blackList","User blacklisted"
6
- "isBankAvailable","Bank not available"
7
- "isCompanyApproved","Company not approved"
8
- "isReasonAvailable","Reason not selected"
9
- "email.emailDomain","Email is not correct"
10
- "recipient.errorStatus","Incorrect recipient status"
11
- "recipient.notFound","Recipient not found"
12
- "Validation failed: email.emailDomain","Invalid email"
 
1
+ "isNotCorporateUser","In order to use cashcloud payments, your account must be corporate"
2
+ "SendMoneyOptionBlocked","Sending money blocked"
3
+ "minAmountTransactionPerTradeLimit","Transaction amount too small"
4
+ "maxAmountTransactionPerTradeLimit","Maximum trade limit reached"
5
+ "blackList","User blacklisted"
6
+ "isBankAvailable","Bank not available"
7
+ "isCompanyApproved","Company not approved"
8
+ "isReasonAvailable","Reason not selected"
9
+ "email.emailDomain","Email is not correct"
10
+ recipient.errorStatus,"You are not allowed to order this product because of your available balance. Please top up your account first."
11
+ "recipient.notFound","Recipient not found"
12
+ "Validation failed: email.emailDomain","Invalid email"
13
+ cashcloud.description,"Cashcloud is your mobile eWallet and payment service. Just pay with your mobile phone. No need to enter card or bank account details. Simply enter your cashcloud username, send payment request and confirm on your mobile phone within the cashcloud APP. How to become cashcloud user? Just download cashcloud from the Apple App Store or Google Play Store and register for free, top up your cashcloud account in your eWallet. Or start at www.cashcloud.com."
app/locale/en_US/Mage_CashCloud.csv CHANGED
@@ -1,12 +1,13 @@
1
- "isNotCorporateUser","In order to use cashcloud payments, your account must be corporate"
2
- "SendMoneyOptionBlocked","Sending money blocked"
3
- "minAmountTransactionPerTradeLimit","Transaction amount too small"
4
- "maxAmountTransactionPerTradeLimit","Maximum trade limit reached"
5
- "blackList","User blacklisted"
6
- "isBankAvailable","Bank not available"
7
- "isCompanyApproved","Company not approved"
8
- "isReasonAvailable","Reason not selected"
9
- "email.emailDomain","Email is not correct"
10
- "recipient.errorStatus","Incorrect recipient status"
11
- "recipient.notFound","Recipient not found"
12
- "Validation failed: email.emailDomain","Invalid email"
 
1
+ "isNotCorporateUser","In order to use cashcloud payments, your account must be corporate"
2
+ "SendMoneyOptionBlocked","Sending money blocked"
3
+ "minAmountTransactionPerTradeLimit","Transaction amount too small"
4
+ "maxAmountTransactionPerTradeLimit","Maximum trade limit reached"
5
+ "blackList","User blacklisted"
6
+ "isBankAvailable","Bank not available"
7
+ "isCompanyApproved","Company not approved"
8
+ "isReasonAvailable","Reason not selected"
9
+ "email.emailDomain","Email is not correct"
10
+ "recipient.errorStatus","You are not allowed to order this product because of your available balance. Please top up your account first."
11
+ "recipient.notFound","Recipient not found"
12
+ "Validation failed: email.emailDomain","Invalid email"
13
+ cashcloud.description,"Cashcloud is your mobile eWallet and payment service. Just pay with your mobile phone. No need to enter card or bank account details. Simply enter your cashcloud username, send payment request and confirm on your mobile phone within the cashcloud APP. How to become cashcloud user? Just download cashcloud from the Apple App Store or Google Play Store and register for free, top up your cashcloud account in your eWallet. Or start at www.cashcloud.com."
lib/CashCloudApi/README.md CHANGED
File without changes
lib/CashCloudApi/composer.json CHANGED
File without changes
lib/CashCloudApi/phpunit.xml CHANGED
File without changes
lib/CashCloudApi/samples/GetRate.php CHANGED
File without changes
lib/CashCloudApi/samples/GetReasons.php CHANGED
File without changes
lib/CashCloudApi/samples/GetSettings.php CHANGED
File without changes
lib/CashCloudApi/samples/RequestMoney.php CHANGED
File without changes
lib/CashCloudApi/samples/SaveSettings.php CHANGED
File without changes
lib/CashCloudApi/samples/credentials.php CHANGED
File without changes
lib/CashCloudApi/src/CashCloud/Api/Exception/AuthException.php CHANGED
File without changes
lib/CashCloudApi/src/CashCloud/Api/Exception/CashCloudException.php CHANGED
File without changes
lib/CashCloudApi/src/CashCloud/Api/Exception/ValidateException.php CHANGED
File without changes
lib/CashCloudApi/src/CashCloud/Api/Method/GetRates.php CHANGED
File without changes
lib/CashCloudApi/src/CashCloud/Api/Method/GetReasons.php CHANGED
File without changes
lib/CashCloudApi/src/CashCloud/Api/Method/GetSettings.php CHANGED
File without changes
lib/CashCloudApi/src/CashCloud/Api/Method/GetTransactions.php CHANGED
File without changes
lib/CashCloudApi/src/CashCloud/Api/Method/Method.php CHANGED
File without changes
lib/CashCloudApi/src/CashCloud/Api/Method/Refund.php CHANGED
@@ -1,131 +1,137 @@
1
- <?php namespace CashCloud\Api\Method;
2
-
3
- use CashCloud\Api\Rest\Client;
4
- use CashCloud\Api\Rest\Request;
5
-
6
- /**
7
- * Class Settings
8
- * @package CashCloud\Api\Method
9
- */
10
- class Refund extends Method
11
- {
12
- /**
13
- * @var string
14
- */
15
- protected $hash;
16
- /**
17
- * @var int
18
- */
19
- protected $amount;
20
- /**
21
- * @var string
22
- */
23
- protected $remark;
24
-
25
- /**
26
- * Return method URL
27
- *
28
- * @param \CashCloud\Api\Rest\Client $api
29
- * @return string
30
- */
31
- public function getUrl(Client $api)
32
- {
33
- return $api->getMethodUrl("refund");
34
- }
35
-
36
- /**
37
- * Return request method
38
- *
39
- * @return string
40
- */
41
- public function getMethod()
42
- {
43
- return Request::POST;
44
- }
45
-
46
-
47
- /**
48
- * Return method data
49
- *
50
- * @return array
51
- */
52
- public function getData()
53
- {
54
- return array(
55
- 'hash'=>$this->hash,
56
- 'amount'=>$this->amount,
57
- 'remark'=>$this->remark,
58
- );
59
- }
60
-
61
- /**
62
- * Formats response
63
- *
64
- * @param Request $request
65
- * @return array
66
- */
67
- public function formatResponse(Request $request)
68
- {
69
- return $request->getJson();
70
- }
71
-
72
- /**
73
- * Returns cashcloud hash
74
- *
75
- * @return string
76
- */
77
- public function getHash()
78
- {
79
- return $this->hash;
80
- }
81
-
82
- /**
83
- * Sets cashcloud hash
84
- *
85
- * @param string $hash
86
- */
87
- public function setHash($hash)
88
- {
89
- $this->hash = $hash;
90
- }
91
-
92
- /**
93
- * Returns amount in euro cents
94
- *
95
- * @return int
96
- */
97
- public function getAmount()
98
- {
99
- return $this->amount;
100
- }
101
-
102
- /**
103
- * Sets amount in euro cents
104
- *
105
- * @param int $amount
106
- */
107
- public function setAmount($amount)
108
- {
109
- $this->amount = $amount;
110
- }
111
-
112
- /**
113
- * Returns order remark
114
- *
115
- * @return string
116
- */
117
- public function getRemark()
118
- {
119
- return $this->remark;
120
- }
121
-
122
- /**
123
- * Sets order remark
124
- *
125
- * @param string $remark
126
- */
127
- public function setRemark($remark)
128
- {
129
- $this->remark = $remark;
130
- }
131
- }
 
 
 
 
 
 
1
+ <?php namespace CashCloud\Api\Method;
2
+
3
+ use CashCloud\Api\Rest\Client;
4
+ use CashCloud\Api\Rest\Request;
5
+
6
+ /**
7
+ * Class Settings
8
+ * @package CashCloud\Api\Method
9
+ */
10
+ class Refund extends Method
11
+ {
12
+ const REFUND_ACCEPTED_STATUS = 3;
13
+ const REFUND_CANCELLED_STATUS = 5;
14
+
15
+ /**
16
+ * @var string
17
+ */
18
+ protected $hash;
19
+ /**
20
+ * @var int
21
+ */
22
+ protected $amount;
23
+ /**
24
+ * @var string
25
+ */
26
+ protected $remark;
27
+ /**
28
+ * @var string
29
+ */
30
+ protected $externalId;
31
+ /**
32
+ * @var string
33
+ */
34
+ protected $externalReference;
35
+ /**
36
+ * @var string
37
+ */
38
+ protected $externalDescription;
39
+ /**
40
+ * Return method URL
41
+ * @param \CashCloud\Api\Rest\Client $api
42
+ * @return string
43
+ */
44
+ public function getUrl(Client $api)
45
+ {
46
+ return $api->getMethodUrl("refund");
47
+ }
48
+
49
+ /**
50
+ * @return string
51
+ */
52
+ public function getMethod()
53
+ {
54
+ return Request::POST;
55
+ }
56
+
57
+
58
+ /**
59
+ * Return method data
60
+ * @return array
61
+ */
62
+ public function getData()
63
+ {
64
+ return array(
65
+ 'hash'=>$this->hash,
66
+ 'amount'=>$this->amount,
67
+ 'remark'=>$this->remark,
68
+ 'extern[id]'=> $this->externalId,
69
+ 'extern[reference]' => $this->externalReference,
70
+ 'extern[description]' => $this->externalDescription
71
+ );
72
+ }
73
+
74
+ /**
75
+ * @param Request $request
76
+ * @return array
77
+ */
78
+ public function formatResponse(Request $request)
79
+ {
80
+ return $request->getJson();
81
+ }
82
+
83
+ /**
84
+ * @return string
85
+ */
86
+ public function getHash()
87
+ {
88
+ return $this->hash;
89
+ }
90
+
91
+ /**
92
+ * @param string $hash
93
+ */
94
+ public function setHash($hash)
95
+ {
96
+ $this->hash = $hash;
97
+ }
98
+
99
+ /**
100
+ * @return int
101
+ */
102
+ public function getAmount()
103
+ {
104
+ return $this->amount;
105
+ }
106
+
107
+ /**
108
+ * @param int $amount
109
+ */
110
+ public function setAmount($amount)
111
+ {
112
+ $this->amount = $amount;
113
+ }
114
+
115
+ /**
116
+ * @return string
117
+ */
118
+ public function getRemark()
119
+ {
120
+ return $this->remark;
121
+ }
122
+
123
+ /**
124
+ * @param string $remark
125
+ */
126
+ public function setRemark($remark)
127
+ {
128
+ $this->remark = $remark;
129
+ }
130
+
131
+ public function setExternalData($id, $reference = null, $description = null)
132
+ {
133
+ $this->externalId = $id;
134
+ $this->externalReference = $reference;
135
+ $this->externalDescription = $description;
136
+ }
137
+ }
lib/CashCloudApi/src/CashCloud/Api/Method/RequestMoney.php CHANGED
@@ -172,15 +172,15 @@ class RequestMoney extends Method
172
  public function perform(Client $api)
173
  {
174
  if($this->getAmount() <= 0) {
175
- throw new CashCloudException("Invalid amount!");
176
  }
177
 
178
  if(is_null($this->getCurrency())) {
179
- throw new CashCloudException("Invalid currency!");
180
  }
181
 
182
  if(empty($this->email)) {
183
- throw new CashCloudException("Invalid email!");
184
  }
185
 
186
 
172
  public function perform(Client $api)
173
  {
174
  if($this->getAmount() <= 0) {
175
+ throw new CashCloudException("currency.invalidAmount");
176
  }
177
 
178
  if(is_null($this->getCurrency())) {
179
+ throw new CashCloudException("currency.invalid");
180
  }
181
 
182
  if(empty($this->email)) {
183
+ throw new CashCloudException("email.missing");
184
  }
185
 
186
 
lib/CashCloudApi/src/CashCloud/Api/Method/SaveSettings.php CHANGED
File without changes
lib/CashCloudApi/src/CashCloud/Api/Rest/Auth.php CHANGED
File without changes
lib/CashCloudApi/src/CashCloud/Api/Rest/Client.php CHANGED
@@ -40,7 +40,7 @@ class Client
40
  /**
41
  * @var string
42
  */
43
- private $apiUrl = 'https://merchant.api.cashcloud.com/';
44
 
45
  /**
46
  * @var bool
40
  /**
41
  * @var string
42
  */
43
+ private $apiUrl = 'https://merchant-api.cashcloud.com/';
44
 
45
  /**
46
  * @var bool
lib/CashCloudApi/src/CashCloud/Api/Rest/CurlRequest.php CHANGED
File without changes
lib/CashCloudApi/src/CashCloud/Api/Rest/Request.php CHANGED
File without changes
lib/CashCloudApi/tests/CashCloud/Test/Api/Exception/ValidateExceptionTest.php CHANGED
File without changes
lib/CashCloudApi/tests/CashCloud/Test/Api/Method/GetRatesTest.php CHANGED
File without changes
lib/CashCloudApi/tests/CashCloud/Test/Api/Method/GetReasonsTest.php CHANGED
File without changes
lib/CashCloudApi/tests/CashCloud/Test/Api/Method/GetSettingsTest.php CHANGED
File without changes
lib/CashCloudApi/tests/CashCloud/Test/Api/Method/RequestMoneyTest.php CHANGED
File without changes
lib/CashCloudApi/tests/CashCloud/Test/Api/Method/SaveSettingsTest.php CHANGED
File without changes
lib/CashCloudApi/tests/CashCloud/Test/Api/Rest/AuthTest.php CHANGED
File without changes
lib/CashCloudApi/tests/CashCloud/Test/Api/Rest/ClientTest.php CHANGED
File without changes
lib/CashCloudApi/tests/CashCloud/Test/Api/Rest/CurlRequestTest.php CHANGED
File without changes
lib/CashCloudApi/tests/CashCloud/Test/TestCase.php CHANGED
File without changes
lib/CashCloudApi/tests/bootstrap.php CHANGED
File without changes
lib/CashCloudApi/vendor/autoload.php CHANGED
@@ -1,7 +1,7 @@
1
- <?php
2
-
3
- // autoload.php @generated by Composer
4
-
5
- require_once __DIR__ . '/composer' . '/autoload_real.php';
6
-
7
- return ComposerAutoloaderInit60b06a271c4afd54382eb508729e7f95::getLoader();
1
+ <?php
2
+
3
+ // autoload.php @generated by Composer
4
+
5
+ require_once __DIR__ . '/composer' . '/autoload_real.php';
6
+
7
+ return ComposerAutoloaderInit76796d25b4b4f7397f1845503cdedf67::getLoader();
lib/CashCloudApi/vendor/composer/ClassLoader.php CHANGED
@@ -143,6 +143,8 @@ class ClassLoader
143
  * @param string $prefix The prefix/namespace, with trailing '\\'
144
  * @param array|string $paths The PSR-0 base directories
145
  * @param bool $prepend Whether to prepend the directories
 
 
146
  */
147
  public function addPsr4($prefix, $paths, $prepend = false)
148
  {
@@ -202,10 +204,13 @@ class ClassLoader
202
  * Registers a set of PSR-4 directories for a given namespace,
203
  * replacing any others previously set for this namespace.
204
  *
205
- * @param string $prefix The prefix/namespace, with trailing '\\'
206
- * @param array|string $paths The PSR-4 base directories
 
 
207
  */
208
- public function setPsr4($prefix, $paths) {
 
209
  if (!$prefix) {
210
  $this->fallbackDirsPsr4 = (array) $paths;
211
  } else {
143
  * @param string $prefix The prefix/namespace, with trailing '\\'
144
  * @param array|string $paths The PSR-0 base directories
145
  * @param bool $prepend Whether to prepend the directories
146
+ *
147
+ * @throws \InvalidArgumentException
148
  */
149
  public function addPsr4($prefix, $paths, $prepend = false)
150
  {
204
  * Registers a set of PSR-4 directories for a given namespace,
205
  * replacing any others previously set for this namespace.
206
  *
207
+ * @param string $prefix The prefix/namespace, with trailing '\\'
208
+ * @param array|string $paths The PSR-4 base directories
209
+ *
210
+ * @throws \InvalidArgumentException
211
  */
212
+ public function setPsr4($prefix, $paths)
213
+ {
214
  if (!$prefix) {
215
  $this->fallbackDirsPsr4 = (array) $paths;
216
  } else {
lib/CashCloudApi/vendor/composer/autoload_real.php CHANGED
@@ -1,53 +1,50 @@
1
- <?php
2
-
3
- // autoload_real.php @generated by Composer
4
-
5
- class ComposerAutoloaderInit60b06a271c4afd54382eb508729e7f95
6
- {
7
- private static $loader;
8
-
9
- public static function loadClassLoader($class)
10
- {
11
- if ('Composer\Autoload\ClassLoader' === $class) {
12
- require __DIR__ . '/ClassLoader.php';
13
- }
14
- }
15
-
16
- public static function getLoader()
17
- {
18
- if (null !== self::$loader) {
19
- return self::$loader;
20
- }
21
-
22
- spl_autoload_register(array('ComposerAutoloaderInit60b06a271c4afd54382eb508729e7f95', 'loadClassLoader'), true, true);
23
- self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
- spl_autoload_unregister(array('ComposerAutoloaderInit60b06a271c4afd54382eb508729e7f95', 'loadClassLoader'));
25
-
26
- $vendorDir = dirname(__DIR__);
27
- $baseDir = dirname($vendorDir);
28
-
29
- $map = require __DIR__ . '/autoload_namespaces.php';
30
- foreach ($map as $namespace => $path) {
31
- $loader->set($namespace, $path);
32
- }
33
-
34
- $map = require __DIR__ . '/autoload_psr4.php';
35
- foreach ($map as $namespace => $path) {
36
- $loader->setPsr4($namespace, $path);
37
- }
38
-
39
- $classMap = require __DIR__ . '/autoload_classmap.php';
40
- if ($classMap) {
41
- $loader->addClassMap($classMap);
42
- }
43
-
44
- $loader->register(true);
45
-
46
- return $loader;
47
- }
48
- }
49
-
50
- function composerRequire60b06a271c4afd54382eb508729e7f95($file)
51
- {
52
- require $file;
53
- }
1
+ <?php
2
+
3
+ // autoload_real.php @generated by Composer
4
+
5
+ class ComposerAutoloaderInit76796d25b4b4f7397f1845503cdedf67
6
+ {
7
+ private static $loader;
8
+
9
+ public static function loadClassLoader($class)
10
+ {
11
+ if ('Composer\Autoload\ClassLoader' === $class) {
12
+ require __DIR__ . '/ClassLoader.php';
13
+ }
14
+ }
15
+
16
+ public static function getLoader()
17
+ {
18
+ if (null !== self::$loader) {
19
+ return self::$loader;
20
+ }
21
+
22
+ spl_autoload_register(array('ComposerAutoloaderInit76796d25b4b4f7397f1845503cdedf67', 'loadClassLoader'), true, true);
23
+ self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
+ spl_autoload_unregister(array('ComposerAutoloaderInit76796d25b4b4f7397f1845503cdedf67', 'loadClassLoader'));
25
+
26
+ $map = require __DIR__ . '/autoload_namespaces.php';
27
+ foreach ($map as $namespace => $path) {
28
+ $loader->set($namespace, $path);
29
+ }
30
+
31
+ $map = require __DIR__ . '/autoload_psr4.php';
32
+ foreach ($map as $namespace => $path) {
33
+ $loader->setPsr4($namespace, $path);
34
+ }
35
+
36
+ $classMap = require __DIR__ . '/autoload_classmap.php';
37
+ if ($classMap) {
38
+ $loader->addClassMap($classMap);
39
+ }
40
+
41
+ $loader->register(true);
42
+
43
+ return $loader;
44
+ }
45
+ }
46
+
47
+ function composerRequire76796d25b4b4f7397f1845503cdedf67($file)
48
+ {
49
+ require $file;
50
+ }
 
 
 
lib/CashCloudApi/vendor/composer/include_paths.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // include_paths.php @generated by Composer
4
+
5
+ $vendorDir = dirname(dirname(__FILE__));
6
+ $baseDir = dirname($vendorDir);
7
+
8
+ return array(
9
+ $vendorDir . '/phpunit/php-text-template',
10
+ $vendorDir . '/phpunit/phpunit-mock-objects',
11
+ $vendorDir . '/phpunit/php-timer',
12
+ $vendorDir . '/phpunit/php-token-stream',
13
+ $vendorDir . '/phpunit/php-file-iterator',
14
+ $vendorDir . '/phpunit/php-code-coverage',
15
+ $vendorDir . '/phpunit/phpunit',
16
+ $vendorDir . '/symfony/yaml',
17
+ );
lib/CashCloudApi/vendor/composer/installed.json ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ [
2
+
3
+ ]
package.xml CHANGED
@@ -1,276 +1,18 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>cashcloud_payments</name>
4
- <version>0.0.2</version>
5
  <stability>stable</stability>
6
- <license uri="http://creativecommons.org/licenses/by/4.0/">
7
- Creative Commons Attribution 4.0 International
8
- License</license>
9
  <channel>community</channel>
10
- <extends />
11
- <summary>CashCloud payments</summary>
12
- <description>This extension adds CashCloud payment
13
- methods</description>
14
  <notes>This extension adds CashCloud payment methods</notes>
15
- <authors>
16
- <author>
17
- <name>cashcloud</name>
18
- <user>cashcloud</user>
19
- <email>olaf.taupitz@cashcloud.com</email>
20
- </author>
21
- </authors>
22
- <date>2014-05-21</date>
23
- <time>16:32:14</time>
24
- <contents>
25
- <target name="magelocal">
26
- <dir name="Mage">
27
- <dir name="CashCloud">
28
- <dir name="Model">
29
- <dir name="Mysql4">
30
- <file name="Setup.php"
31
- hash="295e6757cc76c40fa261e2ddd3913cd3" />
32
- </dir>
33
- <file name="PaymentMethod.php"
34
- hash="7f970fb0d25c4eb6d8cadc1b97525a1c" />
35
- </dir>
36
- <dir name="Block">
37
- <file name="Process.php"
38
- hash="1ddd06b620ce06c27510dfed0a7c477b" />
39
- <file name="Info.php"
40
- hash="4b22b99be40392e2adb7bdec86b7ad74" />
41
- <file name="Form.php"
42
- hash="d3ef5077816a2f508b3a7da7e80c3c6f" />
43
- </dir>
44
- <dir name="Helper">
45
- <file name="Data.php"
46
- hash="341c8d49beec9f37d97ae7433cad4726" />
47
- </dir>
48
- <dir name="Adminhtml">
49
- <dir name="Model">
50
- <file name="Reason.php"
51
- hash="93265ecf40c4283b00d1eff9abfb09b6" />
52
- <file name="Checks.php"
53
- hash="0927945f60fd1b13f16b55156b8445de" />
54
- <file name="Config.php"
55
- hash="473fad0327a658612816993c22dc0614" />
56
- <file name="Expiration.php"
57
- hash="ee5862cd87523a727b91841364ddc41a" />
58
- </dir>
59
- </dir>
60
- <dir name="controllers">
61
- <file name="PayController.php"
62
- hash="3cff4207fa9bd237dec13dda00a57c69" />
63
- </dir>
64
- <dir name="etc">
65
- <file name="config.xml"
66
- hash="e9c0749a5890f83dd7a4f69e56a36338" />
67
- <file name="system.xml"
68
- hash="67188821ef5177363deab0aa78c37237" />
69
- </dir>
70
- <dir name="sql">
71
- <dir name="cashcloud_setup">
72
- <file name="mysql4-install-0.0.1.php"
73
- hash="50b96b7c003ab0c754f1e128cdab04ad" />
74
- </dir>
75
- </dir>
76
- </dir>
77
- </dir>
78
- </target>
79
- <target name="mageetc">
80
- <dir name="modules">
81
- <file name="Mage_CashCloud.xml"
82
- hash="29b871aff1556810277f8a7b6048f20b" />
83
- </dir>
84
- </target>
85
- <target name="magedesign">
86
- <dir name="frontend">
87
- <dir name="base">
88
- <dir name="default">
89
- <dir name="template">
90
- <dir name="cashcloud">
91
- <file name="process.phtml"
92
- hash="710854e31bb803b87624f0d837a9c2f7" />
93
- <file name="form.phtml"
94
- hash="f135a08dd235baba859990e95df3f22e" />
95
- <file name="info.phtml"
96
- hash="d00f05fe6004a057beff737d7168d7e4" />
97
- </dir>
98
- </dir>
99
- </dir>
100
- </dir>
101
- </dir>
102
- <dir name="adminhtml">
103
- <dir name="default">
104
- <dir name="default">
105
- <dir name="template">
106
- <dir name="cashcloud">
107
- <file name="checks.phtml"
108
- hash="ce871438d50046b5bf01632287bb113a" />
109
- </dir>
110
- </dir>
111
- </dir>
112
- </dir>
113
- </dir>
114
- </target>
115
- <target name="magelib">
116
- <dir name="CashCloudApi">
117
- <dir name="samples">
118
- <file name="GetRate.php"
119
- hash="2713be10db66ffd9048a134ae08e925e" />
120
- <file name="SaveSettings.php"
121
- hash="2628c36df7f07f3c4c02b73c3c2608d0" />
122
- <file name="RequestMoney.php"
123
- hash="6ce3c6b1f08e1fe7f86307dae449ce95" />
124
- <file name="credentials.php"
125
- hash="5902bffeb7f9b1218e4b34653a9821e5" />
126
- <file name="GetSettings.php"
127
- hash="bc5890f26445fdc11524c779fa608cf6" />
128
- <file name="GetReasons.php"
129
- hash="f181a8f0c74e1127af87bea42151d6ff" />
130
- </dir>
131
- <file name="phpunit.xml"
132
- hash="84e70fe584254f6aa1377b0f5295cf73" />
133
- <dir name="tests">
134
- <file name="bootstrap.php"
135
- hash="d9027f2b29bfb77e1962266d414648b1" />
136
- <dir name="CashCloud">
137
- <dir name="Test">
138
- <dir name="Api">
139
- <dir name="Exception">
140
- <file name="ValidateExceptionTest.php"
141
- hash="e10c57f487b08bcae84c394bdf0c30d9" />
142
- </dir>
143
- <dir name="Rest">
144
- <file name="AuthTest.php"
145
- hash="de6f4af4bdf395b00ce843a825d38bdb" />
146
- <file name="CurlRequestTest.php"
147
- hash="a191b71e687b6aaf0a3384b37e2d64f7" />
148
- <file name="ClientTest.php"
149
- hash="e512fb59531809f65b77a4a8f034d690" />
150
- </dir>
151
- <dir name="Method">
152
- <file name="RequestMoneyTest.php"
153
- hash="8b83522fc0c55ec19a5effe09c345bf8" />
154
- <file name="GetReasonsTest.php"
155
- hash="1b5ad83bf87727c99783da70df3fb9ad" />
156
- <file name="GetSettingsTest.php"
157
- hash="62751c64dc3b383b1607aeff27e2e863" />
158
- <file name="SaveSettingsTest.php"
159
- hash="f66782fba1fe916c8ec340c6a4e2e593" />
160
- <file name="GetRatesTest.php"
161
- hash="221247ea77d858ee5743afded4f81ea1" />
162
- </dir>
163
- </dir>
164
- <file name="TestCase.php"
165
- hash="cc78576f845fb0af58da9d15b59f301f" />
166
- </dir>
167
- </dir>
168
- </dir>
169
- <dir name="src">
170
- <dir name="CashCloud">
171
- <dir name="Api">
172
- <dir name="Exception">
173
- <file name="ValidateException.php"
174
- hash="0ad42a0a57ef9375eff856d785be4416" />
175
- <file name="AuthException.php"
176
- hash="2e908258e593142961c7f0475b161b03" />
177
- <file name="CashCloudException.php"
178
- hash="99efbf3eb2432500ea1741e546d4936f" />
179
- </dir>
180
- <dir name="Rest">
181
- <file name="Request.php"
182
- hash="bd042d8d659f761401b5e018c9659b56" />
183
- <file name="Auth.php"
184
- hash="eb9b86a654ca9eb18d8e8296aecef053" />
185
- <file name="Client.php"
186
- hash="f38915cb0e063f03c849eb4707b82c05" />
187
- <file name="CurlRequest.php"
188
- hash="5a9a9394dda28cf1ae931a444aec437e" />
189
- </dir>
190
- <dir name="Method">
191
- <file name="SaveSettings.php"
192
- hash="c2b89ab82f46665d7058aefa3805d2a1" />
193
- <file name="Method.php"
194
- hash="ed6fb4b76e6b169f1bde7db4b796a4bb" />
195
- <file name="RequestMoney.php"
196
- hash="4a54c849396d9c925b20e0bc51e780b6" />
197
- <file name="Refund.php"
198
- hash="f220ac262f5f86abd553ca3dafd3b34b" />
199
- <file name="GetTransactions.php"
200
- hash="f04180b23f4247f4e013c721b5a46ded" />
201
- <file name="GetSettings.php"
202
- hash="83bd592acf928f426760a909d68236af" />
203
- <file name="GetRates.php"
204
- hash="91732fcc50ca3a1ab7616223e9ee5e6a" />
205
- <file name="GetReasons.php"
206
- hash="3ff3776c9e0ed05195a362e7aabeaa62" />
207
- </dir>
208
- </dir>
209
- </dir>
210
- </dir>
211
- <file name="README.md"
212
- hash="aab32792745c5d2c37ab89b374dd4679" />
213
- <file name="composer.json"
214
- hash="f028b4aeea73abffc53d6b3537731848" />
215
- <dir name="vendor">
216
- <dir name="composer">
217
- <file name="autoload_psr4.php"
218
- hash="dd3a00f0d13eb29781edd8c77d4c5100" />
219
- <file name="autoload_classmap.php"
220
- hash="8645d3a4e3ad87e7cf4d88a46717aab4" />
221
- <file name="ClassLoader.php"
222
- hash="3adcacc118804f98f1fd888e2575f00a" />
223
- <file name="autoload_namespaces.php"
224
- hash="6ad7d23d00d37b668c1c42aeb4334849" />
225
- <file name="autoload_real.php"
226
- hash="ec07aaf8d8b23827afbc6ba519a6e560" />
227
- </dir>
228
- <file name="autoload.php"
229
- hash="e3f18817dc5427187c7042137ef7fb55" />
230
- </dir>
231
- </dir>
232
- </target>
233
- <target name="mageskin">
234
- <dir name="frontend">
235
- <dir name="base">
236
- <dir name="default">
237
- <dir name="js">
238
- <file name="cashcloud.js"
239
- hash="d41d8cd98f00b204e9800998ecf8427e" />
240
- </dir>
241
- <dir name="css">
242
- <file name="cashcloud.css"
243
- hash="1d4ce0ed49ce6ebeb2bb2f3573bbf4ba" />
244
- </dir>
245
- <dir name="images">
246
- <dir name="cashcloud">
247
- <file name="logo.png"
248
- hash="7b61cdf3b30ecfe0c14f0941748daac9" />
249
- <file name="loader.gif"
250
- hash="b78b8cd94c60b5a6515bfaf5ce974b75" />
251
- </dir>
252
- </dir>
253
- </dir>
254
- </dir>
255
- </dir>
256
- </target>
257
- <target name="magelocale">
258
- <dir name="en_GB">
259
- <file name="Mage_CashCloud.csv"
260
- hash="81cc71f688fb48b92b955a7f05ff8a69" />
261
- </dir>
262
- <dir name="en_US">
263
- <file name="Mage_CashCloud.csv"
264
- hash="81cc71f688fb48b92b955a7f05ff8a69" />
265
- </dir>
266
- </target>
267
- </contents>
268
- <dependencies>
269
- <required>
270
- <php>
271
- <min>5.3.0</min>
272
- <max>6.0.0</max>
273
- </php>
274
- </required>
275
- </dependencies>
276
- </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>cashcloud_payments</name>
4
+ <version>0.2.0</version>
5
  <stability>stable</stability>
6
+ <license uri="http://creativecommons.org/licenses/by/4.0/">Creative Commons Attribution 4.0 International License</license>
 
 
7
  <channel>community</channel>
8
+ <extends/>
9
+ <summary>Cashcloud Payments</summary>
10
+ <description>This extension adds CashCloud payment methods</description>
 
11
  <notes>This extension adds CashCloud payment methods</notes>
12
+ <authors><author><name>cashcloud</name><user>cashcloud</user><email>olaf.taupitz@cashcloud.com</email></author></authors>
13
+ <date>2014-10-07</date>
14
+ <time>07:23:38</time>
15
+ <contents><target name="magelocal"><dir name="Mage"><dir name="CashCloud"><dir name="Adminhtml"><dir name="Model"><file name="Checks.php" hash="0927945f60fd1b13f16b55156b8445de"/><file name="Config.php" hash="473fad0327a658612816993c22dc0614"/><file name="Expiration.php" hash="ee5862cd87523a727b91841364ddc41a"/><file name="Reason.php" hash="93265ecf40c4283b00d1eff9abfb09b6"/></dir></dir><dir name="Block"><file name="Form.php" hash="d3ef5077816a2f508b3a7da7e80c3c6f"/><file name="Info.php" hash="4b22b99be40392e2adb7bdec86b7ad74"/><file name="Process.php" hash="1ddd06b620ce06c27510dfed0a7c477b"/></dir><dir name="Helper"><file name="Data.php" hash="f309f21334c8f4265d38d51c6921c760"/></dir><dir name="Model"><dir name="Mysql4"><file name="Setup.php" hash="8cbe6a9f14851706b56fd4470a0386c9"/></dir><file name="PaymentMethod.php" hash="b6c716d51c6868970b66a4e05befa2ed"/></dir><dir name="controllers"><file name="PayController.php" hash="87d436a21922adcf6b6eac1d8017aee8"/></dir><dir name="etc"><file name="config.xml" hash="55d3e1b09a046dde0530fc7f62379f26"/><file name="system.xml" hash="78cb64000afe5a2e549835dcbe7cf21f"/></dir><dir name="sql"><dir name="cashcloud_setup"><file name="mysql4-install-0.2.0.php" hash="50b96b7c003ab0c754f1e128cdab04ad"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="cashcloud"><file name="checks.phtml" hash="f5060790b3ff0d5e7b45c6878f51c447"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="cashcloud"><file name="form.phtml" hash="8f554c6ba296c9b64c9861754ac8547f"/><file name="info.phtml" hash="860f2034b5ce4862df24b922b739d56b"/><file name="process.phtml" hash="29ff7bce87440e31c811191a2c14c019"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Mage_CashCloud.xml" hash="95bbf7f9b27dafa7b53e67dc76667877"/></dir></target><target name="magelib"><dir name="CashCloudApi"><file name="README.md" hash="aab32792745c5d2c37ab89b374dd4679"/><file name="composer.json" hash="f028b4aeea73abffc53d6b3537731848"/><file name="phpunit.xml" hash="84e70fe584254f6aa1377b0f5295cf73"/><dir name="samples"><file name="GetRate.php" hash="2713be10db66ffd9048a134ae08e925e"/><file name="GetReasons.php" hash="f181a8f0c74e1127af87bea42151d6ff"/><file name="GetSettings.php" hash="bc5890f26445fdc11524c779fa608cf6"/><file name="RequestMoney.php" hash="6ce3c6b1f08e1fe7f86307dae449ce95"/><file name="SaveSettings.php" hash="2628c36df7f07f3c4c02b73c3c2608d0"/><file name="credentials.php" hash="5902bffeb7f9b1218e4b34653a9821e5"/></dir><dir name="src"><dir name="CashCloud"><dir name="Api"><dir name="Exception"><file name="AuthException.php" hash="2e908258e593142961c7f0475b161b03"/><file name="CashCloudException.php" hash="99efbf3eb2432500ea1741e546d4936f"/><file name="ValidateException.php" hash="0ad42a0a57ef9375eff856d785be4416"/></dir><dir name="Method"><file name="GetRates.php" hash="91732fcc50ca3a1ab7616223e9ee5e6a"/><file name="GetReasons.php" hash="3ff3776c9e0ed05195a362e7aabeaa62"/><file name="GetSettings.php" hash="83bd592acf928f426760a909d68236af"/><file name="GetTransactions.php" hash="f04180b23f4247f4e013c721b5a46ded"/><file name="Method.php" hash="ed6fb4b76e6b169f1bde7db4b796a4bb"/><file name="Refund.php" hash="18222395a913602ef08683c3c445da79"/><file name="RequestMoney.php" hash="375204e2692da50d48cbfe5d736ac2c5"/><file name="SaveSettings.php" hash="c2b89ab82f46665d7058aefa3805d2a1"/></dir><dir name="Rest"><file name="Auth.php" hash="eb9b86a654ca9eb18d8e8296aecef053"/><file name="Client.php" hash="591013ea31f2f7db118218ed31295bf6"/><file name="CurlRequest.php" hash="5a9a9394dda28cf1ae931a444aec437e"/><file name="Request.php" hash="bd042d8d659f761401b5e018c9659b56"/></dir></dir></dir></dir><dir name="tests"><dir name="CashCloud"><dir name="Test"><dir name="Api"><dir name="Exception"><file name="ValidateExceptionTest.php" hash="e10c57f487b08bcae84c394bdf0c30d9"/></dir><dir name="Method"><file name="GetRatesTest.php" hash="221247ea77d858ee5743afded4f81ea1"/><file name="GetReasonsTest.php" hash="1b5ad83bf87727c99783da70df3fb9ad"/><file name="GetSettingsTest.php" hash="62751c64dc3b383b1607aeff27e2e863"/><file name="RequestMoneyTest.php" hash="8b83522fc0c55ec19a5effe09c345bf8"/><file name="SaveSettingsTest.php" hash="f66782fba1fe916c8ec340c6a4e2e593"/></dir><dir name="Rest"><file name="AuthTest.php" hash="de6f4af4bdf395b00ce843a825d38bdb"/><file name="ClientTest.php" hash="e512fb59531809f65b77a4a8f034d690"/><file name="CurlRequestTest.php" hash="a191b71e687b6aaf0a3384b37e2d64f7"/></dir></dir><file name="TestCase.php" hash="cc78576f845fb0af58da9d15b59f301f"/></dir></dir><file name="bootstrap.php" hash="d9027f2b29bfb77e1962266d414648b1"/></dir><dir name="vendor"><file name="autoload.php" hash="faca6583691c6533107bd1c6657eda83"/><dir name="composer"><file name="ClassLoader.php" hash="479613a7d15cfdf2bcdf0399a032ff9a"/><file name="autoload_classmap.php" hash="8645d3a4e3ad87e7cf4d88a46717aab4"/><file name="autoload_namespaces.php" hash="6ad7d23d00d37b668c1c42aeb4334849"/><file name="autoload_psr4.php" hash="dd3a00f0d13eb29781edd8c77d4c5100"/><file name="autoload_real.php" hash="f79bcbdb8c96af954913c56eb32eee63"/><file name="include_paths.php" hash="58e858c436a105301193a34024bbff5d"/><file name="installed.json" hash="a00049ba79152d03380c34652f2cb612"/></dir></dir></dir></target><target name="magelocale"><dir><dir name="de_DE"><file name="Mage_CashCloud.csv" hash="57ca6ab757ee7de695192f51a08f2ca8"/></dir><dir name="en_GB"><file name="Mage_CashCloud.csv" hash="156ad2982854427e2da92c6b8f968cf4"/></dir><dir name="en_US"><file name="Mage_CashCloud.csv" hash="26df77060000b8e0aad8e67609bc2be6"/></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><file name="cashcloud.css" hash="1d4ce0ed49ce6ebeb2bb2f3573bbf4ba"/><file name="widgets.css" hash="e755828e5680da2e27edecbeafe553fc"/></dir><file name="favicon.ico" hash="88733ee53676a47fc354a61c32516e82"/><dir name="images"><file name="calendar.gif" hash="b1468e5239504974c689eea5d93f86d4"/><dir name="cashcloud"><file name="loader.gif" hash="b78b8cd94c60b5a6515bfaf5ce974b75"/><file name="logo.png" hash="7b61cdf3b30ecfe0c14f0941748daac9"/></dir><dir name="catalog"><dir name="product"><dir name="placeholder"><file name="image.jpg" hash="097ab8a3051bc037ea3de0e17f440540"/><file name="small_image.jpg" hash="f825d16f97a640453553c79c48ebaa73"/><file name="thumbnail.jpg" hash="b2b682d28a08a748a73d2cda70ab5a57"/></dir></dir></dir><dir name="centinel"><file name="sc_learn_62x34.png" hash="7d6ec4b19f8eeb6baa2cddd5d4274f87"/><file name="v_activate_steps.gif" hash="005312b14c6aed41e8a47c4acaac7c1a"/><file name="vbv_ltbg_71x57.png" hash="324e5de7f6c75dc3cecb61646113ac41"/></dir><dir name="cookies"><file name="firefox.png" hash="425e1b2ddc38c0bba431fb54357c66a4"/><file name="ie6-1.gif" hash="5c27700e245762bc89ed8c3ee7183f21"/><file name="ie6-2.gif" hash="d8c55e15e1f711e5c259300a9c19551b"/><file name="ie7-1.gif" hash="d61edcc8a514a3c81ea116b7d38ddcb6"/><file name="ie7-2.gif" hash="0526a654e94c54866cad977c0a47d3e5"/><file name="ie7-3.gif" hash="4fb142def3f6cfd8d8d23e1315528a1e"/><file name="ie7-4.gif" hash="575c276231c6a91e28935ec98215e146"/><file name="ie7-5.gif" hash="3ae5fcc11fe89da91674d183872337c1"/><file name="ie7-6.gif" hash="95a4981a41785a8cde273c9b2edbfbc7"/><file name="opera.png" hash="34070d92180d4ee0e37b1dd8bb731cd7"/></dir><file name="cvv.gif" hash="83cdd38bf110b0f9c52fe84b56f45298"/><file name="fam_book_open.png" hash="0ba89b9fbe7e88d4c6896ed0a1f495aa"/><dir name="moneybookers"><file name="banner_120_de.gif" hash="74815117bf378543e5b3496bb5bc4e8a"/><file name="banner_120_de.png" hash="6c3f708fcb6dac92e53472d4c2246c68"/><file name="banner_120_dk.gif" hash="2106bd994d188d40474bf2a2e8d62a8d"/><file name="banner_120_fr.gif" hash="a84241eef7bc38fb38567e7aa8ca245a"/><file name="banner_120_fr.png" hash="8994d1dc3b4f5c9e5efc67ce3f9f55a9"/><file name="banner_120_int.gif" hash="e23ddcf71e15f0a9300062ef9cdea512"/><file name="banner_120_int.png" hash="f9dfbc26041e52b34eea65348707d64f"/><file name="banner_120_pl.gif" hash="44313c7d27cdcf59c2f66708c6c5abd5"/><file name="banner_120_pl.png" hash="67d3385f93bc9113880305ee7c7da9de"/><file name="banner_120_sp.gif" hash="a003ed8db63620672ae945682b1e1e39"/><file name="banner_120_sp.png" hash="f9c4a653d6814ab3f8c535da706f5f77"/><file name="moneybookers_acc.png" hash="a3e639a68fafdffaca81e91985127735"/><file name="moneybookers_csi.gif" hash="4eec4ed7c494d01d518a3c6c691128e9"/><file name="moneybookers_did.gif" hash="6a3a3365894e9cdb199647a5b74ba35b"/><file name="moneybookers_dnk.gif" hash="7d4b8d27784f8a6fa6ef81c4e911831b"/><file name="moneybookers_ebt.gif" hash="9911d8cc223e7f3d9ec12f50c280ec61"/><file name="moneybookers_ent.gif" hash="704e9551ed4aff82b67114242b9fba1a"/><file name="moneybookers_gcb.gif" hash="e2e7c0f501e5ab0136f859ca5f57abc2"/><file name="moneybookers_gir.gif" hash="f16e949bc60bbd812f803d5e377d47f6"/><file name="moneybookers_idl.gif" hash="fe0ad1efc12d43df6c9ff3ffdd9dd59b"/><file name="moneybookers_lsr.gif" hash="58cdadfa20b6d37aeaa19e50995e4baf"/><file name="moneybookers_mae.gif" hash="4d4b5f0cf3377939c7738fc7e416d25f"/><file name="moneybookers_npy.gif" hash="01242c5ad7bc667e7493b550b6397fab"/><file name="moneybookers_obt_de.png" hash="ce44fd2974b8d279401778292e2c4484"/><file name="moneybookers_obt_dk.png" hash="2985e8cb472d1886d584fa31d56bee92"/><file name="moneybookers_obt_ee.png" hash="cb186be1c7595544f61d3737c7bf85aa"/><file name="moneybookers_obt_en.png" hash="eee098a06e3ea34f33e276724b084774"/><file name="moneybookers_obt_fl.png" hash="6c3766df052d875ce399e62ad8a435f8"/><file name="moneybookers_obt_lt.png" hash="adf61f248fc6d5985840db3e0c23391e"/><file name="moneybookers_obt_lv.png" hash="4e7f16b4988ea30f049942d4dcdb5f78"/><file name="moneybookers_obt_pl.png" hash="fb2c43c18ba73d390e5b5f5261261f4a"/><file name="moneybookers_obt_se.png" hash="9028412e9c3f25d114bf40bb2049d225"/><file name="moneybookers_pli.gif" hash="93989e85caff760af7a61838db0300bf"/><file name="moneybookers_psp.gif" hash="7abffc2246f172625be2ce31f4315cb2"/><file name="moneybookers_pwy.gif" hash="b4a0b9db9a031855e6e3899592012fae"/><file name="moneybookers_sft.gif" hash="e9e774163c99a8ab4deb18d37feaf658"/><file name="moneybookers_so2.gif" hash="9911d8cc223e7f3d9ec12f50c280ec61"/><file name="moneybookers_wlt.gif" hash="4b9cbc5aa5c32f3015ce7bec98da2670"/></dir><file name="reload.png" hash="84cc4883f78ef850814ea9b53989b2a7"/><dir name="widgets"><file name="i_block-list.gif" hash="fe8424127ecbe4b0d893bcf6f253dc1a"/><file name="i_widget-link.gif" hash="1bf753578171f147f0203e7b13bdd0c4"/><file name="i_widget-new.gif" hash="a75377ffed51b711cbc608ffaa1a2e7d"/></dir><dir name="xmlconnect"><dir name="catalog"><dir name="category"><dir name="placeholder"><file name="image.jpg" hash="097ab8a3051bc037ea3de0e17f440540"/><file name="small_image.jpg" hash="f825d16f97a640453553c79c48ebaa73"/><file name="thumbnail.jpg" hash="b2b682d28a08a748a73d2cda70ab5a57"/></dir></dir></dir><file name="tab_account.png" hash="0498d73e47ed47179e5546dc15c17dc7"/><file name="tab_cart.png" hash="9055ba76e256a51d3fee53a8c41d5226"/><file name="tab_home.png" hash="07d0af93e167b9366d3d4fb3d6cdb31c"/><file name="tab_more.png" hash="b9fc21feb8d7655bc9c2985c37b0de2f"/><file name="tab_page.png" hash="ca05dbc42f944b8d4255f6675f6dd93a"/><file name="tab_search.png" hash="25e880eb2a4d06828e2e1c3f32d22400"/><file name="tab_shop.png" hash="fe602fc2e7093efef5ecc0b027a32d91"/></dir></dir><dir name="js"><file name="bundle.js" hash="f9b86e41e5f0c4d06b17da4e47ee2df9"/><file name="cashcloud.js" hash="d41d8cd98f00b204e9800998ecf8427e"/><dir name="checkout"><file name="review.js" hash="3fdad9cf5021ee558e4dc854f66ea262"/></dir><file name="giftmessage.js" hash="2dd68dc03bdf634dba41a4b79ea51184"/><file name="ie6.js" hash="5dbfb553bbaab5ef71ecf92ea81b7a59"/><file name="msrp.js" hash="dda49c55b8532a58a7f2ebc5b4392671"/><file name="opcheckout.js" hash="df3abbc80c8bc22151444a823cc36597"/></dir><dir name="lib"><dir name="prototype"><dir name="windows"><dir name="themes"><dir name="magento"><file name="btn_bg.gif" hash="37c51a4d48a92da9648dcd3ca011039f"/><file name="content_bg.gif" hash="21278ea0da2d4256f4ced96b6080ba2e"/><file name="top_bg.gif" hash="26f28090de87d64f9b01bf624f89bfe2"/><file name="window_close.png" hash="3af14f053f360bf31f8ba2df73ec7f1e"/></dir><file name="magento.css" hash="c5d762c101ae9b2c979bd3cd159211c5"/></dir></dir></dir></dir></dir></dir></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies><required><php><min>5.3.0</min><max>6.0.0</max></php></required></dependencies>
18
+ </package>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
skin/frontend/base/default/css/widgets.css ADDED
@@ -0,0 +1,96 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Magento
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the Academic Free License (AFL 3.0)
7
+ * that is bundled with this package in the file LICENSE_AFL.txt.
8
+ * It is also available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/afl-3.0.php
10
+ * If you did not receive a copy of the license and are unable to
11
+ * obtain it through the world-wide-web, please send an email
12
+ * to license@magentocommerce.com so we can send you a copy immediately.
13
+ *
14
+ * DISCLAIMER
15
+ *
16
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
17
+ * versions in the future. If you wish to customize Magento for your
18
+ * needs please refer to http://www.magentocommerce.com for more information.
19
+ *
20
+ * @category design
21
+ * @package base_default
22
+ * @copyright Copyright (c) 2014 Magento Inc. (http://www.magentocommerce.com)
23
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
24
+ */
25
+
26
+ /* Widgets =============================================================================== */
27
+ .widget { display:inline; }
28
+ .widget .widget-title { clear:both; padding:15px 0 0; margin:0 0 7px; }
29
+ .widget .widget-title h2 { font-size:15px; font-weight:bold; color:#e25203; }
30
+
31
+ .widget .mini-products-images-list .product-image { display:block; width:76px; height:76px; border:1px solid #a9a9a9; margin:0 auto; }
32
+ .widget .mini-products-images-list li.item { float:left; width:77px; height:77px; }
33
+
34
+ /* Widget: Catalog New Proructs List */
35
+ .widget-new-products { display:block; }
36
+ .col-main .widget-new-products { margin:7px 0; }
37
+ .widget-new-products .products-grid .product-image,
38
+ .widget-new-products .products-list .product-image { width:85px; height:85px; }
39
+ .widget-new-products .products-list .product-shop { margin-left:100px; }
40
+ .sidebar .widget-new-products .block { font-size:11px; line-height:1.25; }
41
+ .sidebar .widget-new-products .block-title strong { background:url(../images/widgets/i_widget-new.gif) 0 1px no-repeat; padding-left:21px; color:#dc5033; }
42
+
43
+ /* Widget: Recently Viewed Proructs */
44
+ .widget-viewed { display:block; }
45
+ .col-main .widget-viewed { margin:7px 0; }
46
+ .widget-viewed .products-grid .product-image,
47
+ .widget-viewed .products-list .product-image { width:85px; height:85px; }
48
+ .widget-viewed .products-list .product-shop { margin-left:100px; }
49
+ .sidebar .widget-viewed .block { font-size:11px; line-height:1.25; }
50
+ .sidebar .widget-viewed .block-title strong { background:url(../images/widgets/i_block-list.gif) 0 0 no-repeat; padding-left:21px; }
51
+
52
+ /* Widget: Recently Compared Proructs */
53
+ .widget-compared { display:block;}
54
+ .col-main .widget-compared { margin:7px 0; }
55
+ .widget-compared .products-grid .product-image,
56
+ .widget-compared .products-list .product-image { width:85px; height:85px; }
57
+ .widget-compared .products-list .product-shop { margin-left:100px; }
58
+ .sidebar .widget-compared .block { font-size:11px; line-height:1.25; }
59
+ .sidebar .widget-compared .block-title strong { background:url(../images/widgets/i_block-list.gif) 0 0 no-repeat; padding-left:21px; }
60
+
61
+ /* Widget: CMS Static Block */
62
+ .widget-static-block {}
63
+ .sidebar .widget-static-block { display:block; margin:0 0 15px; }
64
+
65
+ /* Widgets: Links Common Styles */
66
+ .top-container .widget a { padding:0 0 0 7px; }
67
+
68
+ .bottom-container .widget a { padding:0 3px; }
69
+
70
+ /* Widget: Catalog Product Link */
71
+ .widget-product-link-inline { display:inline; }
72
+
73
+ .col-main .widget-product-link { display:block; text-align:right; margin:7px 0; }
74
+ .col-main .widget-product-link a { background:url(../images/widgets/i_widget-link.gif) 100% 4px no-repeat; padding-right:15px; }
75
+
76
+ .sidebar .widget-product-link { display:block; margin:0 0 15px; padding:0 10px; }
77
+ .sidebar .widget-product-link a { background:url(../images/widgets/i_widget-link.gif) 100% 4px no-repeat; padding:0 15px 0 0; }
78
+
79
+ /* Widget: Catalog Category Link */
80
+ .widget-category-link-inline { display:inline; }
81
+
82
+ .col-main .widget-category-link { display:block; text-align:right; margin:7px 0; }
83
+ .col-main .widget-category-link a { background:url(../images/widgets/i_widget-link.gif) 100% 4px no-repeat; padding-right:15px; }
84
+
85
+ .sidebar .widget-category-link { display:block; margin:0 0 15px; padding:0 10px; }
86
+ .sidebar .widget-category-link a { background:url(../images/widgets/i_widget-link.gif) 100% 4px no-repeat; padding:0 15px 0 0; }
87
+
88
+ /* Widget: CMS Page Link */
89
+ .widget-cms-link-inline { display:inline; }
90
+
91
+ .col-main .widget-cms-link { display:block; text-align:right; margin:7px 0; }
92
+ .col-main .widget-cms-link a { background:url(../images/widgets/i_widget-link.gif) 100% 4px no-repeat; padding-right:15px; }
93
+
94
+ .sidebar .widget-cms-link { display:block; margin:0 0 15px; padding:0 10px; }
95
+ .sidebar .widget-cms-link a { background:url(../images/widgets/i_widget-link.gif) 100% 4px no-repeat; padding:0 15px 0 0; }
96
+ /* ======================================================================================= */
skin/frontend/base/default/favicon.ico ADDED
Binary file
skin/frontend/base/default/images/calendar.gif ADDED
Binary file
skin/frontend/base/default/images/catalog/product/placeholder/image.jpg ADDED
Binary file
skin/frontend/base/default/images/catalog/product/placeholder/small_image.jpg ADDED
Binary file
skin/frontend/base/default/images/catalog/product/placeholder/thumbnail.jpg ADDED
Binary file
skin/frontend/base/default/images/centinel/sc_learn_62x34.png ADDED
Binary file
skin/frontend/base/default/images/centinel/v_activate_steps.gif ADDED
Binary file
skin/frontend/base/default/images/centinel/vbv_ltbg_71x57.png ADDED
Binary file
skin/frontend/base/default/images/cookies/firefox.png ADDED
Binary file
skin/frontend/base/default/images/cookies/ie6-1.gif ADDED
Binary file
skin/frontend/base/default/images/cookies/ie6-2.gif ADDED
Binary file
skin/frontend/base/default/images/cookies/ie7-1.gif ADDED
Binary file
skin/frontend/base/default/images/cookies/ie7-2.gif ADDED
Binary file
skin/frontend/base/default/images/cookies/ie7-3.gif ADDED
Binary file
skin/frontend/base/default/images/cookies/ie7-4.gif ADDED
Binary file
skin/frontend/base/default/images/cookies/ie7-5.gif ADDED
Binary file
skin/frontend/base/default/images/cookies/ie7-6.gif ADDED
Binary file
skin/frontend/base/default/images/cookies/opera.png ADDED
Binary file
skin/frontend/base/default/images/cvv.gif ADDED
Binary file
skin/frontend/base/default/images/fam_book_open.png ADDED
Binary file
skin/frontend/base/default/images/moneybookers/banner_120_de.gif ADDED
Binary file
skin/frontend/base/default/images/moneybookers/banner_120_de.png ADDED
Binary file
skin/frontend/base/default/images/moneybookers/banner_120_dk.gif ADDED
Binary file
skin/frontend/base/default/images/moneybookers/banner_120_fr.gif ADDED
Binary file
skin/frontend/base/default/images/moneybookers/banner_120_fr.png ADDED
Binary file
skin/frontend/base/default/images/moneybookers/banner_120_int.gif ADDED
Binary file
skin/frontend/base/default/images/moneybookers/banner_120_int.png ADDED
Binary file
skin/frontend/base/default/images/moneybookers/banner_120_pl.gif ADDED
Binary file
skin/frontend/base/default/images/moneybookers/banner_120_pl.png ADDED
Binary file
skin/frontend/base/default/images/moneybookers/banner_120_sp.gif ADDED
Binary file
skin/frontend/base/default/images/moneybookers/banner_120_sp.png ADDED
Binary file
skin/frontend/base/default/images/moneybookers/moneybookers_acc.png ADDED
Binary file
skin/frontend/base/default/images/moneybookers/moneybookers_csi.gif ADDED
Binary file
skin/frontend/base/default/images/moneybookers/moneybookers_did.gif ADDED
Binary file
skin/frontend/base/default/images/moneybookers/moneybookers_dnk.gif ADDED
Binary file
skin/frontend/base/default/images/moneybookers/moneybookers_ebt.gif ADDED
Binary file
skin/frontend/base/default/images/moneybookers/moneybookers_ent.gif ADDED
Binary file
skin/frontend/base/default/images/moneybookers/moneybookers_gcb.gif ADDED
Binary file
skin/frontend/base/default/images/moneybookers/moneybookers_gir.gif ADDED
Binary file
skin/frontend/base/default/images/moneybookers/moneybookers_idl.gif ADDED
Binary file
skin/frontend/base/default/images/moneybookers/moneybookers_lsr.gif ADDED
Binary file
skin/frontend/base/default/images/moneybookers/moneybookers_mae.gif ADDED
Binary file
skin/frontend/base/default/images/moneybookers/moneybookers_npy.gif ADDED
Binary file
skin/frontend/base/default/images/moneybookers/moneybookers_obt_de.png ADDED
Binary file
skin/frontend/base/default/images/moneybookers/moneybookers_obt_dk.png ADDED
Binary file
skin/frontend/base/default/images/moneybookers/moneybookers_obt_ee.png ADDED
Binary file
skin/frontend/base/default/images/moneybookers/moneybookers_obt_en.png ADDED
Binary file
skin/frontend/base/default/images/moneybookers/moneybookers_obt_fl.png ADDED
Binary file
skin/frontend/base/default/images/moneybookers/moneybookers_obt_lt.png ADDED
Binary file
skin/frontend/base/default/images/moneybookers/moneybookers_obt_lv.png ADDED
Binary file
skin/frontend/base/default/images/moneybookers/moneybookers_obt_pl.png ADDED
Binary file
skin/frontend/base/default/images/moneybookers/moneybookers_obt_se.png ADDED
Binary file
skin/frontend/base/default/images/moneybookers/moneybookers_pli.gif ADDED
Binary file
skin/frontend/base/default/images/moneybookers/moneybookers_psp.gif ADDED
Binary file
skin/frontend/base/default/images/moneybookers/moneybookers_pwy.gif ADDED
Binary file
skin/frontend/base/default/images/moneybookers/moneybookers_sft.gif ADDED
Binary file
skin/frontend/base/default/images/moneybookers/moneybookers_so2.gif ADDED
Binary file
skin/frontend/base/default/images/moneybookers/moneybookers_wlt.gif ADDED
Binary file
skin/frontend/base/default/images/reload.png ADDED
Binary file
skin/frontend/base/default/images/widgets/i_block-list.gif ADDED
Binary file
skin/frontend/base/default/images/widgets/i_widget-link.gif ADDED
Binary file
skin/frontend/base/default/images/widgets/i_widget-new.gif ADDED
Binary file
skin/frontend/base/default/images/xmlconnect/catalog/category/placeholder/image.jpg ADDED
Binary file
skin/frontend/base/default/images/xmlconnect/catalog/category/placeholder/small_image.jpg ADDED
Binary file
skin/frontend/base/default/images/xmlconnect/catalog/category/placeholder/thumbnail.jpg ADDED
Binary file
skin/frontend/base/default/images/xmlconnect/tab_account.png ADDED
Binary file
skin/frontend/base/default/images/xmlconnect/tab_cart.png ADDED
Binary file
skin/frontend/base/default/images/xmlconnect/tab_home.png ADDED
Binary file
skin/frontend/base/default/images/xmlconnect/tab_more.png ADDED
Binary file
skin/frontend/base/default/images/xmlconnect/tab_page.png ADDED
Binary file
skin/frontend/base/default/images/xmlconnect/tab_search.png ADDED
Binary file
skin/frontend/base/default/images/xmlconnect/tab_shop.png ADDED
Binary file
skin/frontend/base/default/js/bundle.js ADDED
@@ -0,0 +1,274 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Magento
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the Academic Free License (AFL 3.0)
7
+ * that is bundled with this package in the file LICENSE_AFL.txt.
8
+ * It is also available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/afl-3.0.php
10
+ * If you did not receive a copy of the license and are unable to
11
+ * obtain it through the world-wide-web, please send an email
12
+ * to license@magentocommerce.com so we can send you a copy immediately.
13
+ *
14
+ * DISCLAIMER
15
+ *
16
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
17
+ * versions in the future. If you wish to customize Magento for your
18
+ * needs please refer to http://www.magentocommerce.com for more information.
19
+ *
20
+ * @category design
21
+ * @package base_default
22
+ * @copyright Copyright (c) 2014 Magento Inc. (http://www.magentocommerce.com)
23
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
24
+ */
25
+ if(typeof Product=='undefined') {
26
+ var Product = {};
27
+ }
28
+ /**************************** BUNDLE PRODUCT **************************/
29
+ Product.Bundle = Class.create();
30
+ Product.Bundle.prototype = {
31
+ initialize: function(config){
32
+ this.config = config;
33
+
34
+ // Set preconfigured values for correct price base calculation
35
+ if (config.defaultValues) {
36
+ for (var option in config.defaultValues) {
37
+ if (this.config['options'][option].isMulti) {
38
+ var selected = new Array();
39
+ for (var i = 0; i < config.defaultValues[option].length; i++) {
40
+ selected.push(config.defaultValues[option][i]);
41
+ }
42
+ this.config.selected[option] = selected;
43
+ } else {
44
+ this.config.selected[option] = new Array(config.defaultValues[option] + "");
45
+ }
46
+ }
47
+ }
48
+
49
+ this.reloadPrice();
50
+ },
51
+ changeSelection: function(selection){
52
+ var parts = selection.id.split('-');
53
+ if (this.config['options'][parts[2]].isMulti) {
54
+ selected = new Array();
55
+ if (selection.tagName == 'SELECT') {
56
+ for (var i = 0; i < selection.options.length; i++) {
57
+ if (selection.options[i].selected && selection.options[i].value != '') {
58
+ selected.push(selection.options[i].value);
59
+ }
60
+ }
61
+ } else if (selection.tagName == 'INPUT') {
62
+ selector = parts[0]+'-'+parts[1]+'-'+parts[2];
63
+ selections = $$('.'+selector);
64
+ for (var i = 0; i < selections.length; i++) {
65
+ if (selections[i].checked && selections[i].value != '') {
66
+ selected.push(selections[i].value);
67
+ }
68
+ }
69
+ }
70
+ this.config.selected[parts[2]] = selected;
71
+ } else {
72
+ if (selection.value != '') {
73
+ this.config.selected[parts[2]] = new Array(selection.value);
74
+ } else {
75
+ this.config.selected[parts[2]] = new Array();
76
+ }
77
+ this.populateQty(parts[2], selection.value);
78
+ var tierPriceElement = $('bundle-option-' + parts[2] + '-tier-prices'),
79
+ tierPriceHtml = '';
80
+ if (selection.value != '' && this.config.options[parts[2]].selections[selection.value].customQty == 1) {
81
+ tierPriceHtml = this.config.options[parts[2]].selections[selection.value].tierPriceHtml;
82
+ }
83
+ tierPriceElement.update(tierPriceHtml);
84
+ }
85
+ this.reloadPrice();
86
+ },
87
+
88
+ reloadPrice: function() {
89
+ var calculatedPrice = 0;
90
+ var dispositionPrice = 0;
91
+ var includeTaxPrice = 0;
92
+
93
+ for (var option in this.config.selected) {
94
+ if (this.config.options[option]) {
95
+ for (var i=0; i < this.config.selected[option].length; i++) {
96
+ var prices = this.selectionPrice(option, this.config.selected[option][i]);
97
+ calculatedPrice += Number(prices[0]);
98
+ dispositionPrice += Number(prices[1]);
99
+ includeTaxPrice += Number(prices[2]);
100
+ }
101
+ }
102
+ }
103
+
104
+ //Tax is calculated in a different way for the the TOTAL BASED method
105
+ //We round the taxes at the end. Hence we do the same for consistency
106
+ //This variable is set in the bundle.phtml
107
+ if (taxCalcMethod == CACL_TOTAL_BASE) {
108
+ var calculatedPriceFormatted = calculatedPrice.toFixed(10);
109
+ var includeTaxPriceFormatted = includeTaxPrice.toFixed(10);
110
+ var tax = includeTaxPriceFormatted - calculatedPriceFormatted;
111
+ calculatedPrice = includeTaxPrice - Math.round(tax * 100) / 100;
112
+ }
113
+
114
+ //make sure that the prices are all rounded to two digits
115
+ //this is needed when tax calculation is based on total for dynamic
116
+ //price bundle product. For fixed price bundle product, the rounding
117
+ //needs to be done after option price is added to base price
118
+ if (this.config.priceType == '0') {
119
+ calculatedPrice = Math.round(calculatedPrice*100)/100;
120
+ dispositionPrice = Math.round(dispositionPrice*100)/100;
121
+ includeTaxPrice = Math.round(includeTaxPrice*100)/100;
122
+
123
+ }
124
+
125
+ var event = $(document).fire('bundle:reload-price', {
126
+ price: calculatedPrice,
127
+ priceInclTax: includeTaxPrice,
128
+ dispositionPrice: dispositionPrice,
129
+ bundle: this
130
+ });
131
+ if (!event.noReloadPrice) {
132
+ optionsPrice.specialTaxPrice = 'true';
133
+ optionsPrice.changePrice('bundle', calculatedPrice);
134
+ optionsPrice.changePrice('nontaxable', dispositionPrice);
135
+ optionsPrice.changePrice('priceInclTax', includeTaxPrice);
136
+ optionsPrice.reload();
137
+ }
138
+
139
+ return calculatedPrice;
140
+ },
141
+
142
+ selectionPrice: function(optionId, selectionId) {
143
+ if (selectionId == '' || selectionId == 'none') {
144
+ return 0;
145
+ }
146
+ var qty = null;
147
+ var tierPriceInclTax, tierPriceExclTax;
148
+ if (this.config.options[optionId].selections[selectionId].customQty == 1 && !this.config['options'][optionId].isMulti) {
149
+ if ($('bundle-option-' + optionId + '-qty-input')) {
150
+ qty = $('bundle-option-' + optionId + '-qty-input').value;
151
+ } else {
152
+ qty = 1;
153
+ }
154
+ } else {
155
+ qty = this.config.options[optionId].selections[selectionId].qty;
156
+ }
157
+ if (this.config.priceType == '0') {
158
+ price = this.config.options[optionId].selections[selectionId].price;
159
+ tierPrice = this.config.options[optionId].selections[selectionId].tierPrice;
160
+
161
+ for (var i=0; i < tierPrice.length; i++) {
162
+ if (Number(tierPrice[i].price_qty) <= qty && Number(tierPrice[i].price) <= price) {
163
+ price = tierPrice[i].price;
164
+ tierPriceInclTax = tierPrice[i].priceInclTax;
165
+ tierPriceExclTax = tierPrice[i].priceExclTax;
166
+ }
167
+ }
168
+ } else {
169
+ selection = this.config.options[optionId].selections[selectionId];
170
+ if (selection.priceType == '0') {
171
+ price = selection.priceValue;
172
+ } else {
173
+ price = (this.config.basePrice*selection.priceValue)/100;
174
+ }
175
+ }
176
+ //price += this.config.options[optionId].selections[selectionId].plusDisposition;
177
+ //price -= this.config.options[optionId].selections[selectionId].minusDisposition;
178
+ //return price*qty;
179
+ var disposition = this.config.options[optionId].selections[selectionId].plusDisposition +
180
+ this.config.options[optionId].selections[selectionId].minusDisposition;
181
+
182
+ if (this.config.specialPrice) {
183
+ newPrice = (price*this.config.specialPrice)/100;
184
+ price = Math.min(newPrice, price);
185
+ }
186
+
187
+ selection = this.config.options[optionId].selections[selectionId];
188
+ if (tierPriceInclTax !== undefined && tierPriceExclTax !== undefined) {
189
+ priceInclTax = tierPriceInclTax;
190
+ price = tierPriceExclTax;
191
+ } else if (selection.priceInclTax !== undefined) {
192
+ priceInclTax = selection.priceInclTax;
193
+ price = selection.priceExclTax !== undefined ? selection.priceExclTax : selection.price;
194
+ } else {
195
+ priceInclTax = price;
196
+ }
197
+
198
+ if (this.config.priceType == '1' || taxCalcMethod == CACL_TOTAL_BASE) {
199
+ var result = new Array(price*qty, disposition*qty, priceInclTax*qty);
200
+ return result;
201
+ }
202
+ else if (taxCalcMethod == CACL_UNIT_BASE) {
203
+ price = (Math.round(price*100)/100).toString();
204
+ disposition = (Math.round(disposition*100)/100).toString();
205
+ priceInclTax = (Math.round(priceInclTax*100)/100).toString();
206
+ var result = new Array(price*qty, disposition*qty, priceInclTax*qty);
207
+ return result;
208
+ } else { //taxCalcMethod == CACL_ROW_BASE)
209
+ price = (Math.round(price*qty*100)/100).toString();
210
+ disposition = (Math.round(disposition*qty*100)/100).toString();
211
+ priceInclTax = (Math.round(priceInclTax*qty*100)/100).toString();
212
+ var result = new Array(price, disposition, priceInclTax);
213
+ return result;
214
+ }
215
+ },
216
+
217
+ populateQty: function(optionId, selectionId){
218
+ if (selectionId == '' || selectionId == 'none') {
219
+ this.showQtyInput(optionId, '0', false);
220
+ return;
221
+ }
222
+ if (this.config.options[optionId].selections[selectionId].customQty == 1) {
223
+ this.showQtyInput(optionId, this.config.options[optionId].selections[selectionId].qty, true);
224
+ } else {
225
+ this.showQtyInput(optionId, this.config.options[optionId].selections[selectionId].qty, false);
226
+ }
227
+ },
228
+
229
+ showQtyInput: function(optionId, value, canEdit) {
230
+ elem = $('bundle-option-' + optionId + '-qty-input');
231
+ elem.value = value;
232
+ elem.disabled = !canEdit;
233
+ if (canEdit) {
234
+ elem.removeClassName('qty-disabled');
235
+ } else {
236
+ elem.addClassName('qty-disabled');
237
+ }
238
+ },
239
+
240
+ changeOptionQty: function (element, event) {
241
+ var checkQty = true;
242
+ if (typeof(event) != 'undefined') {
243
+ if (event.keyCode == 8 || event.keyCode == 46) {
244
+ checkQty = false;
245
+ }
246
+ }
247
+ if (checkQty && (Number(element.value) == 0 || isNaN(Number(element.value)))) {
248
+ element.value = 1;
249
+ }
250
+ parts = element.id.split('-');
251
+ optionId = parts[2];
252
+ if (!this.config['options'][optionId].isMulti) {
253
+ selectionId = this.config.selected[optionId][0];
254
+ this.config.options[optionId].selections[selectionId].qty = element.value*1;
255
+ this.reloadPrice();
256
+ }
257
+ },
258
+
259
+ validationCallback: function (elmId, result){
260
+ if (elmId == undefined || $(elmId) == undefined) {
261
+ return;
262
+ }
263
+ var container = $(elmId).up('ul.options-list');
264
+ if (typeof container != 'undefined') {
265
+ if (result == 'failed') {
266
+ container.removeClassName('validation-passed');
267
+ container.addClassName('validation-failed');
268
+ } else {
269
+ container.removeClassName('validation-failed');
270
+ container.addClassName('validation-passed');
271
+ }
272
+ }
273
+ }
274
+ }
skin/frontend/base/default/js/checkout/review.js ADDED
@@ -0,0 +1,454 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Magento
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the Academic Free License (AFL 3.0)
7
+ * that is bundled with this package in the file LICENSE_AFL.txt.
8
+ * It is also available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/afl-3.0.php
10
+ * If you did not receive a copy of the license and are unable to
11
+ * obtain it through the world-wide-web, please send an email
12
+ * to license@magentocommerce.com so we can send you a copy immediately.
13
+ *
14
+ * DISCLAIMER
15
+ *
16
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
17
+ * versions in the future. If you wish to customize Magento for your
18
+ * needs please refer to http://www.magentocommerce.com for more information.
19
+ *
20
+ * @category design
21
+ * @package base_default
22
+ * @copyright Copyright (c) 2014 Magento Inc. (http://www.magentocommerce.com)
23
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
24
+ */
25
+
26
+ /**
27
+ * Controller of order review form that may select shipping method
28
+ */
29
+ OrderReviewController = Class.create();
30
+ OrderReviewController.prototype = {
31
+ _canSubmitOrder : false,
32
+ _pleaseWait : false,
33
+ shippingSelect : false,
34
+ reloadByShippingSelect : false,
35
+ _copyElement : false,
36
+ onSubmitShippingSuccess : false,
37
+ shippingMethodsUpdateUrl : false,
38
+ _updateShippingMethods: false,
39
+ _ubpdateOrderButton : false,
40
+ shippingMethodsContainer: false,
41
+ _submitUpdateOrderUrl : false,
42
+ _itemsGrid : false,
43
+
44
+ /**
45
+ * Add listeners to provided objects, if any
46
+ * @param orderForm - form of the order submission
47
+ * @param orderFormSubmit - element for the order form submission (optional)
48
+ * @param shippingSelect - dropdown with available shipping methods (optional)
49
+ * @param shippingSubmitForm - form of shipping method submission (optional, requires shippingSelect)
50
+ * @param shippingResultId - element where to update results of shipping ajax submission (optional, requires shippingSubmitForm)
51
+ */
52
+ initialize : function(orderForm, orderFormSubmit, shippingSelect, shippingSubmitForm, shippingResultId, shippingSubmit)
53
+ {
54
+ if (!orderForm) {
55
+ return;
56
+ }
57
+ this.form = orderForm;
58
+ if (orderFormSubmit) {
59
+ this.formSubmit = orderFormSubmit;
60
+ Event.observe(orderFormSubmit, 'click', this._submitOrder.bind(this));
61
+ }
62
+
63
+ if (shippingSubmitForm) {
64
+ this.reloadByShippingSelect = true;
65
+ if (shippingSubmitForm && shippingSelect) {
66
+ this.shippingSelect = shippingSelect;
67
+ Event.observe(
68
+ shippingSelect,
69
+ 'change',
70
+ this._submitShipping.bindAsEventListener(this, shippingSubmitForm.action, shippingResultId)
71
+ );
72
+ this._updateOrderSubmit(false);
73
+ } else {
74
+ this._canSubmitOrder = true;
75
+ }
76
+ } else {
77
+ Form.getElements(this.form).each(this._bindElementChange, this);
78
+
79
+ if (shippingSelect && $(shippingSelect)) {
80
+ this.shippingSelect = $(shippingSelect).id;
81
+ this.shippingMethodsContainer = $(this.shippingSelect).up();
82
+ } else {
83
+ this.shippingSelect = shippingSelect;
84
+ }
85
+ this._updateOrderSubmit(false);
86
+ }
87
+ },
88
+
89
+ /**
90
+ * Register element that should show up when ajax request is in progress
91
+ * @param element
92
+ */
93
+ addPleaseWait : function(element)
94
+ {
95
+ if (element) {
96
+ this._pleaseWait = element;
97
+ }
98
+ },
99
+
100
+ /**
101
+ * Dispatch an ajax request of shipping method submission
102
+ * @param event
103
+ * @param url - url where to submit shipping method
104
+ * @param resultId - id of element to be updated
105
+ */
106
+ _submitShipping : function(event, url, resultId)
107
+ {
108
+ if (this.shippingSelect && url && resultId) {
109
+ this._updateOrderSubmit(true);
110
+ if (this._pleaseWait) {
111
+ this._pleaseWait.show();
112
+ }
113
+ if ('' != this.shippingSelect.value) {
114
+ new Ajax.Updater(resultId, url, {
115
+ parameters: {isAjax:true, shipping_method:this.shippingSelect.value},
116
+ onComplete: function() {
117
+ if (this._pleaseWait) {
118
+ this._pleaseWait.hide();
119
+ }
120
+ }.bind(this),
121
+ onSuccess: this._onSubmitShippingSuccess.bind(this),
122
+ evalScripts: true
123
+ });
124
+ }
125
+ }
126
+ },
127
+
128
+ /**
129
+ * Set event observer to Update Order button
130
+ * @param element
131
+ * @param url - url to submit on Update button
132
+ * @param resultId - id of element to be updated
133
+ */
134
+ setUpdateButton : function(element, url, resultId)
135
+ {
136
+ if (element) {
137
+ this._ubpdateOrderButton = element;
138
+ this._submitUpdateOrderUrl = url;
139
+ this._itemsGrid = resultId;
140
+ Event.observe(element, 'click', this._submitUpdateOrder.bindAsEventListener(this, url, resultId));
141
+ if(this.shippingSelect) {
142
+ this._updateShipping();
143
+ }
144
+ this._updateOrderSubmit(!this._validateForm());
145
+ this.formValidator.reset();
146
+ this._clearValidation('');
147
+ }
148
+ },
149
+
150
+ /**
151
+ * Set event observer to copy data from shipping address to billing
152
+ * @param element
153
+ */
154
+ setCopyElement : function(element)
155
+ {
156
+ if (element) {
157
+ this._copyElement = element;
158
+ Event.observe(element, 'click', this._copyShippingToBilling.bind(this));
159
+ this._copyShippingToBilling();
160
+ }
161
+ },
162
+
163
+ /**
164
+ * Set observers to Shipping Address elements
165
+ * @param element Container of Shipping Address elements
166
+ */
167
+ setShippingAddressContainer: function(element)
168
+ {
169
+ if (element) {
170
+ Form.getElements(element).each(function(input) {
171
+ if (input.type.toLowerCase() == 'radio' || input.type.toLowerCase() == 'checkbox') {
172
+ Event.observe(input, 'click', this._onShippingChange.bindAsEventListener(this));
173
+ } else {
174
+ Event.observe(input, 'change', this._onShippingChange.bindAsEventListener(this));
175
+ }
176
+ }, this);
177
+ }
178
+ },
179
+
180
+ /**
181
+ * Sets Container element of Shipping Method
182
+ * @param element Container element of Shipping Method
183
+ */
184
+ setShippingMethodContainer: function(element)
185
+ {
186
+ if (element) {
187
+ this.shippingMethodsContainer = element;
188
+ }
189
+ },
190
+
191
+ /**
192
+ * Copy element value from shipping to billing address
193
+ * @param el
194
+ */
195
+ _copyElementValue: function(el)
196
+ {
197
+ var newId = el.id.replace('shipping:','billing:');
198
+ if (newId && $(newId) && $(newId).type != 'hidden') {
199
+ $(newId).value = el.value;
200
+ $(newId).setAttribute('readOnly', 'readonly');
201
+ $(newId).addClassName('local-validation');
202
+ $(newId).setStyle({opacity:.5});
203
+ $(newId).disable();
204
+ }
205
+ },
206
+
207
+ /**
208
+ * Copy data from shipping address to billing
209
+ */
210
+ _copyShippingToBilling : function (event)
211
+ {
212
+ if (!this._copyElement) {
213
+ return;
214
+ }
215
+ if (this._copyElement.checked) {
216
+ this._copyElementValue($('shipping:country_id'));
217
+ billingRegionUpdater.update();
218
+ $$('[id^="shipping:"]').each(this._copyElementValue);
219
+ this._clearValidation('billing');
220
+ } else {
221
+ $$('[id^="billing:"]').invoke('enable');
222
+ $$('[id^="billing:"]').each(function(el){el.removeAttribute("readOnly");});
223
+ $$('[id^="billing:"]').invoke('removeClassName', 'local-validation');
224
+ $$('[id^="billing:"]').invoke('setStyle', {opacity:1});
225
+ }
226
+ if (event) {
227
+ this._updateOrderSubmit(true);
228
+ }
229
+ },
230
+
231
+ /**
232
+ * Dispatch an ajax request of Update Order submission
233
+ * @param url - url where to submit shipping method
234
+ * @param resultId - id of element to be updated
235
+ */
236
+ _submitUpdateOrder : function(event, url, resultId)
237
+ {
238
+ this._copyShippingToBilling();
239
+ if (url && resultId && this._validateForm()) {
240
+ if (this._copyElement && this._copyElement.checked) {
241
+ this._clearValidation('billing');
242
+ }
243
+ this._updateOrderSubmit(true);
244
+ if (this._pleaseWait) {
245
+ this._pleaseWait.show();
246
+ }
247
+ this._toggleButton(this._ubpdateOrderButton, true);
248
+
249
+ arr = $$('[id^="billing:"]').invoke('enable');
250
+ var formData = this.form.serialize(true);
251
+ if (this._copyElement.checked) {
252
+ $$('[id^="billing:"]').invoke('disable');
253
+ this._copyElement.enable();
254
+ }
255
+ formData.isAjax = true;
256
+ new Ajax.Updater(resultId, url, {
257
+ parameters: formData,
258
+ onComplete: function() {
259
+ if (this._pleaseWait && !this._updateShippingMethods) {
260
+ this._pleaseWait.hide();
261
+ }
262
+ this._toggleButton(this._ubpdateOrderButton, false);
263
+ }.bind(this),
264
+ onSuccess: this._updateShippingMethodsElement.bind(this),
265
+ evalScripts: true
266
+ });
267
+ } else {
268
+ if (this._copyElement && this._copyElement.checked) {
269
+ this._clearValidation('billing');
270
+ }
271
+ }
272
+ },
273
+
274
+ /**
275
+ * Update Shipping Methods Element from server
276
+ */
277
+ _updateShippingMethodsElement : function (){
278
+ if (this._updateShippingMethods ) {
279
+ new Ajax.Updater($(this.shippingMethodsContainer).up(), this.shippingMethodsUpdateUrl, {
280
+ onComplete: this._updateShipping.bind(this),
281
+ onSuccess: this._onSubmitShippingSuccess.bind(this),
282
+ evalScripts: false
283
+ });
284
+ } else {
285
+ this._onSubmitShippingSuccess();
286
+ }
287
+ },
288
+
289
+ /**
290
+ * Update Shipping Method select element and bind events
291
+ */
292
+ _updateShipping : function () {
293
+ if ($(this.shippingSelect)) {
294
+ $(this.shippingSelect).enable();
295
+ Event.stopObserving($(this.shippingSelect), 'change');
296
+
297
+ this._bindElementChange($(this.shippingSelect));
298
+ Event.observe(
299
+ $(this.shippingSelect),
300
+ 'change',
301
+ this._submitUpdateOrder.bindAsEventListener(this, this._submitUpdateOrderUrl, this._itemsGrid)
302
+ );
303
+
304
+ $(this.shippingSelect + '_update').hide();
305
+ $(this.shippingSelect).show();
306
+ }
307
+ this._updateShippingMethods = false;
308
+ if (this._pleaseWait) {
309
+ this._pleaseWait.hide();
310
+ }
311
+ },
312
+
313
+ /**
314
+ * Validate Order form
315
+ */
316
+ _validateForm : function()
317
+ {
318
+ if (!this.form) {
319
+ return false;
320
+ }
321
+ if (!this.formValidator) {
322
+ this.formValidator = new Validation(this.form);
323
+ }
324
+
325
+ return this.formValidator.validate();
326
+ },
327
+
328
+ /**
329
+ * Actions on change Shipping Address data
330
+ * @param event
331
+ */
332
+ _onShippingChange : function(event){
333
+ var element = Event.element(event);
334
+ if (element != $(this.shippingSelect) && !($(this.shippingSelect) && $(this.shippingSelect).disabled)) {
335
+ if ($(this.shippingSelect)) {
336
+ $(this.shippingSelect).disable();
337
+ $(this.shippingSelect).hide();
338
+ if ($('advice-required-entry-' + this.shippingSelect)) {
339
+ $('advice-required-entry-' + this.shippingSelect).hide();
340
+ }
341
+ }
342
+ if (this.shippingMethodsContainer && $(this.shippingMethodsContainer)) {
343
+ $(this.shippingMethodsContainer).hide();
344
+ }
345
+
346
+ if (this.shippingSelect && $(this.shippingSelect + '_update')) {
347
+ $(this.shippingSelect + '_update').show();
348
+ }
349
+ this._updateShippingMethods = true;
350
+ }
351
+ },
352
+
353
+ /**
354
+ * Bind onChange event listener to elements for update Submit Order button state
355
+ * @param input
356
+ */
357
+ _bindElementChange : function(input){
358
+ Event.observe(input, 'change', this._onElementChange.bindAsEventListener(this))
359
+ },
360
+
361
+ /**
362
+ * Disable Submit Order button
363
+ */
364
+ _onElementChange : function(){
365
+ this._updateOrderSubmit(true);
366
+ },
367
+
368
+ /**
369
+ * Clear validation result for all form elements or for elements with id prefix
370
+ * @param idprefix
371
+ */
372
+ _clearValidation : function(idprefix)
373
+ {
374
+ var prefix = '';
375
+ if (idprefix) {
376
+ prefix = '[id*="' + idprefix + ':"]';
377
+ $$(prefix).each(function(el){
378
+ el.up().removeClassName('validation-failed')
379
+ .removeClassName('validation-passed')
380
+ .removeClassName('validation-error');
381
+ });
382
+ } else {
383
+ this.formValidator.reset();
384
+ }
385
+ $$('.validation-advice' + prefix).invoke('remove');
386
+ $$('.validation-failed' + prefix).invoke('removeClassName', 'validation-failed');
387
+ $$('.validation-passed' + prefix).invoke('removeClassName', 'validation-passed');
388
+ $$('.validation-error' + prefix).invoke('removeClassName', 'validation-error');
389
+ },
390
+
391
+ /**
392
+ * Attempt to submit order
393
+ */
394
+ _submitOrder : function()
395
+ {
396
+ if (this._canSubmitOrder && (this.reloadByShippingSelect || this._validateForm())) {
397
+ this.form.submit();
398
+ this._updateOrderSubmit(true);
399
+ if (this._ubpdateOrderButton) {
400
+ this._ubpdateOrderButton.addClassName('no-checkout');
401
+ this._ubpdateOrderButton.setStyle({opacity:.5});
402
+ }
403
+ if (this._pleaseWait) {
404
+ this._pleaseWait.show();
405
+ }
406
+ return;
407
+ }
408
+ this._updateOrderSubmit(true);
409
+ },
410
+
411
+ /**
412
+ * Explicitly enable order submission
413
+ */
414
+ _onSubmitShippingSuccess : function()
415
+ {
416
+ this._updateOrderSubmit(false);
417
+ if (this.onSubmitShippingSuccess) {
418
+ this.onSubmitShippingSuccess();
419
+ }
420
+ },
421
+
422
+ /**
423
+ * Check/Set whether order can be submitted
424
+ * Also disables form submission element, if any
425
+ * @param shouldDisable - whether should prevent order submission explicitly
426
+ */
427
+ _updateOrderSubmit : function(shouldDisable)
428
+ {
429
+ var isDisabled = shouldDisable || (
430
+ this.reloadByShippingSelect && (!this.shippingSelect || '' == this.shippingSelect.value)
431
+ );
432
+ this._canSubmitOrder = !isDisabled;
433
+ if (this.formSubmit) {
434
+ this._toggleButton(this.formSubmit, isDisabled);
435
+ }
436
+ },
437
+
438
+ /**
439
+ * Enable/Disable button
440
+ *
441
+ * @param button
442
+ * @param disable
443
+ */
444
+ _toggleButton : function(button, disable)
445
+ {
446
+ button.disabled = disable;
447
+ button.removeClassName('no-checkout');
448
+ button.setStyle({opacity:1});
449
+ if (disable) {
450
+ button.addClassName('no-checkout');
451
+ button.setStyle({opacity:.5});
452
+ }
453
+ }
454
+ };
skin/frontend/base/default/js/giftmessage.js ADDED
@@ -0,0 +1,129 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Magento
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the Academic Free License (AFL 3.0)
7
+ * that is bundled with this package in the file LICENSE_AFL.txt.
8
+ * It is also available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/afl-3.0.php
10
+ * If you did not receive a copy of the license and are unable to
11
+ * obtain it through the world-wide-web, please send an email
12
+ * to license@magentocommerce.com so we can send you a copy immediately.
13
+ *
14
+ * DISCLAIMER
15
+ *
16
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
17
+ * versions in the future. If you wish to customize Magento for your
18
+ * needs please refer to http://www.magentocommerce.com for more information.
19
+ *
20
+ * @category design
21
+ * @package base_default
22
+ * @copyright Copyright (c) 2014 Magento Inc. (http://www.magentocommerce.com)
23
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
24
+ */
25
+ var GiftMessage = Class.create();
26
+
27
+ GiftMessage.prototype = {
28
+ uniqueId: 0,
29
+ initialize: function (buttonId) {
30
+ GiftMessageStack.addObject(this);
31
+ this.buttonId = buttonId;
32
+ this.initListeners();
33
+ },
34
+ editGiftMessage: function (evt) {
35
+ var popUpUrl = this.url + '?uniqueId=' + this.uniqueId;
36
+ this.popUp = window.open(popUpUrl, 'giftMessage', 'width=350,height=400,resizable=yes,scrollbars=yes');
37
+ this.popUp.focus();
38
+ Event.stop(evt);
39
+ },
40
+ initListeners: function () {
41
+ var items = $(this.buttonId).getElementsByClassName('listen-for-click');
42
+ items.each(function(item) {
43
+ Event.observe(item, 'click', this.editGiftMessage.bindAsEventListener(this));
44
+ item.controller = this;
45
+ }.bind(this));
46
+ },
47
+ reloadContainer: function (url) {
48
+ new Ajax.Updater(this.buttonId, url, {onComplete:this.initListeners.bind(this)});
49
+ },
50
+ initWindow: function (windowObject) {
51
+ this.windowObj = windowObject;
52
+ }
53
+ };
54
+
55
+ var GiftMessageStack = {
56
+ _stack: [],
57
+ _nextUniqueId: 0,
58
+ addObject: function(giftMessageObject) {
59
+ giftMessageObject.uniqueId = this.uniqueId();
60
+ this._stack.push(giftMessageObject);
61
+ return this;
62
+ },
63
+ uniqueId: function() {
64
+ return 'objectStack' + (this._nextUniqueId++);
65
+ },
66
+ getObjectById: function(id) {
67
+ var giftMessageObject = false;
68
+ this._stack.each(function(item){
69
+ if(item.uniqueId == id) {
70
+ giftMessageObject = item;
71
+ }
72
+ });
73
+ return giftMessageObject;
74
+ }
75
+ };
76
+
77
+ var GiftMessageWindow = Class.create();
78
+ GiftMessageWindow.prototype = {
79
+ initialize: function(uniqueId, formId, removeUrl) {
80
+ this.uniqueId = uniqueId;
81
+ this.removeUrl = removeUrl;
82
+ if(window.opener) {
83
+ this.parentObject = window.opener.GiftMessageStack.getObjectById(this.uniqueId);
84
+ this.parentObject.initWindow(this);
85
+ }
86
+ if(formId) {
87
+ this.form = new VarienForm(formId, true);
88
+ this.formElement = $(formId);
89
+ this.initListeners();
90
+ }
91
+ },
92
+ initListeners: function() {
93
+ removeButtons = this.formElement.getElementsByClassName('listen-remove');
94
+ removeButtons.each(function(item){
95
+ Event.observe(item, 'click', this.remove.bindAsEventListener(this));
96
+ }.bind(this));
97
+
98
+ cancelButtons = this.formElement.getElementsByClassName('listen-cancel');
99
+ cancelButtons.each(function(item){
100
+ Event.observe(item, 'click', this.cancel.bindAsEventListener(this));
101
+ }.bind(this));
102
+ },
103
+ cancel: function(evt) {
104
+ Event.stop(evt);
105
+ window.opener.focus();
106
+ window.close();
107
+ },
108
+ close: function() {
109
+ window.opener.focus();
110
+ window.close();
111
+ },
112
+ remove: function(evt) {
113
+ Event.stop(evt);
114
+ if(this.confirmMessage && !window.confirm(this.confirmMessage)) {
115
+ return;
116
+ }
117
+ window.location.href = this.removeUrl;
118
+ },
119
+ updateParent: function (url, buttonUrl) {
120
+ if(this.parentObject) {
121
+ this.parentObject.url = url
122
+ this.parentObject.reloadContainer(buttonUrl);
123
+ }
124
+ setTimeout(function(){
125
+ window.opener.focus();
126
+ window.close();
127
+ }, 3000);
128
+ }
129
+ };
skin/frontend/base/default/js/ie6.js ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Magento
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the Academic Free License (AFL 3.0)
7
+ * that is bundled with this package in the file LICENSE_AFL.txt.
8
+ * It is also available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/afl-3.0.php
10
+ * If you did not receive a copy of the license and are unable to
11
+ * obtain it through the world-wide-web, please send an email
12
+ * to license@magentocommerce.com so we can send you a copy immediately.
13
+ *
14
+ * DISCLAIMER
15
+ *
16
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
17
+ * versions in the future. If you wish to customize Magento for your
18
+ * needs please refer to http://www.magentocommerce.com for more information.
19
+ *
20
+ * @category design
21
+ * @package base_default
22
+ * @copyright Copyright (c) 2014 Magento Inc. (http://www.magentocommerce.com)
23
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
24
+ */
25
+
26
+ ieHover = function() {
27
+ var items, iframe;
28
+ items = $$('#nav ul', '#nav div', '.truncated_full_value .item-options', '.tool-tip');
29
+ $$('#checkout-step-payment', '.tool-tip').each(function(el) {
30
+ el.show();
31
+ el.setStyle({'visibility':'hidden'})
32
+ })
33
+ for (var j=0; j<items.length; j++) {
34
+ iframe = document.createElement('IFRAME');
35
+ iframe.src = BLANK_URL;
36
+ iframe.scrolling = 'no';
37
+ iframe.frameBorder = 0;
38
+ iframe.className = 'hover-fix';
39
+ iframe.style.width = items[j].offsetWidth+"px";
40
+ iframe.style.height = items[j].offsetHeight+"px";
41
+ items[j].insertBefore(iframe, items[j].firstChild);
42
+ }
43
+ $$('.tool-tip', '#checkout-step-payment').each(function(el) {
44
+ el.hide();
45
+ el.setStyle({'visibility':'visible'})
46
+ })
47
+ }
48
+ Event.observe(window, 'load', ieHover);
skin/frontend/base/default/js/msrp.js ADDED
@@ -0,0 +1,368 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Magento
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the Academic Free License (AFL 3.0)
7
+ * that is bundled with this package in the file LICENSE_AFL.txt.
8
+ * It is also available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/afl-3.0.php
10
+ * If you did not receive a copy of the license and are unable to
11
+ * obtain it through the world-wide-web, please send an email
12
+ * to license@magentocommerce.com so we can send you a copy immediately.
13
+ *
14
+ * DISCLAIMER
15
+ *
16
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
17
+ * versions in the future. If you wish to customize Magento for your
18
+ * needs please refer to http://www.magentocommerce.com for more information.
19
+ *
20
+ * @category design
21
+ * @package base_default
22
+ * @copyright Copyright (c) 2014 Magento Inc. (http://www.magentocommerce.com)
23
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
24
+ */
25
+ if (!window.Catalog) {
26
+ window.Catalog = {};
27
+ }
28
+
29
+ Catalog.Map = {
30
+
31
+ helpLinks: [],
32
+
33
+ active: false,
34
+
35
+ addHelpLink: function(linkElement, title, actualPrice, msrpPrice, addToCartLink) {
36
+ if (typeof linkElement == 'string') {
37
+ linkElement = $$(linkElement)[0];
38
+ }
39
+
40
+ if (!linkElement) {
41
+ return;
42
+ }
43
+
44
+ var helpLink = {
45
+ 'link': linkElement
46
+ };
47
+
48
+ var showPopup = false;
49
+
50
+ if (typeof title == 'string' && title) {
51
+ helpLink.title = title;
52
+ showPopup = true;
53
+ }
54
+
55
+ if (typeof actualPrice == 'string' && actualPrice || typeof actualPrice == 'object' && actualPrice) {
56
+ helpLink.price = actualPrice;
57
+ showPopup = true;
58
+ }
59
+
60
+ if (typeof msrpPrice == 'string' && msrpPrice) {
61
+ helpLink.msrp = msrpPrice;
62
+ showPopup = true;
63
+ }
64
+
65
+ if (typeof addToCartLink == 'string' && addToCartLink) {
66
+ helpLink.cartLink = addToCartLink;
67
+ } else if (addToCartLink && addToCartLink.url) {
68
+ helpLink.cartLink = addToCartLink.url;
69
+ if (addToCartLink.qty) {
70
+ helpLink.qty = addToCartLink.qty;
71
+ }
72
+ if (addToCartLink.notUseForm) {
73
+ helpLink.notUseForm = addToCartLink.notUseForm;
74
+ }
75
+ }
76
+
77
+ if (!showPopup) {
78
+ this.setGotoView(linkElement, addToCartLink);
79
+ } else {
80
+ var helpLinkIndex = this.helpLinks.push(helpLink) - 1;
81
+ Event.observe(linkElement, 'click', this.showHelp.bind(this.helpLinks[helpLinkIndex]));
82
+ }
83
+ return helpLink;
84
+ },
85
+
86
+ setGotoView: function(element, viewPageUrl) {
87
+ $(element).stopObserving('click');
88
+ element.href = viewPageUrl;
89
+ if(window.opener) {
90
+ Event.observe(element, 'click', function(event) {
91
+ setPLocation(this.href,true);
92
+ Catalog.Map.hideHelp();
93
+ event.stop();
94
+ });
95
+ } else {
96
+ Event.observe(element, 'click', function(event) {
97
+ setLocation(this.href);
98
+ Catalog.Map.hideHelp();
99
+ window.opener.focus();
100
+ event.stop();
101
+ });
102
+ }
103
+ },
104
+
105
+ showSelects: function() {
106
+ var elements = document.getElementsByTagName("select");
107
+ for (i=0;i< elements.length;i++) {
108
+ elements[i].style.visibility='visible';
109
+ }
110
+ },
111
+
112
+ hideSelects: function() {
113
+ var elements = document.getElementsByTagName("select");
114
+ for (i=0;i< elements.length;i++) {
115
+ elements[i].style.visibility='hidden';
116
+ }
117
+ },
118
+
119
+ showHelp: function(event) {
120
+ var helpBox = $('map-popup'),
121
+ isIE6 = typeof document.body.style.maxHeight === "undefined";
122
+ if (!helpBox) {
123
+ return;
124
+ }
125
+
126
+ //Move help box to be right in body tag
127
+ var bodyNode = $$('body')[0];
128
+ if (helpBox.parentNode != bodyNode) {
129
+ helpBox.remove();
130
+ bodyNode.insert(helpBox);
131
+ // Fix for FF4-FF5 bug with missing alt text after DOM manipulations
132
+ var paypalImg = helpBox.select('.paypal-logo > a > img')[0];
133
+ if (paypalImg) paypalImg.src = paypalImg.src;
134
+ }
135
+
136
+ if (this != Catalog.Map && Catalog.Map.active != this.link) {
137
+ helpBox.style.display = 'none';
138
+ if (!helpBox.offsetPosition) {
139
+ helpBox.offsetPosition = {left:0, top: 0};
140
+ }
141
+
142
+ helpBox.removeClassName('map-popup-right');
143
+ helpBox.removeClassName('map-popup-left');
144
+ if (Element.getWidth(bodyNode) < event.pageX + Element.getWidth(helpBox)) {
145
+ helpBox.addClassName('map-popup-left');
146
+ } else if (event.pageX - Element.getWidth(helpBox) < 0) {
147
+ helpBox.addClassName('map-popup-right');
148
+ }
149
+
150
+ helpBox.style.left = event.pageX - (Element.getWidth(helpBox) / 2) + 'px';
151
+ helpBox.style.top = event.pageY + 10 + 'px';
152
+
153
+ //Title
154
+ var mapTitle = $('map-popup-heading');
155
+ if (typeof this.title != 'undefined') {
156
+ Element.update(mapTitle, this.title);
157
+ $(mapTitle).show();
158
+ } else {
159
+ $(mapTitle).hide();
160
+ }
161
+
162
+ //MSRP price
163
+ var mapMsrp = $('map-popup-msrp-box');
164
+ if (typeof this.msrp != 'undefined') {
165
+ Element.update($('map-popup-msrp'), this.msrp);
166
+ $(mapMsrp).show();
167
+ } else {
168
+ $(mapMsrp).hide();
169
+ }
170
+
171
+ //Actual price
172
+ var mapPrice = $('map-popup-price-box');
173
+ if (typeof this.price != 'undefined') {
174
+ var price = typeof this.price == 'object' ? this.price.innerHTML : this.price;
175
+ Element.update($('map-popup-price'), price);
176
+ $(mapPrice).show();
177
+ } else {
178
+ $(mapPrice).hide();
179
+ }
180
+
181
+ //`Add to cart` button
182
+ var cartButton = $('map-popup-button');
183
+ if (typeof this.cartLink != 'undefined') {
184
+ if (typeof productAddToCartForm == 'undefined' || this.notUseForm) {
185
+ Catalog.Map.setGotoView(cartButton, this.cartLink);
186
+ productAddToCartForm = $('product_addtocart_form_from_popup');
187
+ } else {
188
+ if (this.qty) {
189
+ productAddToCartForm.qty = this.qty;
190
+ }
191
+ cartButton.stopObserving('click');
192
+ cartButton.href = this.cartLink;
193
+ Event.observe(cartButton, 'click', function(event) {
194
+ productAddToCartForm.action = this.href;
195
+ productAddToCartForm.submit(this);
196
+ });
197
+ }
198
+ productAddToCartForm.action = this.cartLink;
199
+ var productField = $('map-popup-product-id');
200
+ productField.value = this.product_id;
201
+ $(cartButton).show();
202
+ $$('.additional-addtocart-box').invoke('show');
203
+ } else {
204
+ $(cartButton).hide();
205
+ $$('.additional-addtocart-box').invoke('hide');
206
+ }
207
+
208
+ //Horizontal line
209
+ var mapText = $('map-popup-text'),
210
+ mapTextWhatThis = $('map-popup-text-what-this'),
211
+ mapContent = $('map-popup-content');
212
+ if (!mapMsrp.visible() && !mapPrice.visible() && !cartButton.visible()) {
213
+ //If just `What's this?` link
214
+ $(mapText).hide();
215
+ $(mapTextWhatThis).show();
216
+ $(mapTextWhatThis).removeClassName('map-popup-only-text');
217
+ $(mapContent).hide().setStyle({visibility: 'hidden'});
218
+ $('product_addtocart_form_from_popup').hide();
219
+ } else {
220
+ $(mapTextWhatThis).hide();
221
+ $(mapText).show();
222
+ $(mapText).addClassName('map-popup-only-text');
223
+ $(mapContent).show().setStyle({visibility: 'visible'});
224
+ $('product_addtocart_form_from_popup').show();
225
+ }
226
+
227
+ $(helpBox).show();
228
+ if (isIE6) {
229
+ Catalog.Map.hideSelects();
230
+ }
231
+ var closeButton = $('map-popup-close');
232
+ if (closeButton) {
233
+ $(closeButton).stopObserving('click');
234
+ Event.observe(closeButton, 'click', Catalog.Map.showHelp.bind(this));
235
+ Catalog.Map.active = this.link;
236
+ }
237
+ } else {
238
+ $(helpBox).hide();
239
+ if (isIE6) {
240
+ Catalog.Map.showSelects();
241
+ }
242
+ Catalog.Map.active = false;
243
+ }
244
+
245
+ Event.stop(event);
246
+ },
247
+
248
+ hideHelp: function(){
249
+ var helpBox = $('map-popup');
250
+ if (helpBox) {
251
+ var isIE6 = typeof document.body.style.maxHeight === "undefined";
252
+ $(helpBox).hide();
253
+ if (isIE6) {
254
+ Catalog.Map.showSelects();
255
+ }
256
+ Catalog.Map.active = false;
257
+ }
258
+ },
259
+
260
+ bindProductForm: function(){
261
+ if (('undefined' != typeof productAddToCartForm) && productAddToCartForm) {
262
+ productAddToCartFormOld = productAddToCartForm;
263
+ productAddToCartForm = new VarienForm('product_addtocart_form_from_popup');
264
+ productAddToCartForm.submitLight = productAddToCartFormOld.submitLight;
265
+ } else if(!$('product_addtocart_form_from_popup')) {
266
+ return false;
267
+ } else if ('undefined' == typeof productAddToCartForm) {
268
+ productAddToCartForm = new VarienForm('product_addtocart_form_from_popup');
269
+ }
270
+
271
+ productAddToCartForm.submit = function(button, url) {
272
+ if (('undefined' != typeof productAddToCartFormOld) && productAddToCartFormOld) {
273
+ if (Catalog.Map.active) {
274
+ Catalog.Map.hideHelp();
275
+ }
276
+ if (productAddToCartForm.qty && $('qty')) {
277
+ $('qty').value = productAddToCartForm.qty;
278
+ }
279
+ parentResult = productAddToCartFormOld.submit();
280
+ return false;
281
+ }
282
+ if(window.opener) {
283
+ var parentButton = button;
284
+ new Ajax.Request(this.form.action, {
285
+ parameters: {isAjax: 1, method: 'GET'},
286
+ onSuccess: function(transport) {
287
+ window.opener.focus();
288
+ if (parentButton && parentButton.href) {
289
+ setPLocation(parentButton.href, true);
290
+ Catalog.Map.hideHelp();
291
+ }
292
+ }
293
+ });
294
+ return;
295
+ }
296
+ if (this.validator.validate()) {
297
+ var form = this.form;
298
+ var oldUrl = form.action;
299
+
300
+ if (url) {
301
+ form.action = url;
302
+ }
303
+ if (!form.getAttribute('action')) {
304
+ form.action = productAddToCartForm.action;
305
+ }
306
+ try {
307
+ this.form.submit();
308
+ } catch (e) {
309
+ this.form.action = oldUrl;
310
+ throw e;
311
+ }
312
+ this.form.action = oldUrl;
313
+
314
+ if (button && button != 'undefined') {
315
+ button.disabled = true;
316
+ }
317
+ }
318
+ };
319
+ }
320
+ };
321
+
322
+ Event.observe(window, 'resize', function(event) {
323
+ if (Catalog.Map.active) {
324
+ Catalog.Map.showHelp(event);
325
+ }
326
+ })
327
+
328
+ $(document).observe('bundle:reload-price', function (event) { //reload price
329
+ var data = event.memo, bundle = data.bundle;
330
+ if (!Number(bundle.config.isMAPAppliedDirectly) && !Number(bundle.config.isFixedPrice)) {
331
+ var canApplyMAP = false;
332
+ try {
333
+ for (var option in bundle.config.selected) {
334
+ if (bundle.config.options[option] && bundle.config.options[option].selections) {
335
+ var selections = bundle.config.options[option].selections;
336
+ for (var i = 0, l = bundle.config.selected[option].length; i < l; i++) {
337
+ var selectionId = bundle.config.selected[option][i];
338
+ if (Number(selections[selectionId].canApplyMAP)) {
339
+ canApplyMAP = true;
340
+ break;
341
+ }
342
+ }
343
+ }
344
+ if (canApplyMAP) {
345
+ break;
346
+ }
347
+ }
348
+ } catch (e) {
349
+ canApplyMAP = true;
350
+ }
351
+ if (canApplyMAP) {
352
+ $$('.full-product-price').each(function(e){
353
+ $(e).hide();
354
+ });
355
+ $$('.map-info').each(function(e){
356
+ $(e).show();
357
+ });
358
+ event.noReloadPrice = true;
359
+ } else {
360
+ $$('.full-product-price').each(function(e){
361
+ $(e).show();
362
+ });
363
+ $$('.map-info').each(function(e){
364
+ $(e).hide();
365
+ });
366
+ }
367
+ }
368
+ });
skin/frontend/base/default/js/opcheckout.js ADDED
@@ -0,0 +1,962 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Magento
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the Academic Free License (AFL 3.0)
7
+ * that is bundled with this package in the file LICENSE_AFL.txt.
8
+ * It is also available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/afl-3.0.php
10
+ * If you did not receive a copy of the license and are unable to
11
+ * obtain it through the world-wide-web, please send an email
12
+ * to license@magentocommerce.com so we can send you a copy immediately.
13
+ *
14
+ * DISCLAIMER
15
+ *
16
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
17
+ * versions in the future. If you wish to customize Magento for your
18
+ * needs please refer to http://www.magentocommerce.com for more information.
19
+ *
20
+ * @category design
21
+ * @package base_default
22
+ * @copyright Copyright (c) 2014 Magento Inc. (http://www.magentocommerce.com)
23
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
24
+ */
25
+ var Checkout = Class.create();
26
+ Checkout.prototype = {
27
+ initialize: function(accordion, urls){
28
+ this.accordion = accordion;
29
+ this.progressUrl = urls.progress;
30
+ this.reviewUrl = urls.review;
31
+ this.saveMethodUrl = urls.saveMethod;
32
+ this.failureUrl = urls.failure;
33
+ this.billingForm = false;
34
+ this.shippingForm= false;
35
+ this.syncBillingShipping = false;
36
+ this.method = '';
37
+ this.payment = '';
38
+ this.loadWaiting = false;
39
+ this.steps = ['login', 'billing', 'shipping', 'shipping_method', 'payment', 'review'];
40
+ //We use billing as beginning step since progress bar tracks from billing
41
+ this.currentStep = 'billing';
42
+
43
+ this.accordion.sections.each(function(section) {
44
+ Event.observe($(section).down('.step-title'), 'click', this._onSectionClick.bindAsEventListener(this));
45
+ }.bind(this));
46
+
47
+ this.accordion.disallowAccessToNextSections = true;
48
+ },
49
+
50
+ /**
51
+ * Section header click handler
52
+ *
53
+ * @param event
54
+ */
55
+ _onSectionClick: function(event) {
56
+ var section = $(Event.element(event).up().up());
57
+ if (section.hasClassName('allow')) {
58
+ Event.stop(event);
59
+ this.gotoSection(section.readAttribute('id').replace('opc-', ''), false);
60
+ return false;
61
+ }
62
+ },
63
+
64
+ ajaxFailure: function(){
65
+ location.href = this.failureUrl;
66
+ },
67
+
68
+ reloadProgressBlock: function(toStep) {
69
+ this.reloadStep(toStep);
70
+ if (this.syncBillingShipping) {
71
+ this.syncBillingShipping = false;
72
+ this.reloadStep('shipping');
73
+ }
74
+ },
75
+
76
+ reloadStep: function(prevStep) {
77
+ var updater = new Ajax.Updater(prevStep + '-progress-opcheckout', this.progressUrl, {
78
+ method:'get',
79
+ onFailure:this.ajaxFailure.bind(this),
80
+ onComplete: function(){
81
+ this.checkout.resetPreviousSteps();
82
+ },
83
+ parameters:prevStep ? { prevStep:prevStep } : null
84
+ });
85
+ },
86
+
87
+ reloadReviewBlock: function(){
88
+ var updater = new Ajax.Updater('checkout-review-load', this.reviewUrl, {method: 'get', onFailure: this.ajaxFailure.bind(this)});
89
+ },
90
+
91
+ _disableEnableAll: function(element, isDisabled) {
92
+ var descendants = element.descendants();
93
+ for (var k in descendants) {
94
+ descendants[k].disabled = isDisabled;
95
+ }
96
+ element.disabled = isDisabled;
97
+ },
98
+
99
+ setLoadWaiting: function(step, keepDisabled) {
100
+ if (step) {
101
+ if (this.loadWaiting) {
102
+ this.setLoadWaiting(false);
103
+ }
104
+ var container = $(step+'-buttons-container');
105
+ container.addClassName('disabled');
106
+ container.setStyle({opacity:.5});
107
+ this._disableEnableAll(container, true);
108
+ Element.show(step+'-please-wait');
109
+ } else {
110
+ if (this.loadWaiting) {
111
+ var container = $(this.loadWaiting+'-buttons-container');
112
+ var isDisabled = (keepDisabled ? true : false);
113
+ if (!isDisabled) {
114
+ container.removeClassName('disabled');
115
+ container.setStyle({opacity:1});
116
+ }
117
+ this._disableEnableAll(container, isDisabled);
118
+ Element.hide(this.loadWaiting+'-please-wait');
119
+ }
120
+ }
121
+ this.loadWaiting = step;
122
+ },
123
+
124
+ gotoSection: function (section, reloadProgressBlock) {
125
+
126
+ if (reloadProgressBlock) {
127
+ this.reloadProgressBlock(this.currentStep);
128
+ }
129
+ this.currentStep = section;
130
+ var sectionElement = $('opc-' + section);
131
+ sectionElement.addClassName('allow');
132
+ this.accordion.openSection('opc-' + section);
133
+ if(!reloadProgressBlock) {
134
+ this.resetPreviousSteps();
135
+ }
136
+ },
137
+
138
+ resetPreviousSteps: function () {
139
+ var stepIndex = this.steps.indexOf(this.currentStep);
140
+
141
+ //Clear other steps if already populated through javascript
142
+ for (var i = stepIndex; i < this.steps.length; i++) {
143
+ var nextStep = this.steps[i];
144
+ var progressDiv = nextStep + '-progress-opcheckout';
145
+ if ($(progressDiv)) {
146
+ //Remove the link
147
+ $(progressDiv).select('.changelink').each(function (item) {
148
+ item.remove();
149
+ });
150
+ $(progressDiv).select('dt').each(function (item) {
151
+ item.removeClassName('complete');
152
+ });
153
+ //Remove the content
154
+ $(progressDiv).select('dd.complete').each(function (item) {
155
+ item.remove();
156
+ });
157
+ }
158
+ }
159
+ },
160
+
161
+ changeSection: function (section) {
162
+ var changeStep = section.replace('opc-', '');
163
+ this.gotoSection(changeStep, false);
164
+ },
165
+
166
+ setMethod: function(){
167
+ if ($('login:guest') && $('login:guest').checked) {
168
+ this.method = 'guest';
169
+ var request = new Ajax.Request(
170
+ this.saveMethodUrl,
171
+ {method: 'post', onFailure: this.ajaxFailure.bind(this), parameters: {method:'guest'}}
172
+ );
173
+ Element.hide('register-customer-password');
174
+ this.gotoSection('billing', true);
175
+ }
176
+ else if($('login:register') && ($('login:register').checked || $('login:register').type == 'hidden')) {
177
+ this.method = 'register';
178
+ var request = new Ajax.Request(
179
+ this.saveMethodUrl,
180
+ {method: 'post', onFailure: this.ajaxFailure.bind(this), parameters: {method:'register'}}
181
+ );
182
+ Element.show('register-customer-password');
183
+ this.gotoSection('billing', true);
184
+ }
185
+ else{
186
+ alert(Translator.translate('Please choose to register or to checkout as a guest').stripTags());
187
+ return false;
188
+ }
189
+ document.body.fire('login:setMethod', {method : this.method});
190
+ },
191
+
192
+ setBilling: function() {
193
+ if (($('billing:use_for_shipping_yes')) && ($('billing:use_for_shipping_yes').checked)) {
194
+ shipping.syncWithBilling();
195
+ $('opc-shipping').addClassName('allow');
196
+ this.gotoSection('shipping_method', true);
197
+ } else if (($('billing:use_for_shipping_no')) && ($('billing:use_for_shipping_no').checked)) {
198
+ $('shipping:same_as_billing').checked = false;
199
+ this.gotoSection('shipping', true);
200
+ } else {
201
+ $('shipping:same_as_billing').checked = true;
202
+ this.gotoSection('shipping', true);
203
+ }
204
+
205
+ // this refreshes the checkout progress column
206
+
207
+ // if ($('billing:use_for_shipping') && $('billing:use_for_shipping').checked){
208
+ // shipping.syncWithBilling();
209
+ // //this.setShipping();
210
+ // //shipping.save();
211
+ // $('opc-shipping').addClassName('allow');
212
+ // this.gotoSection('shipping_method');
213
+ // } else {
214
+ // $('shipping:same_as_billing').checked = false;
215
+ // this.gotoSection('shipping');
216
+ // }
217
+ // this.reloadProgressBlock();
218
+ // //this.accordion.openNextSection(true);
219
+ },
220
+
221
+ setShipping: function() {
222
+ //this.nextStep();
223
+ this.gotoSection('shipping_method', true);
224
+ //this.accordion.openNextSection(true);
225
+ },
226
+
227
+ setShippingMethod: function() {
228
+ //this.nextStep();
229
+ this.gotoSection('payment', true);
230
+ //this.accordion.openNextSection(true);
231
+ },
232
+
233
+ setPayment: function() {
234
+ //this.nextStep();
235
+ this.gotoSection('review', true);
236
+ //this.accordion.openNextSection(true);
237
+ },
238
+
239
+ setReview: function() {
240
+ this.reloadProgressBlock();
241
+ //this.nextStep();
242
+ //this.accordion.openNextSection(true);
243
+ },
244
+
245
+ back: function(){
246
+ if (this.loadWaiting) return;
247
+ //Navigate back to the previous available step
248
+ var stepIndex = this.steps.indexOf(this.currentStep);
249
+ var section = this.steps[--stepIndex];
250
+ var sectionElement = $('opc-' + section);
251
+
252
+ //Traverse back to find the available section. Ex Virtual product does not have shipping section
253
+ while (sectionElement === null && stepIndex > 0) {
254
+ --stepIndex;
255
+ section = this.steps[stepIndex];
256
+ sectionElement = $('opc-' + section);
257
+ }
258
+ this.changeSection('opc-' + section);
259
+ },
260
+
261
+ setStepResponse: function(response){
262
+ if (response.update_section) {
263
+ $('checkout-'+response.update_section.name+'-load').update(response.update_section.html);
264
+ }
265
+ if (response.allow_sections) {
266
+ response.allow_sections.each(function(e){
267
+ $('opc-'+e).addClassName('allow');
268
+ });
269
+ }
270
+
271
+ if(response.duplicateBillingInfo)
272
+ {
273
+ this.syncBillingShipping = true;
274
+ shipping.setSameAsBilling(true);
275
+ }
276
+
277
+ if (response.goto_section) {
278
+ this.gotoSection(response.goto_section, true);
279
+ return true;
280
+ }
281
+ if (response.redirect) {
282
+ location.href = response.redirect;
283
+ return true;
284
+ }
285
+ return false;
286
+ }
287
+ }
288
+
289
+ // billing
290
+ var Billing = Class.create();
291
+ Billing.prototype = {
292
+ initialize: function(form, addressUrl, saveUrl){
293
+ this.form = form;
294
+ if ($(this.form)) {
295
+ $(this.form).observe('submit', function(event){this.save();Event.stop(event);}.bind(this));
296
+ }
297
+ this.addressUrl = addressUrl;
298
+ this.saveUrl = saveUrl;
299
+ this.onAddressLoad = this.fillForm.bindAsEventListener(this);
300
+ this.onSave = this.nextStep.bindAsEventListener(this);
301
+ this.onComplete = this.resetLoadWaiting.bindAsEventListener(this);
302
+ },
303
+
304
+ setAddress: function(addressId){
305
+ if (addressId) {
306
+ request = new Ajax.Request(
307
+ this.addressUrl+addressId,
308
+ {method:'get', onSuccess: this.onAddressLoad, onFailure: checkout.ajaxFailure.bind(checkout)}
309
+ );
310
+ }
311
+ else {
312
+ this.fillForm(false);
313
+ }
314
+ },
315
+
316
+ newAddress: function(isNew){
317
+ if (isNew) {
318
+ this.resetSelectedAddress();
319
+ Element.show('billing-new-address-form');
320
+ } else {
321
+ Element.hide('billing-new-address-form');
322
+ }
323
+ },
324
+
325
+ resetSelectedAddress: function(){
326
+ var selectElement = $('billing-address-select')
327
+ if (selectElement) {
328
+ selectElement.value='';
329
+ }
330
+ },
331
+
332
+ fillForm: function(transport){
333
+ var elementValues = {};
334
+ if (transport && transport.responseText){
335
+ try{
336
+ elementValues = eval('(' + transport.responseText + ')');
337
+ }
338
+ catch (e) {
339
+ elementValues = {};
340
+ }
341
+ }
342
+ else{
343
+ this.resetSelectedAddress();
344
+ }
345
+ arrElements = Form.getElements(this.form);
346
+ for (var elemIndex in arrElements) {
347
+ if (arrElements[elemIndex].id) {
348
+ var fieldName = arrElements[elemIndex].id.replace(/^billing:/, '');
349
+ arrElements[elemIndex].value = elementValues[fieldName] ? elementValues[fieldName] : '';
350
+ if (fieldName == 'country_id' && billingForm){
351
+ billingForm.elementChildLoad(arrElements[elemIndex]);
352
+ }
353
+ }
354
+ }
355
+ },
356
+
357
+ setUseForShipping: function(flag) {
358
+ $('shipping:same_as_billing').checked = flag;
359
+ },
360
+
361
+ save: function(){
362
+ if (checkout.loadWaiting!=false) return;
363
+
364
+ var validator = new Validation(this.form);
365
+ if (validator.validate()) {
366
+ checkout.setLoadWaiting('billing');
367
+
368
+ // if ($('billing:use_for_shipping') && $('billing:use_for_shipping').checked) {
369
+ // $('billing:use_for_shipping').value=1;
370
+ // }
371
+
372
+ var request = new Ajax.Request(
373
+ this.saveUrl,
374
+ {
375
+ method: 'post',
376
+ onComplete: this.onComplete,
377
+ onSuccess: this.onSave,
378
+ onFailure: checkout.ajaxFailure.bind(checkout),
379
+ parameters: Form.serialize(this.form)
380
+ }
381
+ );
382
+ }
383
+ },
384
+
385
+ resetLoadWaiting: function(transport){
386
+ checkout.setLoadWaiting(false);
387
+ document.body.fire('billing-request:completed', {transport: transport});
388
+ },
389
+
390
+ /**
391
+ This method recieves the AJAX response on success.
392
+ There are 3 options: error, redirect or html with shipping options.
393
+ */
394
+ nextStep: function(transport){
395
+ if (transport && transport.responseText){
396
+ try{
397
+ response = eval('(' + transport.responseText + ')');
398
+ }
399
+ catch (e) {
400
+ response = {};
401
+ }
402
+ }
403
+
404
+ if (response.error){
405
+ if ((typeof response.message) == 'string') {
406
+ alert(response.message);
407
+ } else {
408
+ if (window.billingRegionUpdater) {
409
+ billingRegionUpdater.update();
410
+ }
411
+
412
+ alert(response.message.join("\n"));
413
+ }
414
+
415
+ return false;
416
+ }
417
+
418
+ checkout.setStepResponse(response);
419
+ payment.initWhatIsCvvListeners();
420
+ // DELETE
421
+ //alert('error: ' + response.error + ' / redirect: ' + response.redirect + ' / shipping_methods_html: ' + response.shipping_methods_html);
422
+ // This moves the accordion panels of one page checkout and updates the checkout progress
423
+ //checkout.setBilling();
424
+ }
425
+ }
426
+
427
+ // shipping
428
+ var Shipping = Class.create();
429
+ Shipping.prototype = {
430
+ initialize: function(form, addressUrl, saveUrl, methodsUrl){
431
+ this.form = form;
432
+ if ($(this.form)) {
433
+ $(this.form).observe('submit', function(event){this.save();Event.stop(event);}.bind(this));
434
+ }
435
+ this.addressUrl = addressUrl;
436
+ this.saveUrl = saveUrl;
437
+ this.methodsUrl = methodsUrl;
438
+ this.onAddressLoad = this.fillForm.bindAsEventListener(this);
439
+ this.onSave = this.nextStep.bindAsEventListener(this);
440
+ this.onComplete = this.resetLoadWaiting.bindAsEventListener(this);
441
+ },
442
+
443
+ setAddress: function(addressId){
444
+ if (addressId) {
445
+ request = new Ajax.Request(
446
+ this.addressUrl+addressId,
447
+ {method:'get', onSuccess: this.onAddressLoad, onFailure: checkout.ajaxFailure.bind(checkout)}
448
+ );
449
+ }
450
+ else {
451
+ this.fillForm(false);
452
+ }
453
+ },
454
+
455
+ newAddress: function(isNew){
456
+ if (isNew) {
457
+ this.resetSelectedAddress();
458
+ Element.show('shipping-new-address-form');
459
+ } else {
460
+ Element.hide('shipping-new-address-form');
461
+ }
462
+ shipping.setSameAsBilling(false);
463
+ },
464
+
465
+ resetSelectedAddress: function(){
466
+ var selectElement = $('shipping-address-select')
467
+ if (selectElement) {
468
+ selectElement.value='';
469
+ }
470
+ },
471
+
472
+ fillForm: function(transport){
473
+ var elementValues = {};
474
+ if (transport && transport.responseText){
475
+ try{
476
+ elementValues = eval('(' + transport.responseText + ')');
477
+ }
478
+ catch (e) {
479
+ elementValues = {};
480
+ }
481
+ }
482
+ else{
483
+ this.resetSelectedAddress();
484
+ }
485
+ arrElements = Form.getElements(this.form);
486
+ for (var elemIndex in arrElements) {
487
+ if (arrElements[elemIndex].id) {
488
+ var fieldName = arrElements[elemIndex].id.replace(/^shipping:/, '');
489
+ arrElements[elemIndex].value = elementValues[fieldName] ? elementValues[fieldName] : '';
490
+ if (fieldName == 'country_id' && shippingForm){
491
+ shippingForm.elementChildLoad(arrElements[elemIndex]);
492
+ }
493
+ }
494
+ }
495
+ },
496
+
497
+ setSameAsBilling: function(flag) {
498
+ $('shipping:same_as_billing').checked = flag;
499
+ // #5599. Also it hangs up, if the flag is not false
500
+ // $('billing:use_for_shipping_yes').checked = flag;
501
+ if (flag) {
502
+ this.syncWithBilling();
503
+ }
504
+ },
505
+
506
+ syncWithBilling: function () {
507
+ $('billing-address-select') && this.newAddress(!$('billing-address-select').value);
508
+ $('shipping:same_as_billing').checked = true;
509
+ if (!$('billing-address-select') || !$('billing-address-select').value) {
510
+ arrElements = Form.getElements(this.form);
511
+ for (var elemIndex in arrElements) {
512
+ if (arrElements[elemIndex].id) {
513
+ var sourceField = $(arrElements[elemIndex].id.replace(/^shipping:/, 'billing:'));
514
+ if (sourceField){
515
+ arrElements[elemIndex].value = sourceField.value;
516
+ }
517
+ }
518
+ }
519
+ //$('shipping:country_id').value = $('billing:country_id').value;
520
+ shippingRegionUpdater.update();
521
+ $('shipping:region_id').value = $('billing:region_id').value;
522
+ $('shipping:region').value = $('billing:region').value;
523
+ //shippingForm.elementChildLoad($('shipping:country_id'), this.setRegionValue.bind(this));
524
+ } else {
525
+ $('shipping-address-select').value = $('billing-address-select').value;
526
+ }
527
+ },
528
+
529
+ setRegionValue: function(){
530
+ $('shipping:region').value = $('billing:region').value;
531
+ },
532
+
533
+ save: function(){
534
+ if (checkout.loadWaiting!=false) return;
535
+ var validator = new Validation(this.form);
536
+ if (validator.validate()) {
537
+ checkout.setLoadWaiting('shipping');
538
+ var request = new Ajax.Request(
539
+ this.saveUrl,
540
+ {
541
+ method:'post',
542
+ onComplete: this.onComplete,
543
+ onSuccess: this.onSave,
544
+ onFailure: checkout.ajaxFailure.bind(checkout),
545
+ parameters: Form.serialize(this.form)
546
+ }
547
+ );
548
+ }
549
+ },
550
+
551
+ resetLoadWaiting: function(transport){
552
+ checkout.setLoadWaiting(false);
553
+ },
554
+
555
+ nextStep: function(transport){
556
+ if (transport && transport.responseText){
557
+ try{
558
+ response = eval('(' + transport.responseText + ')');
559
+ }
560
+ catch (e) {
561
+ response = {};
562
+ }
563
+ }
564
+ if (response.error){
565
+ if ((typeof response.message) == 'string') {
566
+ alert(response.message);
567
+ } else {
568
+ if (window.shippingRegionUpdater) {
569
+ shippingRegionUpdater.update();
570
+ }
571
+ alert(response.message.join("\n"));
572
+ }
573
+
574
+ return false;
575
+ }
576
+
577
+ checkout.setStepResponse(response);
578
+
579
+ /*
580
+ var updater = new Ajax.Updater(
581
+ 'checkout-shipping-method-load',
582
+ this.methodsUrl,
583
+ {method:'get', onSuccess: checkout.setShipping.bind(checkout)}
584
+ );
585
+ */
586
+ //checkout.setShipping();
587
+ }
588
+ }
589
+
590
+ // shipping method
591
+ var ShippingMethod = Class.create();
592
+ ShippingMethod.prototype = {
593
+ initialize: function(form, saveUrl){
594
+ this.form = form;
595
+ if ($(this.form)) {
596
+ $(this.form).observe('submit', function(event){this.save();Event.stop(event);}.bind(this));
597
+ }
598
+ this.saveUrl = saveUrl;
599
+ this.validator = new Validation(this.form);
600
+ this.onSave = this.nextStep.bindAsEventListener(this);
601
+ this.onComplete = this.resetLoadWaiting.bindAsEventListener(this);
602
+ },
603
+
604
+ validate: function() {
605
+ var methods = document.getElementsByName('shipping_method');
606
+ if (methods.length==0) {
607
+ alert(Translator.translate('Your order cannot be completed at this time as there is no shipping methods available for it. Please make necessary changes in your shipping address.').stripTags());
608
+ return false;
609
+ }
610
+
611
+ if(!this.validator.validate()) {
612
+ return false;
613
+ }
614
+
615
+ for (var i=0; i<methods.length; i++) {
616
+ if (methods[i].checked) {
617
+ return true;
618
+ }
619
+ }
620
+ alert(Translator.translate('Please specify shipping method.').stripTags());
621
+ return false;
622
+ },
623
+
624
+ save: function(){
625
+
626
+ if (checkout.loadWaiting!=false) return;
627
+ if (this.validate()) {
628
+ checkout.setLoadWaiting('shipping-method');
629
+ var request = new Ajax.Request(
630
+ this.saveUrl,
631
+ {
632
+ method:'post',
633
+ onComplete: this.onComplete,
634
+ onSuccess: this.onSave,
635
+ onFailure: checkout.ajaxFailure.bind(checkout),
636
+ parameters: Form.serialize(this.form)
637
+ }
638
+ );
639
+ }
640
+ },
641
+
642
+ resetLoadWaiting: function(transport){
643
+ checkout.setLoadWaiting(false);
644
+ },
645
+
646
+ nextStep: function(transport){
647
+ if (transport && transport.responseText){
648
+ try{
649
+ response = eval('(' + transport.responseText + ')');
650
+ }
651
+ catch (e) {
652
+ response = {};
653
+ }
654
+ }
655
+
656
+ if (response.error) {
657
+ alert(response.message);
658
+ return false;
659
+ }
660
+
661
+ if (response.update_section) {
662
+ $('checkout-'+response.update_section.name+'-load').update(response.update_section.html);
663
+ }
664
+
665
+ payment.initWhatIsCvvListeners();
666
+
667
+ if (response.goto_section) {
668
+ checkout.gotoSection(response.goto_section, true);
669
+ checkout.reloadProgressBlock();
670
+ return;
671
+ }
672
+
673
+ if (response.payment_methods_html) {
674
+ $('checkout-payment-method-load').update(response.payment_methods_html);
675
+ }
676
+
677
+ checkout.setShippingMethod();
678
+ }
679
+ }
680
+
681
+
682
+ // payment
683
+ var Payment = Class.create();
684
+ Payment.prototype = {
685
+ beforeInitFunc:$H({}),
686
+ afterInitFunc:$H({}),
687
+ beforeValidateFunc:$H({}),
688
+ afterValidateFunc:$H({}),
689
+ initialize: function(form, saveUrl){
690
+ this.form = form;
691
+ this.saveUrl = saveUrl;
692
+ this.onSave = this.nextStep.bindAsEventListener(this);
693
+ this.onComplete = this.resetLoadWaiting.bindAsEventListener(this);
694
+ },
695
+
696
+ addBeforeInitFunction : function(code, func) {
697
+ this.beforeInitFunc.set(code, func);
698
+ },
699
+
700
+ beforeInit : function() {
701
+ (this.beforeInitFunc).each(function(init){
702
+ (init.value)();;
703
+ });
704
+ },
705
+
706
+ init : function () {
707
+ this.beforeInit();
708
+ var elements = Form.getElements(this.form);
709
+ if ($(this.form)) {
710
+ $(this.form).observe('submit', function(event){this.save();Event.stop(event);}.bind(this));
711
+ }
712
+ var method = null;
713
+ for (var i=0; i<elements.length; i++) {
714
+ if (elements[i].name=='payment[method]') {
715
+ if (elements[i].checked) {
716
+ method = elements[i].value;
717
+ }
718
+ } else {
719
+ elements[i].disabled = true;
720
+ }
721
+ elements[i].setAttribute('autocomplete','off');
722
+ }
723
+ if (method) this.switchMethod(method);
724
+ this.afterInit();
725
+ },
726
+
727
+ addAfterInitFunction : function(code, func) {
728
+ this.afterInitFunc.set(code, func);
729
+ },
730
+
731
+ afterInit : function() {
732
+ (this.afterInitFunc).each(function(init){
733
+ (init.value)();
734
+ });
735
+ },
736
+
737
+ switchMethod: function(method){
738
+ if (this.currentMethod && $('payment_form_'+this.currentMethod)) {
739
+ this.changeVisible(this.currentMethod, true);
740
+ $('payment_form_'+this.currentMethod).fire('payment-method:switched-off', {method_code : this.currentMethod});
741
+ }
742
+ if ($('payment_form_'+method)){
743
+ this.changeVisible(method, false);
744
+ $('payment_form_'+method).fire('payment-method:switched', {method_code : method});
745
+ } else {
746
+ //Event fix for payment methods without form like "Check / Money order"
747
+ document.body.fire('payment-method:switched', {method_code : method});
748
+ }
749
+ if (method) {
750
+ this.lastUsedMethod = method;
751
+ }
752
+ this.currentMethod = method;
753
+ },
754
+
755
+ changeVisible: function(method, mode) {
756
+ var block = 'payment_form_' + method;
757
+ [block + '_before', block, block + '_after'].each(function(el) {
758
+ element = $(el);
759
+ if (element) {
760
+ element.style.display = (mode) ? 'none' : '';
761
+ element.select('input', 'select', 'textarea', 'button').each(function(field) {
762
+ field.disabled = mode;
763
+ });
764
+ }
765
+ });
766
+ },
767
+
768
+ addBeforeValidateFunction : function(code, func) {
769
+ this.beforeValidateFunc.set(code, func);
770
+ },
771
+
772
+ beforeValidate : function() {
773
+ var validateResult = true;
774
+ var hasValidation = false;
775
+ (this.beforeValidateFunc).each(function(validate){
776
+ hasValidation = true;
777
+ if ((validate.value)() == false) {
778
+ validateResult = false;
779
+ }
780
+ }.bind(this));
781
+ if (!hasValidation) {
782
+ validateResult = false;
783
+ }
784
+ return validateResult;
785
+ },
786
+
787
+ validate: function() {
788
+ var result = this.beforeValidate();
789
+ if (result) {
790
+ return true;
791
+ }
792
+ var methods = document.getElementsByName('payment[method]');
793
+ if (methods.length==0) {
794
+ alert(Translator.translate('Your order cannot be completed at this time as there is no payment methods available for it.').stripTags());
795
+ return false;
796
+ }
797
+ for (var i=0; i<methods.length; i++) {
798
+ if (methods[i].checked) {
799
+ return true;
800
+ }
801
+ }
802
+ result = this.afterValidate();
803
+ if (result) {
804
+ return true;
805
+ }
806
+ alert(Translator.translate('Please specify payment method.').stripTags());
807
+ return false;
808
+ },
809
+
810
+ addAfterValidateFunction : function(code, func) {
811
+ this.afterValidateFunc.set(code, func);
812
+ },
813
+
814
+ afterValidate : function() {
815
+ var validateResult = true;
816
+ var hasValidation = false;
817
+ (this.afterValidateFunc).each(function(validate){
818
+ hasValidation = true;
819
+ if ((validate.value)() == false) {
820
+ validateResult = false;
821
+ }
822
+ }.bind(this));
823
+ if (!hasValidation) {
824
+ validateResult = false;
825
+ }
826
+ return validateResult;
827
+ },
828
+
829
+ save: function(){
830
+ if (checkout.loadWaiting!=false) return;
831
+ var validator = new Validation(this.form);
832
+ if (this.validate() && validator.validate()) {
833
+ checkout.setLoadWaiting('payment');
834
+ var request = new Ajax.Request(
835
+ this.saveUrl,
836
+ {
837
+ method:'post',
838
+ onComplete: this.onComplete,
839
+ onSuccess: this.onSave,
840
+ onFailure: checkout.ajaxFailure.bind(checkout),
841
+ parameters: Form.serialize(this.form)
842
+ }
843
+ );
844
+ }
845
+ },
846
+
847
+ resetLoadWaiting: function(){
848
+ checkout.setLoadWaiting(false);
849
+ },
850
+
851
+ nextStep: function(transport){
852
+ if (transport && transport.responseText){
853
+ try{
854
+ response = eval('(' + transport.responseText + ')');
855
+ }
856
+ catch (e) {
857
+ response = {};
858
+ }
859
+ }
860
+ /*
861
+ * if there is an error in payment, need to show error message
862
+ */
863
+ if (response.error) {
864
+ if (response.fields) {
865
+ var fields = response.fields.split(',');
866
+ for (var i=0;i<fields.length;i++) {
867
+ var field = null;
868
+ if (field = $(fields[i])) {
869
+ Validation.ajaxError(field, response.error);
870
+ }
871
+ }
872
+ return;
873
+ }
874
+ alert(response.error);
875
+ return;
876
+ }
877
+
878
+ checkout.setStepResponse(response);
879
+
880
+ //checkout.setPayment();
881
+ },
882
+
883
+ initWhatIsCvvListeners: function(){
884
+ $$('.cvv-what-is-this').each(function(element){
885
+ Event.observe(element, 'click', toggleToolTip);
886
+ });
887
+ }
888
+ }
889
+
890
+ var Review = Class.create();
891
+ Review.prototype = {
892
+ initialize: function(saveUrl, successUrl, agreementsForm){
893
+ this.saveUrl = saveUrl;
894
+ this.successUrl = successUrl;
895
+ this.agreementsForm = agreementsForm;
896
+ this.onSave = this.nextStep.bindAsEventListener(this);
897
+ this.onComplete = this.resetLoadWaiting.bindAsEventListener(this);
898
+ },
899
+
900
+ save: function(){
901
+ if (checkout.loadWaiting!=false) return;
902
+ checkout.setLoadWaiting('review');
903
+ var params = Form.serialize(payment.form);
904
+ if (this.agreementsForm) {
905
+ params += '&'+Form.serialize(this.agreementsForm);
906
+ }
907
+ params.save = true;
908
+ var request = new Ajax.Request(
909
+ this.saveUrl,
910
+ {
911
+ method:'post',
912
+ parameters:params,
913
+ onComplete: this.onComplete,
914
+ onSuccess: this.onSave,
915
+ onFailure: checkout.ajaxFailure.bind(checkout)
916
+ }
917
+ );
918
+ },
919
+
920
+ resetLoadWaiting: function(transport){
921
+ checkout.setLoadWaiting(false, this.isSuccess);
922
+ },
923
+
924
+ nextStep: function(transport){
925
+ if (transport && transport.responseText) {
926
+ try{
927
+ response = eval('(' + transport.responseText + ')');
928
+ }
929
+ catch (e) {
930
+ response = {};
931
+ }
932
+ if (response.redirect) {
933
+ this.isSuccess = true;
934
+ location.href = response.redirect;
935
+ return;
936
+ }
937
+ if (response.success) {
938
+ this.isSuccess = true;
939
+ window.location=this.successUrl;
940
+ }
941
+ else{
942
+ var msg = response.error_messages;
943
+ if (typeof(msg)=='object') {
944
+ msg = msg.join("\n");
945
+ }
946
+ if (msg) {
947
+ alert(msg);
948
+ }
949
+ }
950
+
951
+ if (response.update_section) {
952
+ $('checkout-'+response.update_section.name+'-load').update(response.update_section.html);
953
+ }
954
+
955
+ if (response.goto_section) {
956
+ checkout.gotoSection(response.goto_section, true);
957
+ }
958
+ }
959
+ },
960
+
961
+ isSuccess: false
962
+ }
skin/frontend/base/default/lib/prototype/windows/themes/magento.css ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Magento
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the Academic Free License (AFL 3.0)
7
+ * that is bundled with this package in the file LICENSE_AFL.txt.
8
+ * It is also available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/afl-3.0.php
10
+ * If you did not receive a copy of the license and are unable to
11
+ * obtain it through the world-wide-web, please send an email
12
+ * to license@magentocommerce.com so we can send you a copy immediately.
13
+ *
14
+ * DISCLAIMER
15
+ *
16
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
17
+ * versions in the future. If you wish to customize Magento for your
18
+ * needs please refer to http://www.magentocommerce.com for more information.
19
+ *
20
+ * @category design
21
+ * @package base_default
22
+ * @copyright Copyright (c) 2014 Magento Inc. (http://www.magentocommerce.com)
23
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
24
+ */
25
+ .dialog { border:1px solid #555; }
26
+ .dialog .bot { display:none !important; }
27
+ .overlay_magento { background-color:#000; filter:alpha(opacity=60); -moz-opacity:.6; opacity:.6; -webkit-opacity:.6; }
28
+ .top.table_window { border-bottom:1px solid #e6e6e6; background:#6a838b url(magento/top_bg.gif) 0 100% repeat-x; }
29
+
30
+ .magento_nw { width:6px; height:28px; }
31
+ .magento_n { height:28px; }
32
+ .magento_ne { width:6px; height:28px; }
33
+
34
+ .magento_w { width:6px; }
35
+ .magento_e { width:6px; }
36
+ .magento_w,
37
+ .magento_e,
38
+ .magento_content { background: #fafafa url(magento/content_bg.gif) 0 0 repeat-x; }
39
+
40
+ .magento_sw { background:#deebf0; width:5px; height:3px; }
41
+ .magento_s { background:#deebf0; height:3px; }
42
+ .magento_se,
43
+
44
+ .magento_sizer { background:#deebf0; width:5px; height:3px; }
45
+ .magento_sizer { cursor:se-resize; }
46
+
47
+ .magento_close { width:16px; height:16px; background:url(magento/window_close.png) no-repeat 0 0; position:absolute; top:5px; right:7px; cursor:pointer; z-index:1000; }
48
+ .magento_minimize { width:16px; height:16px; background:url(magento/window_minimize.png) 0 0 no-repeat; position:absolute; top:5px; right:28px; cursor:pointer; z-index:1000; }
49
+ .magento_maximize { width:16px; height:16px; background:url(magento/window_maximize.png)0 0 no-repeat; position:absolute; top:5px; right:49px; cursor:pointer; z-index:1000; }
50
+
51
+ .magento_title { float:left; width:100%; font:bold 12px/28px Arial, Helvetica, sans-serif; color:#fff; text-align:left; }
52
+
53
+ .magento_content { overflow:auto; font-size:12px; }
54
+ .magento_content,
55
+ .magento_content label { color:#333; font-family:Arial, sans-serif; }
56
+
57
+ .magento_buttons { padding:10px; text-align:right; }
58
+ .magento_buttons input.button { border-width:1px; border-style:solid; border-color:#ed6502 #a04300 #a04300 #ed6502; background:#ffac47 url(magento/btn_bg.gif) 0 100% repeat-x; padding:0 7px 1px 7px; font:bold 12px/18px Arial, Helvetica, sans-serif; color:#fff; cursor:pointer; text-align:center; white-space:nowrap; }
59
+ .magento_buttons button.button span span span { display:inline; background:none; padding:0; height:auto; }
60
+
61
+ /* FOR IE */
62
+ * html .magento_close { background-image:none; filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/magento/window_maximize.png", sizingMethod="crop"); }
63
+ * html .magento_minimize { background-image:none; filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/magento/window_close.png", sizingMethod="crop");}
64
+ * html .magento_maximize { background-image:none; filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/magento/window_minimize.png", sizingMethod="crop"); }
skin/frontend/base/default/lib/prototype/windows/themes/magento/btn_bg.gif ADDED
Binary file
skin/frontend/base/default/lib/prototype/windows/themes/magento/content_bg.gif ADDED
Binary file
skin/frontend/base/default/lib/prototype/windows/themes/magento/top_bg.gif ADDED
Binary file
skin/frontend/base/default/lib/prototype/windows/themes/magento/window_close.png ADDED
Binary file