* SZEP card transaction log check bumped to last 7 days
* account_id and transation parameter form changes in KOIN
This commit is contained in:
parent
9d4062e724
commit
5d09d96cf2
@ -38,6 +38,11 @@ class KoinService
|
||||
*/
|
||||
private $httpClient;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $accountId;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
@ -285,6 +290,7 @@ class KoinService
|
||||
$body = $httpResponse->getBody();
|
||||
|
||||
$this->getCsrfToken($body);
|
||||
$this->getAccountId($body);
|
||||
|
||||
$httpResponse = $this->httpClient
|
||||
->post(self::BASE_URI . "/site/login", [
|
||||
@ -306,9 +312,9 @@ class KoinService
|
||||
$documentXpath = $this->getCsrfToken($htmlData);
|
||||
|
||||
/** @var \DOMNodeList $expenseOptionElements */
|
||||
$expenseOptionElements = $documentXpath->query('//select[@id="transactioncreate-category_id"]/optgroup[@label="Kiadás"]/option');
|
||||
$expenseOptionElements = $documentXpath->query('//select[@id="transaction-category_id"]/optgroup[@label="Kiadás"]/option');
|
||||
/** @var \DOMNodeList $incomeOptionElements */
|
||||
$incomeOptionElements = $documentXpath->query('//select[@id="transactioncreate-category_id"]/optgroup[@label="Bevétel"]/option');
|
||||
$incomeOptionElements = $documentXpath->query('//select[@id="transaction-category_id"]/optgroup[@label="Bevétel"]/option');
|
||||
|
||||
/** @var \DOMElement $element */
|
||||
foreach ($expenseOptionElements as $element) {
|
||||
@ -347,6 +353,29 @@ class KoinService
|
||||
return $documentXpath;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse account:id from html
|
||||
*
|
||||
* @param $html
|
||||
* @return \DOMXPath
|
||||
*/
|
||||
private function getAccountId($html): \DOMXPath
|
||||
{
|
||||
$xmlErrorHandling = libxml_use_internal_errors(TRUE);
|
||||
$domDocument = new \DOMDocument();
|
||||
$domDocument->loadHTML($html);
|
||||
libxml_clear_errors();
|
||||
libxml_use_internal_errors($xmlErrorHandling);
|
||||
|
||||
$documentXpath = new \DOMXPath($domDocument);
|
||||
/** @var \DOMElement $accountIdElement */
|
||||
$accountIdElement = $documentXpath->query('//input[@id="transaction-account_id"]')->item(0);
|
||||
|
||||
$this->csrfParam = $accountIdElement->getAttribute("value");
|
||||
|
||||
return $documentXpath;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $amount
|
||||
* @param string $currency
|
||||
@ -361,12 +390,13 @@ class KoinService
|
||||
->post(self::BASE_URI . "/main/save-transaction", [
|
||||
'form_params' => [
|
||||
$this->csrfParam => $this->csrfToken,
|
||||
'TransactionCreate[category_id]' => $category,
|
||||
'TransactionCreate[value]' => $amount,
|
||||
'TransactionCreate[currency]' => $currency,
|
||||
'TransactionCreate[imgKey]' => "",
|
||||
'TransactionCreate[tagData]' => $tags,
|
||||
'TransactionCreate[date]' => $date,
|
||||
'Transaction[account_id]' => $this->accountId,
|
||||
'Transaction[category_id]' => $category,
|
||||
'Transaction[value]' => $amount,
|
||||
'Transaction[currency]' => $currency,
|
||||
'Transaction[imgKey]' => "",
|
||||
'Transaction[tagData]' => $tags,
|
||||
'Transaction[date]' => $date,
|
||||
],
|
||||
]);
|
||||
|
||||
|
||||
@ -82,7 +82,7 @@ class SZEPManagerService
|
||||
openssl_public_encrypt($this->config['szep.key'], $cryptCardKey, $certificate, OPENSSL_PKCS1_PADDING);
|
||||
|
||||
$endDate = new \DateTimeImmutable();
|
||||
$startDate = $endDate->sub(new \DateInterval('P4D'));
|
||||
$startDate = $endDate->sub(new \DateInterval('P7D'));
|
||||
|
||||
$gueryTemplate = file_get_contents(self::TEMPLATE_QUERY_CARD);
|
||||
$query = sprintf($gueryTemplate,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user