vendidero / woocommerce-germanized

Adapt WooCommerce to the German Market with Germanized for WooCommerce
https://vendidero.de/woocommerce-germanized
Other
51 stars 42 forks source link

[Pro] SevDesk Sync - Vendidero\StoreaBill\sevDesk - Bug when comparing transaction ids in book_invoice() + general PayPal matching issue #205

Closed shazzygh closed 6 months ago

shazzygh commented 6 months ago

Hi,

After facing the problem of PayPal orders always being synced to the default account in SevDesk instead to the special PayPal account I did some digging and believe to have discovered a bug.

Bug in book_invoice()

In packages/storeabill-sevdesk/src/Sync.php on line 668 you are using strtolower on the remote paymtPurpose to later on extract the remote transaction id.

$remote_purpose_piece = trim( strtolower( $remote_purpose_piece ));

On line 686 you are trying to match the now lowercase remote transaction id with the order transaction id, which in case of PayPal payments is always uppercased. Thus the match fails even if the ids should match.

if ( ... && $remote_transaction_id === $invoice_trans_id )

That being said: The transaction is still matched below on line 700 by the order number.

General SevDesk issue with auto_book_vouchers option enabled

However the above doesn't solve my problem, which is more general: When the setting for automatic sync to SevDesk is enabled, WcGzd uploads the invoice to SevDesk and tries to find a matching transaction immediately. You can configure a PayPal account within SevDesk which regularly pulls transactions from that account. However this only happens once or twice a day. In 99% of cases the transaction will not yet be present in the SevDesk database when the transaction matching is running, resulting in the invoice to be placed in the fallback "default account".

This renders the automatic sync option essentially useless for digital goods or services, at least for PayPal (and possibly also for Stripe I reckon), as you have to then manually match all invoices and transactions in SevDesk, which is a huge PIA.

To solve this, it would be great if you could consider an option to defer the sync to SevDesk for 24 hours or so using the WC event scheduler. This would allow for true automation.

(Or alternatively add a callable action to run the sync function for a specific order so one could build their own scheduler)

dennisnissle commented 6 months ago

Hi there,

thanks for reporting.

To solve this, it would be great if you could consider an option to defer the sync to SevDesk for 24 hours or so using the WC event scheduler. This would allow for true automation.

Yes, that's exactly what we experienced too and it's on our roadmap already!

Best, Dennis