9

I'm trying to schedule pickup using Pickup Service. First I send Pickup Availability request to get cutoff time, then use the result I get in Pickup Request. But after that I get error "Ready Time after Cutoff Time" for the time that is obviously before the cutoff time. In my example cutoff time returned is 16:00 but the latest time I can schedule pickup for is 11:00. Part of pickup availability response:

<v3:ScheduleDay>SAME_DAY</v3:ScheduleDay>
<v3:Available>true</v3:Available>
<v3:PickupDate>2013-04-02</v3:PickupDate>
<v3:CutOffTime>16:00:00</v3:CutOffTime>

Part of schedule pickup request that produces error:

<ns1:ReadyTimestamp>2013-04-02T13:00:00</ns1:ReadyTimestamp>
<ns1:CompanyCloseTime>20:00:00</ns1:CompanyCloseTime>

Here's full request/response code for two requests: http://pastebin.com/jqtfsRFc

UPD: More details according to the discussion in comments

That's what written about ReadyTimestamp The time must be no later than the CutOffTime, which can be discovered with the PickupAvailabilityRequest.

So I make a pickup availability request and see the reply:

<v3:ScheduleDay>SAME_DAY</v3:ScheduleDay>
<v3:Available>true</v3:Available>
<v3:PickupDate>2013-04-09</v3:PickupDate>
<v3:CutOffTime>16:00:00</v3:CutOffTime>

Documentation says that timestamps for Pickup Availability are used according to the local TZ (taken from zip code). Out local TZ is PST which has -07:00 offset from UTC. There's also a line in Pickup Availability reply that indicates the time when my Pickup Availability request was processed. I checked and see that it is also in PST so this step looks working fine: <v3:RequestTimestamp>2013-03-26T11:58:37</v3:RequestTimestamp>

So I got cutoff time 16:00 PST and the next step is to schedule actual pickup for the time that will not be later than cutoff time using Create Pickup request. For this request ReadyTimestamp should contain TZ info so I tried different date/time formats. So if I want to create pickup for 14:00 PST I try 2013-04-09T21:00:00, 2013-04-09T21:00:00.000Z, 2013-04-09T21:00:00+00:00, and 2013-04-09T14:00:00-07:00. In all of these cases I get error Ready Time after Cutoff Time. I tried many different values and discovered that the latest time it works for is 04:00 PST (same as 11:00 UTC). So 04:00 gives me success and 04:01 gives Ready Time after Cutoff Time and it works this way with any date/time format.

yefrem
  • 666
  • 7
  • 20
  • 1
    Is the time you're sending in the request formatted correctly? I saw `2013-04-02T13:00:00`, is that how they want to receive it? Sorry, I've never worked with FedEx's API but I figured I'd do a little digging seeing as you haven't had much action on this question. – zajd Mar 29 '13 at 21:57
  • @zjd Hello, thanks for your attention to my question. I do no have much experience with SOAP and as far as I see date-time field should be formatted this way or can also contain milliseconds. First I think milliseconds are irrelevant in this situation. And they also send request timestamp in the reply and it's formatted the same way. To be 100% sure I tried all possible combination I will try with milliseconds right now. – yefrem Mar 29 '13 at 22:24
  • yes, same thing with date "2013-04-02T14:00:00.000Z" – yefrem Mar 29 '13 at 22:34
  • Could it potentially be a timezone issue? – zajd Mar 30 '13 at 00:32
  • @zjd I don't think so, according to documentation all dates in requests and replies are provided in the timezone of pickup address. So even if I have something wrong with the timezone on my side the dates in requests and replies should match with one another. – yefrem Mar 30 '13 at 00:49
  • What day are you scheduling pickup for? Its noted that `FedEx Express pickup can be scheduled for the current or next business day.` – fitheflow Apr 04 '13 at 22:42
  • @fitheflow I use Fedex Ground. Result is actually the same for different days starting from the current day. – yefrem Apr 04 '13 at 22:49
  • I see.. Just to double check that everything you do is correct, for **Fedex Ground** pickup can be scheduled for the _next business day_ or any business day up to 2 weeks in advance. A FedEx Ground pickup **cannot be scheduled** for _the current day_. – fitheflow Apr 04 '13 at 22:57
  • Ok, there are two types of `PickupRequestType` in the **PickupAvailability** request . Request type valid values are: `SAME_DAY` `FUTURE_DAY`. Did you try requesting the pickup availability with a `FUTURE_DAY` value ? I think the `CutOffTime` could differ. – fitheflow Apr 04 '13 at 23:07
  • @fitheflow You are right, for `FUTURE_DAY` it returns 13:00 as cutoff time. Also there is a field "access time" which is also different for different request types (4hrs for future day and 2 hrs for same day) but I still can't put all these things together to understand the way it works. BTW I'm not sure I really understand the difference between `FUTURE_DAY` and `SAME_DAY` because it doesn't affect Create Pickup request. `SAME_DAY` means that I want to schedule pickup for the day I send Create Pickup request? If yes it means all requests I try has cutoff time for `FUTURE_DAY` which is 16:00 – yefrem Apr 04 '13 at 23:24
  • _SAME_DAY means that I want to schedule pickup for the day I send Create Pickup request?_ Yes you are right, and as it's stated that you can only schedule the **Ground pickup** for the next day, you should try using the **CutOffTime** got from the pickup availability request with the `PickupRequestType` value set to `FUTURE_DAY`. – fitheflow Apr 05 '13 at 00:10
  • `AccessTime` is the minimum time window that must be allocated for the FedEx courier to make the pickup. The difference between the Business Close Time (or the local “cutoff time” if it is earlier than the Business Close Time) and the Package Ready Time must be equal to, or exceed, the access time. (`AccessTime <= CompanyCloseTime-PackageReadyTime`). – fitheflow Apr 05 '13 at 00:25

4 Answers4

3

Have you noticed that the ReadyTimestamp in the Example CreatePickupRequest on page 76

<q0:ReadyTimestamp>2011-08-02T08:00:18.282Z</q0:ReadyTimestamp>
<q0:CompanyCloseTime>17:00:00</q0:CompanyCloseTime>

Is given with the timezone code.

UPD. You can check php fedex api wrapper from github or fedex api wrapper from phpclasses.

fitheflow
  • 411
  • 3
  • 12
  • not sure what you mean. I'm using `OriginDetail/ReadyTimeStamp` in Pickup Request and `PackageReadyTime` in Pickup Availability request. Looks fine according to the PDF doc. – yefrem Apr 02 '13 at 18:25
  • You mentioned that you want to make a **Pickup Availability request** `table 32`, but you are using elements from **Pickup Availability request** `table 26` – fitheflow Apr 02 '13 at 20:24
  • Checked your request on the `pastebin`, yes you are right- you are using correct elements – fitheflow Apr 02 '13 at 20:34
  • Just saw your comment about time zone code. I saw TZD there before but you made me looking more attentively at it. So first I noticed that availability request should not contain any TZ info and date should be in local TZ. So I made so in both requests. Now I checked and see that it's not right because pickup request instruction doesn't have this comment and TZD is included. So looks like pickup request should contain date in UTC unlike availability request that has date in local TZ. Local TZ is PST so I should probably check it again. Thank you. – yefrem Apr 02 '13 at 21:35
  • Its not explicitly specified for `ReadyTimestamp` for some reason but all other timestamps are specified to contain TZ information. **ShipTimestamp** `The date format must be YYYY-MM-DDTHH:MM:SS-xx:xx. The time must be in the format: HH:MM:SS using a 24-hour clock. The date and time are separated by the letter T, such as 2009-06-26T17:00:00. The UTC offset indicates the number of hours/minutes, for example xx:xx from UTC, such as 2009-06-26T17:00:00-05:00 is defined as June 26, 2009 5:00 p.m. Eastern Time. See Appendix L: “Time Zones” for more information about time zones ` – fitheflow Apr 02 '13 at 23:03
  • I tried different combinations and still got no result. Tried `2013-04-08T15:00:00-07:00`, also same format in UTC: `2013-04-08T22:00:00+00:00`, and the format from the table in PDF you reminded me about before: `2013-04-08T22:00:00.000Z`. All examples for 15:00 PST (our local TZ), which is 22:00 UTC. Am I still missing something? – yefrem Apr 03 '13 at 20:46
  • Does it still respond with `Ready Time after Cutoff Time` error? Please pastebin the request and response for `2013-04-08T22:00:00.000Z` example. – fitheflow Apr 03 '13 at 21:39
  • Yes, error message is still the same and other fields are also similar so I didn't paste it. BTW the earliest time I can schedule pickup for is 11:00 UTC. My experiments show that it works the same way for `2013-04-08T11:00:00+00:00`, `2013-04-08T11:00:00.000Z` and even `2013-04-08T11:00:00` but returns `Invalid ready time` for `2013-04-08T04:00:00-07:00`. So looks like TZ info doesn't really matter but offset they use is strange. – yefrem Apr 03 '13 at 22:10
  • You set the `ReadyTimestamp` to `2013-04-08T04:00:00-07:00` means you want the pickup at `4AM`? Maybe try setting time inside the business day. For example `2013-04-08T09:00:00-07:00` or `2013-04-08T16:00:00.000Z`. _Note that_ `To calculate UTC time one has to subtract the offset from the local time, e.g. for "15:00-03:30" do 15:00 − (−03:30) to get 18:30 UTC.` – fitheflow Apr 04 '13 at 00:13
  • Sorry, I wrote "earliest" instead of "latest". So I got cutoff time 16:00 in PST (our local TZ according to the doc), this is 23:00 UTC. Now I try to schedule pickup for, let's say, 14:00 PST, which is 21:00 UTC. But in fact only 04:00 PST (11:00 UTC) works, anything later says `Ready Time after Cutoff Time`. So looks like 11:00 UTC is real cutoff time and I can't understand how they calculate TZ offset for my local TZ. – yefrem Apr 04 '13 at 10:58
  • >But in fact only 04:00 PST (11:00 UTC) works. Do you mean that your request is successful, or you get `Invalid ready time` error message? – fitheflow Apr 04 '13 at 21:00
  • That's what written about `ReadyTimestamp` _The time must be no later than the CutOffTime, which can be discovered with the PickupAvailabilityRequest._ Maybe you try the time just before the cutoff time if you haven't already(can't exactly see what are you trying, trying to rely on your words referring to the pastebin)? – fitheflow Apr 04 '13 at 21:26
  • Btw. you are using the (php fedex api wrapper)[https://github.com/JeremyDunn/php-fedex-api-wrapper], right? – fitheflow Apr 04 '13 at 21:42
  • As said [in class](https://github.com/JeremyDunn/php-fedex-api-wrapper/blob/master/src/FedEx/PickupService/ComplexType/PickupOriginDetail.php) `The time is the local time of the pickup based on the shipper's time zone. The date component must be in the format: YYYY-MM-DD (e.g. 2006-06-26). The time component must be in the format: HH:MM:SS in 24-hour form. The date and time parts are separated by the letter T (e.g. 2006-06-26T17:00:00). Because this is a local time, no TZD should be included. If a TZD is included, it will be ignored, and the time treated as local to the pickup postal code.` – fitheflow Apr 04 '13 at 21:43
  • My english is far from perfect and maybe that's why not all my comments are clear. I've updated the question to give you more detailed description of what I did. No I don't use wrapper, maybe that's a good idea to try. Quotation you show seems to be about ready timestamp for pickup availability request and the same text we already found in Fedex Developer Guide. P.S. Thanks for your time – yefrem Apr 04 '13 at 22:14
2

ReadyTimestamp in createPickup request takes timestamp as value

example: 'ReadyTimestamp': '1404891463'

This will work

1

If you want to pass Date in WebService request, The DateTime Data type for WSDL is

class DateTime2 extends DateTime {
    function __toString() { 
        return $this->format("Y-m-d\TH:i:s.000\Z");
    }
}

$date = new DateTime2();

$client = new SoapClient(
    "http://www.myos.it/sp/smartphonelayer.asmx?wsdl", 
    array("trace" => 1)
);

$result = $client->SetReservation(array("RDescription"=>"Giuseppe Silvestri",
                                        "RNumber"=>2,
                                        "RPhoneNumber"=>"3286026817",
                                        "RDate"=>$date.""));

echo "REQUEST:".$client->__getLastRequest()."<br>"; 

print_r($result);
Troy Alford
  • 26,660
  • 10
  • 64
  • 82
Umesh Chavan
  • 614
  • 3
  • 11
0

you must have a difference between: a- when the package is ready b- cutoff time c- company close time.

consequently, if your zip code has a cutoff time of 16:00, your package must be ready before that time, and your company must be open up to a couple of hours later.

my suggestion. place the company close time at 19:00, fedex latest pickup time usually is at 17hs for all zip codes. those 2 your is because when you request a pickup the van courier has 2 hours to go to that place, if your company close time is only 1 hour from the pickup request you will experience problems.

hope it helps.

s_h
  • 1,476
  • 2
  • 27
  • 61