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

krystalcode created an issue. See original summary.

krystalcode’s picture

Title: API authentication review for shipping methods » API authentication improvements for shipping methods
Issue summary: View changes
krystalcode’s picture

Issue summary: View changes
thejacer87’s picture

work 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

  • thejacer87 authored f245db5 on 8.x-1.x
    Issue #2980728 by krystalcode, thejacer87: API authentication...
thejacer87’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.