Skip to content
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

Merged
merged 17 commits into from
Sep 5, 2024

Conversation

tomkalon
Copy link
Contributor

@tomkalon tomkalon commented Aug 6, 2024

  • Added the ability to select package dimensions

Changing the dimensions of the package is possible until the export shipment is sent.

Przechwytywanie

@tomkalon tomkalon force-pushed the OP-319 branch 5 times, most recently from b97d4a0 to 73101a2 Compare August 6, 2024 13:56
@tomkalon tomkalon force-pushed the OP-319 branch 4 times, most recently from 972f3ff to a547dff Compare August 8, 2024 11:11
This was referenced Aug 9, 2024
@senghe senghe changed the base branch from main to feature/OP-374 August 13, 2024 08:20
Comment on lines 24 to 28
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
Copy link
Member

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.

Copy link
Contributor Author

@tomkalon tomkalon Aug 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok 👍
80cdcfb

Comment on lines 67 to 69
/**
* @throws \Exception
*/
Copy link
Member

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.

Suggested change
/**
* @throws \Exception
*/

Copy link
Contributor Author

@tomkalon tomkalon Aug 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK 👍
e161c2e

ShipmentInterface $shipment,
?ShippingExportInterface $shippingExport = null,
): array {
$this->shippingExport = $shippingExport;
Copy link
Member

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.

Copy link
Contributor Author

@tomkalon tomkalon Aug 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$weight = $shipment->getShippingWeight();
$template = 'large';
Copy link
Member

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.

Copy link
Contributor Author

@tomkalon tomkalon Aug 13, 2024

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

@@ -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;
Copy link
Member

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?

Copy link
Contributor Author

@tomkalon tomkalon Aug 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

route: sylius_shop_order_show
parameters:
tokenValue: resource.tokenValue
templates:
Copy link
Member

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...

Copy link
Contributor Author

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
Copy link
Member

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.

Copy link
Contributor Author

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
Copy link
Member

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?

Copy link
Contributor Author

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.

ebf8ae9

@senghe senghe changed the base branch from feature/OP-374 to main August 13, 2024 08:35
@senghe
Copy link
Member

senghe commented Aug 13, 2024

For CR purposes I've changed base branch to feature/OP-374 as it's the PR dependency. The current PR can be merged only when feature/OP-374 is merged.
After the CR I've reverted back the base branch to main.

Copy link
Member

@senghe senghe left a 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
Copy link
Member

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.

Copy link
Contributor Author

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.

shipping_method:
classes:
model: App\Entity\ShippingMethod

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

Copy link
Contributor Author

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.

Comment on lines 488 to 495
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'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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'
// ...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

Comment on lines 444 to 447
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'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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'
// ...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

Comment on lines 32 to 33


Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

Copy link
Contributor Author

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
Copy link
Member

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

Copy link
Contributor Author

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.

@tomkalon tomkalon force-pushed the OP-319 branch 3 times, most recently from c1c3d84 to fe10a65 Compare September 2, 2024 11:09
@senghe senghe merged commit 2047a12 into BitBagCommerce:main Sep 5, 2024
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants