Thank you for looking at this and the thought provoking questions. I don't really need access to the ShippingMethod per se (which is why I suggested just the bvin). I really just need access to the ShippingMethod-specific (aka local) ComponentSettingsManager...the one you create with "new ComponentSettingsManager(method.Bvin)".
The provider will use those settings to decide how to answer the questions "Do you require a city", etc.
There are three situations in which I will use this.
First, the EstimateShipping.aspx page currently has code like this...
Code:
provider = AvailableProviders.FindProviderById(method.ShippingProviderId)
If provider IsNot Nothing Then
If provider.RequiresCity Then
Return True
End If
End If
[/code]
The problem is that I want the merchant to decide if RequiresCity is true or false. And I want the merchant to be able to make a different decision for each instance of ShippingMethod. For example, the merchant might create two ShippingMethods that both use my DHL Provider. The first only returns Ground and the merchant has turned off Requires City. The second returns all the other rates and the merchant has turned on Requires City. If the code looked like this...
Code:
provider = AvailableProviders.FindProviderById(method.ShippingProviderId)
If provider IsNot Nothing Then
If provider.RequiresCity(method.Bvin) Then
Return True
End If
End If
...then my DHL Provider could create a ComponentSettingsManager with the method.Bvin, look up, and return the "RequiresCity" setting.
The second scenario is for a new ShippingProvider that I am working on that will divide up an order based on rules. For example one rule might be that the product "ABC" always uses the "Freight" ShippingMethod while all other products use the "DHL" ShippingMethod.
In this case, when EstimateShipping.aspx asks my new provider "Do you require city?", my provider needs to move through each possible shipping method and ask it's provider, "Do you require a city?". The list of possible shipping methods ("Freight" and "DHL" in this example) is stored in the local ComponentSettingsManager. It looks something like this:
Code:
Public Overrides Readonly Property RequiresCity(string bvin)
Dim settings As New ComponentSettingsManager(bvin)
Dim methods as Collection(Of ComponentSettingListItem) = settings.GetSettingList("Methods")
For Each method As ComponentSettingListItem in methods
Dim provider As ShippingProvider = AvailableProviders.FindProviderById(method.Setting1);
If provider.RequiresCity(method.Setting2) Then Return True
End For
Return False
End Property
So you see my provider used the method bvin to find the list of child shipping methods, then it asked the provider of each child shipping method if it requires a city passing it the bvin of the child method. If the child method was my DHL provider then it would look up the setting to see what the merchant decided.
The third situation is not solvable without a major change. So never mind about
GetTrackingUrl.