-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #22 from mercadopago/release/1.9.0
Release v1.9.0
- Loading branch information
Showing
86 changed files
with
4,508 additions
and
222 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,5 @@ vendor | |
.phpunit.result.cache | ||
testdoc.txt | ||
.idea | ||
coverage/ | ||
coverage/ | ||
test-results |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
<?php | ||
/** | ||
* Copyright © MercadoPago. All rights reserved. | ||
* | ||
* @author Mercado Pago | ||
* @license See LICENSE for license details. | ||
*/ | ||
|
||
namespace MercadoPago\AdbPayment\Block\Sales\Form; | ||
|
||
use Magento\Backend\Model\Session\Quote; | ||
use Magento\Framework\View\Element\Template\Context; | ||
use MercadoPago\AdbPayment\Gateway\Config\Config; | ||
use MercadoPago\AdbPayment\Gateway\Config\ConfigYape; | ||
|
||
/** | ||
* Payment form block by YAPE. | ||
* | ||
* @SuppressWarnings(PHPMD.CamelCasePropertyName) | ||
*/ | ||
class Yape extends \Magento\Payment\Block\Form | ||
{ | ||
/** | ||
* YAPE template. | ||
* | ||
* @var string | ||
*/ | ||
protected $_template = 'MercadoPago_AdbPayment::form/yape.phtml'; | ||
|
||
/** | ||
* @var Config | ||
*/ | ||
protected $config; | ||
|
||
/** | ||
* @var ConfigYape | ||
*/ | ||
protected $configYape; | ||
|
||
/** | ||
* @var Quote | ||
*/ | ||
protected $sessionQuote; | ||
|
||
/** | ||
* @param Context $context | ||
* @param Config $config | ||
* @param ConfigYape $configYape | ||
* @param Quote $sessionQuote | ||
*/ | ||
public function __construct( | ||
Context $context, | ||
Config $config, | ||
ConfigYape $configYape, | ||
Quote $sessionQuote | ||
) { | ||
parent::__construct($context); | ||
$this->config = $config; | ||
$this->configYape = $configYape; | ||
$this->sessionQuote = $sessionQuote; | ||
} | ||
|
||
/** | ||
* Get Backend Session Quote. | ||
*/ | ||
public function getBackendSessionQuote() | ||
{ | ||
return $this->sessionQuote->getQuote(); | ||
} | ||
|
||
/** | ||
* Title. | ||
* | ||
* @return string | ||
*/ | ||
public function getTitle() | ||
{ | ||
$storeId = $this->getBackendSessionQuote()->getStoreId(); | ||
|
||
return $this->configYape->getTitle($storeId); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
/** | ||
* Copyright © MercadoPago. All rights reserved. | ||
* | ||
* @author Mercado Pago | ||
* @license See LICENSE for license details. | ||
*/ | ||
|
||
namespace MercadoPago\AdbPayment\Block\Sales\Info; | ||
|
||
use MercadoPago\AdbPayment\Block\Sales\Info\Info; | ||
|
||
|
||
/** | ||
* Payment details form block by Yape. | ||
* | ||
* @SuppressWarnings(PHPMD.CamelCaseMethodName) | ||
*/ | ||
class Yape extends Info | ||
{ | ||
/** | ||
* Yape Info template. | ||
* | ||
* @var string | ||
*/ | ||
protected $_template = 'MercadoPago_AdbPayment::info/yape/instructions.phtml'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
<?php | ||
/** | ||
* Copyright © MercadoPago. All rights reserved. | ||
* | ||
* @author Mercado Pago | ||
* @license See LICENSE for license details. | ||
*/ | ||
|
||
namespace MercadoPago\AdbPayment\Cron; | ||
|
||
use Magento\Framework\App\ResourceConnection; | ||
use Magento\Payment\Model\Method\Logger; | ||
use Magento\Sales\Model\Order; | ||
use Magento\Sales\Model\ResourceModel\Order\CollectionFactory; | ||
use MercadoPago\AdbPayment\Gateway\Config\ConfigYape; | ||
use MercadoPago\AdbPayment\Model\Console\Command\Notification\FetchStatus; | ||
|
||
/** | ||
* CronTab for fetch Yape Order Status. | ||
*/ | ||
class FetchYapeOrderStatus | ||
{ | ||
/** | ||
* @var Logger | ||
*/ | ||
protected $logger; | ||
|
||
/** | ||
* @var FetchStatus | ||
*/ | ||
protected $fetchStatus; | ||
|
||
/** | ||
* @var CollectionFactory | ||
*/ | ||
protected $collectionFactory; | ||
|
||
/** | ||
* @var ResourceConnection | ||
*/ | ||
protected $resource; | ||
|
||
/** | ||
* Constructor. | ||
* | ||
* @param Logger $logger | ||
* @param FetchStatus $fetchStatus | ||
* @param CollectionFactory $collectionFactory | ||
* @param ResourceConnection $resource; | ||
*/ | ||
public function __construct( | ||
Logger $logger, | ||
FetchStatus $fetchStatus, | ||
CollectionFactory $collectionFactory, | ||
ResourceConnection $resource | ||
) { | ||
$this->logger = $logger; | ||
$this->fetchStatus = $fetchStatus; | ||
$this->collectionFactory = $collectionFactory; | ||
$this->resource = $resource; | ||
} | ||
|
||
/** | ||
* Get sales_order_payment table name. | ||
* | ||
* @return string | ||
*/ | ||
public function getSalesOrderPaymentTableName() | ||
{ | ||
return $this->resource->getTableName('sales_order_payment'); | ||
} | ||
|
||
/** | ||
* Execute the cron. | ||
* | ||
* @return void | ||
*/ | ||
public function execute() | ||
{ | ||
$orders = $this->collectionFactory->create() | ||
->addFieldToFilter('state', Order::STATE_NEW); | ||
$orders->getSelect() | ||
->join( | ||
['sop' => $this->getSalesOrderPaymentTableName()], | ||
'main_table.entity_id = sop.parent_id', | ||
['method'] | ||
) | ||
->where('sop.method = ?', ConfigYape::METHOD); | ||
|
||
foreach ($orders as $order) { | ||
$orderId = $order->getEntityId(); | ||
|
||
$this->logger->debug([ | ||
'fetch' => 'Fetch Status Yape for Order Id '.$orderId, | ||
]); | ||
|
||
$this->fetchStatus->fetch($orderId); | ||
} | ||
} | ||
} |
Oops, something went wrong.