Closed remcotolsma closed 1 year ago
Added a filter in https://github.com/pronamic/wp-pronamic-pay-adyen/commit/783900b51c6a969fcb004bb0870d58492af8c23f, could be used like this:
<?php
add_filter(
'pronamic_pay_adyen_merchant_order_reference',
function( $merchant_order_reference, $payment ) {
// Check if payment source is Gravity Forms.
if ( 'gravityformsideal' !== $payment->get_source() ) {
return $merchant_order_reference;
}
// Check if Gravity Forms API is available.
if ( ! method_exists( 'GFAPI', 'get_entry' ) ) {
return $merchant_order_reference;
}
// Check if Gravity Forms entry exists.
$entry = GFAPI::get_entry( $payment->get_source_id() );
if ( false === $entry ) {
return $merchant_order_reference;
}
// Format merchant order reference.
$merchant_order_reference = strtr(
$merchant_order_reference,
[
'{gf_form_id}' => $entry['form_id'],
'{gf_entry_id}' => $entry['id'],
]
);
return $merchant_order_reference;
},
10,
2
);
Request from customer:
Internal Help Scout conversation: https://secure.helpscout.net/conversation/2282196531/25812?folderId=1425710
https://github.com/pronamic/wp-pronamic-pay-adyen/blob/701b8345e9773370ecc245f5e0cbaf9ae40b003f/src/PaymentRequestHelper.php#L30-L36