mangopay2-php-sdk icon indicating copy to clipboard operation
mangopay2-php-sdk copied to clipboard

Missing type casting in GetSchema response for LocalBankTransfer and InternationalBankTransfer

Open tarsFromTesseract opened this issue 5 months ago • 1 comments

Hi,

When I call GetSchema to retrieve a Recipient Schema, it seems that some type casting is missing for the following properties:

  1. LocalBankTransfer
  2. InternationalBankTransfer

The expected types are :

/**
 * @var array<string, array<string, RecipientPropertySchema>>
 */
public $LocalBankTransfer;

/**
 * @var array<string, RecipientPropertySchema>
 */
public $InternationalBankTransfer;

However, the response I get contains stdClass instances instead. For example: LocalBankTransfer: {#40627 +"EUR": {#40639 +"IBAN": {#40628 +"Required": true +"MaxLength": 34 +"Pattern": "^[a-zA-Z]{2}\d{2}\s*(\w{4}\s*){2,7}\w{1,4}\s*$" +"Label": "IBAN" +"EndUserDisplay": "Show" } } }

InternationalBankTransfer: {#2723 +"AccountNumber": {#2648 +"Required": true +"MaxLength": 34 +"Pattern": "^[a-zA-Z]{2}\d{2}\s*(\w{4}\s*){2,7}\w{1,4}\s*$" +"Label": "Account Number" +"EndUserDisplay": "Show" } }

Could you please confirm if this is expected, or if there's a missing deserialization step?

Thanks!

tarsFromTesseract avatar Jun 16 '25 09:06 tarsFromTesseract

Hi @tarsFromTesseract thanks for raising this and sorry for the delayed reply. The team is working on a fix. In the meantime you can cast the stdClass to an array (this is probably what they will implement):

json_decode(json_encode($schema->LocalBankTransfer), true)

Kind regards, Anthony

ghost avatar Jun 27 '25 09:06 ghost