Skip to content

Updates for one shipment per oder#7

Merged
mateusz-kaczmarek-paysera merged 26 commits into
paysera:mainfrom
a-zagroba:main
May 15, 2026
Merged

Updates for one shipment per oder#7
mateusz-kaczmarek-paysera merged 26 commits into
paysera:mainfrom
a-zagroba:main

Conversation

@a-zagroba

Copy link
Copy Markdown
Contributor

Body:

Summary

  • Single-shipment-per-order mode now uses the merchant's default parcel
    dimensions/weight from settings instead of summing every item's
    dimensions (which produced unrealistic shipment sizes).
  • Extended PayseraDeliverySettingsInterface with
    getDefaultParcelWidth/Height/Length/Weight().
  • ShipmentsAdapter::convert() now takes the full
    PayseraDeliverySettingsInterface instead of a bool flag, so it can
    read both the toggle and the default parcel size from one source.
  • Bumped to 0.5.0 and updated CHANGELOG.md.

Changes

  • src/Adapter/ShipmentsAdapter.phpcreateSingleShipment() reads
    defaults from settings; signature of convert() updated.
  • src/Adapter/OrderCreateRequestAdapter.php,
    src/Adapter/OrderUpdateRequestAdapter.php — pass DeliverySettings
    to ShipmentsAdapter::convert().
  • src/Entity/PayseraDeliverySettingsInterface.php — 4 new getters.
  • tests/Adapter/ShipmentsAdapterTest.php — updated to new signature
    and asserts the parcel uses the defaults from settings.

Breaking changes

ShipmentsAdapter::convert() signature changed from
(OrderItemsCollection, bool) to
(OrderItemsCollection, PayseraDeliverySettingsInterface).
Any implementer of PayseraDeliverySettingsInterface must add the four
new getDefaultParcel*() methods.

Test plan

  • composer test (PHPUnit) passes
  • PHPStan / CS-Fixer clean
  • Manual: order placed with single-shipment toggle ON produces one
    shipment with the merchant's default parcel dimensions
  • Manual: toggle OFF still creates one shipment per item

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request updates the shipment creation logic to use merchant-defined default parcel dimensions for single-shipment orders instead of summing individual item dimensions. Key changes include updates to the ShipmentsAdapter, the PayseraDeliverySettingsInterface, and the corresponding request adapters. Feedback from the review suggests adding a check to prevent creating shipments for empty orders in single-shipment mode and improving PHPDoc documentation for better static analysis.

Comment thread src/Adapter/ShipmentsAdapter.php
Comment thread src/Adapter/ShipmentsAdapter.php
@mateusz-kaczmarek-paysera mateusz-kaczmarek-paysera merged commit 51ec7f4 into paysera:main May 15, 2026
12 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.

3 participants