Skip to content

Commit

Permalink
Use E12 for same-country and CLASSIC for international shipping
Browse files Browse the repository at this point in the history
  • Loading branch information
TheBestPessimist committed Nov 15, 2019
1 parent f82833e commit d35b3b1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
Expand Up @@ -109,7 +109,17 @@ public DeliveryOrder createDraftDeliveryOrder(@NonNull final CreateDraftDelivery
final ShipperId shipperId = deliveryOrderKey.getShipperId();
final ShipperTransportationId shipperTransportationId = deliveryOrderKey.getShipperTransportationId();

final DpdServiceType serviceType = DpdServiceType.DPD_CLASSIC;
final DpdServiceType serviceType;
if (pickupFromLocation.getC_Country_ID() == deliverToLocation.getC_Country_ID())
{
// inside same country we want "next-day" delivery
serviceType = DpdServiceType.DPD_E12;
}
else
{
// international shipping only works with classic delivery (or express)
serviceType = DpdServiceType.DPD_CLASSIC;
}

final DpdOrderCustomDeliveryData customDeliveryData = DpdOrderCustomDeliveryData.builder()
.orderType(DpdOrderType.CONSIGNMENT)
Expand Down Expand Up @@ -144,7 +154,6 @@ public DeliveryOrder createDraftDeliveryOrder(@NonNull final CreateDraftDelivery
timeFrom,
timeTo,
deliverToBPartner,
deliverToBPartnerLocationId,
deliverToLocation,
deliverToPhoneNumber,
serviceType,
Expand Down Expand Up @@ -176,7 +185,6 @@ DeliveryOrder createDeliveryOrderFromParams(
@NonNull final LocalTime timeFrom,
@NonNull final LocalTime timeTo,
@NonNull final I_C_BPartner deliverToBPartner,
final int deliverToBPartnerLocationId,
@NonNull final I_C_Location deliverToLocation,
@Nullable final String deliverToPhoneNumber,
@NonNull final ServiceType serviceType,
Expand Down
Expand Up @@ -403,7 +403,6 @@ private DeliveryOrder createDraftDeliveryOrderFromDummy(@NonNull final DeliveryO
//noinspection deprecation,ConstantConditions
deliverToBPartner.setEMail(deliveryOrder.getDeliveryContact().getEmailAddress());
final I_C_Location deliverToLocation = ShipperTestHelper.createLocation(deliveryOrder.getDeliveryAddress());
final int deliverToBPartnerLocationId = 0;
final String deliverToPhoneNumber = deliveryOrder.getDeliveryContact().getSimplePhoneNumber();

//
Expand All @@ -427,7 +426,6 @@ private DeliveryOrder createDraftDeliveryOrderFromDummy(@NonNull final DeliveryO
timeFrom,
timeTo,
deliverToBPartner,
deliverToBPartnerLocationId,
deliverToLocation,
deliverToPhoneNumber,
detectedServiceType,
Expand Down

0 comments on commit d35b3b1

Please sign in to comment.