11<?php
2- /**
3- * Copyright 2015 Compropago.
4- *
5- * Licensed under the Apache License, Version 2.0 (the "License");
6- * you may not use this file except in compliance with the License.
7- * You may obtain a copy of the License at
8- *
9- * http://www.apache.org/licenses/LICENSE-2.0
10- *
11- * Unless required by applicable law or agreed to in writing, software
12- * distributed under the License is distributed on an "AS IS" BASIS,
13- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14- * See the License for the specific language governing permissions and
15- * limitations under the License.
16- */
17- /**
18- * Compropago $Library
19- * @author Eduardo Aguilar <eduardo.aguilar@compropago.com>
20- */
21- $ libcp = Mage::getBaseDir ('lib ' ) . DS . 'Compropago ' . DS . 'vendor ' . DS . 'autoload.php ' ;
22-
23- require_once $ libcp ;
2+
3+ require_once Mage::getBaseDir ('lib ' ) . DS . 'Compropago ' . DS . 'vendor ' . DS . 'autoload.php ' ;
244
255use CompropagoSdk \Client ;
266use CompropagoSdk \Factory \Factory ;
@@ -37,10 +17,12 @@ class Compropago_CpPayment_Model_Standard extends Mage_Payment_Model_Method_Abst
3717 protected $ _isInitializeNeeded = true ;
3818
3919 /**
40- * Asignacion inicial de informacion
20+ * Assing init data
4121 *
4222 * @param $data
4323 * @return $this
24+ *
25+ * @author Eduardo Aguilar <dante.aguilar41@gmail.com>
4426 */
4527 public function assignData ($ data )
4628 {
@@ -84,11 +66,13 @@ public function assignData($data)
8466 }
8567
8668 /**
87- * Generacion de la orden
69+ * Generate order
8870 *
8971 * @param $paymentAction
9072 * @param $stateObject
9173 * @return $this
74+ *
75+ * @author Eduardo Aguilar <dante.aguilar41@gmail.com>
9276 */
9377 public function initialize ($ paymentAction , $ stateObject )
9478 {
@@ -111,7 +95,6 @@ public function initialize($paymentAction, $stateObject)
11195
11296 $ quote = Mage::getSingleton ('checkout/session ' )->getQuote ($ quoteId );
11397 $ orderId = $ quote ->getReservedOrderId ();
114- $ shipping = $ quote ->getShippingAddress ();
11598
11699 $ order = Mage::getModel ('sales/order ' )->loadByIncrementId ($ orderId );
117100 $ grandTotal = (float )$ order ->getBaseGrandTotal ();
@@ -141,21 +124,11 @@ public function initialize($paymentAction, $stateObject)
141124 'customer_name ' => $ info ['customer_name ' ],
142125 'customer_email ' => $ info ['customer_email ' ],
143126 'payment_type ' => $ info ['payment_type ' ],
144- 'currency ' => Mage::app ()->getStore ()->getCurrentCurrencyCode (),
145- 'image_url ' => null ,
146127 'app_client_name ' => 'magento ' ,
147128 'app_client_version ' => Mage::getVersion (),
148- 'cp ' => $ shipping -> getData ( ' postcode ' )
129+ 'currency ' => Mage:: app ()-> getStore ()-> getCurrentCurrencyCode ( )
149130 );
150131
151- if (isset ($ info ['latitude ' ])) {
152- $ order_info ['latitude ' ] = $ info ['latitude ' ];
153- }
154-
155- if (isset ($ info ['longitude ' ])) {
156- $ order_info ['longitude ' ] = $ info ['longitude ' ];
157- }
158-
159132 $ order = Factory::getInstanceOf ('PlaceOrderInfo ' , $ order_info );
160133
161134 $ client = new Client (
@@ -206,7 +179,7 @@ public function initialize($paymentAction, $stateObject)
206179 'date ' => $ date ,
207180 'modified ' => $ date ,
208181 'compropagoId ' => $ response ->id ,
209- 'compropagoStatus ' => $ response ->status ,
182+ 'compropagoStatus ' => $ response ->type ,
210183 'storeCartId ' => $ orderNumber ,
211184 'storeOrderId ' => $ orderNumber ,
212185 'storeExtra ' => 'COMPROPAGO_PENDING ' ,
@@ -223,8 +196,8 @@ public function initialize($paymentAction, $stateObject)
223196 'orderId ' => $ orderNumber ,
224197 'date ' => $ date ,
225198 'compropagoId ' => $ response ->id ,
226- 'compropagoStatus ' => $ response ->status ,
227- 'compropagoStatusLast ' => $ response ->status ,
199+ 'compropagoStatus ' => $ response ->type ,
200+ 'compropagoStatusLast ' => $ response ->type ,
228201 'ioIn ' => $ ioin ,
229202 'ioOut ' => $ ioout
230203 );
@@ -238,9 +211,11 @@ public function initialize($paymentAction, $stateObject)
238211 }
239212
240213 /**
241- * Envio de proveedores filtrados a la vista
214+ * Obtain available providers
242215 *
243216 * @return array
217+ *
218+ * @author Eduardo Aguilar <dante.aguilar41@gmail.com>
244219 */
245220 public function getProviders ()
246221 {
@@ -270,10 +245,12 @@ public function getProviders()
270245 }
271246
272247 /**
273- * Esconde texto de titulo si se indico uso de logo
248+ * Get payment method title or image banner
249+ *
250+ * @param bool $isInfo
251+ * @return string
274252 *
275- * @param $isInfo
276- * @return mixed|string
253+ * @author Eduardo Aguilar <dante.aguilar41@gmail.com>
277254 */
278255 public function getTitle ($ isInfo = false )
279256 {
@@ -286,42 +263,31 @@ public function getTitle($isInfo = false)
286263 }
287264
288265 /**
289- * verificacion de muestra de logos
266+ * Verify if the plugin is allow to show image buttons for providers
290267 *
291268 * @return bool
269+ *
270+ * @author Eduardo Aguilar <dante.aguilar41@gmail.com>
292271 */
293272 public function showLogoProviders ()
294273 {
295274 return (int )trim ($ this ->getConfigData ("compropago_showlogo " )) == 1 ? true : false ;
296275 }
297276
298- /**
299- * Validate if have persion for obtain Glocation
300- *
301- * @return void
302- */
303- public function getGlocation ()
304- {
305- return (int )trim ($ this ->getConfigData ("compropago_gloaction " )) == 1 ? true : false ;
306- }
307277
308278 /**
309- * Despliegue de retroalimentacion en el panel de administración
279+ * Return warning messages after save configuration
310280 *
311- * @param bool $enabled
312- * @param string $publickey
313- * @param string $privatekey
314- * @param bool $live
281+ * @param $enabled
282+ * @param $publickey
283+ * @param $privatekey
284+ * @param $live
315285 * @return array
286+ *
287+ * @author Eduardo Aguilar <dante.aguilar41@gmail.com>
316288 */
317289 public function hookRetro ($ enabled , $ publickey , $ privatekey , $ live )
318290 {
319- $ error = array (
320- false ,
321- '' ,
322- 'yes '
323- );
324-
325291 if (!$ enabled ) {
326292 return array (
327293 true ,
0 commit comments