This repository has been archived by the owner on Nov 8, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 44
Shippo add parcel "extra" field for insurance rates. #283
Open
defcronyke
wants to merge
332
commits into
oxidecomputer:master
Choose a base branch
from
defcronyke:shippo_parcel_extra
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Just to clarify on this, since I have not looked at how insurance is handled closely, can the provider field be an enum over Otherwise looks good to me. |
* Add scorers to `read_applicants` * Switch to create or replace
* Parse labels from rfds * Add to model
* Do not update user gsuite data * Fix comment
Fixes oxidecomputer#282 Support getting Shippo shipping rates with shipping insurance included: https://goshippo.com/docs/insurance/ It's supported through a field named "extra" that's missing in Shipment for single parcel shipments, and for multiple parcel shipments it's supported in an "extra" field on Parcel. Add Extra and Insurance structs.
I'm more interested in Fedex or UPS insurance, which needs a "provider" field on the Parcel struct, instead of a "content" field on the Shipment struct.
Per-parcel insurance takes the amount field as a float, not a String, while per-shipment insurance takes it as a String.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #282
Add optional "extra" field to Parcel and Shipment structs, and create Extra and Insurance structs.
I wanted to be able to request shipping rates with insurance, so I added this "extra" field as an Option type.
Unfortunately Shippo will only add the insurance rates to the price for one carrier which you have to specify in the Parcel extra.provider field, and it only supports "UPS" or "FEDEX", so if your Shippo account has more than one carrier enabled and rates are returned from multiple carriers, the other carrier rates will be returned without any insurance amount added, which isn't ideal.
It's possible to request insurance rates from a different insurance company affiliated with Shippo, on the Shipment struct's "extra" field, however I'm not using this personally and not supporting it properly in this PR, because it needs a slightly different Insurance struct with the "amount" field being a String, and instead of the "provider" field, it needs a "content": String field.
Since I wanted to buy insurance from FedEx or UPS and not Shippo's provider, I didn't feel like properly supporting the "extra" field on the Shipment struct. It would be very easy to fix this though.
See for details: https://goshippo.com/docs/insurance/