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

feat: add carrier ups #787

Merged
merged 10 commits into from
Dec 21, 2023
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Block/Sales/NewShipmentForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use MyParcelNL\Sdk\src\Model\Carrier\CarrierDHLParcelConnect;
use MyParcelNL\Sdk\src\Model\Carrier\CarrierFactory;
use MyParcelNL\Sdk\src\Model\Carrier\CarrierPostNL;
use MyParcelNL\Sdk\src\Model\Carrier\CarrierUPS;
use MyParcelNL\Sdk\src\Model\Consignment\AbstractConsignment;

class NewShipmentForm
Expand All @@ -17,6 +18,7 @@ class NewShipmentForm
CarrierDHLForYou::class,
CarrierDHLEuroplus::class,
CarrierDHLParcelConnect::class,
CarrierUPS::class,
];

public const PACKAGE_TYPE_HUMAN_MAP = [
Expand Down
3 changes: 3 additions & 0 deletions Helper/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use MyParcelNL\Sdk\src\Model\Carrier\CarrierDHLForYou;
use MyParcelNL\Sdk\src\Model\Carrier\CarrierDHLParcelConnect;
use MyParcelNL\Sdk\src\Model\Carrier\CarrierPostNL;
use MyParcelNL\Sdk\src\Model\Carrier\CarrierUPS;
use MyParcelNL\Sdk\src\Model\Consignment\AbstractConsignment;
use MyParcelNL\Sdk\src\Model\Consignment\DropOffPoint;
use MyParcelNL\Sdk\src\Services\CheckApiKeyService;
Expand All @@ -25,12 +26,14 @@ class Data extends AbstractHelper
public const XML_PATH_DHLFORYOU_SETTINGS = 'myparcelnl_magento_dhlforyou_settings/';
public const XML_PATH_DHLEUROPLUS_SETTINGS = 'myparcelnl_magento_dhleuroplus_settings/';
public const XML_PATH_DHLPARCELCONNECT_SETTINGS = 'myparcelnl_magento_dhlparcelconnect_settings/';
public const XML_PATH_UPS_SETTINGS = 'myparcelnl_magento_ups_settings/';
public const DEFAULT_WEIGHT = 1000;
public const CARRIERS_XML_PATH_MAP = [
CarrierPostNL::NAME => self::XML_PATH_POSTNL_SETTINGS,
CarrierDHLForYou::NAME => self::XML_PATH_DHLFORYOU_SETTINGS,
CarrierDHLEuroplus::NAME => self::XML_PATH_DHLEUROPLUS_SETTINGS,
CarrierDHLParcelConnect::NAME => self::XML_PATH_DHLPARCELCONNECT_SETTINGS,
CarrierUPS::NAME => self::XML_PATH_UPS_SETTINGS,
];

/**
Expand Down
43 changes: 43 additions & 0 deletions etc/adminhtml/system.xml
Original file line number Diff line number Diff line change
Expand Up @@ -905,6 +905,49 @@
</field>
</group>
</section>
<section id="myparcelnl_magento_ups_settings" translate="label" type="text" sortOrder="200" showInDefault="1" showInWebsite="1" showInStore="1">
<label>UPS settings</label>
<tab>myparcelnl_magento</tab>
<resource>MyParcelNL_Magento::myparcelnl_magento</resource>
<group id="general" translate="label comment" type="text" sortOrder="270" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Basic settings</label>
<field id="allow_show_delivery_date" translate="label comment" type="select" sortOrder="275" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Show delivery date</label>
<tooltip>Show a delivery date in the checkout.</tooltip>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
</field>
<field id="deliverydays_window" translate="label comment" type="select" sortOrder="276" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Number of days</label>
<depends>
<field id="allow_show_delivery_date">1</field>
</depends>
<source_model>MyParcelNL\Magento\Model\Source\NumberOfDays</source_model>
<tooltip>Amount of days in the future customers can choose from in the checkout.</tooltip>
</field>
<field id="cutoff_time" translate="label comment" type="time" sortOrder="280" showInDefault="1" showInWebsite="1" showInStore="0">
<label>Cutoff time</label>
<tooltip>If a request is made for the delivery options between Friday after, and Monday before, cut-off time then Tuesday will be shown as the next possible delivery date.</tooltip>
</field>
<field id="dropoff_days" translate="label comment" type="multiselect" sortOrder="285" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Drop-off days</label>
<source_model>MyParcelNL\Magento\Model\Source\DropOffDays</source_model>
<tooltip>Select the days that you send the orders.</tooltip>
<can_be_empty>1</can_be_empty>
</field>
<field id="dropoff_delay" translate="label comment" type="select" sortOrder="290" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Drop-off-delay</label>
<tooltip>This options allows you to set the number of days it takes you to pick, pack and hand in your parcels at UPS when ordered before the cutoff time.</tooltip>
<source_model>MyParcelNL\Magento\Model\Source\DropOffDelayDays</source_model>
</field>
</group>
<group id="delivery" translate="label comment" type="text" sortOrder="300" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Delivery settings</label>
<field id="active" translate="label comment" type="select" sortOrder="305" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Delivery enabled</label>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
</field>
</group>
</section>
<section id="sales_email">
<group id="track" translate="label" type="text" sortOrder="5" showInDefault="1" showInWebsite="1" showInStore="1">
<label>MyParcel Track</label>
Expand Down
16 changes: 16 additions & 0 deletions etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,22 @@
</pickup>
</myparcelnl_magento_dhlparcelconnect_settings>

<myparcelnl_magento_ups_settings>
<default_options>
</default_options>
<general>
<deliverydays_window>3</deliverydays_window>
<cutoff_time>15,30,00</cutoff_time>
<dropoff_days>1,2,3,4,5</dropoff_days>
<monday_delivery_active>0</monday_delivery_active>
<saturday_cutoff_time>14,30,00</saturday_cutoff_time>
<dropoff_delay>0</dropoff_delay>
</general>
<delivery>
<active>1</active>
</delivery>
</myparcelnl_magento_ups_settings>

<sales_email>
<track>
<enabled>1</enabled>
Expand Down
1 change: 1 addition & 0 deletions i18n/en_US.csv
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ myparcelnl_magento_dhlforyou_settings/delivery/only_recipient, DHL For You deliv
myparcelnl_magento_dhlforyou_settings/delivery/only_recipient/signature, DHL For You delivery with only recipient and signature
myparcelnl_magento_dhleuroplus_settings/delivery, DHL Europlus delivery
myparcelnl_magento_dhlparcelconnect_settings/delivery, DHL Parcel Connect delivery
myparcelnl_magento_ups_settings/delivery, UPS delivery
myparcelnl_magento_error_no_shipments_to_process, No MyParcel shipments to process.
no_account_settings, No account settings found. Press the import button in general configuration to fetch account settings.
manage_drop_off_point, Manage your default drop-off point in the
Expand Down
1 change: 1 addition & 0 deletions i18n/nl_NL.csv
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ myparcelnl_magento_dhlforyou_settings/delivery/only_recipient, DHL For You bezor
myparcelnl_magento_dhlforyou_settings/delivery/only_recipient/signature, DHL For You bezorging met alleen ontvanger en handtekening
myparcelnl_magento_dhleuroplus_settings/delivery, DHL Europlus bezorging
myparcelnl_magento_dhlparcelconnect_settings/delivery, DHL Parcel Connect bezorging
myparcelnl_magento_ups_settings.delivery, UPS bezorging
myparcelnl_magento_error_no_shipments_to_process, Geen MyParcel zendingen om te verwerken.
Version and support,Versie en support
General settings,Algemene instellingen
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"postinstall": "node postinstall.js"
},
"dependencies": {
"@myparcel/delivery-options": "^5.10.0",
"@myparcel/delivery-options": "^5.11.1",
"custom-event-polyfill": "^1.0.7",
"object-path": "^0.11.5"
},
Expand Down
5 changes: 5 additions & 0 deletions view/adminhtml/web/template/grid/order_massaction.html
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@
name="mypa_carrier" value="dhlparcelconnect">
<label class="admin__field-label" for="mypa_carrier_dhlparcelconnect" trans="DHL Parcel Connect"></label>
</div>
<div class="admin__field admin__field-option">
<input type="radio" class="admin__control-radio" id="mypa_carrier_ups"
name="mypa_carrier" value="ups">
<label class="admin__field-label" for="mypa_carrier_ups" trans="UPS"></label>
</div>
</div>
</div>
</div>
Expand Down
1 change: 1 addition & 0 deletions view/frontend/web/js/view/delivery-options.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ define(
'myparcelnl_magento_dhlforyou_settings/delivery/only_recipient/same_day_delivery': 'config.carrierSettings.dhlforyou.priceSameDayDeliveryAndOnlyRecipient',
'myparcelnl_magento_dhleuroplus_settings/delivery': 'config.carrierSettings.dhleuroplus.priceStandardDelivery',
'myparcelnl_magento_dhlparcelconnect_settings/delivery': 'config.carrierSettings.dhlparcelconnect.priceStandardDelivery',
'myparcelnl_magento_ups_settings/delivery': 'config.carrierSettings.ups.priceStandardDelivery',
},

/**
Expand Down