Problem uploading KYC documents to Mangopay

  • Posts: 128
  • Thank you received: 2
7 years 4 months ago #255615

-- HikaShop version -- : 2.6.4
-- HikaMarket version -- : 1.7.2
-- Joomla version -- : 3.6.4
-- PHP version -- : 5.6

Hi there,

When uploading a KYC document to Mangopay via the Hikamarket Mangopay plugin (version 1.7.3) there is always an error message

Error
Error Saving

There are no php or Mangopay error messages in the php and Mangopay logs.

I have done some troubleshooting and the problem seems to be in the file plugins/hikamarket/mangopay/mangopay_class.php inside the funtion addDocument()

The condition on line 210 is always met and hence it returns FALSE and the error message I quoted above shows.
	if(empty($createdPage))
			return false;


on line 204 the file is uploaded to Mangopay as follows
  $createdPage = $api->Users->CreateKycPageFromFile($mango_vendor->Id, $createdDocument->Id, $file);

However it looks like the variable $createdPage always gets the value NULL

I'm not sure the document is being uploaded to Mangopay since in the Mangopay dashboard I cannot see the document itself.

Looking at the Mangopay API documentation it seems to suggest that the variable $file needs to be a string containing the file as base64 encoded.

in your code, line 186, $file is an array as follows

$file = $_FILES;


Could you please look into this an advice?

Many thanks

Last edit: 7 years 4 months ago by sabroso.

Please Log in or Create an account to join the conversation.

  • Posts: 25994
  • Thank you received: 4004
  • MODERATOR
7 years 4 months ago #255629

Hi

For the function "CreateKyCPageFromFile", see the definition here :
1.6 - github.com/Mangopay/mangopay2-php-sdk/bl...ls/apiUsers.inc#L224
2.4.1 - github.com/Mangopay/mangopay2-php-sdk/bl...ay/ApiUsers.php#L285

I cannot tell you like that why you document is not uploaded but I can see that the SDK is not consistent.
While every function return the content which is coming from the "CreateObject" function, that specific one, do not..
Which in fact, shouldn't surprise me ; even if they own code made the same error :
1.7 - github.com/Mangopay/mangopay2-php-sdk/bl...flow/scripts/kyc.php
2.4.1 - github.com/Mangopay/mangopay2-php-sdk/bl...flow/scripts/kyc.php

But while in their code there is no check of the variable, I made the mistake to think that the function returned something... And the patch I implemented became an error....

So please replace the code by

	$createdPage = false;
	try {
		$api->Users->CreateKycPageFromFile($mango_vendor->Id, $createdDocument->Id, $file);
		$createdPage = true;
	}
So the plugin will still handle the PHP exception in the MangoPay SDK.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

Please Log in or Create an account to join the conversation.

Moderators: Obsidev
Time to create page: 0.043 seconds
Powered by Kunena Forum