Skip to content

Commit

Permalink
Merge pull request #84 from logeecom/master
Browse files Browse the repository at this point in the history
Release version 3.4.0
  • Loading branch information
jlrvilla authored May 20, 2024
2 parents 2232441 + 2a55501 commit 835d851
Show file tree
Hide file tree
Showing 53 changed files with 4,008 additions and 102 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).

## [3.3.21](https://github.com/packlink-dev/ecommerce_module_core/compare/v3.3.20...v3.3.21) - 2024-02-04
## [3.4.0](https://github.com/packlink-dev/ecommerce_module_core/compare/v3.3.21...v3.4.0) - 2024-05-20
### Added
- Added creating customs invoice in Packlink PRO

## [3.3.21](https://github.com/packlink-dev/ecommerce_module_core/compare/v3.3.20...v3.3.21) - 2024-04-02
### Changed
- Add unsupported countries Denmark, Norway, Saudi Arabia, Canada, Cyprus, Slovenia and Slovakia
- Add min-height property to lp-content class
Expand Down
10 changes: 10 additions & 0 deletions src/BusinessLogic/BootstrapComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
use Packlink\BusinessLogic\Country\Country;
use Packlink\BusinessLogic\Country\CountryService;
use Packlink\BusinessLogic\Country\WarehouseCountryService;
use Packlink\BusinessLogic\Customs\CustomsMapping;
use Packlink\BusinessLogic\Customs\CustomsService;
use Packlink\BusinessLogic\DTO\FrontDtoFactory;
use Packlink\BusinessLogic\DTO\ValidationError;
use Packlink\BusinessLogic\FileResolver\FileResolverService;
Expand Down Expand Up @@ -198,6 +200,13 @@ function () {
return new AutoTestService();
}
);

ServiceRegister::registerService(
CustomsService::CLASS_NAME,
function () {
return new CustomsService();
}
);
}

/**
Expand Down Expand Up @@ -235,5 +244,6 @@ protected static function initDtoRegistry()
FrontDtoFactory::register(RegistrationRequest::CLASS_KEY, RegistrationRequest::CLASS_NAME);
FrontDtoFactory::register(RegistrationLegalPolicy::CLASS_KEY, RegistrationLegalPolicy::CLASS_NAME);
FrontDtoFactory::register(ShippingPricePolicy::CLASS_KEY, ShippingPricePolicy::CLASS_NAME);
FrontDtoFactory::register(CustomsMapping::CLASS_KEY, CustomsMapping::CLASS_NAME);
}
}
26 changes: 26 additions & 0 deletions src/BusinessLogic/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Packlink\BusinessLogic;

use Packlink\BusinessLogic\Customs\CustomsMapping;
use Packlink\BusinessLogic\DTO\FrontDtoFactory;
use Packlink\BusinessLogic\Http\DTO\ParcelInfo;
use Packlink\BusinessLogic\Http\DTO\User;
Expand Down Expand Up @@ -260,6 +261,31 @@ public function getOrderStatusMappings()
return $this->getConfigValue('orderStatusMappings');
}

/**
* Sets customs mappings.
*
* @param CustomsMapping $mapping
*
* @return void
*/
public function setCustomsMappings(CustomsMapping $mapping)
{
$this->saveConfigValue('customsMappings', $mapping->toArray());
}

/**
* @return CustomsMapping|null
* @noinspection PhpDocMissingThrowsInspection
*/
public function getCustomsMappings()
{
$value = $this->getConfigValue('customsMappings');

/** @noinspection PhpIncompatibleReturnTypeInspection */
/** @noinspection PhpUnhandledExceptionInspection */
return $value && is_array($value) ? FrontDtoFactory::get(CustomsMapping::CLASS_KEY, $value) : null;
}

/**
* Sets a flag that module setup is finished.
*/
Expand Down
67 changes: 67 additions & 0 deletions src/BusinessLogic/Controllers/CustomsController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?php

namespace Packlink\BusinessLogic\Controllers;

use Packlink\BusinessLogic\Country\CountryCodes;
use Packlink\BusinessLogic\Customs\CustomsMapping;
use Packlink\BusinessLogic\Customs\CustomsMappingService;
use Packlink\BusinessLogic\DTO\Exceptions\FrontDtoNotRegisteredException;
use Packlink\BusinessLogic\DTO\Exceptions\FrontDtoValidationException;

/**
* Class CustomsController
*
* @package Packlink\BusinessLogic\Controllers
*/
class CustomsController
{
/**
* @var CustomsMappingService
*/
private $customService;

/**
* @param CustomsMappingService $customService
*/
public function __construct(CustomsMappingService $customService)
{
$this->customService = $customService;
}

/**
* @return CustomsMapping|null
*/
public function getData()
{
return $this->customService->getCustomsMappings();
}

/**
* @return array
*/
public function getAllCountries()
{
return CountryCodes::$countryCodes;
}

/**
* @return array
*/
public function getReceiverTaxIdOptions()
{
return $this->customService->getReceiverTaxIdOptions();
}

/**
* @param array $data
*
* @return void
*
* @throws FrontDtoNotRegisteredException
* @throws FrontDtoValidationException
*/
public function save($data)
{
$this->customService->updateCustomsMapping($data);
}
}
Loading

0 comments on commit 835d851

Please sign in to comment.