Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export compliance deserialization failed #52

Open
fgarnier-hublot opened this issue Apr 21, 2022 · 0 comments
Open

Export compliance deserialization failed #52

fgarnier-hublot opened this issue Apr 21, 2022 · 0 comments

Comments

@fgarnier-hublot
Copy link

There is bad deserialization of the export compliance response for these fields from this class type:
CyberSource\Model\RiskV1ExportComplianceInquiriesPost201ResponseExportComplianceInformationWatchListMatches

addresses
The mapping is incorrect, we have address but there is addresses in the PHP mapping class : vendor/cybersource/rest-client-php/lib/Model/RiskV1ExportComplianceInquiriesPost201ResponseExportComplianceInformationWatchListMatches.php

aliases
programs
The deserialization failed with string[] type in the file vendor/cybersource/rest-client-php/lib/ObjectSerializer.php

After my workaround

} elseif (strcasecmp(substr($class, -2), '[]') === 0) {
            $subClass = substr($class, 0, -2);
            $values = [];

            if (!is_array($data)) {
                if (in_array($subClass, ['DateTime', 'bool', 'boolean', 'byte', 'double', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)) {
                    $values[] = self::deserialize($data, $subClass, null);
                }
            } else {
                foreach ($data as $key => $value) {
                    $values[] = self::deserialize($value, $subClass, null);
                }
            }

            return $values;
        }
            if (isset($data->address)) {
                $data->addresses = $data->address;
            }

I succeed with this type of response:

[0] => CyberSource\Model\RiskV1ExportComplianceInquiriesPost201ResponseExportComplianceInformationWatchListMatches Object
(
    [container:protected] => Array
        (
            [addresses] => Array
                (
                    [0] => [c/o COCINA DE TIJUANA, S. DE R.L. DE C.V.,Tijuana,Baja California,null,, c/o HACIENDA CIEN ANOS DE TIJUANA, S. DE R.L. DE C.V.,Tijuana,Baja California,null,, c/o MEXGLOBO, S.A. DE C.V.,Tijuana,Baja California,null,, c/o MULTISERVICIOS AGSA, S.A. DE C.V.,Tijuana,Baja California,null,, Calle Garita de Otay No. 1408, Colonia Mesa de Otay,Tijuana,Baja California,null,, Calle Gladiolas No. 28, Fraccionamiento Del Prado,Tijuana,Baja California,null,, Cll Gladiolas 11449, Lomas de Agua Caliente c de Las Torres c de S Fco,Tijuana,Baja California,null,22024, Priv del Cesar No. 7013, Fracc. Racial Agua Caliente,Tijuana,Baja California,null,]
                )

            [sanctionList] => Office of Foreign Assets Control
            [aliases] => Array
                (
                    [0] => [Claudia AGUIRRE SANCHEZ]
                )

            [programs] => Array
                (
                    [0] => [SDNTK]
                )

        )
)

Without my workaround, the native response:

PHP Warning:  Invalid argument supplied for foreach() in /home/ubuntu2004/Projects/cybersource-rest-samples-php/vendor/cybersource/rest-client-php/lib/ObjectSerializer.php on line 252
[0] => CyberSource\Model\RiskV1ExportComplianceInquiriesPost201ResponseExportComplianceInformationWatchListMatches Object
(
    [container:protected] => Array
        (
            [addresses] => 
            [sanctionList] => Office of Foreign Assets Control
            [aliases] => Array
                (
                )

            [programs] => Array
                (
                )

        )

)

Thanks,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant