pronamic / wp-pronamic-pay

The Pronamic Pay plugin allows you to easily accept payments with payment methods like credit card, iDEAL, Bancontact and Sofort through a variety of payment providers on your WordPress website.
https://pronamicpay.com
34 stars 14 forks source link

Gravity Forms `{pronamic_payment_id}` is missing since update `7.0.0` #208

Closed remcotolsma closed 3 years ago

remcotolsma commented 3 years ago

Internal HelpScout tickets:

rvdsteege commented 3 years ago

Issue resolved in https://github.com/wp-pay-extensions/gravityforms/commit/e2b8579c621bd968e0838a174269119e7acf8123

remcotolsma commented 3 years ago

@rvdsteege You mentioned that sometimes there were 2 meta values for the pronamic_payment_id meta key? Should we figure out how this happens? According to https://docs.gravityforms.com/gform_update_meta/ this should not happen? It is nice to know why the empty check is necessary.

rvdsteege commented 3 years ago

@remcotolsma First time our update_entry_payment_meta() is called, the pronamic_payment_id entry meta got set to null in the database.

In a subsequent call to gform_update_meta(), the result of gform_get_meta() in https://github.com/wp-premium/gravityforms/blob/2.4.20/forms_model.php#L7750-L7751 will be false. Therefore the $meta_exists also results in false and a new meta item gets added.

Therefore, we either have to keep the empty() check (or update to null !== $payment_id check) or cast $payment->get_id() to a string. In case there is no payment ID yet, an empty string will be added as pronamic_payment_id meta. An empty string meta item updates correctly.

rvdsteege commented 2 years ago

Related issue: some merge tags also resulted in empty text in notification with the Form is submitted event, even though the data was stored correctly in the entry. This has been resolved in https://github.com/wp-pay-extensions/gravityforms/commit/e293644c158e561d8b03c82a405fff0fdc7dea07.