Skip to content
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

Insurance for Dutch Parcels: difference between SDK and API Documentation #5

Closed
LeonidasJP opened this issue Feb 22, 2017 · 3 comments

Comments

@LeonidasJP
Copy link
Contributor

Hi Reindert,

According to the API Documentation, chapter 6.A.4, example 3 "NL Insured", the insured amount should be injected in cents, and be either 5000, 25000, 50000 or 500000.

But when I view the code in the SDK, Model\MyParcelConsignment::setInsurance() accepts the Insured amount in whole euros, and the function also accepts values between 1000 and 4500 euros, in steps of 500.

These values are not enforced when setInsurance gets called; therefore I'd still be able to inject invalid values like "1Aje83", which would eventually lead to an insurance for just € 1,-

Would it be an option to enhance setInsurance to also check for a valid Insurance value, and add a note in the SDK-documentation that the Insurance value should be provided in whole euros?
Perhaps the API documentation should be updated as well, if the 1000-4500 range should be supported...

@reindert-vetter
Copy link
Contributor

I thought I had resolved this before. Could you check this?

@LeonidasJP
Copy link
Contributor Author

Currently, in the Master-branch, SDK\Model\MyParcelConsignment::setInsurance() is formed like this:

    /**
     * Insurance price for the package.
     *
     * Composite type containing integer and currency. The amount is without decimal
     * separators.
     * Pattern: [50, 250, 500, 1000, 1500, 2000, 2500, 3000, 3500, 4000, 4500, 5000]
     * Required: No
     *
     * @param int $insurance
     *
     * @return $this
     */
    public function setInsurance($insurance)
    {
        if (!$this->canHaveOption()) {
            $insurance = 0;
        }
        $this->insurance = $insurance;
        return $this;
    }

There is no check if $insurance is even an integer, or the inserted integer is allowed... So it does not seem to be fixed in the current release...

reindert-vetter pushed a commit that referenced this issue Aug 31, 2017
@reindert-vetter
Copy link
Contributor

This is solved in version v1.2.0-beta.2. Could you to check if its working properly?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants