Skip to content

Client throws error for function subscriptions.get_next() #315

@JorikMollie

Description

@JorikMollie

Issue

When I try to get to the next page of subscriptions, using the function subscriptions.get_next() , an error is thrown.

What happens

TypeError                                 Traceback (most recent call last)
<ipython-input-5-0be7c2df0c3e> in <cell line: 10>()
      8 
      9 subscriptions = mollie_client.subscriptions.list()
---> 10 subscriptions = subscriptions.get_next() #THIS LINE THROWS ERROR

/usr/local/lib/python3.9/dist-packages/mollie/api/objects/list.py in get_next(self)
     88         """Return the next set of objects in an ObjectList."""
     89         url = self._get_link("next")
---> 90         resource = self.object_type.get_resource_class(self.client)
     91         resp = resource.perform_api_call(resource.REST_READ, url)
     92         return ObjectList(resp, self.object_type, self.client)

/usr/local/lib/python3.9/dist-packages/mollie/api/objects/subscription.py in get_resource_class(cls, client)
     10         from ..resources import CustomerSubscriptions
     11 
---> 12         return CustomerSubscriptions(client)
     13 
     14     STATUS_ACTIVE = "active"
TypeError: __init__() missing 1 required positional argument: 'customer'

What should happen

The function should retrieve the next page of subscriptions, instead of throwing that error.

Steps to reproduce

  1. Get an API key of a merchant with many subscriptions.
  2. 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)

subscriptions = mollie_client.subscriptions.list()
subscriptions = subscriptions.get_next() #THIS LINE THROWS ERROR

Hypothesis

The base resource class for a subscription is a CustomerSubscription instead of a normal subscription.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions