Skip to content

Commit

Permalink
Merge branch 'master' into hotfix/PAOP-185-improve-response-log
Browse files Browse the repository at this point in the history
  • Loading branch information
yanpantoja committed Jul 30, 2021
2 parents 0330928 + d0b65d2 commit 9c3d25a
Show file tree
Hide file tree
Showing 12 changed files with 103 additions and 164 deletions.
14 changes: 0 additions & 14 deletions Api/CustomerCreateManagementInterface.php

This file was deleted.

2 changes: 1 addition & 1 deletion Concrete/integrityData

Large diffs are not rendered by default.

33 changes: 3 additions & 30 deletions Controller/Adminhtml/Plans/Create.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,12 @@

namespace MundiPagg\MundiPagg\Controller\Adminhtml\Plans;

use Magento\Backend\App\Action;
use Magento\Backend\App\Action\Context;
use Magento\Framework\Registry;
use Magento\Framework\View\Result\PageFactory;
use MundiPagg\MundiPagg\Controller\Adminhtml\Plans\PlanAction;
use Mundipagg\Core\Recurrence\Aggregates\Plan;
use Mundipagg\Core\Recurrence\Repositories\PlanRepository;
use Mundipagg\Core\Recurrence\Services\PlanService;

class Create extends Action
class Create extends PlanAction
{
protected $resultPageFactory = false;
/**
* @var ProductsPlanFactory
*/
private $productsPlanFactory;

/**
* Constructor
*
* @param Context $context
* @param PageFactory $resultPageFactory
* @param Registry $coreRegistry
*/
public function __construct(
Context $context,
PageFactory $resultPageFactory,
Registry $coreRegistry
) {
parent::__construct($context);
$this->resultPageFactory = $resultPageFactory;
$this->coreRegistry = $coreRegistry;
}

/**
* Index action
*
Expand All @@ -43,7 +16,7 @@ public function __construct(
public function execute()
{
$planId = (int) $this->getRequest()->getParam('id');
if($planId) {
if ($planId) {
//@todo this should be a product plan core object
$planService = new PlanService();
$planData = $planService->findById($planId);
Expand Down
40 changes: 2 additions & 38 deletions Controller/Adminhtml/Plans/Delete.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -2,47 +2,11 @@

namespace MundiPagg\MundiPagg\Controller\Adminhtml\Plans;

use Magento\Backend\App\Action;
use Magento\Backend\App\Action\Context;
use Magento\Framework\Message\Factory;
use Magento\Framework\Registry;
use Magento\Framework\View\Result\PageFactory;
use MundiPagg\MundiPagg\Controller\Adminhtml\Plans\PlanAction;
use Mundipagg\Core\Recurrence\Services\PlanService;
use Mundipagg\Core\Recurrence\Services\ProductSubscriptionService;
use MundiPagg\MundiPagg\Concrete\Magento2CoreSetup;
use MundiPagg\MundiPagg\Model\ProductsSubscriptionFactory;

class Delete extends Action
class Delete extends PlanAction
{
protected $resultPageFactory;

/**
* @var Registry
*/
protected $coreRegistry;

/**
* Constructor
*
* @param \Magento\Backend\App\Action\Context $context
* @param \Magento\Framework\View\Result\PageFactory $resultPageFactory
* @throws \Exception
*/
public function __construct(
\Magento\Backend\App\Action\Context $context,
\Magento\Framework\View\Result\PageFactory $resultPageFactory,
Registry $coreRegistry,
Factory $messageFactory
)
{
$this->resultPageFactory = $resultPageFactory;
$this->coreRegistry = $coreRegistry;
$this->messageFactory = $messageFactory;
Magento2CoreSetup::bootstrap();

parent::__construct($context);
}

/**
* Index action
*
Expand Down
24 changes: 3 additions & 21 deletions Controller/Adminhtml/Plans/Index.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,10 @@

namespace MundiPagg\MundiPagg\Controller\Adminhtml\Plans;

use Magento\Backend\App\Action;
use Magento\Backend\App\Action\Context;
use Magento\Framework\View\Result\PageFactory;
use MundiPagg\MundiPagg\Controller\Adminhtml\Plans\PlanAction;

class Index extends Action
class Index extends PlanAction
{
protected $resultPageFactory = false;

/**
* Constructor
*
* @param Context $context
* @param PageFactory $resultPageFactory
*/
public function __construct(
Context $context,
PageFactory $resultPageFactory
) {
$this->resultPageFactory = $resultPageFactory;
parent::__construct($context);
}

/**
* Index action
*
Expand All @@ -33,7 +15,7 @@ public function execute()
{
$resultPage = $this->resultPageFactory->create();
$resultPage->getConfig()->getTitle()->prepend(__("Plans"));

return $resultPage;
}
}
86 changes: 86 additions & 0 deletions Controller/Adminhtml/Plans/PlanAction.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
<?php

namespace MundiPagg\MundiPagg\Controller\Adminhtml\Plans;

use Magento\Backend\App\Action;
use Magento\Backend\App\Action\Context;
use Magento\Framework\Registry;
use Magento\Framework\View\Result\PageFactory;
use Magento\Framework\Controller\Result\JsonFactory;
use MundiPagg\MundiPagg\Concrete\Magento2CoreSetup;
use Magento\Framework\Message\Factory;
use Magento\Catalog\Model\ResourceModel\Product\CollectionFactory;
use MundiPagg\MundiPagg\Helper\ProductHelper;
use Magento\Store\Model\StoreManagerInterface;

class PlanAction extends Action
{

protected $resultPageFactory = false;
/**
* @var CollectionFactory
*/
protected $productCollectionFactory;
/**
* @var JsonFactory
*/
protected $resultJsonFactory;
/**
* @var ProductHelper
*/
protected $productHelper;
/**
* @var Registry
*/
protected $coreRegistry;
/**
* @var Factory
*/
protected $messageFactory;


/**
* Constructor
*
* @param Context $context
* @param PageFactory $resultPageFactory
* @param Registry $coreRegistry
*/
public function __construct(
Context $context,
PageFactory $resultPageFactory,
Registry $coreRegistry,
Factory $messageFactory,
CollectionFactory $productCollectionFactory,
JsonFactory $resultJsonFactory,
ProductHelper $productHelper,
StoreManagerInterface $storeManager
) {
parent::__construct($context);

$this->resultPageFactory = $resultPageFactory;
$this->coreRegistry = $coreRegistry;
$this->messageFactory = $messageFactory;
$this->productHelper = $productHelper;
$this->productCollectionFactory = $productCollectionFactory;
$this->resultJsonFactory = $resultJsonFactory;
$this->storeManager = $storeManager;

$this->bootstrapDefaultStoreConfigurations();
}

/**
* @return \Magento\Framework\Controller\ResultInterface
*/
public function execute()
{
}

private function bootstrapDefaultStoreConfigurations()
{
$defaultStoreId = Magento2CoreSetup::getDefaultStoreId();
$this->storeManager->setCurrentStore($defaultStoreId);

Magento2CoreSetup::bootstrap();
}
}
52 changes: 5 additions & 47 deletions Controller/Adminhtml/Plans/SearchProduct.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -2,59 +2,17 @@

namespace MundiPagg\MundiPagg\Controller\Adminhtml\Plans;

use Magento\Backend\App\Action;
use Magento\Backend\App\Action\Context;
use Magento\Catalog\Model\ResourceModel\Product\CollectionFactory;

use MundiPagg\MundiPagg\Controller\Adminhtml\Plans\PlanAction;
use Magento\Framework\App\ObjectManager;
use Magento\Framework\Controller\Result\JsonFactory;
use Magento\Framework\View\Result\PageFactory;
use Mundipagg\Core\Kernel\Services\MoneyService;
use Mundipagg\Core\Recurrence\Aggregates\Plan;
use Mundipagg\Core\Recurrence\Aggregates\ProductSubscription;
use Mundipagg\Core\Recurrence\Services\PlanService;
use Mundipagg\Core\Recurrence\Services\ProductSubscriptionService;
use MundiPagg\MundiPagg\Concrete\Magento2CoreSetup;
use MundiPagg\MundiPagg\Helper\ProductHelper;

class SearchProduct extends Action
class SearchProduct extends PlanAction
{
protected $resultPageFactory = false;
/**
* @var CollectionFactory
*/
protected $productCollectionFactory;
/**
* @var JsonFactory
*/
protected $resultJsonFactory;
/**
* @var ProductHelper
*/
protected $productHelper;

/**
* Constructor
*
* @param Context $context
* @param PageFactory $resultPageFactory
* @param CollectionFactory $productCollectionFactory
* @param JsonFactory $resultJsonFactory
*/
public function __construct(
Context $context,
PageFactory $resultPageFactory,
CollectionFactory $productCollectionFactory,
JsonFactory $resultJsonFactory,
ProductHelper $productHelper
) {
parent::__construct($context);
$this->resultPageFactory = $resultPageFactory;
$this->productCollectionFactory = $productCollectionFactory;
$this->resultJsonFactory = $resultJsonFactory;
$this->productHelper = $productHelper;
Magento2CoreSetup::bootstrap();
}

/**
* Index action
*
Expand All @@ -72,7 +30,7 @@ public function execute()
$product = $objectManager->get('\Magento\Catalog\Model\Product')
->load($productId);

if (empty($product) ) {
if (empty($product)) {
return;
}

Expand Down Expand Up @@ -229,4 +187,4 @@ public function getRecurrenceService($recurrenceType)
}
return new ProductSubscriptionService();
}
}
}
2 changes: 1 addition & 1 deletion Model/Api/ProductsPlan.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ class ProductsPlan implements ProductPlanApiInterface

public function __construct(Request $request)
{
Magento2CoreSetup::bootstrap();
$this->request = $request;
$this->planService = new PlanService();
Magento2CoreSetup::bootstrap();
}

/**
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "mundipagg/mundipagg-magento2-module",
"license": "MIT",
"version": "2.11.0",
"version": "2.11.2",
"type": "magento2-module",
"description": "Magento 2 Module Mundipagg",
"require": {
Expand Down
1 change: 0 additions & 1 deletion etc/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
<preference for="MundiPagg\MundiPagg\Api\WebhookManagementInterface" type="MundiPagg\MundiPagg\Model\WebhookManagement"/>
<preference for="MundiPagg\MundiPagg\Api\InstallmentsByBrandManagementInterface" type="MundiPagg\MundiPagg\Model\InstallmentsByBrandManagement"/>
<preference for="MundiPagg\MundiPagg\Api\InstallmentsByBrandAndAmountManagementInterface" type="MundiPagg\MundiPagg\Model\InstallmentsByBrandAndAmountManagement"/>
<preference for="MundiPagg\MundiPagg\Api\CustomerCreateManagementInterface" type="MundiPagg\MundiPagg\Model\CustomerCreateManagement" />

<preference for="MundiPagg\MundiPagg\Api\MaintenanceInterface"
type="MundiPagg\MundiPagg\Model\Maintenance"/>
Expand Down
2 changes: 1 addition & 1 deletion etc/module.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="MundiPagg_MundiPagg" setup_version="2.11.0">
<module name="MundiPagg_MundiPagg" setup_version="2.11.2">
<sequence>
<module name="Magento_Sales" />
<module name="Magento_Payment" />
Expand Down
9 changes: 0 additions & 9 deletions etc/webapi.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,6 @@
</resources>
</route>

<route url="/V1/mundipagg/customer/create" method="POST">
<service
class="MundiPagg\MundiPagg\Api\CustomerCreateManagementInterface"
method="createCustomer"/>
<resources>
<resource ref="anonymous"/>
</resources>
</route>

<route url="/V1/mundipagg/webhook" method="POST">
<service class="MundiPagg\MundiPagg\Api\WebhookManagementInterface"
method="save"/>
Expand Down

0 comments on commit 9c3d25a

Please sign in to comment.