openstamanager/plugins/receiptFE/src/Interaction.php

47 lines
1.0 KiB
PHP
Raw Normal View History

2018-12-14 12:50:44 +01:00
<?php
namespace Plugins\ReceiptFE;
use Plugins\ExportFE\Connection;
/**
* Classe per l'interazione con API esterne.
*
* @since 2.4.3
*/
class Interaction extends Connection
{
public static function getReceiptList()
{
2019-02-19 15:59:27 +01:00
$response = static::request('POST', 'notifiche_da_importare');
2019-02-19 16:45:46 +01:00
$body = static::responseBody($response);
2018-12-14 12:50:44 +01:00
2019-02-19 16:45:46 +01:00
return $body['results'];
2018-12-14 12:50:44 +01:00
}
public static function getReceipt($name)
{
2019-02-19 15:59:27 +01:00
$response = static::request('POST', 'notifica_da_importare', [
2018-12-14 12:50:44 +01:00
'name' => $name,
]);
$body = static::responseBody($response);
2019-02-20 12:39:28 +01:00
return $body['content'];
}
public static function processReceipt($filename)
{
$response = static::request('POST', 'notifica_xml_salvata', [
'filename' => $filename,
]);
$body = static::responseBody($response);
$result = true;
if ($body['status'] != '200') {
$result = $body['status'].' - '.$body['message'];
}
return $result;
2018-12-14 12:50:44 +01:00
}
}