Problem/Motivation

When configure a Swiss Post endpoint, we can't use the module due to an error.

Steps to reproduce

See the Internal Server Error in drupal logs.

Proposed resolution

Name of fields have changed in the Swiss Post API.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

olivierg created an issue. See original summary.

olivierg’s picture

Status: Active » Needs review
StatusFileSize
new2.88 KB

See the patch for Swiss Post issue.

olivierg’s picture

Issue summary: View changes
mably’s picture

Hi @olivierg, thanks for your patch.

Could you create a merge request please?

olivierg’s picture

Hi @mably,
The merge request was created.

mably’s picture

Hi @olivierg, is there any test account available I could use to test the new code?

Didn't succeed to get one on the Post CH website:

Authentication is conducted via an HTML basic authentication. The authentication should be “pre-emptive”.

A technical user is required for authentication. To create this user, a customer login is required on www.swisspost.ch for business customers with a billing relationship. If a customer has such a login, they can log in to the www.swisspost.ch website and create a new technical user via the Customer Center.

Thanks for your help.

olivierg’s picture

Hi @mably,
I worked for a customer who gave me access to use the api.
I don't think my client will share you these access.

As you can see in the merge request, I mainly changed keys of data that didn't match to the api.
You can see keys in the autocomple documentation here -> https://developer.post.ch/en/address-web-services-rest
You can search "/autocomplete4" in the page to find the correct section.

An example of the service describ in this section report this structure :
{
"request": {
"ONRP": 0,
"ZipCode": "817",
"ZipAddition": "",
"TownName": "n",
"STRID": 0,
"StreetName": "",
"HouseKey": 0,
"HouseNo": "",
"HouseNoAddition": ""
},
"zipOrderMode":0,
"zipFilterMode":0
}

There was Upercase errors and other bad keys like "HouseNo".
I can send you a print screen of the autocomplete on monday if you need.

Anyway, your implementation of Swiss Post api doesn't work, you lose nothing to use mine...

  • mably committed 6f15efc2 on 1.0.x authored by olivierg
    Issue #3557874 by ogilbert, mably: Swiss Post return a 500 Internal...
mably’s picture

It's merged! Thanks for all @olivierg.

mably’s picture

@olivierg can you confirm that it works fine for you so I can publish a new release?

Thanks.

mably’s picture

Status: Needs review » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

olivierg’s picture

Hi @mably,
I can confirm it works.
You can see a print screen of the autocomplete with Swiss addresses...

olivierg’s picture

And another one print screen here

  • mably committed 6544f12b on 1.x authored by olivierg
    Issue #3557874 by ogilbert, mably: Swiss Post return a 500 Internal...
mably’s picture

Thanks @olivierg, it's released!

Status: Fixed » Closed (fixed)

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