Username/password/customer number are currently defined both in sitewide configuration and in each shipping method. They are needed as sitewide configuration for integrating with APIs other than the Shipping Rates API. For most cases, this is redundant; it is unlikely that the same site will be using different API authentication details for different shipping methods, unless the site is a marketplace with multiple stores.
The ideal behavior should be the following:
- On the shipping method add/edit form display a warning if the API authentication details are not set in the corresponding configuration object.
- On the shipping method add/edit form add a checkbox allowing the user to override the API authentication details. When checked, expand to display the relevant form elements.
- When calculating the rates, first check if we have overridden API authentication details and use those. If not, use those from the sitewide configuration.
The solution here should be reviewed in light of https://www.drupal.org/project/commerce_canadapost/issues/2980732
Comments
Comment #2
krystalcode commentedComment #3
krystalcode commentedComment #4
thejacer87 commentedwork for it here: https://github.com/thejacer87/commerce_canadapost/pull/15
doesn't add the override on the plugin page, that can be added later if we still think its necessary
Comment #6
thejacer87 commented