feat(104-apaczka-weekend-delivery): Apaczka Paczka w Weekend dla paczkomatow InPost
Phase 104 complete: - Backend: ApaczkaShipmentService::buildOptionsPayload() mapuje weekend_delivery -> option[19] = 1 w payloadzie API Apaczka v2 - Stala OPTION_KEYS jako rozszerzalne mapowanie pole formularza -> id opcji Apaczki - Frontend: checkbox "Dostawa w weekend (sobota)" w prepare.php widoczny tylko dla supplier=INPOST + paczkomat (door_to_point=1 lub point_to_point=1) - JS toggle oparty na atrybutach data-supplier/data-paczkomat z resetem stanu - 3 nowe testy jednostkowe pokrywajace mapowanie buildOptionsPayload (phpunit OK 11/11) - Hotfix integracyjny po UAT: ShipmentController::create() nie przekazywal pola weekend_delivery z requestu do formData providera (root cause: reczna lista pol w controllerze) - Dokumentacja zaktualizowana (DOCS/ARCHITECTURE.md, DOCS/TECH_CHANGELOG.md) DEFER-104-01: rozwazyc test integracyjny pelnego flow controller -> service lub refactor na request->all(). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -43,6 +43,20 @@ final class ApaczkaShipmentServiceTest extends TestCase
|
||||
$method->invoke($this->service, $street);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string, mixed> $formData
|
||||
* @return array<int, int>
|
||||
*/
|
||||
private function invokeBuildOptions(array $formData): array
|
||||
{
|
||||
$method = new ReflectionMethod(ApaczkaShipmentService::class, 'buildOptionsPayload');
|
||||
$method->setAccessible(true);
|
||||
/** @var array<int, int> $result */
|
||||
$result = $method->invoke($this->service, $formData);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function testTruncateStreetForPointShortensLongValue(): void
|
||||
{
|
||||
$input = 'Punkt odbioru POP-XYZ123 przy al. Jerozolimskich 55A/12';
|
||||
@@ -107,4 +121,19 @@ final class ApaczkaShipmentServiceTest extends TestCase
|
||||
|
||||
$this->invokeAssert('Ul. Generała Pilota Józefa Kowalskiego 6/1');
|
||||
}
|
||||
|
||||
public function testBuildOptionsPayloadWeekendEnabled(): void
|
||||
{
|
||||
$this->assertSame([19 => 1], $this->invokeBuildOptions(['weekend_delivery' => '1']));
|
||||
}
|
||||
|
||||
public function testBuildOptionsPayloadWeekendDisabled(): void
|
||||
{
|
||||
$this->assertSame([], $this->invokeBuildOptions(['weekend_delivery' => '0']));
|
||||
}
|
||||
|
||||
public function testBuildOptionsPayloadEmptyForm(): void
|
||||
{
|
||||
$this->assertSame([], $this->invokeBuildOptions([]));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user