fontis/fontis_australia

custom negotiated eParcel charge codes should be allowed

jonpday opened this issue · 12 comments

some customers have unique charge costs for eParcel that are not included in Fontis_Australia_Helper_Eparcel::$chargeCodes. Options to fix this are either (a) add a System Config value for "allow custom charge code" which isValidChargeCode will check if charge code is not found in the private array, or (b) use config XML rather than a private array. Option (b) this would allow developers to specify charge codes in their own module's config.xml to validate the codes uploaded by administrators are still valid.

Hi @jonpday,

I'm absolutely flat out the next few days but will try to have a look asap. PRs welcome if you want.

no problem @jonathan-dh I did implement option (a) for a short term fix, option (b) might be nice when there's more time (hah!)

Would it worthwhile adding a system config option to specify additional codes, instead of in an XML file? This way you wouldn't need a developer to dive in and modify a file if Australia Post hand out one of these custom codes, while still allowing for validation against a defined list.

yeah, that makes sense @chnorton I'll change it so that there is one system config field for "allow any charge code" and another (comma-separated) for "allow the following additional charge codes"

Hi @jonpday, happy new year!

Sorry I never got around to this, the end of 2014 was hectic. Did you get it working? Any chance you could open a PR? I doubt I'm going to dive into this any time soon unfortunately :(

hiya, we just went with the lightweight solution (aligent@7a48be6) in the end, might revisit if the client needs further changes... happy to PR that if you'd like?

I think that would be enough for most users. @chnorton, what do you think?

Happy to accept a PR for this - the lightweight solution looks fine to me.

Added to 2.6.0 and 3.1.0 versions.

This throws an error now if the Charge code is one of the standard codes.

$isStandard = in_array($chargeCode, $this->standardChargeCodes);

        if ($isStandard) {
            return true;
        }
        elseif (!$isStandard && Mage::getStoreConfigFlag('doghouse_eparcelexport/charge_codes/allow_custom_charge_codes')) {

The code needs to return true if $isStandard

Regards
Geoff

that makes sense @behindthepage - given that this issue has been closed, suggest that you raise a new issue and create a merge request with the change you've sketched then @chnorton can review and incorporate it.