Skip to content

Commit

Permalink
Merge pull request #28 from EaDesgin/feature/MLC-246-Import-module-fr…
Browse files Browse the repository at this point in the history
…om-bitbucket

MLC-246: Import module from BitBucket
  • Loading branch information
mardeleanu authored Apr 1, 2020
2 parents 6ae3130 + ff7b87b commit 930ef37
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 16 deletions.
2 changes: 1 addition & 1 deletion Block/Adminhtml/Xtea/Edit/Tab/Curier.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use Eadesigndev\Awb\Model\Sources\PaymentMethod;
use Eadesigndev\Awb\Model\Sources\DeliveryPayment;
use Eadesigndev\Awb\Model\Sources\Tariff;
use Eadesigndev\Awb\Model\Sources\PickupId;
use Eadesigndev\Urgent\Model\Sources\PickupId;
use Eadesigndev\Awb\Model\Sources\InputType;
use Magento\Backend\Block\Template\Context;
use Magento\Backend\Block\Widget\Tab\TabInterface;
Expand Down
2 changes: 1 addition & 1 deletion Block/Adminhtml/Xtea/EditAwb.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,4 @@ public function _construct()
__('Delete Awb')
);
}
}
}
46 changes: 37 additions & 9 deletions Model/Sources/Tariff.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,56 @@

namespace Eadesigndev\Awb\Model\Sources;

use Eadesigndev\Urgent\Helper\ConnectUrgent;

/**
* Class Tariff
* @package Eadesigndev\Awb\ModelSource
*/
class Tariff extends AbstractSource
{
/**
* Tariff
* @var ConnectUrgent
*/
const ACT = 84828;
const MKT = 64252;
private $connectUrgent;

/**
* Tariff constructor.
* @param ConnectUrgent $connectUrgent
*/
public function __construct(
ConnectUrgent $connectUrgent
) {
$this->connectUrgent = $connectUrgent;
}

/**
* @param $array
* @param $key
* @param $value
* @return array
*/
public function getAvailable()
public function toOptionArrayReplaceList($array, $key, $value): ?array
{
$tariffPlan = [
self::ACT => __('Act Add 01.11.2018'),
self::MKT => __('Tarif MKT Place 5106'),
];
if (!empty($array)) {
$return = [];
foreach ($array as $element) {
$return[$element[$key]] = $element[$value];
}
return $return;
}
}

return $tariffPlan;
/**
* @return array
*/
public function getAvailable(): array
{
$connectUrgent = $this->connectUrgent;
$tariffPlan = $connectUrgent->connect('PriceTables', \Zend_Http_Client::GET);
if ($tariffPlan != '"Failed to authenticate!"') {
return $this->toOptionArrayReplaceList($tariffPlan, 'PriceTableId', 'Name');
}
return ['0'=> 'Failed to authenticate!'];
}
}
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "eadesignro/awb",
"description": "AWB module who manages parcel dispatches",
"type": "magento2-module",
"version": "1.1.9",
"version": "1.1.11",
"autoload": {
"files": [
"registration.php"
Expand All @@ -25,7 +25,7 @@
},

"require": {
"php": "~7.1.3|~7.2.0",
"php": "~7.1.3|~7.2.0|~7.3.0",
"magento/module-backend": "101.0.*",
"magento/module-sales": "102.0.*",
"magento/framework": "102.0.*",
Expand All @@ -42,4 +42,4 @@
},
"minimum-stability": "dev",
"prefer-stable": true
}
}
2 changes: 1 addition & 1 deletion etc/module.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0"?>

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Eadesigndev_Awb" setup_version="1.1.9"/>
<module name="Eadesigndev_Awb" setup_version="1.1.11"/>
</config>
2 changes: 1 addition & 1 deletion view/adminhtml/ui_component/awb_fields_listing.xml
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@
</column>
<column name="awb_pickup_id">
<argument name="data" xsi:type="array">
<item name="options" xsi:type="object">Eadesigndev\Awb\Model\Sources\PickupId</item>
<item name="options" xsi:type="object">Eadesigndev\Urgent\Model\Sources\PickupId</item>
<item name="config" xsi:type="array">
<item name="filter" xsi:type="string">select</item>
<item name="component" xsi:type="string">Magento_Ui/js/grid/columns/select</item>
Expand Down

0 comments on commit 930ef37

Please sign in to comment.