-
-
Notifications
You must be signed in to change notification settings - Fork 102
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
fix: service name and carrier name parsing #672
base: main
Are you sure you want to change the base?
Conversation
93945a5
to
2f5839a
Compare
…packages and eShipper XML
2f5839a
to
4a6817c
Compare
don't merge before #675 is fixed, becouse in prod this will cause that no service name will show |
@@ -29,6 +29,8 @@ def _extract_details( | |||
service = provider_units.ShippingService.map(str(rate.serviceId)) | |||
carrierId = provider_units.ShippingService.carrier_id(service.value_or_key) | |||
rate_provider = provider_units.ShippingService.carrier(service.value_or_key).lower() | |||
service_name = service.name.replace("eshipper_", "") |
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.
The issue with this is it doesn't take into consideration API changes from eshipper.
If they introduce a new service or carrier that we don't have in the enum, service.name
will be None
causing an exception.
Essentially, we need to anticipate unexpected data as well.
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.
correct. I already fixed it on my local... becouse when testing with production it returned only carrier ID
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.
but I got overwhelmed with the mapping problem
Ensure `service_name` uses `rate.serviceName` as a fallback when `service.name` is not available. This prevents potential attribute errors and ensures consistent naming by replacing spaces with underscores.
@danh91 can you recommend what else we need to do to fix the mappings types? |
this fixes the bug that currently eshipper returns itself as the carrier, and it's different from how it was in the eshipper lagecy XML API, and how other providers that provide multi carrier rates.