Skip to content
This repository has been archived by the owner on Apr 9, 2021. It is now read-only.

Shipping method with pickup places - zasilkovna #6

Merged
merged 1 commit into from
Aug 9, 2018

Conversation

boris-brtan
Copy link
Contributor

Q A
Description, reason for the PR we want to try extensibility of shopsys framework
New feature Yes
BC breaks Yes
Fixes issues #3
Standards and tests pass Yes/No
Have you read and signed our License Agreement for contributions? Yes

@boris-brtan boris-brtan force-pushed the bb-zasilkovna branch 5 times, most recently from 4b31c93 to f64a89f Compare July 27, 2018 08:25
@LukasHeinz
Copy link
Contributor

Please add entry to changelog...

@boris-brtan boris-brtan changed the title shipping method with pickup places Shipping method with pickup places Jul 30, 2018
@boris-brtan boris-brtan force-pushed the bb-zasilkovna branch 4 times, most recently from 58c3b7e to 18ab5c9 Compare July 31, 2018 11:43
@Miroslav-Stopka Miroslav-Stopka self-assigned this Jul 31, 2018
@Miroslav-Stopka Miroslav-Stopka self-requested a review July 31, 2018 12:44
Copy link
Contributor

@Miroslav-Stopka Miroslav-Stopka left a comment

Choose a reason for hiding this comment

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

My review is done. It was a little bigger than I expected. Please check it :)

// $this->doTestExtendedEntityInstantiation(OrderItem::class, ExtendedOrderTransport::class, self::ORDER_TRANSPORT_ID);
// $this->doTestExtendedEntityInstantiation(OrderPayment::class, ExtendedOrderPayment::class, self::ORDER_PAYMENT_ID);
// $this->doTestExtendedEntityInstantiation(OrderProduct::class, ExtendedOrderProduct::class, self::ORDER_PRODUCT_ID);
// $this->doTestExtendedEntityInstantiation(OrderTransport::class, ExtendedOrderTransport::class, self::ORDER_TRANSPORT_ID);
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this code commented out? Is it on purpose? Or just some forgotten 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.

it was a big mistake, forgotten changes after searching for tests failing.

Copy link
Contributor

Choose a reason for hiding this comment

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

Solved

{{ form_row(form.companyTaxNumber, { label: 'Tax number'|trans }) }}
</div>
</fieldset>
<div id="js-company-and-delivery-address-fields">
Copy link
Contributor

Choose a reason for hiding this comment

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

Why did you add this new div? Id js-company-and-delivery-address-fields is never used.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed

Copy link
Contributor

Choose a reason for hiding this comment

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

Solved

{{ form_row(form.deliveryAddressFilled, {
attr: { class: 'js-checkbox-toggle', 'data-checkbox-toggle-container-id': 'js-delivery-address-fields' },
label: 'I want to deliver products to different address than the billing one'|trans,
disabled: pickupPlaceDelivery}) }}
Copy link
Contributor

Choose a reason for hiding this comment

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

pickupPlaceDelivery contains information about the fact if transport is already checked and this checked transport is pickUpPlace type. Am I right? If so, please consider renaming the variable like "isSelectedPickupPlaceTypeTransport". I mean, you should be capable to recognize the content of the variable only by variable name. Don't you think?

Copy link
Contributor

Choose a reason for hiding this comment

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

Solved

use Shopsys\FrameworkBundle\Model\Transport\Transport;
use Shopsys\FrameworkBundle\Model\Transport\TransportDataFactory;
use Shopsys\FrameworkBundle\Model\Transport\TransportFactory;
use Shopsys\FrameworkBundle\Model\Transport\TransportDataFactoryInterface;
Copy link
Contributor

Choose a reason for hiding this comment

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

I am kind of confused with your usage of interfaces. In a class VatFacadeTest you changed Shopsys\FrameworkBundle\Model\Transport\TransportDataFactory => Shopsys\ShopBundle\Model\Transport\TransportDataFactory. In this class TransportDomainTest you changed Shopsys\FrameworkBundle\Model\Transport\TransportDataFactory => Shopsys\FrameworkBundle\Model\Transport\ TransportDataFactoryInterface . Please, explain it to me? Why did you choose TransportDataFactoryInterface and sometimes just TransportDataFactory from ShopBundle?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My mistake,
should be the key as in services_test.yml, so Shopsys\FrameworkBundle\Model\Transport\ TransportDataFactoryInterface is correct.

Copy link
Contributor

Choose a reason for hiding this comment

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

.

if ($orderPersonalInfoForm.find('#order_personal_info_form_deliveryAddressFilled').is(':checked')) {
var pickUpPlaceTransport = $orderPersonalInfoForm.find('.js-pick-up-place-hide-if-chosen').hasClass('display-none');
var deliveryAddressFilled = $orderPersonalInfoForm.find('#order_personal_info_form_deliveryAddressFilled').is(':checked');
if (deliveryAddressFilled && !pickUpPlaceTransport) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this condition part !pickUpPlaceTransport necessary? Explain it to me.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If the shipping address is filled just from backend system, there is no need for checking whether it is valid.

Copy link
Contributor

Choose a reason for hiding this comment

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

Im not sure, if checking selection of pickup place by class display-none is the correct way. There must be some other way how you can't decide whether pickup place was chosen or not. An finally change pickUpPlaceTransport to isSelectedPickUpPlaceTransport

return $orderData;
}

private function fillPickUpPlaceDeliveryData(OrderData $orderData, FrontOrderData $frontOrderData)
Copy link
Contributor

Choose a reason for hiding this comment

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

I see, shipping address form is disabled and that is the reason why u need to fill the delivery address from chosen pickupPlace. Am I right? But if you set the shipping address form on readonly instead of disabled, this method will be unnecessary. Correct?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

after consultation, no change needed

$orderData->companyNumber = null;
$orderData->companyTaxNumber = null;
}

Copy link
Contributor

Choose a reason for hiding this comment

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

What about:
$orderData = new OrderData();
parent:: getOrderDataFromFrontOrderData($orderData);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

parent:: getOrderDataFromFrontOrderData($orderData)

public function getOrderDataFromFrontOrderData(FrontOrderData $frontOrderData)
    {
        $orderData = $this->orderDataFactory->create();

i tried to use use

/** @var \Shopsys\ShopBundle\Model\Order\OrderData $orderData */
$orderData = parent:: getOrderDataFromFrontOrderData($orderData);

/**
* @var \Shopsys\ShopBundle\Model\PickUpPlace\PickUpPlace|null
*/
public $pickUpPlace;
Copy link
Contributor

Choose a reason for hiding this comment

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

Missing constructor with default value.

Copy link
Contributor

Choose a reason for hiding this comment

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

Solved

}
parent::__construct($orderData, $orderNumber, $urlHash, $user);
}

Copy link
Contributor

Choose a reason for hiding this comment

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

What about edit() method?

Copy link
Contributor

Choose a reason for hiding this comment

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

Solved

CHANGELOG.md Outdated
- [#6 - Shipping method with pickup places](https://github.com/shopsys/demoshop/pull/6)
- transport, Order entities and forms are extended
- PickUpPlace entity is added
- cronmodule for download of pick up places is created
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the description "Added new shipping method Zasilkovna. Pick up places downloaded by cron." would be enough. Im not sure that "transport, Order entities and forms are extended" is not too detailed for CHANGELOG.md

Copy link
Contributor

Choose a reason for hiding this comment

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

Solved

class: Shopsys\FrameworkBundle\Migrations\Version20180724105136
skip: false
20180724060204:
class: Shopsys\FrameworkBundle\Migrations\Version20180724060204
Copy link
Contributor

Choose a reason for hiding this comment

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

Why add two migrations in a single commit?

@boris-brtan boris-brtan force-pushed the bb-zasilkovna branch 5 times, most recently from 247c21a to 6e08203 Compare August 8, 2018 09:41
{{ form_row(form.deliveryCountry, { label: 'Country'|trans }) }}
</div>
</fieldset>
<fieldset>
Copy link
Contributor

Choose a reason for hiding this comment

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

Indentation


/**
* @param \Shopsys\ShopBundle\Model\Transport\TransportData $transportData
* @param \Shopsys\ShopBundle\Model\Transport\Transport $transport
Copy link
Contributor

Choose a reason for hiding this comment

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

I think one of this param shoud be return.

} else {
$orderData->companyName = null;
$orderData->companyNumber = null;
$orderData->companyTaxNumber = null;
Copy link
Contributor

Choose a reason for hiding this comment

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

Almost done, probably this "company" part is not necessary too.

@boris-brtan boris-brtan force-pushed the bb-zasilkovna branch 2 times, most recently from ad76f04 to e832f5f Compare August 8, 2018 13:27
@Miroslav-Stopka
Copy link
Contributor

Hi @boris-brtan,

tests and review are done. I like it. Thank you for this new feature :)

- transport, Order entities and forms are extended
- PickUpPlace entity is added
- cronmodule for downloading of pick up places is created
@boris-brtan boris-brtan merged commit b42e244 into master Aug 9, 2018
@boris-brtan boris-brtan deleted the bb-zasilkovna branch August 9, 2018 14:20
@LukasHeinz LukasHeinz changed the title Shipping method with pickup places Shipping method with pickup places - zasilkovna Sep 6, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants