Last active
February 3, 2020 08:18
-
-
Save remcotolsma/f302cbac373b4ec23ca6efaafa16bc78 to your computer and use it in GitHub Desktop.
Export completed Pronamic Pay payments.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
post.ID, | |
post.post_title, | |
post.post_date, | |
post.post_status, | |
MAX( IF( meta.meta_key = "_pronamic_payment_description", meta.meta_value, NULL ) ) AS payment_description, | |
MAX( IF( meta.meta_key = "_pronamic_payment_amount", meta.meta_value, NULL ) ) AS payment_amount, | |
MAX( IF( meta.meta_key = '_pronamic_payment_currency', meta.meta_value, NULL ) ) AS payment_currency, | |
MAX( IF( meta.meta_key = '_pronamic_payment_config_id', meta.meta_value, NULL ) ) AS payment_config_id, | |
MAX( IF( meta.meta_key = '_pronamic_payment_status', meta.meta_value, NULL ) ) AS payment_status, | |
MAX( IF( meta.meta_key = "_pronamic_payment_source", meta.meta_value, NULL ) ) AS payment_source, | |
MAX( IF( meta.meta_key = "_pronamic_payment_source_id", meta.meta_value, NULL ) ) AS payment_source_id, | |
MAX( IF( meta.meta_key = "_pronamic_payment_transaction_id", meta.meta_value, NULL ) ) AS payment_transaction_id, | |
MAX( IF( meta.meta_key = "_pronamic_payment_action_url", meta.meta_value, NULL ) ) AS payment_action_url, | |
user.user_email AS user_email | |
FROM | |
wp_posts AS post | |
LEFT JOIN | |
wp_postmeta AS meta | |
ON post.ID = meta.post_id | |
LEFT JOIN | |
wp_users AS user | |
ON post.post_author = user.ID | |
WHERE | |
post_type = "pronamic_payment" | |
AND | |
post_status = "payment_completed" | |
GROUP BY | |
post.ID | |
; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment