Created
June 4, 2020 15:06
-
-
Save remcotolsma/9ef183882c0d30f4455293c513d81f1a to your computer and use it in GitHub Desktop.
Filter `pronamic_pay_mollie_payment_meta_data`.
This file contains hidden or 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
<?php | |
\add_filter( 'pronamic_pay_mollie_payment_meta_data', function( $meta_data, $payment ) { | |
$data = array(); | |
$customer = $payment->get_customer(); | |
if ( null !== $customer ) { | |
$vat_number = $customer->get_vat_number(); | |
if ( null !== $vat_number ) { | |
$data['vat_number'] = $vat_number->normalized(); | |
} | |
} | |
switch ( $payment->get_source() ) { | |
case 'edd': | |
$data['edd_order_id'] = $payment->get_source_id(); | |
break; | |
case 'gf': | |
$data['gf_entry_id'] = $payment->get_entry_id(); | |
break; | |
} | |
$object = (object) $data; | |
$json_string = \wp_json_ecode( $object ); | |
return $json_string; | |
}, 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment