Skip to content

No longer possible to retrieve settlements by bank reference using mollie-api-python client 3.5.0 #335

@SalimAtMollie

Description

@SalimAtMollie

Issue

When they get the settlement with the bank reference , an error is thrown.

What happens

settlement = mollie_client.settlements.get("02893031.2309.10")

File "/home/erik/.local/share/virtualenvs/oakk_ordering-0m3EknA8/lib/python3.10/site-packages/mollie/api/resources/settlements.py", line 35, in get

   self.validate_settlement_id(settlement_id)

 File "/home/erik/.local/share/virtualenvs/oakk_ordering-0m3EknA8/lib/python3.10/site-packages/mollie/api/resources/settlements.py", line 28, in validate_settlement_id

   raise IdentifierError(

mollie.api.error.IdentifierError: Invalid settlement ID: '02893031.2309.10'. A settlement ID should start with 'stl_' , be 'next' or 'open' or contain a valid bank reference.

What should happen

The function should retrieve the settlement, instead of throwing that error.

Steps to reproduce

  1. Get an API key of a merchant with a settlement.
  2. Get a settlement reference number.
  3. Run this snippet of code
#Import Mollie API client for python
from mollie.api.client import Client

#Initialize client and set API key
mollie_client = Client()
mollie_client.set_api_key(API_KEY)

settlement = mollie_client.settlements.get(SETTLEMENT_REF)  #THIS LINE THROWS ERROR

Hypothesis

Looking at the code it seems like although they implemented the settlement.py so that they allow settlement reference numbers, it seems like they are still using a function found in base.py (line 82) which still (regex) checks for a prefix in the reference number and throws an “identifier error”.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions