-
Notifications
You must be signed in to change notification settings - Fork 22
49 ups rest api #50
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
base: master
Are you sure you want to change the base?
49 ups rest api #50
Conversation
UPS API expects most incoming variables as strings, so we need to convert the request data to string type. "preserve_token" returns the preserved access_token or triggered when a new access token is feched via Shipment::UPS::API. - This variable preserves the access token, attempting to reuse it until 10 minutes before it expires. As the UPS API now relies on access_token, and the current token lasts for 4 hours or 14400 seconds, and is rate-limited, this has necessitated a means to save and reuse the access_token. - "preserve_token" accepts a CodeRef, you have the option of using the default or replacing it with your own implementation. To maintain backward compatibility, we preserve the "proxy_domain" variable. Setting a proxy_domain triggers an update to the environment variable, which, in turn, updates the Shipment::UPS::API object endpoints.
- https://developer.ups.com/api/reference#tag/Tracking_other Track data mostly stay the same but the ship_date(), I wasnt able to find a good match data for PickupDate in the json response
- https://developer.ups.com/api/reference#operation/AddressValidation UPS deprecated Address Validation v1, so default to v2, will need to enable Rating API to fully test
- replace username, password with client_id and client_secret - make sure environment to run tests on is 'cie' development endpoints
…, but imported via Shipment::Activity
- remove extra Request failed string - the extra "\n" is to remove the extra error auto added at the end if there is no next line.
…ng ids - change ["tracking_01","tracking_02"] to [tracking_01,tracking_02]
pullingshots
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is awesome! Thanks so much for all the work on this, it's a big change.
Most of the requested changes have to do with re-applying PR #35
| =cut | ||
|
|
||
| has 'surepost_bpm' => ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Support for SurePost BPM and Media services has been removed. Was there a reason for this or can this be added back in?
| name => $self->service_map->{92}, | ||
| ); | ||
|
|
||
| $services{surepost_oz} = $services{92}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Support for SurePost service 92 has also been removed, can this be added back in or was there a reason it was removed? See commit b56dba8
| https://www.ups.com/upsdeveloperkit | ||
| See related modules for documentation on options and how to access rates and labels: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This POD documentation pointing to other Shipment modules needs to be restored.
| =cut | ||
|
|
||
| has 'saturday_delivery' => ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
support for Saturday Delivery needs to be restored. See commit d400bd1
| my $response; | ||
| my %services; | ||
|
|
||
| if ($self->weight_unit ne 'oz') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As per previous comment, this logic is part of adding back additional surepost options - see commit b56dba8
| $package_options->{DeclaredValue}->{CurrencyCode} = $self->currency; | ||
|
|
||
| # default return code is 9 which means we print a return label | ||
| my $return_code = $rc ? $rc : 9; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need to re-apply commit 34ff8d4 here
| }, | ||
| Shipment => { | ||
| ReturnService => { | ||
| Code => $return_code, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need to re-apply commit 34ff8d4 here
| CountryCode => $self->to_address->country_code, | ||
| CountryCode => $country_code_map{$self->to_address->province_code} || $self->to_address->country_code, | ||
| }, | ||
| EmailAddress => $self->from_address->email, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need to re-apply commit 34ff8d4 here
| CountryCode => $self->from_address->country_code, | ||
| }, | ||
| EMailAddress => $self->to_address->email, | ||
| EmailAddress => $self->to_address->email, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need to re-apply commit 34ff8d4 here
| use namespace::clean; | ||
|
|
||
| use Exporter 'import'; | ||
| our @EXPORT_OK = qw( coerce_datetime ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Curious why adding this was required?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Running test in perl 5.40, I got a few complain about function not exported, therefor not usable.
This seem like a new error came from Perl.
|
Will work on restoring the commits. |
Using the new REST API from UPS.