taxjar/taxjar-magento2-extension

No tranasaction found when click on sync transcation

Closed this issue · 12 comments

Hello,

$statesToMatch = ['complete', 'closed'];

when i debug it query is

SELECT main_table.* FROM sales_order AS main_table WHERE (updated_at >= '2017-09-11 00:00:00') AND (updated_at <= '2017-09-20 23:59:59') AND (state = 'complete') AND (state = 'closed')

It should be OR condition for state

Hi @sunilit42,

Which version of Magento 2 are you using? Here's what I'm seeing in the backfill process:

$orderResult->printLogQuery(true);
SELECT `main_table`.* FROM `sales_order` AS `main_table` WHERE ((`updated_at` >= '2017-09-20 00:00:00')) AND ((`updated_at` <= '2017-09-20 23:59:59')) AND ((`state` = 'complete') OR (`state` = 'closed'))

We are using Magento 2.0.7

Taxjar\SalesTax\Model\Transaction

to buildToAddress function,

$toAddress = [
'to_country' => $address->getCountryId(),
'to_zip' => $address->getPostcode(),
'to_state' => $address->getRegionCode(),
'to_city' => $address->getCity(),
'to_street' => $address->getData('street')
];
$address->getRegionCode() for me getting Georgia
it should ne 2 char.

@sunilit42 We require Magento 2.1+ for transaction sync. To perform a logical OR, we specify multiple filters within a filter group correctly based on the documentation. In 2.0.7, there's still some issues with the getList method and search criteria. Also, getRegionCode underwent some changes between Magento 2.0.7 and 2.1.0.

@fastdivision

thanks for your response, i already fixed in magento2.0.7 and working fine.

There is no cron for sync transaction every day?

@sunilit42 No cron jobs at the moment for transaction sync, just for backup rates. We sync orders and their corresponding refunds immediately after the order is updated via sales_order_save_after in a complete or closed state. Older transactions can be imported into TaxJar using the Sync Transactions button.

seems like you created event only for admin area, sometime order complete using frontend side as well

so that event should be global.

@sunilit42 Can you provide an example of when Magento dispatches the sales_order_save_after event from a core module on the frontend? I'll investigate, thanks!

@fastdivision

let's example virtul product on cart, and you are using online payment method, so after order place order status is complete.

Ah, that makes sense. I'll look into making this event global and test it out for virtual orders. Appreciate the help!

@fastdivision welcome :)

otherwise, remove event and make cron for synchronization order.

Thanks @sunilit42, moved that event to global for v0.7.5.