Mangopay / mangopay2-php-sdk

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

MangoPay not working #395

Closed hashmi93 closed 4 years ago

hashmi93 commented 4 years ago

I am trying to run the the following basic code to create a user.

<?php // require include only one file require_once 'vendor/autoload.php';

try { // create object to manage MangoPay API $api = new MangoPay\MangoPayApi(); // use test client credentails (REPLACE IT BY YOUR CLIENT ONES!) $api->Config->ClientId = 'wd786'; $api->Config->ClientPassword = 'my_api_key'; $api->Config->TemporaryFolder = 'temp/xxx/'; $api->Config->BaseUrl = 'https://api.sandbox.mangopay.com'; // CREATE NATURAL USER $naturalUser = new MangoPay\UserNatural(); $naturalUser->Email = 'test_natural_user@testmangopay.com'; $naturalUser->FirstName = "Bob"; $naturalUser->LastName = "Briant"; $naturalUser->Birthday = 121271; $naturalUser->Nationality = "FR"; $naturalUser->CountryOfResidence = "ZA"; $naturalUserResult = $api->Users->Create($naturalUser); // display result MangoPay\Libraries\Logs::Debug('CREATED NATURAL USER', $naturalUserResult);

// CREATE LEGAL USER
$legalUser = new MangoPay\UserLegal();
$legalUser->Name = 'Name Legal Test';
$legalUser->LegalPersonType = 'BUSINESS';
$legalUser->Email = 'legal@testmangopay.com';
$legalUser->LegalRepresentativeFirstName = "Bob";
$legalUser->LegalRepresentativeLastName = "Briant";
$legalUser->LegalRepresentativeBirthday = 121271;
$legalUser->LegalRepresentativeNationality = "FR";
$legalUser->LegalRepresentativeCountryOfResidence = "ZA";
$legalUserResult = $api->Users->Create($legalUser);
// display result
MangoPay\Libraries\Logs::Debug('CREATED LEGAL USER', $legalUserResult);

} catch (MangoPay\Libraries\ResponseException $e) {

MangoPay\Libraries\Logs::Debug('MangoPay\ResponseException Code', $e->GetCode());
MangoPay\Libraries\Logs::Debug('Message', $e->GetMessage());
MangoPay\Libraries\Logs::Debug('Details', $e->GetErrorDetails());

} catch (MangoPay\Libraries\Exception $e) {

MangoPay\Libraries\Logs::Debug('MangoPay\Exception Message', $e->GetMessage());

} ?>

I am getting following response that not what i expect. Can you please help.

MangoPay\ResponseException Code: 404

Message: Not found

Details:

mangomaxoasis commented 4 years ago

Hi @hashmi93 , We're looking into it, we'll keep you updated. Regards, Max

SoloJr commented 4 years ago

Hi @hashmi93

I've taken a look a your error, please see this branch: #395

As you can see here, your code was pasted in a test. Our code did not require the ClientId and ClientPassword as they were already set in our test case. So my thoughts are there may be a problem with either your imports or your account

Best Regards, Mircea