-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OP-319 Added the ability to select package dimensions #28
Conversation
# Conflicts: # src/Api/WebClient.php # src/EventListener/ShippingExportEventListener.php
b97d4a0
to
73101a2
Compare
972f3ff
to
a547dff
Compare
Scenario: Seeing shipments to export | ||
When I go to the shipping export page | ||
Then I should see 1 shipments with "New" state | ||
When I select parcel template | ||
Then I should see that shipping export parcel template is set |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seem to be two scenarios. I can approve this, as the scenario is not so complex, but the order of keywords should be at most: Given/When/Then and after then cannot be next Given/When.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok 👍
80cdcfb
/** | ||
* @throws \Exception | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We do not put @throws annotation.
/** | |
* @throws \Exception | |
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK 👍
e161c2e
src/Api/WebClient.php
Outdated
ShipmentInterface $shipment, | ||
?ShippingExportInterface $shippingExport = null, | ||
): array { | ||
$this->shippingExport = $shippingExport; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no need for putting this as a class property. You can put this into the dependent methods as a parameter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
src/Api/WebClient.php
Outdated
$weight = $shipment->getShippingWeight(); | ||
$template = 'large'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should put the value into container parameter, as it should be configurable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done 👍
Added ability to select default parcel_template and label_type to .env file.
7c1d315#diff-111b44afb58dab47072d0539bea02c838d1bfad316e7d5733f26853abd28a92e
src/Api/WebClientInterface.php
Outdated
@@ -78,7 +79,7 @@ public function getLabels(array $shipmentIds): ?string; | |||
|
|||
public function getAuthorizedHeaderWithContentType(): array; | |||
|
|||
public function createShipment(ShipmentInterface $shipment): array; | |||
public function createShipment(ShipmentInterface $shipment, ?ShippingExportInterface $shippingExport = null): array; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why there can be null?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed 👍
I took too timid an approach.
7c1d315#diff-111b44afb58dab47072d0539bea02c838d1bfad316e7d5733f26853abd28a92e
route: sylius_shop_order_show | ||
parameters: | ||
tokenValue: resource.tokenValue | ||
templates: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the reason of so many lines changed? I can't read what exactly was the logic change...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ctrl+ALt+L and changed for 4 spaces as tab.
My fault. I will remember for the future.
path: /admin/shipping_export/select_parcel_template/{id}/{template} | ||
methods: [POST, PUT] | ||
defaults: | ||
_controller: bitbag.controller.shipping_export::selectParcelTemplate |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could create separate controller for this with __invoke() method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
N/A 👍
classes: | ||
model: Tests\BitBag\SyliusInPostPlugin\Application\src\Entity\ShippingExport | ||
controller: BitBag\SyliusInPostPlugin\Controller\ShippingExportController |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this really needed? Do you override anything in ShippingExportController::exportSingleShipmentAction() or ShippingExportController::exportAllNewShipmentsAction() ? If yes, couldn't it be changed in any other place in the business logic?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The use of the ResourceController cannot be eliminated, hence the controller override has been moved from the plugin level, to the Sylius-Stanrdard level. Installation.md and tests/Application have been completed.
For CR purposes I've changed base branch to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm approving in advance. Please do the thing I asked you with ResourceController and you're free 🖖
use Symfony\Component\HttpFoundation\Session\Flash\FlashBagInterface; | ||
use Webmozart\Assert\Assert; | ||
|
||
final class ShippingExportController extends ResourceController |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would extend namespace BitBag\SyliusShippingExportPlugin\Controller\ShippingExportController
and remove the public methods from the listing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't extend ShippingExportController because it is a final class.
doc/installation.md
Outdated
shipping_method: | ||
classes: | ||
model: App\Entity\ShippingMethod | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed... and few other similar more.
doc/installation.md
Outdated
admin: | ||
json_manifest_path: '%kernel.project_dir%/public/build/admin/manifest.json' | ||
shop: | ||
json_manifest_path: '%kernel.project_dir%/public/build/shop/manifest.json' | ||
app.admin: | ||
json_manifest_path: '%kernel.project_dir%/public/build/app/admin/manifest.json' | ||
app.shop: | ||
json_manifest_path: '%kernel.project_dir%/public/build/app/shop/manifest.json' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
admin: | |
json_manifest_path: '%kernel.project_dir%/public/build/admin/manifest.json' | |
shop: | |
json_manifest_path: '%kernel.project_dir%/public/build/shop/manifest.json' | |
app.admin: | |
json_manifest_path: '%kernel.project_dir%/public/build/app/admin/manifest.json' | |
app.shop: | |
json_manifest_path: '%kernel.project_dir%/public/build/app/shop/manifest.json' | |
// ... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
doc/installation.md
Outdated
admin: '%kernel.project_dir%/public/build/admin' | ||
shop: '%kernel.project_dir%/public/build/shop' | ||
app.admin: '%kernel.project_dir%/public/build/app/admin' | ||
app.shop: '%kernel.project_dir%/public/build/app/shop' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
admin: '%kernel.project_dir%/public/build/admin' | |
shop: '%kernel.project_dir%/public/build/shop' | |
app.admin: '%kernel.project_dir%/public/build/app/admin' | |
app.shop: '%kernel.project_dir%/public/build/app/shop' | |
// ... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
spec/Api/WebClientSpec.php
Outdated
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
use Symfony\Component\HttpFoundation\Session\Flash\FlashBagInterface; | ||
use Webmozart\Assert\Assert; | ||
|
||
final class ShippingExportController extends ResourceController |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please do this as I asked you in README.md comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't extend ShippingExportController because it is a final class.
c1c3d84
to
fe10a65
Compare
Changing the dimensions of the package is possible until the export shipment is sent.