pronamic / wp-pronamic-pay-mollie

Mollie driver for the WordPress payment processing library.
http://www.wp-pay.org/gateways/mollie/
6 stars 1 forks source link

Is a refund initiated from the Mollie Dashboard processed properly in Pronamic Pay / WooCommerce? #27

Closed remcotolsma closed 1 year ago

remcotolsma commented 1 year ago

We already have some code in place for this: https://github.com/pronamic/wp-pronamic-pay-woocommerce/blob/21974a29deef5a8ac633ba199458afaf162fb82e/src/Extension.php#L760-L831

To make this work properly, we keep track of how much refund we have processed in the WooCommerce order in meta: _pronamic_amount_refunded.

For the difference between this amount and the refunded we create a WooCommerce refund via wc_create_refund.

We should extend this with line_items: https://github.com/woocommerce/woocommerce/blob/52bc1879bb3b05413d3e37bdbd3b42b5a04d73db/plugins/woocommerce/includes/wc-order-functions.php#L515-L677

Also we don't have to keep track of the refunded amount, WooCommerce has a function for this: https://github.com/woocommerce/woocommerce/blob/52bc1879bb3b05413d3e37bdbd3b42b5a04d73db/plugins/woocommerce/includes/class-wc-order.php#L2012-L2031