33 \
Magento\Framework\Stdlib\DateTime\DateTime $coreDate,
36 $this->_coreDate = $coreDate;
47 $this->
_init(
'paypal_settlement_report',
'report_id');
48 $this->_rowsTable = $this->
getTable(
'paypal_settlement_report_row');
59 $rows = $object->getRows();
60 if (is_array($rows)) {
62 $reportId = (int)$object->getId();
66 $connection->delete($this->_rowsTable, [
'report_id = ?' => $reportId]);
69 foreach (array_keys($rows) as $key) {
73 $completionDate = new \DateTime($rows[$key][
'transaction_completion_date']);
74 $rows[$key][
'transaction_completion_date'] = $completionDate->format(
'Y-m-d H:i:s');
75 $initiationDate = new \DateTime($rows[$key][
'transaction_initiation_date']);
76 $rows[$key][
'transaction_initiation_date'] = $initiationDate->format(
'Y-m-d H:i:s');
80 $rows[$key][
'fee_amount'] = (double)$rows[$key][
'fee_amount'];
84 $rows[$key][
'report_id'] = $reportId;
87 $connection->insertMultiple($this->_rowsTable, $rows);
112 'account_id = :account_id' 114 'report_date = :report_date' 119 $report->addData(
$data);
_afterSave(\Magento\Framework\Model\AbstractModel $object)
_init($mainTable, $idFieldName)
__construct(\Magento\Framework\Model\ResourceModel\Db\Context $context, \Magento\Framework\Stdlib\DateTime\DateTime $coreDate, $connectionName=null)
loadByAccountAndDate(\Magento\Paypal\Model\Report\Settlement $report, $accountId, $reportDate)