pullingshots / Shipment

Perl interface into various shipping web service API's - FedEx, UPS, Purolator, Temando, Canada Post
https://metacpan.org/pod/Shipment
19 stars 19 forks source link

Implement Future Day Shipments for FedEx #17

Closed pullingshots closed 4 years ago

pullingshots commented 12 years ago

Need to set 'FUTURE_DAY_SHIPMENT' in the ShipmentSpecialServiceType and then set ShipTimestamp to the shipping date.

a-jar commented 12 years ago

While your in there, if you could open up a channel for people to add additional values to ShipmentSpecialServiceType that would be pretty helpful. There are a bunch of special services that are controlled by ShipmentSpecialServiceType. Probably the most popular would be, the Saturday delivery flags...

pullingshots commented 11 years ago

some rough code which would need to be implemented in FedEx.pm would look like this

  my @special_service_types;
...
  push @special_service_types, 'SATURDAY_DELIVERY';
...
  $shipment_options->{SpecialServiceTypes}  = \@special_service_types;
...
  $response = $interface->processShipment(
    {
...
      RequestedShipment => {
...
             SpecialServicesRequested => $shipment_options,
...
      }
    }
  );

This would simply hard code the option into every call to the ship method. What would be needed at this point is to expose the option via a Moose attribute like this

has 'saturday_delivery' => (
  is => 'rw',
  isa => 'Bool',
  default => 0,
);

and then in the 'ship' method...

  push @special_service_types, 'SATURDAY_DELIVERY' if $self->saturday_delivery;
pullingshots commented 11 years ago

Additionally SpecialServiceTypes could be exposed via a Moose attribute so that some of the more obscure FedEx options can be set manually.

has 'special_service_types' => (
   traits => ['Array'],
   is => 'rw',
   isa => 'ArrayRef[Str]',
);

and then in the 'ship' method...

  push @special_service_types, @{$self->special_service_types};
pullingshots commented 4 years ago

This has finally been resolved with commit 15ac3f8

You can now set ShipmentSpecialServiceTypes like SATURDAY_DELIVERY and FUTURE_DAY_SHIPMENT via the shipment_special_service_types attribute

For FUTURE_DAY_SHIPMENT, set the date via the pickup_date attribute