mangopay2-php-sdk
mangopay2-php-sdk copied to clipboard
Missing type casting in GetSchema response for LocalBankTransfer and InternationalBankTransfer
Hi,
When I call GetSchema to retrieve a Recipient Schema, it seems that some type casting is missing for the following properties:
LocalBankTransferInternationalBankTransfer
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!
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