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

Add support for "Klarna Pay Later" `klarnapaylater` in combination with WooCommerce #18

Closed remcotolsma closed 1 year ago

remcotolsma commented 1 year ago

Question from user:

Wanneer wij via Pronamic Pay een bestelling willen betalen via Klarna betaal achteraf, geeft Mollie aan dat dit niet mogelijk is omdat er geen order in Mollie is aangemaakt voor de bestelling:

  • Betalingsstatus gewijzigd van "In afwachting" naar "Mislukt".
  • 422: Unprocessable Entity - An order created with the Orders API is required for this payment method
  • Betaling aangemaakt met status "In afwachting".

Betalingen via iDeal worden wel correct door Mollie verwerkt, maar ook daarvan worden geen 'Bestellingen' aangemaakt in Mollie, dat zijn slechts transacties. Zou het niet zo moeten zijn dat Betalingen via Klarna achteraf betalen automatisch als 'Bestelling' aan Mollie toegevoegd moeten worden? Voor zover wij kunnen zien is dit niet instelbaar via de interface van de Pronamic Pay plugin.

Current we only support MemberPress and Klarna Pay Later:

https://github.com/pronamic/wp-pronamic-pay-mollie/blob/9076c219808dfc9187034d9ea7dc6140720a4f35/src/Gateway.php#L370-L380

https://github.com/pronamic/wp-pronamic-pay-mollie/blob/9076c219808dfc9187034d9ea7dc6140720a4f35/src/Gateway.php#L870-L906

For MemberPress we create a Mollie shipment as soon as the payment is authorized or paid.

https://github.com/pronamic/wp-pronamic-pay-mollie/blob/9076c219808dfc9187034d9ea7dc6140720a4f35/src/Gateway.php#L949-L1011

For WooCommerce we only want to do this once the order status is set to completed?

remcotolsma commented 1 year ago

Extensions like MemberPress and WooCommerce must be able to send a signal that the order has been shipped. Should we keep it simple for now by doing something like this in MemberPress and WooCommerce?

\do_action( 'pronamic_pay_payment_completed', $payment );

In terms of naming, this might be a bit confusing, because this action doesn't necessarily have anything to do with the status of the payment.

\do_action( 'pronamic_pay_payment_source_completed', $payment );
\do_action( 'pronamic_pay_payment_shipped', $payment );

It does not always necessarily have to be a physical shipment... what do you think @rvdsteege?

rvdsteege commented 1 year ago

Reminds me of https://docs.gravityforms.com/gform_paypal_fulfillment/

\do_action( 'pronamic_pay_payment_source_fulfilled', $payment );

What is order fulfillment?

Order fulfillment is the process of receiving, packing, and shipping orders. The process begins when a customer purchases a product and ends when they receive the product.

remcotolsma commented 1 year ago

Discussed this further with @rvdsteege @pronamic HQ today, and we have already made some small adjustments in the codebase for this. With the addition of the pronamic_pay_payment_source_fulfilled actions I expect this to be fully operational. This will now be a maximum of 4 hours of work. With the addition of the pronamic_pay_payment_source_fulfilled actions I expect this to be fully operational. This will now be a maximum of 4 hours of work. Let's tune in next week to see if we want to add this.

remcotolsma commented 1 year ago

It was still a small step to add support for this, so just added.