ebics-client-php icon indicating copy to clipboard operation
ebics-client-php copied to clipboard

Error 091010 on FUL

Open zengheng3 opened this issue 2 years ago • 7 comments

Hello everyone,

I currently use this library to download / upload files with a french bank (BNPP). I successfully finished the INI, HIA, bank letter, HPB steps.

Also, I am able to use FDL command to download files from the bank. But when i started to use FUL, I can only get this error :

091010 : [EBICS_INVALID_XML] XML invalid according to EBICS XML schema.

The bank told me that something is wrong in the authentication part of my request. Here is my code:

Class EBICS_lib
{
        public function __construct()
	{
		if (!file_exists($this->workspace_path)) {
			mkdir($this->workspace_path, 0755, true);
		}
		$this->key_ring_manager = new FileKeyringManager();
		$this->key_ring = $this->key_ring_manager->loadKeyRing($this->key_ring_path, $this->key_password);
		$bank = new Bank($this->host_id, $this->host_url, $this->ebics_server_version);
		$bank->setIsCertified(true);
		$bank->setServerName($this->server_name);
		$user = new User($this->partner_id, $this->user_id);
		$this->client = new EbicsClient($bank, $user, $this->key_ring);
	}

       public function download_file($file_name)
	{
		try {
			$fdl = $this->client->FDL('camt.054.001.02.0ms');
			$content = $fdl->getData();

			if (!file_exists($this->download_file_path)) {
				mkdir($this->download_file_path, 0755, true);
			}

			if (!file_exists($this->download_file_save_path)) {
				mkdir($this->download_file_save_path, 0755, true);
			}

			file_put_contents($this->download_file_path 		. "/" . $file_name, $content);

			return [
		    	"success" 		=> true,
		    	"step"			=> "FDL",
		    	"code" 			=> "OK",
		    	"message"		=> "File downloaded successfully.",
		    	"long_message" 	=> "File downloaded successfully with name " . $file_name . ".",
		    ];

		}catch (NoDownloadDataAvailableException $exception) {
		    return [
		    	"success" 		=> false,
		    	"step"			=> "FDL",
		    	"code" 			=> "OK",
		    	"message"		=> "No data to download today !",
		    	"long_message" 	=> "No data to download today !"
		    ];
		} catch (EbicsResponseExceptionInterface $exception) {
		    return [
		    	"success" 		=> false,
		    	"step"			=> "FDL",
		    	"code" 			=> $exception->getResponseCode(),
		    	"message"		=> $exception->getMessage(),
		    	"long_message" 	=> $exception->getMeaning()
		    ];
		}
	}
        
        public function upload_file($file_name)
	{
		try {

			$context = new FULContext();

                        $document = new Document();
        	        $document->loadXML(file_get_contents($this->upload_file_path . '/' . $file_name));

			$ful = $this->client->FUL('pain.001.001.03.sct', $document, $context);
			$content = $ful->getDataDocument();

			if (!file_exists($this->upload_file_path)) {
				mkdir($this->upload_file_path, 0755, true);
			}

			if (!file_exists($this->upload_file_save_path)) {
				mkdir($this->upload_file_save_path, 0755, true);
			}

			return [
		    	"success" 		=> true,
		    	"step"			=> "FUL",
		    	"code" 			=> "OK",
		    	"message"		=> "File uploaded successfully.",
		    	"long_message" 	=> "File uploaded successfully with name " . $file_name . ".",
		    	"detail"		=> $content
		    ];

		} catch (EbicsResponseExceptionInterface $exception) {
		    return [
		    	"success" 		=> false,
		    	"step"			=> "FUL",
		    	"code" 			=> $exception->getResponseCode(),
		    	"message"		=> $exception->getMessage(),
		    	"long_message" 	=> $exception->getMeaning()
		    ];
		}
	}
}

The download function works well but always the same error for upload. Could you please help me out ?

zengheng3 avatar Aug 21 '23 16:08 zengheng3

I tried to use setIsCertified with true or false, but always the same error code

zengheng3 avatar Aug 21 '23 17:08 zengheng3

  1. French bank should always use setIsCertified
  2. Error says that XML that you uploading is invalid. Try to experiment in this direction. But it not guaranty, that error is in xml document.

andrew-svirin avatar Aug 21 '23 20:08 andrew-svirin

Hi @andrew-svirin ,

Really appreciate your reply. I tried to debug with a valid and verified XML file with the format PAIN 001.001.03 but it still doesn't work. Also, I tried to change my download request:

  • If I use $fdl = $this->client->FDL('camt.054.001.02.0ms'); , it works well.
  • If I use $fdl = $this->client->FDL('camt.054.001.02.0ms', 'text', 'FR', new DateTime() , it still works.
  • But if I change the parameters to $fdl = $this->client->FDL('camt.054.001.02.0ms', 'text', 'FR', new DateTime(), DateTime::createFromFormat('Y-m-d', '2023-08-20'), DateTime::createFromFormat('Y-m-d', '2023-08-22')); , I got the same error code as the upload function.

According to the response of the bank staff, I have some errors in the authentication part, I guess this is not because of the content format.

Also like you said that french bank should always use setIsCertified, I never set it to true when I send out INI, HIA, HPB requests. And it doesn't influence the download process.

Do you have some new ideas from this information ?

Best regards, Heng ZENG

zengheng3 avatar Aug 22 '23 16:08 zengheng3

It looks like you are using Ebics 2.4.

Then is building invalid Ebics request.

andrew-svirin avatar Aug 22 '23 18:08 andrew-svirin

@andrew-svirin Ah yes you are right, the configuration I received from the bank is on the version H003 ,so I guess it is EBICS 2.4 Is there a version of the library that supports 2.4 or if not, which files I need tom modify ?

zengheng3 avatar Aug 22 '23 19:08 zengheng3

You can modify any files you need, but of course changes should not affect other versions (2.5, 3.0).

andrew-svirin avatar Aug 23 '23 10:08 andrew-svirin

Hello @zengheng3 could you show me how could you success INI, HIA, bank letter, HPB steps., I send to the bank but they said: "the "seals / hash" of the authentication / encryption and signature certificates do not match those deposited on our server".

Really appreciate if you could spare some times from your experience !

Longchuck avatar Jan 09 '24 03:01 Longchuck