bunq / sdk_php

PHP SDK for bunq API
MIT License
83 stars 54 forks source link

Cant list/edit credit cards #208

Open Shafied opened 3 years ago

Shafied commented 3 years ago

Steps to reproduce:

  1. Import all Cards (Debit & Credit cards)

  2. It will only return Debit Cards

  3. Use the endpoint to edit a Credit Card

  4. It will not return data

What should happen:

  1. Show a list of both Credit and Debit cards

What happens:

  1. You can only add/view Debit Cards

Traceback

In the function bunq\Model\Generated\Endpoint\Card::listing

return BunqResponseCardList::castFromBunqResponse( static::fromJsonList($responseRaw, self::OBJECT_TYPE_GET) );

And in the function bunq\Model\Generated\Endpoint\Card::get

return BunqResponseCard::castFromBunqResponse( static::fromJson($responseRaw, self::OBJECT_TYPE_GET) );

The const OBJECT_TYPE_GET is always CardCredit. So this is why all card are being mapped correctly. Since this is in generated code. I can't create a PR to fix it.

const OBJECT_TYPE_GET = 'CardDebit';

SDK version and environment

Response id

Extra info:

The wrapper should be dynamic instead of hardcoded. Or the "Card" class should be made so that it can handle both Credit And Debit Cards. For the put endpoit you do have 2 different entities