Mangopay / mangopay2-php-sdk

PHP SDK for MANGOPAY
https://packagist.org/packages/mangopay/php-sdk-v2
MIT License
122 stars 133 forks source link

Call to undefined method stdClass::GetReadOnlyProperties #501

Closed Fred-Guile closed 3 years ago

Fred-Guile commented 3 years ago

Hi,

i'm trying to create a Direct-Debit Direct PayIn :

` public function DirectDebit($params) {

    try {
  $payIn = new \MangoPay\PayIn();
  $payIn->CreditedWalletId = $params->CreditedUserId;
  $payIn->AuthorId = $params->AuthorId;

  $payIn->DebitedFunds = new \MangoPay\Money();
  $payIn->DebitedFunds->Amount = $params->Amount;
  $payIn->DebitedFunds->Currency = 'EUR';

        $PayIn->PaymentDetails = new \MangoPay\PayInPaymentDetailsDirectDebitDirect();
        $PayIn->PaymentDetails->MandateId = $params->MandateId;

        $PayIn->ExecutionDetails = new \MangoPay\PayInExecutionDetailsDirect();
        $PayIn->ExecutionDetails->Culture = "FR";

        $resultat = $this->Api->PayIns->Create($PayIn);
        $this->log($this->toArray($resultat), "DirectDebit($params->AuthorId, $params->CreditedUserId, $params->Amount, $params->MandateId)");
        return json_encode($this->toArray($resultat));
    } catch(MangoPay\Libraries\ResponseException $e) {
        $this->log($this->toArray($e), "DirectDebit($params->AuthorId, $params->CreditedUserId, $params->Amount, $params->MandateId)");
        return json_encode($this->toArray($e));
    } catch(MangoPay\Libraries\Exception $e) {
        $this->log($this->toArray($e), "DirectDebit($params->AuthorId, $params->CreditedUserId, $params->Amount, $params->MandateId)");
        return json_encode($this->toArray($e));
    }       
}

`

Here is the error `
Notice: Undefined index: payins_directdebitdirect-direct_create in /web/api/mangopay/mangopay/vendor/mangopay/php-sdk-v2/MangoPay/Libraries/ApiBase.php on line 200

Fatal error: Uncaught Error: Call to undefined method stdClass::GetReadOnlyProperties() in /web/api/mangopay/mangopay/vendor/mangopay/php-sdk-v2/MangoPay/Libraries/ApiBase.php:447 Stack trace:

0 /web/api/mangopay/mangopay/vendor/mangopay/php-sdk-v2/MangoPay/Libraries/ApiBase.php(233): MangoPay\Libraries\ApiBase->BuildRequestData(Object(stdClass))

1 /web/api/mangopay/mangopay/vendor/mangopay/php-sdk-v2/MangoPay/ApiPayIns.php(18): MangoPay\Libraries\ApiBase->CreateObject('payins_directde...', Object(stdClass), '\MangoPay\PayIn', NULL, NULL, NULL)

2 /web/api/mangopay/waster.php(310): MangoPay\ApiPayIns->Create(Object(stdClass))

3 /web/api/mangopay/index.php(95): Waster->DirectDebit(Object(stdClass))

4 {main}

thrown in /web/api/mangopay/mangopay/vendor/mangopay/php-sdk-v2/MangoPay/Libraries/ApiBase.php on line 447
`

What am i missing ?

Regards.

H4wKs commented 3 years ago

Hi @Fred-Guile ,

I would try to update / reinstall the SDK, look like some of your SDK files may be corrupted.

Fred-Guile commented 3 years ago

I've already tried with the latest version but always the same mistake.

Nevermind, our client has changed his mind. Thanx.