Closed interduo closed 5 years ago
Sprawdzisz proszę czy najnowsza zmiana na https://github.com/BillTechPL/lms-billtech-plugin/tree/cashimport rozwiązuje problem?
Ok - wrzuciłem sobie cherry-pickiem commita, dam znać jutro czy pomogło. W poniedziałek.
Nie działa.
2019/05/29 11:08 | Paweł | - | +112,00 zł | - | » | 0,00 zł | BillTech Payments |
-- | -- | -- | -- | -- | -- | -- | -- | --
2019/05/30 00:00 | | - | +112,00 zł | - | » | 112,00 zł | Opłata za saldo-20190529 ID: 527 re\|f:20190529-045156 dotpay: 355898 M2\|443-94603 (Wpłata BS)
lub
2019/05/29 09:58 | | - | +100,00 zł | - | » | 0,00 zł | BillTech Payments |
-- | -- | -- | -- | -- | -- | -- | -- | --
2019/05/30 00:00 | | - | +100,00 zł | - | » | 100,00 zł | Opłata za saldo-20190529 ID: 2547 r\|ef:20190529-408486 dotpay: 355898 M\|1407-19203 (Wpłata BS)
lub
2019/05/29 08:53 | Paweł | - | +245,00 zł | - | » | 0,00 zł | BillTech Payments |
-- | -- | -- | -- | -- | -- | -- | -- | --
2019/05/30 00:00 | | - | +245,00 zł | - | » | 245,00 zł | Opłata za saldo-20190529 ID: 1867 r\|ef:20190529-073144 dotpay: 355898 M\|1407-19206 (Wpłata BS)
Cashimport wykonuję za pomocą skryptu https://github.com/lmsgit/lms/blob/master/bin/lms-cashimport.php.
@MKaciuba pomożesz z tym?
@interduo jaka jest wartość w konfiguracji cashimport.autocommit? Czy możesz zweryfikować czy w ogóle ten hook jest wywoływany dodając np. jakiegoś loga do BillTechPaymentCashImportHandler->processCashImport?
SELECT * FROM uiconfig WHERE section='billtech' AND var='cashimport_enabled';
+-----+----------+--------------------+-------+-------------+----------+------+
| id | section | var | value | description | disabled | type |
+-----+----------+--------------------+-------+-------------+----------+------+
| 367 | billtech | cashimport_enabled | true | | 0 | 7 |
+-----+----------+--------------------+-------+-------------+----------+------+
SELECT * FROM uiconfig WHERE var="autocommit";
+-----+------------+------------+-------+-------------+----------+------+
| id | section | var | value | description | disabled | type |
+-----+------------+------------+-------+-------------+----------+------+
| 287 | cashimport | autocommit | true | | 0 | 7 |
+-----+------------+------------+-------+-------------+----------+------+
Aktualnie w systemie mam plugin zawierający commit: https://github.com/BillTechPL/lms-billtech-plugin/commit/7f3bf857f067baf30a664d4af2cb394c75ebc45b
kod
mail('jkl@interduo.pl','BillTechPaymentCashImportHandler.php - hook test','biltechowy handler w skrypcie billtechpaymentcashimporthandler dziala');
Zobaczymy czy jutro płatności się rozliczą.
Handler działa. Dostałem maila po imporcie za pomocą lms-cashimport.php który mam w crontabie.
Płatności billtechowe są nadal nierozliczone w https://lms/?m=billtechpaymentlist
(oczywiście nie starsze niż $billtech.payment_expiration
).
Spróbujesz jeszcze ze zmianami z brancha cashimport?
Jak już napisałem ten commit (https://github.com/BillTechPL/lms-billtech-plugin/commit/7f3bf857f067baf30a664d4af2cb394c75ebc45b) mam u siebie w systemie. Branche różnią się tylko tym commitem.
Ok, zmyliło mnie, że podlinkowałeś https://github.com/BillTechPL/lms-billtech-plugin/blob/master/handlers/BillTechPaymentCashImportHandler.php#L13. W takim razie czy mógłbyś do tego maila dodać jeszcze wartość var_dump($hookdata, true)
i podesłać do mnie?
Teraz w https://github.com/BillTechPL/lms-billtech-plugin/blob/master/handlers/BillTechPaymentCashImportHandler.php#L13 dodałem kod:
$msg=var_dump($hookdata, true);
mail('jkl@interduo.pl','BillTechPaymentCashImportHandler.php',$msg);
Dam Ci tego maila jutro dopiero po 11.
Dostałem pustego maila, czyli $hookdata puste
array(1) {
["cashimports"]=>
array(1) {
[0]=>
array(11) {
["id"]=>
string(5) "98417"
["date"]=>
string(10) "1562709600"
["value"]=>
string(4) "1.00"
["customer"]=>
string(21) "WYKASOWAŁEM BO RODO"
["description"]=>
string(34) "WYKASOWAŁEM BO RODO"
["customerid"]=>
string(3) "635"
["hash"]=>
string(32) "a5e2e1c5fa56caaf617a9d0140cae4c8"
["closed"]=>
string(1) "0"
["sourceid"]=>
NULL
["sourcefileid"]=>
string(4) "2534"
["idate"]=>
string(10) "1562838349"
}
}
}
bool(true)
Niestety to jeszcze nie to. Płatność nadal nie jest rozliczona.
Czy wartość pola description
wygląda tak:
Opłata za saldo-20190522 ID: 681 re|f:20190522-331308 dotpay: 355898 M1|278-88906 (Wpłata BS)
? Separator to |
czy \|
?
Separator w polu description to pojedyńczy znak |
.
Array
(
[0] => Array
(
[id] => 98422
[date] => 1562709600
[value] => 126.00
[customer] => RODOSRODO
[description] => Opłata za saldo-20190709 ID: 361 re|f:20190709-338742 dotpay: 355898 M1|763-44428 (Wpłata BS)
[customerid] => 361
[hash] => dd346948825940f8ef3fdc03fd1cd109
[closed] => 0
[sourceid] =>
[sourcefileid] => 2539
[idate] => 1562844774
)
)
to jest winne - prag_replace nie działa - kasuje wszystko
# git diff
diff --git a/handlers/BillTechPaymentCashImportHandler.php b/handlers/BillTechPaymentCashImportHandler.php
index bc363c6..74110d6 100644
--- a/handlers/BillTechPaymentCashImportHandler.php
+++ b/handlers/BillTechPaymentCashImportHandler.php
@@ -15,7 +15,7 @@ class BillTechPaymentCashImportHandler
$description = $import['description'];
if (ConfigHelper::getConfig('billtech.cashimport_enabled', false) && $description) {
- preg_match('/ref:(\d{8}-\d{6})/', preg_replace('[,|]', '', $description), $matches);
+ preg_match('/ref:(\d{8}-\d{6})/', preg_replace('/[|]/', '', $description), $matches);
if (isset($matches[1])) {
$reference_number = $matches[1];
$payment = $DB->GetRow("SELECT id, amount, closed, cashid FROM billtech_payments WHERE reference_number=? AND closed=0", array($reference_number));
Naprawiłem i działa. Jak wrzucisz do repo zamknij zgłoszenie.
Mam zmienną:
cashimport_enabled = true
Wydaje mi się, że w: https://github.com/BillTechPL/lms-billtech-plugin/blob/master/handlers/BillTechPaymentCashImportHandler.php#L18
Coś nie gra. Czy
|
nie powinien być escape'nięty?Mam najnowszą wersję wtyczki.
Mam np wpłatę:
Opłata za saldo-20190522 ID: 681 re|f:20190522-331308 dotpay: 355898 M1|278-88906 (Wpłata BS)